Help with flow variable

Hi I am trying to use a flow to sync the state of my lights with a varible in tasker and i wanted to ask if there is a prettier way to do that using a variable for the light name and for the message in order to avoid rewriting it for all the lights

image

[{"id":"d74a9d75.14009","type":"switch","z":"d942872a.9d48d8","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"},{"t":"eq","v":"unavailable","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":290,"y":100,"wires":[["b0b51bee.62ddf8"],["7370af01.f04a8"],["a8528b03.d64498"]]},{"id":"9848f03f.ded56","type":"trigger-state","z":"d942872a.9d48d8","name":"Computer Light ","server":"bb4f1378.25112","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"light.computer","entityidfiltertype":"exact","debugenabled":false,"constraints":[],"constraintsmustmatch":"all","outputs":5,"customoutputs":[{"outputId":"5baen1r312c","messageType":"payload","messageValue":"on","messageValueType":"json","comparatorPropertyType":"current_state","comparatorPropertyValue":"new_state.state","comparatorType":"is","comparatorValue":"on"},{"outputId":"2nsklkejg9q","messageType":"payload","messageValue":"off","messageValueType":"json","comparatorPropertyType":"current_state","comparatorPropertyValue":"new_state.state","comparatorType":"is","comparatorValue":"off"},{"outputId":"4r9tosvu55g","messageType":"payload","messageValue":"unavailable","messageValueType":"json","comparatorPropertyType":"current_state","comparatorPropertyValue":"new_state.state","comparatorType":"is","comparatorValue":"unavailable"}],"outputinitially":false,"state_type":"str","x":120,"y":80,"wires":[[],[],["d74a9d75.14009"],["d74a9d75.14009"],["d74a9d75.14009"]]},{"id":"7370af01.f04a8","type":"api-call-service","z":"d942872a.9d48d8","name":"Tasker Var Off","server":"bb4f1378.25112","version":1,"debugenabled":false,"service_domain":"joaoapps_join","service":"mate10_send_tasker","entityId":"","data":"{\"command\":\"light.computer=:=off\"}","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":460,"y":100,"wires":[[]]},{"id":"a8528b03.d64498","type":"api-call-service","z":"d942872a.9d48d8","name":"Tasker Var Unavailable","server":"bb4f1378.25112","version":1,"debugenabled":false,"service_domain":"joaoapps_join","service":"mate10_send_tasker","entityId":"","data":"{\"command\":\"light.computer=:=unavailable\"}","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":480,"y":140,"wires":[[]]},{"id":"b0b51bee.62ddf8","type":"api-call-service","z":"d942872a.9d48d8","name":"Tasker Var On","server":"bb4f1378.25112","version":1,"debugenabled":false,"service_domain":"joaoapps_join","service":"mate10_send_tasker","entityId":"","data":"{\"command\":\"light.computer=:=on\"}","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":460,"y":60,"wires":[[]]},{"id":"bb4f1378.25112","type":"server","z":"","name":"Hassio","legacy":false,"hassio":false,"rejectUnauthorizedCerts":false,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

image

[{"id":"6e3922d1.6fc80c","type":"server-state-changed","z":"56b1c979.b2c618","name":"","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"light.computer","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"x":250,"y":1504,"wires":[["ac97b682.d171b8"]]},{"id":"ac97b682.d171b8","type":"api-call-service","z":"56b1c979.b2c618","name":"Tasker Var","version":1,"debugenabled":false,"service_domain":"joaoapps_join","service":"mate10_send_tasker","entityId":"","data":"{\"command\":\"light.computer=:={{payload}}\"}","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":470,"y":1504,"wires":[[]]}]
1 Like

Thx, so easy :grinning: