Can NR be set to trigger on changes in global scope context values?

A State Node triggers when state changes on the referenced Entity.

Can a state change on a Global context variable, be set to trigger something in a similar way ?

Hassio running on a Raspberry Pi.

/Boja

Have you tried it? Did you run into an issue? What node are you referencing? (full name please)

Hi @Boja

no, it is not possible to trigger an event when a context value changes.

Are you using MQTT? If so then rather than using a context variable use mqtt, then when a new value appears you will receive a message.

could you use the watch node to watch the .node-red/context/ flow or global json file? of course if you have more than one variable you would have to read it and test it against a saved copy of the value

No. Currently I handle changes by use of an input_number that is updated by all function nodes, whenever they change something in the setup, and have added a server-state-change node that sends messages to all effected Nodes. In relatively simple setups, I of couse just let functions send messages directly to affected nodes.

Not very elegant maybe, but I just needed to know if a different mechanism was available.

Being able to get data out of "node-red/context/ flow or global json file" as you mentioned zenofmud is completely new to me, but sounds like something I have to look at.

Thanks to all for the info.

Why not a loop that checks the given variable or whatever and if has changed since last poll? You would just need to keep the previous valve or do some type of check sum of the variable value to know when it has changed on each poll.

Calculating crc32 for example is fast and easy, and would catch just any valve change.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.