bfreeze09
(Brian Freeze)
February 5, 2023, 5:56pm
1
I am trying to make a template sensor to track my HVAC preset mode.
I have the final line double checked in the developer tools and it provides the correct value.
However i get an error about my configuration value
"Cannot read an implicit mapping pair; a colon is missed (40:69) with and error point to the m in ‘preset_mode’
# Template Sensor
#1st Floor Climate
template:
- sensor:
- name: '1st Floor Preset Mode'
state:'{{ state_attr('climate.1st_floor_2', 'preset_mode') }}'
any thoughts?
EDIT with solution:
Missed a space before State_attr
Need different quotes inside and outside
# Template Sensor
# 1st Floor Climate
template:
- sensor:
- name: '1st Floor Preset Mode'
state: "{{ state_attr('climate.1st_floor_2', 'preset_mode') }}"
state: (space)…
state: '{{ state_attr('climate.1st_floor_2', 'preset_mode') }}'
bfreeze09
(Brian Freeze)
February 5, 2023, 7:16pm
3
Thank you, that results in "bad indentation of mapping entity and points at state_attr
# Template Sensor
# 1st Floor Climate
template:
- sensor:
- name: '1st Floor Preset Mode'
state: '{{ state_attr('climate.1st_floor_2', 'preset_mode') }}'
petro
(Petro)
February 5, 2023, 7:25pm
4
Inside quotes have to differ from outside quotes. " '..' "
bfreeze09
(Brian Freeze)
February 5, 2023, 9:58pm
5
Thanks that did it, i was pulling my nonexistent hair out. Felt like I had tried every combination, guess not
Final working
# Template Sensor
# 1st Floor Climate
template:
- sensor:
- name: '1st Floor Preset Mode'
state: "{{ state_attr('climate.1st_floor_2', 'preset_mode') }}"