Temporarily unavailable sensors and utility meters

Hello all,

I have 2 water meters.

Last night both meters were unavailable for 1 minute.
Cause unknown (network ?)
This has caused the utility meters to show incorrect values.
How can I prevent the utility meters from giving wrong values ​​if the sensor(s) fail?

Watersensor 1 minute unavailable.


Response daily utility meter.

Watersensor 1 minute unavailable.

sensor:

  - platform: rest 
    name: meter_a 
    json_attributes: 
    - waterflow
    - waterquantity 
    resource: http://192.168.0.101/water.html

  - platform: rest 
    name: meter_b
    json_attributes:
    - waterflow
    - waterquantity
    resource: http://192.168.0.100/water.html

template:

  - sensor: 
      name: "meter_a quantity" 
      state: "{{ ( state_attr('sensor.meter_a','waterquantity')|int) }}" 
      state_class: "measurement" 
      unit_of_measurement: "l" 
    
  - sensor: 
      name: "meter_b quantity" 
      state: "{{ ( state_attr('sensor.meter_b', 'waterquantity')|int ) }}"  
      state_class: "measurement" 
      unit_of_measurement: "l" 

utility_meter:

  daily_meter_a:
    source: sensor.meter_a_quantity
    cycle: daily
    name: daily meter_a

  daily_meter_b:
   source: sensor.meter_b_quantity
   cycle: daily
   name: daily meter_b

I understand that I can/should solve this with availability template.
Now to understand how this works…
:thinking:

What were the wrong values the utility meters were showing?

After the sensors were unavailable for about 1 minute, the utility meters apparently saw this as a 0 value?

When the sensors were available again, the difference between the current value and the 0 value was apparently calculated by the utility meters?

See images in the (edited) original post

Did you find a solution for this? I have the exact same problem trying to create a utility meter to measure the power usage of my electric car.