86 lines
2.0 KiB
YAML
86 lines
2.0 KiB
YAML
|
|
||
|
homeassistant:
|
||
|
customize:
|
||
|
switch.all_sonoffs:
|
||
|
friendly_name: "All Sonoffs on Network"
|
||
|
|
||
|
switch:
|
||
|
- platform: mqtt
|
||
|
name: "Sonoff White"
|
||
|
state_topic: "stat/sonoff/white/RESULT"
|
||
|
value_template: "{{ value_json.POWER }}"
|
||
|
command_topic: "cmnd/sonoff/white/POWER"
|
||
|
# availability_topic: "tele/sonoff/STATE"
|
||
|
qos: 1
|
||
|
payload_on: "ON"
|
||
|
payload_off: "OFF"
|
||
|
# payload_available: "Online"
|
||
|
# payload_not_available: "Offline"
|
||
|
retain: true
|
||
|
|
||
|
- platform: mqtt
|
||
|
name: "Sonoff Brown"
|
||
|
state_topic: "stat/sonoff/brown/RESULT"
|
||
|
value_template: "{{ value_json.POWER }}"
|
||
|
command_topic: "cmnd/sonoff/brown/POWER"
|
||
|
# availability_topic: "tele/sonoff/STATE"
|
||
|
qos: 1
|
||
|
payload_on: "ON"
|
||
|
payload_off: "OFF"
|
||
|
# payload_available: "Online"
|
||
|
# payload_not_available: "Offline"
|
||
|
retain: true
|
||
|
|
||
|
- platform: template
|
||
|
switches:
|
||
|
all_sonoffs:
|
||
|
value_template: "{{ is_state('group.sonoffs','on') }}"
|
||
|
turn_on:
|
||
|
- service: homeassistant.turn_on
|
||
|
entity_id: group.sonoffs
|
||
|
turn_off:
|
||
|
- service: homeassistant.turn_off
|
||
|
entity_id: group.sonoffs
|
||
|
|
||
|
group:
|
||
|
sonoffs:
|
||
|
entities:
|
||
|
- switch.sonoff_white
|
||
|
- switch.sonoff_brown
|
||
|
|
||
|
|
||
|
automation:
|
||
|
- alias: “Power state on HA start-up”
|
||
|
trigger:
|
||
|
platform: homeassistant
|
||
|
event: start
|
||
|
action:
|
||
|
- service: mqtt.publish
|
||
|
data:
|
||
|
topic: “cmd/sonoff/white/state”
|
||
|
payload: “”
|
||
|
- service: mqtt.publish
|
||
|
data:
|
||
|
topic: cmd/sonoff/white/POWER
|
||
|
|
||
|
|
||
|
# automation:
|
||
|
# - alias: "Power State Sonoffs"
|
||
|
# trigger:
|
||
|
# platform: homeassistant
|
||
|
# event: start
|
||
|
# action:
|
||
|
# - service: mqtt.publish
|
||
|
# data:
|
||
|
# topic: "cmnd/sonoff/white/state"
|
||
|
# payload: ""
|
||
|
# - service: mqtt.publish
|
||
|
# data:
|
||
|
# topic: cmnd/tasmotas/POWER
|
||
|
# - service: mqtt.publish
|
||
|
# data:
|
||
|
# topic: cmnd/tasmotas/POWER2
|
||
|
# - service: mqtt.publish
|
||
|
# data:
|
||
|
# topic: cmnd/tasmotas/POWER3
|