I have a Withings sleep sensor that tells me I spent 15,000 seconds in REM last night. That’s not convenient so I am trying to convert it to minutes by creating a template sensor by putting this in configuration.yaml.
template:
- sensor:
- name: "REM"
unit_of_measurement: "Minutes"
state: >
{% set bedroom = states('sensor.withings_sleep_rem_duration_seconds_NAME') | float %}
{{ ((bedroom / 60)}}
This does not create a sensor in the entities. I’ve tried a number of configurations similar to this (and reloading YAML and restarting HA) and none have worked.
I have also tried
template:
sensor:
REM_Minutes:
friendly_name: "REM Minutes"
unit_of_measurement: 'Minutes'
value_template: >-
{% set REMminutes = states('sensor.withings_sleep_rem_duration_seconds_NAME') | float %}
{{((REMminutes)/60}}