Can't get generic thermostat to use filter sensor value

Hi all. I am trying to set up a generic thermostat using a filtered temperature sensor. The thermostat works fine if I configure it to use the sensor directly, but if I set target_sensor to a filter sensor, the value always shows as null. The filter sensor does show a good value on the History page. Can anyone see what I might be doing wrong in this config?

sensor:
        - platform: filter
          name: "Filtered Main Zone Temp"
          entity_id: sensor.living_room_temperature
          filters:
                  - filter: outlier
                    window_size: 10
                    radius: 3.0
                  - filter: lowpass
                    time_constant: 10
                    precision: 1

climate:
        - platform: generic_thermostat
          name: Main Zone
          heater: switch.main_heat_zone
          target_sensor: sensor.filtered_main_zone_temp
          target_temp: 63
          min_cycle_duration:
                  minutes: 1
          initial_hvac_mode: "heat"
          precision: 0.1
1 Like

add a unit of measurement to your filter sensor, i.e. ĀŗF or ĀŗC

Thanks. After your reply I tried adding a unit_of_measurement line to the filter sensor, but then configuration validation fails. I think it may already be picking that up from the source sensor anyway:

If it has a unit of measurement it should be wroking with your configuration. What does the sensor.living_room_temperature look like?

I donā€™t have a config snippet for that once since it was added by the ESPHome add-on, but hereā€™s what it looks like in Developer Tools:

It should be working then based on your config and that screenshot. Are there errors in your logs?

Just the one from trying to add a unit of measurement (which no longer happens after I removed that line):
2019-12-20 09:30:35 ERROR (MainThread) [homeassistant.components.hassio] Invalid config for [sensor.filter]: [unit_of_measurement] is an invalid option for [sensor.filter]. Check: sensor.filter->unit_of_measurement. (See ?, line ?). Please check the docs at https://home-assistant.io/integrations/filter/

Hereā€™s what the thermostat looks like when I set target_sensor to sensor.filtered_main_zone_temp:

If itā€™s null, you should be getting errors in your log

One would think. But if there are, they donā€™t show up under Developer Tools->Logs, or through ssh ā€œhassio homeassistant logsā€

Whatā€™s your logger setting? Info?

Yes, I tried debug but didnā€™t see anything relevant there either.

Odd, looking at the code then the only path without information is a path with a valid config and a number thatā€™s returned. Which doesnā€™t make sense because youā€™re getting null. I plan on making my own ESP temperature sensor but Itā€™ll be a bit before I get all the materials. Until then, I donā€™t think I can help you out. Sorry to waste your time.

Thanks for trying to help! Iā€™ll keep after it, maybe Iā€™m missing something.

If itā€™s not related to the unit_of_measurement, then it might be the scan interval. Itā€™s also possible that the filter doesnā€™t have a state at startup when the climate is ā€˜builtā€™.

Try moving the unit of measurement to the customize section instead of the sensor definition.

That worked! Thanks to you both.

1 Like

I am also hitting this (Home Assistant 0.114.4).

Moving unit_of_measurement to the customize section didnā€™t work:

homeassistant:
  customize:
    sensor.filtered_temperature:
      unit_of_measurement: Ā°C

I tried all sorts of things in config. Nothing worked.

But eventually I noticed that simply ā€œtouchingā€ a control on thermostat widget in Lovelace will trigger an update. (This is easily reproducible for me by setting current_temperature: null on the thermostat and refreshing the UI.)