Custom Sensor with Text Value or Text Sensor and No Event

Moderator: leecollings

Post Reply
User avatar
Richie1972
Posts: 44
Joined: Saturday 09 April 2016 10:23
Target OS: Windows
Domoticz version:
Contact:

Custom Sensor with Text Value or Text Sensor and No Event

Post by Richie1972 »

Another question that i'm struggling to resolve.
I have an app that needs to trigger a switch with notification (string passed in from app)
So:
http://domsrv:8080/json.htm?type=comman ... ata%20here

If I create a dummy text sensor i can use the above to correctly set the value, but no event is raised, so can't use Blockly and the Virtual Text Sensor has no Notifications button.

If I create a dummy custom sensor I can only pass in numerical values, but do then get the Notifications button.

Is there a way of using a single API call to pass in a string (preferably a Custom Sensor), raise event and use string data (eg to send in part of a push or email notification)?
I am currently exploring using a Lua script to somehow check if the Text Sensor value has changed (not convinced this is possible yet) and then have the script set a Custom Sensor to On.

I'm still learning all this, so i'm hoping someone can help.

Thanks,
Richie
Richie

Aeo S5 USB
3 FGSD002 Smoke
1 FGSM Motion
4 FGBS Binary
1 Horstmann ASR-ZW
2 Aeo Relay
1 FGS222 2xRelay
2 Aeo Multi Gen4
2 Everspring relay
1 Aeo Repeater
1 Popp Switch
1 TKB socket
4 Popp Dimmer
User avatar
Richie1972
Posts: 44
Joined: Saturday 09 April 2016 10:23
Target OS: Windows
Domoticz version:
Contact:

Re: Custom Sensor with Text Value or Text Sensor and No Event

Post by Richie1972 »

Ok, well got it working in a bit of a crappy way:
Created two user variables (CurrentValue, PreviousValue)
Created a virtual switch
Used a Blockly script to check if CurrentValue different to PreviousValue
If different, set PreviousValue=CurrentValue and Set VirtualSwitch to "On"
The CurrentValue can be read via the Blockly script to get the data

Richie
Richie

Aeo S5 USB
3 FGSD002 Smoke
1 FGSM Motion
4 FGBS Binary
1 Horstmann ASR-ZW
2 Aeo Relay
1 FGS222 2xRelay
2 Aeo Multi Gen4
2 Everspring relay
1 Aeo Repeater
1 Popp Switch
1 TKB socket
4 Popp Dimmer
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest