2019-04-17 22:46:06 +00:00
|
|
|
###############################################################################
|
|
|
|
# @author : Mahasri Kalavala
|
|
|
|
# @date : 04/15/2017
|
|
|
|
# @package : TV
|
|
|
|
# @description : Tv Automations
|
|
|
|
###############################################################################
|
2020-02-05 23:28:38 +00:00
|
|
|
binary_sensor:
|
|
|
|
- platform: mqtt
|
|
|
|
name: Sharp TV
|
|
|
|
state_topic: "/home/sharptv"
|
|
|
|
payload_on: "on"
|
|
|
|
payload_off: "off"
|
|
|
|
value_template: "{{ value }}"
|
|
|
|
|
|
|
|
- platform: mqtt
|
|
|
|
name: Sharp TV Command State
|
|
|
|
state_topic: "/home/sharp_tv_cmd"
|
|
|
|
payload_on: "on"
|
|
|
|
payload_off: "off"
|
|
|
|
value_template: "{{ value }}"
|
2019-04-17 22:46:06 +00:00
|
|
|
|
|
|
|
###############################################################################
|
2020-02-05 23:28:38 +00:00
|
|
|
# _ _ _
|
|
|
|
# /\ | | | | (_)
|
|
|
|
# / \ _ _| |_ ___ _ __ ___ __ _| |_ _ ___ _ __ ___
|
2019-04-17 22:46:06 +00:00
|
|
|
# / /\ \| | | | __/ _ \| '_ ` _ \ / _` | __| |/ _ \| '_ \/ __|
|
|
|
|
# / ____ \ |_| | || (_) | | | | | | (_| | |_| | (_) | | | \__ \
|
|
|
|
# /_/ \_\__,_|\__\___/|_| |_| |_|\__,_|\__|_|\___/|_| |_|___/
|
2020-02-05 23:28:38 +00:00
|
|
|
#
|
2019-04-17 22:46:06 +00:00
|
|
|
###############################################################################
|
|
|
|
automation:
|
2020-02-05 23:28:38 +00:00
|
|
|
# Dim Family Room Lights When TV is Turned ON
|
|
|
|
###############################################################################
|
2019-04-17 22:46:06 +00:00
|
|
|
- alias: TV Dim Indoor Lights when TV is ON
|
|
|
|
initial_state: true
|
|
|
|
trigger:
|
|
|
|
platform: state
|
|
|
|
entity_id: binary_sensor.sharp_tv
|
2020-02-05 23:28:38 +00:00
|
|
|
from: "off"
|
|
|
|
to: "on"
|
2019-04-17 22:46:06 +00:00
|
|
|
condition:
|
|
|
|
- condition: state
|
|
|
|
entity_id: sun.sun
|
2020-02-05 23:28:38 +00:00
|
|
|
state: "below_horizon"
|
2019-04-17 22:46:06 +00:00
|
|
|
- condition: state
|
|
|
|
entity_id: input_boolean.light_automations
|
2020-02-05 23:28:38 +00:00
|
|
|
state: "on"
|
2019-04-17 22:46:06 +00:00
|
|
|
action:
|
|
|
|
- service: light.turn_on
|
|
|
|
data:
|
|
|
|
entity_id: light.hue_color_lamp_1
|
|
|
|
brightness: 5
|
|
|
|
color_temp: 154
|
|
|
|
- service: light.turn_on
|
|
|
|
data:
|
|
|
|
entity_id: light.hue_color_lamp_2
|
|
|
|
brightness: 5
|
|
|
|
color_temp: 154
|
|
|
|
- service: light.turn_on
|
|
|
|
data:
|
|
|
|
entity_id: light.hue_color_lamp_3
|
|
|
|
brightness: 5
|
|
|
|
color_temp: 154
|
|
|
|
- service: mqtt.publish
|
|
|
|
data:
|
|
|
|
topic: /home/tv/backlight
|
2020-02-05 23:28:38 +00:00
|
|
|
payload: "on"
|
2019-04-17 22:46:06 +00:00
|
|
|
retain: true
|
2020-02-05 23:28:38 +00:00
|
|
|
|
|
|
|
# Restore Family Room Lights to TV mode
|
|
|
|
###############################################################################
|
2019-04-17 22:46:06 +00:00
|
|
|
- alias: TV Restore Family Room Lights To TV Mode
|
|
|
|
initial_state: true
|
|
|
|
trigger:
|
|
|
|
- platform: state
|
|
|
|
entity_id: group.family_room_lights
|
2020-02-05 23:28:38 +00:00
|
|
|
from: "off"
|
|
|
|
to: "on"
|
2019-04-17 22:46:06 +00:00
|
|
|
condition:
|
|
|
|
- condition: state
|
|
|
|
entity_id: binary_sensor.sharp_tv
|
2020-02-05 23:28:38 +00:00
|
|
|
state: "on"
|
2019-04-17 22:46:06 +00:00
|
|
|
- condition: state
|
|
|
|
entity_id: input_boolean.light_automations
|
2020-02-05 23:28:38 +00:00
|
|
|
state: "on"
|
2019-04-17 22:46:06 +00:00
|
|
|
action:
|
|
|
|
- service: light.turn_on
|
|
|
|
data:
|
|
|
|
entity_id: light.hue_color_lamp_1
|
|
|
|
brightness: 5
|
|
|
|
color_temp: 154
|
|
|
|
transition: 5
|
|
|
|
- service: light.turn_on
|
|
|
|
data:
|
|
|
|
entity_id: light.hue_color_lamp_2
|
|
|
|
brightness: 5
|
|
|
|
color_temp: 154
|
|
|
|
transition: 5
|
|
|
|
- service: light.turn_on
|
|
|
|
data:
|
|
|
|
entity_id: light.hue_color_lamp_3
|
|
|
|
brightness: 5
|
|
|
|
color_temp: 154
|
|
|
|
transition: 5
|
2020-02-05 23:28:38 +00:00
|
|
|
|
|
|
|
# Turn Backlights Off when TV is turned OFF
|
|
|
|
###############################################################################
|
2019-04-17 22:46:06 +00:00
|
|
|
- alias: TV Backlight OFF when TV is OFF
|
|
|
|
initial_state: true
|
|
|
|
trigger:
|
|
|
|
platform: state
|
|
|
|
entity_id: binary_sensor.sharp_tv
|
2020-02-05 23:28:38 +00:00
|
|
|
to: "off"
|
2019-04-17 22:46:06 +00:00
|
|
|
action:
|
|
|
|
- service: mqtt.publish
|
|
|
|
data:
|
|
|
|
topic: /home/tv/backlight
|
2020-02-05 23:28:38 +00:00
|
|
|
payload: "off"
|
2019-04-17 22:46:06 +00:00
|
|
|
retain: true
|
2020-02-05 23:28:38 +00:00
|
|
|
|
|
|
|
# Turn TV backlights when TV is turned ON
|
|
|
|
###############################################################################
|
2019-04-17 22:46:06 +00:00
|
|
|
- alias: TV Backlight is ON when TV is ON
|
|
|
|
initial_state: true
|
|
|
|
trigger:
|
|
|
|
platform: state
|
|
|
|
entity_id: binary_sensor.sharp_tv
|
2020-02-05 23:28:38 +00:00
|
|
|
to: "on"
|
2019-04-17 22:46:06 +00:00
|
|
|
action:
|
|
|
|
- service: mqtt.publish
|
|
|
|
data:
|
|
|
|
topic: /home/tv/backlight
|
2020-02-05 23:28:38 +00:00
|
|
|
payload: "on"
|
2019-04-17 22:46:06 +00:00
|
|
|
retain: true
|
|
|
|
|
2020-02-05 23:28:38 +00:00
|
|
|
# Turn back Family room lights when TV is switched OFF
|
|
|
|
###############################################################################
|
2019-04-17 22:46:06 +00:00
|
|
|
- alias: TV Turn Lights ON When TV is turned OFF
|
|
|
|
initial_state: true
|
|
|
|
trigger:
|
|
|
|
platform: state
|
|
|
|
entity_id: binary_sensor.sharp_tv
|
2020-02-05 23:28:38 +00:00
|
|
|
to: "off"
|
2019-04-17 22:46:06 +00:00
|
|
|
condition:
|
|
|
|
- condition: state
|
|
|
|
entity_id: sun.sun
|
2020-02-05 23:28:38 +00:00
|
|
|
state: "below_horizon"
|
2019-04-17 22:46:06 +00:00
|
|
|
- condition: state
|
|
|
|
entity_id: input_boolean.light_automations
|
2020-02-05 23:28:38 +00:00
|
|
|
state: "on"
|
2019-04-17 22:46:06 +00:00
|
|
|
action:
|
|
|
|
- service: light.turn_on
|
|
|
|
data:
|
|
|
|
entity_id: light.hue_color_lamp_1
|
|
|
|
brightness: 255
|
|
|
|
color_temp: 154
|
|
|
|
transition: 5
|
|
|
|
- service: light.turn_on
|
|
|
|
data:
|
|
|
|
entity_id: light.hue_color_lamp_2
|
|
|
|
brightness: 255
|
|
|
|
color_temp: 154
|
|
|
|
transition: 5
|
|
|
|
- service: light.turn_on
|
|
|
|
data:
|
|
|
|
entity_id: light.hue_color_lamp_3
|
|
|
|
brightness: 255
|
|
|
|
color_temp: 154
|
2020-02-05 23:28:38 +00:00
|
|
|
transition: 5
|
2019-04-17 22:46:06 +00:00
|
|
|
- service: mqtt.publish
|
|
|
|
data:
|
|
|
|
topic: /home/tv/backlight
|
2020-02-05 23:28:38 +00:00
|
|
|
payload: "off"
|
|
|
|
retain: true
|