#
#
MQTT Domoticz Switch
#
#
automation:
#
#
MQTT Switch Domoticz Salon
#
######################################################
- alias: DZ salon
trigger:- platform: mqtt
topic: ‘domoticz/out/Casa/Salon’
condition:
condition: template
value_template: ‘{{ trigger.payload_json.dtype == «Light/Switch» }}’
action: - service: mqtt.publish
data_template:
topic: ‘home/switch/{{ trigger.payload_json.idx }}/state’
payload_template: ‘{% if trigger.payload_json.nvalue == 1 %} On {% else %} Off {% endif %}’
- platform: mqtt
- alias: DZ switch send value as dz expect
trigger:- platform: mqtt
topic: ‘home/switch/+/power’
action: - service: mqtt.publish
data_template:
topic: ‘domoticz/in’
payload_template: ‘{«command»: «switchlight», «idx»: {{ trigger.topic.split(«/»)[-2] }}, «switchcmd»: «{{ trigger.payload }}» }’
- platform: mqtt
switch:
#
#
MQTT Domoticz Salon
#
#
- platform: mqtt
name: «Luz Techo Salon»
command_topic: «home/switch/73/power»
state_topic: «home/switch/73/state»
payload_on: «On»
payload_off: «Off»
qos: 1
retain: true - platform: mqtt
name: «Luz Escalera»
command_topic: «home/switch/53/power»
state_topic: «home/switch/53/state»
payload_on: «On»
payload_off: «Off»
qos: 1
retain: true - platform: mqtt
name: «Luz Plantas»
command_topic: «home/switch/56/power»
state_topic: «home/switch/56/state»
payload_on: «On»
payload_off: «Off»
qos: 1
retain: true - platform: mqtt
name: «Puerta Casa»
command_topic: «home/switch/341/power»
state_topic: «home/switch/341/state»
payload_on: «On»
payload_off: «Off»
qos: 1
retain: true - platform: mqtt
name: «Filtro Aire»
command_topic: «home/switch/479/power»
state_topic: «home/switch/479/state»
payload_on: «On»
payload_off: «Off»
qos: 1
retain: true
icon: mdi:air-filter
