Homeassistant sensor not receiving unchanged values

I have two esphome devices. One is a temperature sensor:

sensor:
  - platform: dallas_temp
    id: kitchen_temperature
    name: "Kitchen temperature"
    icon: mdi:thermometer
    address: 0x5000000054860a28
    force_update: true
    update_interval: 10s

The second device has a thermostat that uses that temperature value. I want it to detect if it hasn’t received an update for a long time, so I have a timer script that decrements the value of a variable every second, and every time the sensor receives a value it is supposed to reset that variable:

sensor:
  - platform: homeassistant
    name: "CH Temperature"
    id: temperature
    entity_id: sensor.temp_sensor_kitchen_temperature
    on_raw_value:
      - logger.log: "Got temperature value"
      - globals.set:
          id: _sensor_timeout
          value: "20"
      - if:
          condition:
            switch.is_off: controller
          then:
            switch.turn_on: controller

The problem is that this sensor doesn’t receive unchanged values.

The sensor in homeassistant is correctly updating every 10s, even if unchanged, but those no-change updates aren’t getting passed on to the second device, so the time times-out.

As an alternative perhaps you could look at importing state.last_reported (or similar) into the second device as an attribute to use as your heartbeat?

Other ideas:

  • look at force_update (probably not much use here)
  • look at accuracy_decimals (to help force new values to flow through the pipeline)
1 Like

Thanks for the reply.

I’ve tried to do this, but can’t figure out how to access last_reported in esphome.

I’m using force_update on the first device, which works fine, but it seems that homeassistant is not pushing no-change values to esphome.

I think I’ve found the code responsible for this, and it looks like it’s intentional: