-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #485 from kylegordon/decking_white_channels_switch
Present external RGBWW white channels as a switch
- Loading branch information
Showing
3 changed files
with
140 additions
and
124 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
--- | ||
switch: | ||
- platform: template | ||
switches: | ||
outside_rgb_white_channels: | ||
unique_id: outside_rgb_white_channels | ||
# yamllint disable-line rule:line-length | ||
value_template: "{% if state_attr('light.decking_lights', 'rgbww_color')[3] | int > 0 | ||
or state_attr('light.decking_lights', 'rgbww_color')[4] | int > 0 %} | ||
true | ||
{% else %} | ||
false | ||
{% endif %}" | ||
turn_on: | ||
service: light.turn_on | ||
# Set the white channel values to maximum | ||
data: | ||
entity_id: light.decking_lights | ||
rgbww_color: | ||
- "{{ state_attr('light.decking_lights', 'rgbww_color')[0] | default(0) | int }}" # yamllint disable-line rule:line-length | ||
- "{{ state_attr('light.decking_lights', 'rgbww_color')[1] | default(0) | int }}" # yamllint disable-line rule:line-length | ||
- "{{ state_attr('light.decking_lights', 'rgbww_color')[2] | default(0) | int }}" # yamllint disable-line rule:line-length | ||
- 255 | ||
- 255 | ||
turn_off: | ||
service: light.turn_on | ||
# Set the white channel values to zero | ||
data: | ||
entity_id: light.decking_lights | ||
rgbww_color: | ||
- "{{ state_attr('light.decking_lights', 'rgbww_color')[0] | default(0) | int }}" # yamllint disable-line rule:line-length | ||
- "{{ state_attr('light.decking_lights', 'rgbww_color')[1] | default(0) | int }}" # yamllint disable-line rule:line-length | ||
- "{{ state_attr('light.decking_lights', 'rgbww_color')[2] | default(0) | int }}" # yamllint disable-line rule:line-length | ||
- 0 | ||
- 0 | ||
|
||
automation: | ||
- alias: "Outside night lights on" | ||
id: outside_night_lights_on | ||
trigger: | ||
- platform: numeric_state | ||
entity_id: sensor.average_external_light_level | ||
below: input_number.blinds_evening | ||
for: | ||
minutes: 10 | ||
condition: | ||
- condition: state | ||
entity_id: binary_sensor.home_occupied | ||
state: "on" | ||
action: | ||
- service: light.turn_on | ||
entity_id: | ||
- light.car_port | ||
- light.front_door_dome | ||
data: | ||
brightness_pct: 100 | ||
color_temp: 400 | ||
transition: 30 | ||
|
||
- alias: Outside night lights off | ||
id: outside_night_lights_off | ||
trigger: | ||
- platform: numeric_state | ||
entity_id: sensor.average_external_light_level | ||
above: input_number.blinds_morning | ||
for: | ||
minutes: 10 | ||
action: | ||
- service: light.turn_off | ||
entity_id: | ||
- light.car_port | ||
- light.front_door_dome | ||
|
||
- alias: Outdoor lights on | ||
id: outdoor_lights_on | ||
trigger: | ||
- platform: state | ||
entity_id: | ||
- binary_sensor.back_door_pir | ||
- binary_sensor.driveway_pir | ||
- binary_sensor.driveway_person_occupancy | ||
- binary_sensor.back_door_person_occupancy | ||
- binary_sensor.gates_person_occupancy | ||
- binary_sensor.front_door_person_occupancy | ||
to: 'on' | ||
condition: | ||
- condition: state | ||
entity_id: input_boolean.night_view | ||
state: "off" | ||
- condition: state | ||
entity_id: sun.sun | ||
state: "below_horizon" | ||
action: | ||
- service: script.tweet_engine | ||
data_template: | ||
tweet: > | ||
{{ [ | ||
"Dark outside and motion detected! Scared! Turning on my outside lights!", | ||
"Woooo, it's dark and scary. Something moved! Turning on the outside lights!", | ||
"Did you hear that? I can't see a thing. Turning on the outside lights" | ||
] | random + " https://amzn.to/2CR5mbQ" }} | ||
- service: light.turn_on | ||
entity_id: | ||
- light.driveway_floodlights | ||
- light.mini_deck_floodlight | ||
- light.driveway_floodlights | ||
- light.back_floodlights | ||
- light.mini_deck_floodlight | ||
- light.outside_rgb_white_channels | ||
# If this evaluates to false, the action will stop here. | ||
- condition: template | ||
value_template: "{{ not is_state('binary_sensor.home_occupied') }}" | ||
- service: light.turn_on | ||
entity_id: light.front_door_floodlights | ||
|
||
- alias: Outdoor lights off | ||
id: outdoor_lights_off | ||
trigger: | ||
- platform: state | ||
entity_id: | ||
- binary_sensor.back_door_pir | ||
- binary_sensor.driveway_pir | ||
- binary_sensor.front_door_motion | ||
- binary_sensor.back_door_person_occupancy | ||
- binary_sensor.driveway_person_occupancy | ||
- binary_sensor.driveway_person_occupancy | ||
- binary_sensor.gates_person_occupancy | ||
to: 'off' | ||
for: | ||
seconds: 300 | ||
action: | ||
- service: light.turn_off | ||
entity_id: | ||
- light.driveway_floodlights | ||
- light.mini_deck_floodlight | ||
- light.front_door_floodlights | ||
- light.driveway_floodlights | ||
- light.back_floodlights | ||
- light.mini_deck_floodlight | ||
- light.outside_rgb_white_channels |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.