Page 1 of 1

Custom Sensor with Text Value or Text Sensor and No Event

Posted: Friday 13 May 2016 14:49
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

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

Posted: Friday 13 May 2016 16:35
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