Help with changing colors, on devices that are on?

Is it possible to ‘check’ what lights are on, and then change the color of these lights? and how can I do this ??

[{"id":"c2c9847.6b2df78","type":"ha-get-entities","z":"8153a403.489028","server":"9405c3fe.d0a6c","name":"","rules":[{"property":"entity_id","logic":"starts_with","value":"light.","valueType":"str"},{"property":"state","logic":"is","value":"on","valueType":"str"}],"output_type":"split","output_empty_results":false,"output_location_type":"msg","output_location":"payload","output_results_count":1,"x":2670,"y":280,"wires":[["332347af.8970f8"]]},{"id":"5967dd7c.a4b1e4","type":"inject","z":"8153a403.489028","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":2510,"y":280,"wires":[["c2c9847.6b2df78"]]},{"id":"332347af.8970f8","type":"join","z":"8153a403.489028","name":"","mode":"custom","build":"string","property":"payload.entity_id","propertyType":"msg","key":"topic","joiner":",","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":2830,"y":280,"wires":[["a25047c8.f4fe68"]]},{"id":"a25047c8.f4fe68","type":"api-call-service","z":"8153a403.489028","name":"To blue","server":"9405c3fe.d0a6c","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"{{payload.entity_id}}","data":"{\"color_name\": \"blue\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":2980,"y":280,"wires":[[]]},{"id":"9405c3fe.d0a6c","type":"server","name":"Home Assistant","addon":true}]

if you want to check the state of all your lights, Get entities node should be something like this:

If you want to check the state of some specific lights, not all of them, do the following. Note the difference between starts with and in.

1 Like

Thnx, going to test tonight