soloam/ha-pid-controller

Output artifacts when input value becomes unavailable

lukepighetti opened this issue · 7 comments

If an input value becomes unavailable, ha-pid-controller defaults to 100% output. It would be nice to either handle this in ha-pid-controller or provide documentation for how to filter these values

Screen Shot 2022-10-18 at 12 19 27 PM

Screen Shot 2022-10-18 at 12 19 47 PM

You can filter all the values with templates! All the fields can handle templating. You could do this, but I agree that the controller should handle this.

Tks

How would one do that with a template? Is there some way to use previous?

You could turn off the pid if the variable of the input is unavailable.

But I agree that the pid should handle this! I'll put it on my to-do list.

This really throws a wrench in things. Would be nice to put together some docs real quick to address this.
IMG_E9C56D23D07A-1

Something that might help other folks, if you're using ESPHome, you can filter out nan values like so. Will have to wait to see if it resolves the issue for me

esphome:
  name: woodstove

# ...

sensor:
  - platform: max6675
    # ...
    filters:
      filter_out: nan

Did a little digging around

select state_id, entity_id, state, last_updated from states where entity_id = "sensor.woodstove_flue_temperature" and last_updated < "2022-10-19 00:18:30" order by last_updated desc limit 5;
3319880|sensor.woodstove_flue_temperature|221.0|2022-10-19 00:18:28.240829
3319874|sensor.woodstove_flue_temperature|220.6|2022-10-19 00:18:26.231467
3319796|sensor.woodstove_flue_temperature|222.8|2022-10-19 00:18:26.185954
3319709|sensor.woodstove_flue_temperature|unavailable|2022-10-19 00:18:25.030334
3319683|sensor.woodstove_flue_temperature|222.8|2022-10-19 00:17:18.227644

Screen Shot 2022-10-18 at 8 46 17 PM

Looks like that gap is when state is unavailable. This appears to be happening downstream of my ESP8266 sensor. I'm not sure how I could filter these values out before they go into ha-pid-controller

In the process of trying this out

  - platform: template
    sensors:
      woodstove_flue_temperature_filtered:
        friendly_name: "Woodstove Flue Temperature Filtered"
        unit_of_measurement: "°F"
        value_template: >
          {% if states('sensor.woodstove_flue_temperature') in ['unavailable', 'unknown', 'none'] %}
            {{ states('sensor.woodstove_flue_temperature_filtered') }}
          {% else %}
            {{ states('sensor.woodstove_flue_temperature') }}
            {% endif %}