Lovelace Guage Card intermittently showing "entity is non-numeric"

Following the most recent esphome update I occasionally receive errors on my Lovelace stating the entity is non-numeric.

The hardware is a Sonoff TH10 and has been solid for a long time, so was surprised to see the error, and how it displays only intermittently.

Here’s what I see on the dashboard:-

Sonoff-Error

Here’s the code for the Sonoff unit in question…

substitutions:
  off_hour: '3'

esphome:
  name: outside-lights
  platform: ESP8266
  board: esp01_1m
  on_boot:
  - wait_until:
      condition: api.connected
  - delay: 2s
  - if:
      condition:
        and:
        - sun.is_below_horizon:
        - lambda: |-
            auto hour = id(ha_time).now().hour;
            return hour > 12 || hour < ${off_hour};
      then:
      - light.turn_on:
          id: outside_lights

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO0
      mode: INPUT_PULLUP
      inverted: True
    name: "Button"
  - platform: status
    name: "Outside Light Controller Status"

output:
  - platform: gpio
    id: relay
    pin: GPIO12
  # Register the blue LED as a dimmable output ....
  - platform: esp8266_pwm
    id: blue_led
    pin: GPIO13
    inverted: True

light:
  # ... and then make a light out of it.
  - platform: monochromatic
    name: "Outside Light Controller Blue LED"
    output: blue_led
  - platform: binary
    name: "Outside Lights"
    id: outside_lights
    output: relay

sensor:
  - platform: dht
    model: SI7021
    pin: GPIO14
    temperature:
      name: "Sonoff Outside Temperature"
    humidity:
      name: "Sonoff Outside Humidity"
    update_interval: 30s

time:
  platform: homeassistant
  timezone: !secret timezone
  id: ha_time
  on_time:
  - hours: ${off_hour}
    minutes: 0
    seconds: 0
    then:
    - light.turn_off:
        id: outside_lights

sun:
  latitude: !secret latitude
  longitude: !secret longitude
  on_sunset:
  - elevation: -10°
    then:
    - light.turn_on:
        id: outside_lights

switch:
  - platform: restart
    name: "Outside Lights Restart"

Have tried a few things, but alas none that have worked. This was one of the threads I read for some ideas.

https://community.home-assistant.io/t/lovelace-guage-card-entity-is-non-numeric/202163

Any suggestions appreciated.

I’m assuming this is because the device is unavailable ?
Unfortunately I’m not sure how you’d edit this to be resilient to that.

In some of my template sensors, I just use a default to ensure its always a numeric value:

{% if state_attr(‘climate.moes_trv_downstairs_bathroom_becathermostat’,‘temperature’) | int(0) >5%}

Hello Rofo, and thanks for the input.

If the issue were an ongoing thing then I’d be inclined to agree. However the issue only started after the most recent Home Assistant and EspHome updates, so the suspicious side of me is inclined to think something in the code has changed.

I often find updates introduce weird issues, and then months later after digging I find the issues is related to a code or syntax change. I suspect in this case there might be a code syntax that likely needs changing.

But I am no expert, so I could be totally wrong :rofl:

I have exactly the same issue. Also with dht temp and humidity, same code and same intermittent message. Sometimes sensors are fine sometimes not. With this error message. Bizarre