After the update I can’t get this to work:
- platform: mqtt
unique_id: Luce_Studio_switch
name: "Switch_luce_studio"
state_topic: "stat/consumi/POWER1"
command_topic: "cmnd/consumi/POWER1"
payload_on: "ON"
payload_off: "OFF"
#state_on: "ON"
#state_off: "OFF"
optimistic: false
qos: 0
retain: true
- platform: template
switches:
luce_studio_template:
unique_id: Luce_Studio_template
value_template: "{{ is_state('switch.Switch_luce_studio', 'on') }}"
turn_on:
service: script.Script_luce_studio
data:
entity_id: switch.Switch_luce_studio_open
turn_off:
service: script.Script_luce_studio
data:
entity_id: switch.Switch_luce_studio_close
icon_template: >-
{% if is_state('switch.Switch_luce_studio', 'on') %}
mdi:lightbulb-on
{% else %}
mdi:lightbulb-off
{% endif %}
I changed it like this but it gives me an error on the template
mqtt:
switch:
- unique_id: Luce_Studio_switch
name: "Switch_luce_studio"
state_topic: "stat/consumi/POWER1"
command_topic: "cmnd/consumi/POWER1"
payload_on: "ON"
payload_off: "OFF"
#state_on: "ON"
#state_off: "OFF"
optimistic: false
qos: 0
retain: true
- platform: template
switches:
luce_studio_template:
unique_id: Luce_Studio_template
value_template: "{{ is_state('switch.Switch_luce_studio', 'on') }}"
turn_on:
service: script.Script_luce_studio
target: #data:
entity_id: switch.Switch_luce_studio_open
turn_off:
service: script.Script_luce_studio
target: #data:
entity_id: switch.Switch_luce_studio_close
icon_template: >-
{% if is_state('switch.Switch_luce_studio', 'on') %}
mdi:lightbulb-on
{% else %}
mdi:lightbulb-off
{% endif %}
can you help me thanks
1 post - 1 participant