Executing an onChanged action for MQTTClient variables

In the old version of Home Remote, the MQTTClient variables had an onChanged event, and I had this running a Script action. I have been trying to replace this with scenes, and while I can do some things with this, I’m still coming up short.

I have a MQTT variable that contains a hexadecimal color (e.g, #A5A2F5), and I want to run actions every time it is changed. I can’t predict a few specific colors, so I can’t make scene triggers for individual colors. If I use a regular expression match (e.g., ^#[0-9A-Z]{6}$), it will match initially and trigger the scene, but then every subsequent change of the MQTTClient variable is not seen as a new/different match and therefore the scene does not trigger again. If the trigger condition supported “not equals”, there are some things I could do, such as storing a temp value in another variable and comparing to test for changes, but this isn’t supported.

Any suggestions?

On a related note, it seems the Color Wheel and Color Temperature Picker don’t have onSelectionChanged events, just Load and Unload. Is there any way to detect when their color has been changed and run an action off of it? I’d trigger a scene if I could based on their variable binding, but the same problem as above applies.

Node Red could possibly help you with this.

Set up a flow that has the required logic. It could read from the device or MQTT. After the logic is applied, it can be written to a different topic which is what THR reads from.

In fact, depending on your integration, Node Red could also trigger the scenes you’re looking for in the background without THR having to do the heavy lifting.