Last active
April 26, 2018 01:31
-
-
Save dale3h/86b7323630d313338c78f417625d799e to your computer and use it in GitHub Desktop.
Light Toggle w/ Brightness (@MattW)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################################ | |
## Packages / Light Toggle with Brightness | |
## | |
## @description Toggle lights with a brightness based on time | |
## @component automation, binary_sensor, light | |
## @license MIT | |
## @author @mattlward, Dale Higgs <@dale3h> | |
################################################################ | |
automation: | |
- alias: "Single Click 21 to Toggle Stair Lights" | |
trigger: | |
- platform: event | |
event_type: click | |
event_data: | |
entity_id: binary_sensor.switch_158d0001f3de21 | |
click_type: single | |
action: | |
- service: light.toggle | |
data: | |
entity_id: light.stair_top, light.stair_bottom | |
- condition: template | |
value_template: "{{ is_state('light.stair_top', 'on') or is_state('light.stair_bottom', 'on') }}" | |
- service: light.turn_on | |
data_template: | |
entity_id: light.stair_top, light.stair_bottom | |
brightness: >- | |
{% if 6.00 < now().strftime('%H.%M')|float < 22.00 %} | |
255 | |
{% else %} | |
64 | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
So, it is close but not there...
When the lights are off and I press the switch they turn on to the correct brightness. But, if they are on and I press the switch they turn off and then right back on.
Also, is this acceptable to add?