Subflow properties

Hi

I created a sublfow with string property lux_entity. This property will hold the id of a sensor entity I want to use in the subflow, but how can I acces this property? This isn’t working:
subflow_prop

I also tried {{lux_entity}} but that didn’t work either. Am I doing something wrong or is this just not possible?

Merijn

Hi, I don’t know if there is a better way, but the following works for me.

With {{foo}} you can address anything within msg context, so you can put a change node before your current_state node, that copies the env var into msg context:
image

Then you can use {{lux_entity}} in current state node:
image

1 Like

Thanks for your creative suggestion :slight_smile: For some reason, it still doesn’t work. I send the message to the output, but msg.lux_entity is an empty string. It’s as if the settings aren’t there. I triple-checked for typos but everything looks fine. This is the flow I’m testing with:

[{"id":"c1a182a1.99598","type":"subflow","name":"TestLuxEntity","info":"","category":"","in":[{"x":50,"y":30,"wires":[{"id":"f8a802dc.73e25"}]}],"out":[{"x":600,"y":60,"wires":[{"id":"76221184.d60eb","port":0}]}],"env":[{"name":"lux_enitity","type":"str","value":"defValue"}],"meta":{},"color":"#DDAA99"},{"id":"76221184.d60eb","type":"api-current-state","z":"c1a182a1.99598","name":"","server":"9679e544.6229a8","version":2,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"{{lux_entity}}","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":420,"y":40,"wires":[[]]},{"id":"f8a802dc.73e25","type":"change","z":"c1a182a1.99598","name":"","rules":[{"t":"set","p":"lux_entity","pt":"msg","to":"lux_entity","tot":"env"}],"action":"","property":"","from":"","to":"","reg":false,"x":190,"y":40,"wires":[["76221184.d60eb"]]},{"id":"9679e544.6229a8","type":"server","name":"Home Assistant","version":1,"legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true},{"id":"7b32a410.c40f6c","type":"debug","z":"e02c5e58.56078","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":710,"y":2040,"wires":[]},{"id":"fa052628.f13848","type":"inject","z":"e02c5e58.56078","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":370,"y":2040,"wires":[["8f131613.565518"]]},{"id":"8f131613.565518","type":"subflow:c1a182a1.99598","z":"e02c5e58.56078","name":"","env":[{"name":"lux_enitity","value":"sensor.hal_lux","type":"str"}],"x":540,"y":2040,"wires":[["7b32a410.c40f6c"]]}]

You have a typo in property definition of your subflow:
image

Oh my god. I must have checked a dozen times! How silly. Thanks for your patience and help!

Sidenote: once spelled correctly, ${lux_entity} started working as well.

Haha, nice one :wink: