[SOLVED] Using entity_id stored in msg.topic from previous node

Hey there, I have the following Events: State Node, with three entities specified in it.

The output contains msg.topic which references the entity_id.

I am then trying to use that msg.topic to get the entity_id to be used in an Action Node here:

I’ve Google’d to the death and no amount of fudging with the syntax can I get it to work, it just errors or fails. If I specify the entity_id directly as follows, it works fine, but then I’d have to replicate everything three times over for all three entities I want to work with:

{"entity_id":"fan.in_wall_smart_fan_control_7"},"parameter":"3","value":"On when load is off"}

The debug output straight from the Events: State Node looks correct -

I figure my syntax to reference it properly from the previous node’s msg.topic is messed up.

Your help is appreciated!

Change the Data field type to J: Expression (JSONata), then use the following expression:

{ "entity_id": topic, "parameter": "3", "value": "On when load is off" }
1 Like

FML… you absolute beauty! You’ve saved the day, thank you!

For reference, THIS:

Is what I was working on, and this is a hacky work around a bug/broken function on Jasco Z-Wave fan controllers (rebranded under a few brands like GE).

There is an LED on the fan controller, and parameter 3 controls the behavior of this LED, with three options:

  • On when load (the fan) is off
  • On when load (the fan) is on
  • Never lit

Now all three options on this parameter works exactly as expected on all other Jasco/GE Z-Wave devices, be it a dimmer, switch, plug-in module, etc, but on the fan controller (and only the fan controller), the ‘Never lit’ option does not work, it just behaves the same as one of the other two options above it (I cannot remember which).

Why is this a problem? Well if you’re anything like me, you hate lights in the dark in the bedroom when you’re trying to sleep, and when it’s this fan controller switch in a bedroom, the bright BLUE LED is super annoying, especially when the the fan itself is automated to turn on/off depending on conditions through the night, I can’t just set one of the other two options and forget it.

So this hacky work around detects when the fan turns on or off, and sets parameter 3 on the source entity that just changed state so that I effectively get my “never lit” -

Fan On = LED - On when off
Fan Off = LED - On when on.

Hope this helps others who are cursed with this fan controller and feel the same way I do about lights in the bedroom when you’re trying to sleep.