"Statistics sensor" from an "Filter sensor" don't work (unavailable)

Hi

I have an:

  1. Sonoff TH16 Temperature and Humidity sensor
  2. An Template sensor over last (1) for accuracy setting if needed
  3. An Filter sensor over last (2) for low/high pass

What I am wanting to do is have statistical sensors defined on the filter sensor (3) to be able to save the minimum/maximum/average values according to different time values.

The problem is that in the statistics, when using the filter sensor (3), I ALWAYS receive “unavailable”.

But if I use the template sensor (2) in the statistics, I immediately begin to have values and they adjust correctly.

My question is enlarged because I have correctly saved the history on the filter (3) since I can use the statistics card on that sensor in lovelace.

I have followed all the new settings defined in: Statistics - Home Assistant

Any idea if it can or am I doing something wrong? It’s Possible to do?

Thanks

Example:

(1)
sonoff:
   sensor: sonoff_123456789

(2)
template:
  - sensor:
     - name: humidity_th16
       unique_id: hum1
       device_class: humidity
       state_class: measurement
       unit_of_measurement: '%'
       state: >
          {{ (states('sensor.sonoff_123456789_humidity')|float(0)*0.98)|round(1) }}

sensor:
(3)
- platform: filter
  name: "FHum1"
  entity_id: sensor.hum1
  filters:
    - filter: lowpass
      time_constant: 20
      precision: 1
(4.a)  DON'T WORK
- platform: statistics
  name: "MAX FHum1 for 24 hours"
  entity_id: sensor.fhum1
  state_characteristic: value_max
  max_age:
    hours: 24
  sampling_size: 200
  precision: 1
(4.b)  WORK OK
- platform: statistics
  name: "MAX Hum1 for 24 hours"
  entity_id: sensor.hum1
  state_characteristic: value_max
  max_age:
    hours: 24
  sampling_size: 200
  precision: 1

Is sensor.fhum1 really the entity_id?
Look in Developer Tools / States

Yes

Exist and has values.

Is the filtered sensor.

The statistics sensor will only update when the input sensor changes. Has sensor.fhum1 changed value?

Yes
Pemanently.
Each time that root sonoff sensor change.

?

Which is it, a permanent value or a changing one?

The statistics sensor requires the monitored sensor to change, more than once. Or it cannot create an average/max/min.

Can you share the history graph of sensor.fhum1?

You asked me “Has sensor.fhum1 changed value?” and I answered “permanently
It means that the “sensor filter” (FHum1) changes as the temperature/humidity principal sensor reads new values.
This is not the problem, since as I said, so far the 3 sensors (principal, corrected and filtered) take correct values.
The problem comes when I select the “sensor filter” (FHum1) as entity for the statistics sensor.

I also leave you the variation image of FHum1 (sensor filter) using an statistics card in lovelace.
Thanks

FHum1

Hi Gabriel, did you ever get this to work?

No
Never. :frowning:

You should open an issue here if you want it to be fixed:

1 Like