diff --git a/packages/outside_lights.yaml b/packages/outside_lights.yaml new file mode 100644 index 000000000..1055aac88 --- /dev/null +++ b/packages/outside_lights.yaml @@ -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 diff --git a/packages/outside_motion.yaml b/packages/outside_motion.yaml deleted file mode 100644 index a7580d451..000000000 --- a/packages/outside_motion.yaml +++ /dev/null @@ -1,87 +0,0 @@ ---- -automation: - - 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 - - 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 }}" - - "{{ state_attr('light.decking_lights', 'rgbww_color')[1] | default(0) | int }}" - - "{{ state_attr('light.decking_lights', 'rgbww_color')[2] | default(0) | int }}" - - 255 - - 255 - # 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 - - 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 }}" - - "{{ state_attr('light.decking_lights', 'rgbww_color')[1] | default(0) | int }}" - - "{{ state_attr('light.decking_lights', 'rgbww_color')[2] | default(0) | int }}" - - 0 - - 0 diff --git a/packages/outside_nightlights.yaml b/packages/outside_nightlights.yaml deleted file mode 100644 index 3f40a1197..000000000 --- a/packages/outside_nightlights.yaml +++ /dev/null @@ -1,37 +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