Hi,
I have my TV and a simple light with esp8266 and esphome.io installed. When I play something on the TV the light should dim itself to 50%. How can I automate this with HomeAssistant?
The YAML of the light is:
esphome:
name: wohnzimmerlicht
area: Wohnzimmer
esp8266:
board: d1_mini
framework:
version: recommended
logger:
# Enable Home Assistant API
api:
encryption:
key: "="
ota:
password: ""
wifi:
ssid: "x"
password: "x"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: " Fallback Hotspot"
password: "x"
sensor:
- platform: bme280
temperature:
name: "BME280 Temperature"
oversampling: 16x
pressure:
name: "BME280 Pressure"
humidity:
name: "BME280 Humidity"
address: 0x76
update_interval: 5s
light:
- platform: monochromatic
name: "TV Lampe"
output: light_output
id: light_wohnzimmer
output:
- id: light_output
platform: esp8266_pwm
pin: D7
binary_sensor:
- platform: gpio
pin:
number: D5
mode: INPUT_PULLUP
name: "Schalter Wohnzimmerlicht"
id: switch_
filters:
- delayed_on: 100ms
- delayed_off: 100ms
on_state:
then:
- if:
condition:
light.is_on: light_wohnzimmer
then:
- output.turn_off: light_output
- light.turn_off: light_wohnzimmer
else:
- if:
condition:
light.is_off: light_wohnzimmer
then:
- output.turn_on: light_output
- light.turn_on: light_wohnzimmer
device_class: light
i2c:
sda: D2
scl: D1
In HomeAssistand I created the following automation:
alias:
TV play
description: TV play, Wohnzimmerlicht gedimmt
trigger:
- platform: device
device_id: f18cc976500199293c21b6ff0c9304f6
domain: media_player
entity_id: f48a437ef50069308d0810348c8059e9
type: playing
condition: []
action:
- device_id: 74baef618f74639e23f0ec5bde6ac63c
domain: light
entity_id: bd4663cc2d80d03ef180f5051bd741ff
type: brightness_decrease
mode: single
Where do I specify the dim level?