Closed mgabor3141 closed 1 year ago
Indeed it looks like it was just waiting for the first update from the sensor, it printed nan while the temperature was "stale". So no bug here, but maybe the logs should be updated to make this clearer.
Indeed it looks like it was just waiting for the first update from the sensor, it printed nan while the temperature was "stale". So no bug here, but maybe the logs should be updated to make this clearer.
I have some similar issue with a e-ink display, which has a correct temperature value but is printed on the display as nan. Even a static template sensor displays nan.
Can I open an issue and mention you? @gabormagyar
The solution to this is actually mentioned in the docs here:
Note: The sensor should have a short update interval. The PID update frequency is tied to the update interval of the sensor. Set a short update_interval like 5s on the sensor.
We recommend putting a filter on the sensor (see filters in Sensor Component) and using output_averaging_samples to calm the PID sensor from a noisy input sensor.
So in esphome I created a new template temperature sensor that mirrors the original sensor:
sensor:
- platform: homeassistant
id: living_room_temperature
entity_id: sensor.living_room_temperature
- platform: template
name: Living Room PID Temp
id: living_room_temperature_pid
unit_of_measurement: "°C"
device_class: "temperature"
state_class: "measurement"
lambda: !lambda return id(living_room_temperature).state;
update_interval: 5s
filters:
- exponential_moving_average:
alpha: 0.5
send_every: 1
If the original sensor allows filtering that works even better, the home assistant api sensor doesn't allow the filter options.
This way no NaN's happen, the auto-tuning got better values, and the heating logic itself is much more responsive (it always waits for the first fresh temperature update before it starts heating if you turn it on).
Still NaN's but since this is a different issue not related to autotune I'll open a new issue ok? I have a report from another user as well. @mgabor3141 Nevermind, it's solved. display: update_interval: 1 min
did the trick. So the display is rendered while the sensor has no value (yet). But is refreshed after 1 min with correct value.
To address your nan comment, I've added this INFO message when the autotuner is started:
Autotune has started. This can take a long time depending on the responsiveness of your system. Your system output will be altered to deliberately oscillate above and below the setpoint multiple times. Until your sensor provides a reading, the autotuner may display 'nan'
[11:38:11][D][switch:013]: 'PID Climate Autotune' Turning ON.
[11:38:11][I][pid.climate.console_fan_thermostat:158]: Autotune has started. This can take a long time depending on the responsiveness of your system. Your system output will be altered to deliberately oscillate above and below the setpoint multiple times. Until your sensor provides a reading, the autotuner may display 'nan'
[11:38:11][W][pid.climate.console_fan_thermostat:166]: !!! For PID autotuner you need to set AUTO (also called heat/cool) mode! Console Fan Thermostat
[11:38:11][D][pid.autotune.console_fan_thermostat:184]: PID Autotune:
[11:38:11][D][pid.autotune.console_fan_thermostat:185]: Autotune is still running!
[11:38:11][D][pid.autotune.console_fan_thermostat:186]: Status: Trying to reach nan °C
[11:38:11][D][pid.autotune.console_fan_thermostat:187]: Stats so far:
The problem
I'm seeing something strange in the logs of my PID autotune. The regular "still running" entries are printing
nan
:The sensor and climate entity output looks like this on the frontend:
Do I need to put the climate entity into HEAT mode? Is it waiting for the first new data point to be reported by the temperature sensor?
Which version of ESPHome has the issue?
2022.11.4
What type of installation are you using?
Home Assistant Add-on
Which version of Home Assistant has the issue?
2022.11.4
What platform are you using?
ESP8266
Board
Lolin D1 Mini
Component causing the issue
pid climate
Example YAML snippet