nitobuendia / oura-custom-component

Oura Custom Component for Home-Assistant. Adds Oura Ring sleep information.
106 stars 24 forks source link

Value error after latest HA update #33

Closed akeslo closed 1 year ago

akeslo commented 1 year ago

Hi @nitobuendia, I'm not sure if this is specific to this component or more of a me issue. I'm seeing the below error in my logs after the latest HA update:

"ValueError: Sensor sensor.0d_bedtime_end_hour has device class None, state class None unit and suggested precision None thus indicating it has a numeric value; however, it has the non-numeric value: 05:31 (<class 'str'>)"

The error is causing the below two sensor's to show unknown. Have you run into this by chance?

Thanks.

      0d_bedtime_end_hour:
        friendly_name: "Bedtime End Hour 0d"
        unit_of_measurement: ""
        value_template: >
            {{ (state_attr('sensor.oura_sleep_metrics', '0d_ago') or {}).get('bedtime_end_hour') }}
      0d_bedtime_start_hour:
        friendly_name: "Bedtime Start Hour 0d"
        unit_of_measurement: ""
        value_template: >
            {{ (state_attr('sensor.oura_sleep_metrics', '0d_ago') or {}).get('bedtime_start_hour') }}
image
akeslo commented 1 year ago

Removing "unit_of_measurement: """ from the above seemed to work.