Hi everyone!
Background: Had a SmartThings button, set up through my Wink Hub 2, controlling a Lightify bulb in my bedroom (also on the winkhub). From 7 am to 9pm it would toggle on/off at full brightness, from 9pm to 7am it would toggle the light on/off at 1% brightness in warmest white. I got a bunch of help crafting 2 HA automations that would control the light.
It worked great! BUT… with all the problems with Wink lately, I’m slowly moving all my stuff over to HA directly (Hassio, on RPi3B, with HUSBZB stick.) and the smartthings button setup direct through HA ZHA, is causing some issues.
I followed the How-to here: How_To: SmartThings button and I edited my automations so that at least I see the button triggering both automations now. BUTmy problem is that I don’t know how to edit the automation that controls light on/off, etc to properly do what I need. (Move from “state” on/off to ZHA event…)
Light Toggle
- id: Button alias: Master Light Toggle trigger: platform: event event_type: zha_event event_data: device_ieee: 28:6d:97:00:01:03:32:ad command: button_single condition: [] action: - entity_id: light.master_bedroom service: light.toggle
What I call MasterFlux (change color/brightness depending on time)
- id: MasterFlux alias: MasterFlux trigger: platform: event event_type: zha_event event_data: device_ieee: 28:6d:97:00:01:03:32:ad command: button_single action: - data_template: entity_id: "{% if states.light.master_bedroom.state == 'off' and now().hour\ \ >=21 and now().hour < 7 %}\n scene.master_nightlight\n{% elif states.light.master_bedroom.state\ \ == 'off' and now().hour >=7 and now().hour < 21 %}\n scene.master_bedroom_on\n\ {% else %}\n light.master_bedroom\n{% endif %}\n" service_template: "{% if states.light.master_bedroom.state == 'off' %}\n scene.turn_on\n\ {% else %}\n light.turn_off \n{% endif %}\n"
Any help would be greatly appreciated!