Does "id(sensorname).state" respect the filters of "sensorname"?

I measure temperature and then calculate EC from that. If I apply a moving filter average to the temperature sensor and use id(sensorname).state in a lambda function to calculate temperature compensated voltage, willthe voltage be calculated using the result of the filtered sensor reading or the raw value?

I’m trying to smoothe out spiky readings and hope that the temperature compensated value is based on the filtered temperature value. I hope the wording makes sense.

Here is the code:
Thank you!

# Temperature In °C
  - platform: dallas
    name: "Water Temperature"
    id: waterds18
    address: 0xa709225351725c28
    accuracy_decimals: 3
      - sliding_window_moving_average:
          window_size: 15
          send_every: 1
          send_first_at: 1

# Temperature Compensated Voltage
  - platform: template
    name: "TDS 01 TCV"
    id: temp01_comp_v
    unit_of_measurement: 'v'
    accuracy_decimals: 3
    lambda: 'return ((id(tds01_raw).state) / (1 + (0.02 * ((id(waterds18).state) - 25.0))));'
    update_interval: never
    internal: true

Thanks! That makes sense. I was unable to google it or find it in the docs.

Yes, state represents the filtered value and raw_state the unfiltered value.


You’re welcome.

Must say that it’s not very clearly stated in the docs. It is mentioned in the backend code in GitHub.