I have a lot of neat little scripts and automations, but out of nowhere I came up with this one.
Its simple I have a sonoff ifan03 in my kitchen. the fan has a light that just isnt bright enough, i also have a chandelier in the kitchen on a wifi switch, and I have a pair of tuya(merkury) bulbs above my cabinets.
Lets make 1 button control them all, BUT individually.
heres how it works.
press light button, fan light comes on.
press light button again within 20 seconds, fan light turns off, chandelier turns on. if you press it after 20 seconds, the fan light just turns off. (wife approval simple factor–)
press it again within the first twenty seconds, fan light turns on along with chandelier still on.
press it again, fan light turns off, cabinet lights turn on along with chandlier still on.
press it again, fan light comes on, all lights on.
wait till timeout --20 seconds. press again everything turns off,
I didnt check what happens if you just keep pressing it, as my use case is simple. sometimes I need just the fan, sometimes just the chandelier, other times all lights on.
pretty nifty all from 1 button. adjust lighting to your needs obvously.
Im not an expert, so there is probably a bettter/easier way. If you optimize it please post up your versions.
[{"id":"f10d454d.c38828","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"cae0e636.150a88","type":"ha-wait-until","z":"f10d454d.c38828","name":"","server":"663af70e.88b558","outputs":2,"entityId":"light.kitchen_light","entityIdFilterType":"exact","property":"state","comparator":"is","value":"off","valueType":"str","timeout":"20","timeoutType":"num","timeoutUnits":"seconds","entityLocation":"","entityLocationType":"none","checkCurrentState":true,"blockInputOverrides":true,"x":730,"y":130,"wires":[["f2c3d1f0.6d7a"],[]]},{"id":"44e3280.42cb4d8","type":"server-state-changed","z":"f10d454d.c38828","name":"Kitchen light ON","server":"663af70e.88b558","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"light.kitchen_light","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":140,"y":130,"wires":[["95ff2ee4.df135"]]},{"id":"436ecb1c.3d8134","type":"api-call-service","z":"f10d454d.c38828","name":"OFF","server":"663af70e.88b558","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_off","entityId":"switch.chandelier","data":"","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":860,"y":190,"wires":[[]]},{"id":"ae8300a7.6798d","type":"api-current-state","z":"f10d454d.c38828","name":"Light On?","server":"663af70e.88b558","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"switch.chandelier","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":730,"y":190,"wires":[["436ecb1c.3d8134"],[]]},{"id":"c6716238.8a615","type":"api-call-service","z":"f10d454d.c38828","name":"ON","server":"663af70e.88b558","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_on","entityId":"switch.chandelier","data":"","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":590,"y":70,"wires":[[]]},{"id":"85b2abda.fc4768","type":"api-call-service","z":"f10d454d.c38828","name":"ON","server":"663af70e.88b558","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_on","entityId":"switch.chandelier","data":"","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":1230,"y":100,"wires":[[]]},{"id":"8f416199.75d21","type":"api-call-service","z":"f10d454d.c38828","name":"ON","server":"663af70e.88b558","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.accent_one, light.accent_two","data":"","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":1230,"y":150,"wires":[[]]},{"id":"f2c3d1f0.6d7a","type":"ha-wait-until","z":"f10d454d.c38828","name":"","server":"663af70e.88b558","outputs":2,"entityId":"light.kitchen_light","entityIdFilterType":"exact","property":"state","comparator":"is","value":"on","valueType":"str","timeout":"20","timeoutType":"num","timeoutUnits":"seconds","entityLocation":"","entityLocationType":"none","checkCurrentState":true,"blockInputOverrides":true,"x":870,"y":130,"wires":[["d14665e4.551008"],[]]},{"id":"13d006dd.914089","type":"api-call-service","z":"f10d454d.c38828","name":"OFF","server":"663af70e.88b558","version":1,"debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"light.accent_one, light.accent_two","data":"","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":590,"y":190,"wires":[["ae8300a7.6798d"]]},{"id":"308559a3.fd76a6","type":"ha-wait-until","z":"f10d454d.c38828","name":"","server":"663af70e.88b558","outputs":2,"entityId":"light.kitchen_light","entityIdFilterType":"exact","property":"state","comparator":"is","value":"off","valueType":"str","timeout":"20","timeoutType":"num","timeoutUnits":"seconds","entityLocation":"","entityLocationType":"none","checkCurrentState":true,"blockInputOverrides":true,"x":460,"y":70,"wires":[["c6716238.8a615"],[]]},{"id":"d14665e4.551008","type":"change","z":"f10d454d.c38828","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"on","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1040,"y":130,"wires":[["85b2abda.fc4768","8f416199.75d21"]]},{"id":"3683b1af.4b76be","type":"api-current-state","z":"f10d454d.c38828","name":"Light On?","server":"663af70e.88b558","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.accents","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":450,"y":190,"wires":[["13d006dd.914089"],[]]},{"id":"95ff2ee4.df135","type":"switch","z":"f10d454d.c38828","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":290,"y":130,"wires":[["308559a3.fd76a6"],["3683b1af.4b76be","fff9fe99.58cba"]]},{"id":"26aaeb0c.85a0c4","type":"api-current-state","z":"f10d454d.c38828","name":"Light On?","server":"663af70e.88b558","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"switch.chandelier","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":600,"y":130,"wires":[["cae0e636.150a88"],[]]},{"id":"fff9fe99.58cba","type":"api-current-state","z":"f10d454d.c38828","name":"Light On?","server":"663af70e.88b558","version":1,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.kitchen_light","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":450,"y":130,"wires":[["26aaeb0c.85a0c4"],[]]},{"id":"663af70e.88b558","type":"server","z":"","name":"Home Assistant-mine","legacy":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]