This gives me a green tick in my config, but when checking the config I get the below error and cannot work out what it means let alone why:
sensor:
- platform: template
sensors:
time_at_work_rounded:
value_template: "{% set hours = states('sensor.time_at_work') | float %}
{% set minutes = ((hours % 1) * 60) | int %}
{% set hours = (hours - (hours % 1)) | int %}
{{ '%02i:%02i'%(hours, minutes) }}"
Error message:
Invalid config for [sensor.template]: expected a dictionary for dictionary value @ data[āsensorsā][ātime_at_work_roundedā]. Got None
expected a dictionary for dictionary value @ data[āsensorsā][āvalue_templateā]. Got ā{% set hours = states(āsensor.time_at_workā) | float %} {% set minutes = ((hours % 1) * 60) | int %} {% set hours = (hours - (hours % 1)) | int %} {{ ā%02i:%02iā%(hours, minutes) }}ā. (See ?, line ?). Please check the docs at https://home-assistant.io/integrations/sensor.template/
I have tried changing " to ā and but with no luck. I have read about needing an entity_id from HA 0.8 onwards but this is not specified as required in the docs that I can see?
sensor:
- platform: template
sensors:
time_at_work_rounded:
value template: >
{% set hours = states('sensor.time_at_work') | float %}
{% set minutes = ((hours % 1) * 60) | int %}
{% set hours = (hours - (hours % 1)) | int %}
{{ '%02i:%02i'%(hours, minutes) }}
gives me this error:
Invalid config for [sensor.template]: [value template] is an invalid option for [sensor.template]. Check: sensor.template->sensors->time_at_work_rounded->value template. (See ?, line ?). Please check the docs at https://home-assistant.io/integrations/sensor.template/