Zenia
(Yevgeniy)
1
Good day smart community. I tried to change Tuya smart fireplace mode ( off/ heat) to simple on/off switch using template, but no luck.
template, which is not working
switch:
- platform: template
switches:
climatisation:
value_template: "{{ states('climate.fireplace') in ['heat'] }}"
turn_on:
service: button.press
target:
entity_id: button.fireplace_on
turn_off:
service: button.press
target:
entity_id: button.fireplace_off
Thank you in advanced
Zenia
(Yevgeniy)
2
Fixed by myself, using OpenAI help
switch:
- platform: template
switches:
fireplace_heat:
friendly_name: "Fireplace"
unique_id: 61fb6ddf-2f5a-46a6-9db2-1bda36d7e2a8
value_template: >
{{ is_state('climate.fireplace', 'heat') }}
turn_on:
service: climate.set_hvac_mode
data:
entity_id: climate.fireplace
hvac_mode: heat
turn_off:
service: climate.set_hvac_mode
data:
entity_id: climate.fireplace
hvac_mode: 'off'
icon_template: >
{% if is_state('climate.fireplace', 'heat') %}
mdi:fire
{% else %}
mdi:fireplace-off
{% endif %}
Mikefila
(Mike Fila)
3
It’s using a legacy format. Template entities should now go under the template:
key to ensure that they will continue to work as expected.
https://www.home-assistant.io/integrations/template/#switch
Zenia
(Yevgeniy)
4
TY. I have this yaml code in my template folder and reference to this folder from configuration.yaml