MQTT Sensor - Start (history graph) with new value when sensor comes back


I have a ESP32 Solar sensor which is sending data to my MQTT Mosquitto Server. In the middle of the night, as soon as the battery is empty, the sensor goes offline. When it comes back, the history graph in Home Assistant starts with the old value which creates this vertical line which you can see on the picture. I want to get rid of the old/previous value and the vertical line.

So far I couldn’t figure out how to achieve that. Any idea or advise if highly appreciated.

Here is my MQTT Sensor config:

  - name: "Deposito %"
    state_topic: esp32-00001-01/sensor/deposito_/state
    icon: mdi:water-check-outline
    unit_of_measurement: "%"
    availability_topic: esp32-00001-01/status

This is the corresponding config in ESPHome:

  - platform: ads1115
    setup_priority: -100.0
    multiplexer: 'A3_GND'
    gain: 4.096
    name: "Deposito %"
    retain: false
    accuracy_decimals: 0
    update_interval: 10s
    unit_of_measurement: "%"    
      - filter_out: 0.00
      - clamp:
          min_value: 0.02
          max_value: 3.6
          ignore_out_of_range: true          
      - skip_initial: 5
      - sliding_window_moving_average:
          window_size: 20 #creates a moving average of the last 10 values
          send_every: 10 #sends the moving average at every measurement
          send_first_at: 10 #
      - delta: 0.02
      - calibrate_linear:
        - 0.02 -> 0.0
        - 3.56 -> 100.0

Thank you.


You cannot achieve this with a standard history-graph card.
It can only be fixed by changing a code of the frontend component itself.
And a necessity of this change is questionable.

I didn’t expect that this is related to the history-graph card itself. I thought the value gets somehow published again as soon as the sensor is online/available again. I hoped that I just missed a Retain flag setting somewhere (or something similar in the config).

Create a template sensor with “availability” and set it to “false” to make the sensor “unavailable”, then make it available again - then see how it looks in history-graph.