I have a question about a Sonoff T1 (with Tasmota) and a Hue bulb and whether I can make my set up more elegant.
Situation:
I want a hue bulb(s) to be switched on/off via alexa, hue app, home assistant, or T1 switch… with the T1 switch being synchronised to the state (so it appears correctly on my wall).
Solution:
The solution I have is using 4 automations.
- Publish any Hue state changes to MQTT which are picked up by the T1 (one for off, one for on)
- Respond to any MQTT messages from the T1 switch to update the state of the hue bulb(s)
Bonus:
I’d really like a long press on a T1 switch to give me a dimmed light with the simple tap on to give me full brightness.
Here’s what I have already, any help gratefully received:
lloyd@home:/data/homeassistant/automations/t1-lounge/power3$ ls
hue-off.yaml hue-on.yaml switch-off.yaml switch-on.yaml
lloyd@home:/data/homeassistant/automations/t1-lounge/power3$ cat *
alias: Lounge T1 = hue->MQTT office light on sync
trigger:
- entity_id: light.office_light
from: 'on'
platform: state
to: 'off'
condition: []
action:
- alias: ''
data:
payload: 'OFF'
topic: sonoff_t1_1/cmnd/power3
service: mqtt.publish
alias: Lounge T1 = hue->MQTT office light on sync
trigger:
- entity_id: light.office_light
from: 'off'
platform: state
to: 'on'
action:
- alias: ''
data:
payload: 'ON'
topic: sonoff_t1_1/cmnd/power3
service: mqtt.publish
alias: Lounge T1 = T1->hue office light on sync
trigger:
platform: mqtt
topic: sonoff_t1_1/stat/POWER3
# Optional
payload: 'OFF'
encoding: 'utf-8'
condition:
- condition: state
entity_id: 'light.office_light'
state: 'on'
action:
- alias: ''
service: light.turn_off
entity_id: light.office_light
alias: Lounge T1 = T1->hue office light on sync
trigger:
platform: mqtt
topic: sonoff_t1_1/stat/POWER3
# Optional
payload: 'ON'
encoding: 'utf-8'
condition:
- condition: state
entity_id: 'light.office_light'
state: 'off'
action:
- alias: ''
service: light.turn_on
entity_id: light.office_light