diff --git a/config/automations.yaml b/config/automations.yaml index 51c400a..54b6a86 100644 --- a/config/automations.yaml +++ b/config/automations.yaml @@ -195,32 +195,85 @@ -# - id: show_time -# alias: Show Time -# initial_state: true -# trigger: -# - platform: state -# entity_id: media_player.home_theater -# to: 'playing' -# action: -# - service: script.turn_off -# entity_id: script.theater_lights_up_check -# - service: script.turn_off -# entity_id: script.theater_lights_up -# - service: script.turn_off -# entity_id: script.theater_lights_out -# - service: script.turn_on -# entity_id: script.theater_lights_down +- id: show_time + alias: Show Time + initial_state: true + trigger: + - platform: state + entity_id: media_player.home_theater + to: 'playing' + condition: + - condition: state + entity_id: light.theater_light + state: 'on' + action: + - service: script.turn_on + entity_id: script.theater_lights_down + - service: script.turn_off + entity_id: script.theater_lights_up -# - id: show_time_over -# alias: Show Time Over -# initial_state: true -# trigger: -# - platform: state -# entity_id: media_player.home_theater -# to: 'idle' -# action: -# - service: script.turn_on -# entity_id: script.theater_lights_up_check -# - service: script.turn_off -# entity_id: script.theater_lights_down \ No newline at end of file +- id: show_time start paused + alias: Show Time Start Paused + initial_state: true + trigger: + - platform: state + entity_id: media_player.home_theater + to: 'idle' + condition: + - condition: state + entity_id: script.theater_lights_down + state: 'on' + action: + - service: script.turn_off + entity_id: script.theater_lights_down + +- id: show_time_over + alias: Show Time over + initial_state: true + trigger: + - platform: state + entity_id: media_player.home_theater + to: 'idle' + for: + seconds: 35 + condition: + - condition: state + entity_id: media_player.home_theater + state: 'idle' + action: + - service: script.turn_on + entity_id: script.theater_lights_up + - service: script.turn_off + entity_id: script.theater_lights_down + +- id: theater_fan_on + alias: Theater Fan On + initial_state: true + trigger: + - above: '74' + platform: numeric_state + entity_id: sensor.theater_temperature + action: + - data: + entity_id: switch.theater_fan + service: switch.turn_off + +- id: theater_light_pressed_up + alias: Theater Light Pressed Up + initial_state: true + trigger: + - platform: state + entity_id: sensor.theater_light_up + action: + - service: scene.turn_on + entity_id: scene.theater_bright + +- id: theater_light_pressed_down + alias: Theater Light Pressed Down + initial_state: true + trigger: + - platform: state + entity_id: sensor.theater_light_down + action: + - service: scene.turn_on + entity_id: scene.theater_dark diff --git a/config/groups.yaml b/config/groups.yaml index 9e5a423..ba03c94 100755 --- a/config/groups.yaml +++ b/config/groups.yaml @@ -70,4 +70,5 @@ livingroom: - switch.fireplace_lights - switch.rail_lights - +theater lights: + - light.theater_light diff --git a/config/lights.yaml b/config/lights.yaml index ff0d524..789408b 100644 --- a/config/lights.yaml +++ b/config/lights.yaml @@ -67,3 +67,15 @@ payload_off: 0 retain: true + +# Theater + +- platform: mqtt + name: Theater Light + command_topic: "zwave2mqtt/theater/38/1/0/set" + brightness_command_topic: "zwave2mqtt/theater/38/1/0/set" + brightness_scale: 99 + brightness_state_topic: "zwave2mqtt/theater/38/1/0" + on_command_type: "brightness" + payload_off: 0 + retain: true diff --git a/config/scenes.yaml b/config/scenes.yaml index 93c26ec..f1716ee 100755 --- a/config/scenes.yaml +++ b/config/scenes.yaml @@ -331,7 +331,7 @@ ####################################### -# Home Theater +# Home Audio - name: normal audio entities: @@ -342,4 +342,44 @@ - name: quiet audio entities: media_player.tsr_6750_a3ed2f: - state: off \ No newline at end of file + state: off + +####################################### +# Home Theather + +- name: theater dark + entities: + group.theater_lights: + state: off + +- name: theater dim + entities: + group.theater_lights: + state: on + brightness: 40 + +- name: theater bright + entities: + group.theater_lights: + state: on + brightness: 255 + +####################################### +# Skylar +# - name: Skylar Full +# entities: +# input_number.skylar_tv_time: 120 +# input_number.skylar_ps_time: 120 +# input_number.skylar_yt_time: 60 + +# - name: Skylar restricted +# entities: +# input_number.skylar_tv_time: 0 +# input_number.skylar_ps_time: 0 +# input_number.skylar_yt_time: 0 + +# - name: Skylar Limited +# entities: +# input_number.skylar_tv_time: 60 +# input_number.skylar_ps_time: 60 +# input_number.skylar_yt_time: 0 diff --git a/config/scripts/lights.yaml b/config/scripts/lights.yaml index c07c197..594bc3d 100755 --- a/config/scripts/lights.yaml +++ b/config/scripts/lights.yaml @@ -17,16 +17,44 @@ livingroom_lamps_on: - service: scene.turn_on entity_id: scene.normal_livingroom_lighting -# Turn off Living Room Lights if sun is up and cloud coverage is below 70% -livingroom_lamps_off: +# Turn off Living Room Lights if sun is up and it is sunny or partly cloudy +livingroom_lights_off: sequence: - condition: and conditions: - condition: state entity_id: sun.sun state: 'above_horizon' + - condition: state + entity_id: binary_sensor.living_room_occupancy + state: 'off' + - condition: template + value_template: > + {%- if states.weather.home.state == "sunny" or states.weather.home.state == "partlycloudy" -%} + true + {%- endif -%} - service: group.turn_off - entity_id: group.livingroom_lamps + entity_id: group.livingroom + + +# Turn off Kitchen Lights if sun is up and it is sunny or partly cloudy +kitchen_lights_off: + sequence: + - condition: and + conditions: + - condition: state + entity_id: sun.sun + state: 'above_horizon' + - condition: state + entity_id: binary_sensor.kitchen_occupancy + state: 'off' + - condition: template + value_template: > + {%- if states.weather.home.state == "sunny" or states.weather.home.state == "partlycloudy" -%} + true + {%- endif -%} + - service: group.turn_off + entity_id: group.kitchen good_night_loft: sequence: @@ -68,13 +96,25 @@ kitchen_lights_night: theater_lights_out: sequence: - - condition: state - entity_id: media_player.home_theater - state: 'idle' - - delay: - minutes: 30 + - condition: and + conditions: + - condition: template + value_template: > + {%- if states.media_player.home_theater != "playing" -%} + true + {%- endif -%} + - condition: template + value_template: > + {%- if states.media_player.playstation_4 != "playing" -%} + true + {%- endif -%} + - condition: state + entity_id: binary_sensor.theater_occupancy + state: 'off' - service: scene.turn_on entity_id: scene.theater_dark + - service: switch.turn_off + entity_id: switch.theater_fan theater_lights_down: sequence: @@ -85,28 +125,15 @@ theater_lights_down: - service: scene.turn_on entity_id: scene.theater_dark -theater_lights_up_check: - sequence: - - delay: - seconds: 20 - - service: script.turn_on - entity_id: script.theater_lights_up - theater_lights_up: sequence: - - condition: state - entity_id: media_player.home_theater - state: 'idle' - service: scene.turn_on - entity_id: scene.theater_dim + entity_id: scene.theater_dim - delay: minutes: 1 - service: scene.turn_on entity_id: scene.theater_bright - - delay: - minutes: 5 - - service: script.turn_on - entity_id: script.theater_lights_out + diff --git a/config/switches.yaml b/config/switches.yaml index 8d35e8d..bda92c3 100644 --- a/config/switches.yaml +++ b/config/switches.yaml @@ -138,6 +138,16 @@ payload_off: "false" +# Theater: + +- platform: mqtt + name: "Theater Fan" + state_topic: "zwave2mqtt/theater/37/2/0" + command_topic: "zwave2mqtt/theater/37/2/0/set" + payload_on: "true" + payload_off: "false" + + # alarm # - platform: mqtt