Wiki example for sensors doesn't seem to work
tboothman opened this issue · 5 comments
I tried the config at https://github.com/ha-warmup/warmup/wiki/Configuration-ideas#sensors and i just ended up with two readings with no name or value. I tried the below using state_attr instead and that worked
sensors:
temperature_kitchen_air:
friendly_name_template: "{{ state_attr('climate.kitchen', 'friendly_name') }} Air Temperature"
value_template: "{{ state_attr('climate.kitchen', 'air_temperature') }}"
unit_of_measurement: "°C"
temperature_kitchen_floor:
friendly_name_template: "{{ state_attr('climate.kitchen', 'friendly_name') }} Floor Temperature"
value_template: "{{ state_attr('climate.kitchen', 'floor_temperature') }}"
unit_of_measurement: "°C"
There's probably a syntax error on line - platform: template:
but I put my sensors in a sensors.yaml instead so I don't know what the right format would be.
For completeness I made a sensors.yaml containing:
platform: template
sensors:
temperature_kitchen_air:
friendly_name_template: "{{ state_attr('climate.kitchen', 'friendly_name') }} Air Temperature"
value_template: "{{ state_attr('climate.kitchen', 'air_temperature') }}"
unit_of_measurement: "°C"
temperature_kitchen_floor:
friendly_name_template: "{{ state_attr('climate.kitchen', 'friendly_name') }} Floor Temperature"
value_template: "{{ state_attr('climate.kitchen', 'floor_temperature') }}"
unit_of_measurement: "°C"
and included it from configuration.yaml like so:
sensor: !include sensors.yaml
Thanks for feeding back, @tboothman , and well done for working out how you got it working. The wiki is actually a part of github that users have the rights to modify themselves, in a collaborative spirit.
If you'd like to add your alternative solution into the wiki, so others can benefit from your work, then please use the Edit button on the top right side of the wiki page. If you don't want to, I can, but if you add it yourself then at least you get the credit you deserve.
We appreciate for your valuable contribution
It's possible I'm missing something but I don't think I do have permission to edit the wiki
How odd, I thought it was open to all users - there should be an Edit button near the top of the page...
Anyhow, I added your code suggestion, many thanks @tboothman