to send a temperatue reading from a sensor to the hub I've been using:
Send Event(name: "temperature", value: fSensorValue , unit:"F", isStateChange: true)
My question is: under what conditions might specify isStateChange: false) would this just rewrite the database value with the same value. What would the reasoning to do this be.
Explicitly setting 'isStateChange: false' will update the device last activity time stamp but will not fire a change event to the subscribed apps. I don't have an idea for a practical use.
1 Like
You generally want to only pass isStateChange
as true
manually if you actually want to force all events to run even if the value is the same as the previous value. For instance, a button being pressed may have the same value as before (ie, pressed) but you want all actions to occur again.
Not passing the isStateChange
field at all will cause SendEvent to look at the existing value of the attribute and set false if the same, true if different.
Always passing isStateChange to true for something like temperature would cause all your rules to run every time even if the temperature didn't change from the last sample. This usually isn't what you'd want unless you're time recording every value forever.
1 Like