Hi everyone,
I have tried to find the proper solution ind docs, this forum, but find none.
I think I am loosing my mind a little bit now.
It has stared when templates syntax changed at the end of the year 2025 and my templates are not working anymore.
The following is my old templates.yaml:
template:
sensor:
dimplex_mode_text:
friendly_name: 'Dimplex Mode Text'
value_template: >
{% set mapper = {
'0': 'Summer',
'1': 'Auto',
'2': 'Holiday',
'3': 'Party',
'4': '2nd heat generator',
'5': 'Cooling'} %}
{% set state = states.sensor.dimplex_mode_2.state %}
{{ mapper[state] if state in mapper else 'Unknown' }}
outside_temperature:
friendly_name: 'Outside Temperature'
unit_of_measurement: '°C'
value_template: "{{ state_attr('weather.forecast_domov', 'temperature') }}"
dimplex_status_text:
friendly_name: 'Dimplex Status Text'
value_template: >
{% set mapper = {
'0': 'off',
'1': 'Heat pump One heating',
'2': 'Heat pump One heating',
'3': 'Heat pump A swimming pool',
'4': 'Heat pump One hot water',
'5': 'Heat pump One heating + 2.heat generator',
'6': 'Heat pump One swimming pool + 2.heat generator',
'7': 'Heat pump A hot water + 2.heat generator',
'8': 'Primary pump feed',
'9': 'Heating sinks',
'10': 'Lock',
'11': 'Lower operating limit',
'12': 'Low pressure limit',
'13': 'Low-pressure shutdown',
'14': 'High pressure protection',
'15': 'Switching game lock',
'16': 'Minimum order period',
'17': 'Grid load',
'18': 'Flow monitoring',
'19': '2.Heat generators',
'20': 'Low pressure brine',
'21': 'Heat pump In defrosting',
'22': 'Upper operating limit',
'23': 'Block External',
'24': 'Operating mode cooling',
'25': 'Frost protection cold',
'26': 'Preliminary limit',
'27': 'Dew point guards',
'28': 'Dew point',
'29': 'Cooling passive',
'30': ' '} %}
{% set state = states.sensor.dimplex_status.state %}
{{ mapper[state] if state in mapper else 'Unknown' }}
# Hvac Activiy
#hvac_activity:
#friendly_name: 'HVAC Activity'
#value_template: '{{ state_attr("climate.madimack_elite_v3_pool_heatpump", "hvac_action") }}'
hvac_mode:
friendly_name: 'HVAC Mode'
value_template: '{{ state_attr("climate.madimack_elite_v3_pool_heatpump", "preset_mode") }}'
daily_PVE_generation_treshold:
friendly_name: 'Expected minimal daily PVE generation'
value_template: '{{ states("sensor.solcast_pv_forecast_predpoved_dnes")|float * 0.8}}'
#helper sensor for hikvision doorbell - using intercom button "call status" attribbute CallStatus status ('idle'|'ring')
#helper for incoming SMS from Alarm (to check last notification date for "Home Alarm" state)
RingBell:
state: "{{ state_attr('button.intercom_call_status','CallStatus').status }}"
AlarmSMS:
state: "{{ state_attr('sensor.sm_s926b_s24_last_notification','android.messages')[-1][1:-1].split(', ')[2].split('=')[1] == 'Home Alarm'}}"
attributes:
history: "{{ state_attr('sensor.sm_s926b_s24_last_notification','android.messages')[-1][1:-1].split(', ')[8].split('=')[1][:-3] | int (1) | timestamp_local }}"
#helper for PV Excess automation
switch:
keba: # Keba does not have enable/disable switch
friendly_name: "Keba"
turn_on:
action: button.press
target:
entity_id: button.keba_p30_de_enable
turn_off:
action: button.press
target:
entity_id: button.keba_p30_de_disable
bazen_tepelko: # heatpump does not have enable switch, just hvac mode
friendly_name: "BazenTepelko"
turn_on:
action: switch.turn_on
target:
entity_id: switch.tepelko_bazen_prepinac # http://homeassistant.local:8123/config/devices/device/b7c3ea15acb611210385403f8ac700e3 - cloud tuya device
turn_off:
action: switch.turn_off
target:
entity_id: switch.tepelko_bazen_prepinac # http://homeassistant.local:8123/config/devices/device/b7c3ea15acb611210385403f8ac700e3 - cloud tuya device
I have the following in the configuration.yaml:
...
modbus: !include modbus.yaml
sensor: !include sensors.yaml
template: !include templates.yaml
...
So I have several sensor types in the templates.yaml.
I know I have duplicity in the templates.yaml, the “template:” in the first line.
Even If i removed that one, and moved the whole section up, I got another error:
“Missing property state”.
So I tried with just state regular sensors and removed everything else:
templates.yaml:
sensor:
#helper sensor for hikvision doorbell - using intercom button "call status" attribute CallStatus status ('idle'|'ring')
#helper for incoming SMS from Alarm (to check last notification date for "Home Alarm" state)
name: RingBell
state: "{{ state_attr('button.intercom_call_status','CallStatus').status }}"
name: AlarmSMS
state: "{{ state_attr('sensor.sm_s926b_s24_last_notification','android.messages')[-1][1:-1].split(', ')[2].split('=')[1] == 'Home Alarm'}}"
attributes:
history: "{{ state_attr('sensor.sm_s926b_s24_last_notification','android.messages')[-1][1:-1].split(', ')[8].split('=')[1][:-3] | int (1) | timestamp_local }}"
I have “Map keys must be unique” error now, so I couldn’t even put more basic sensors into one template file.
Any help appreciated.
Thanks.