diyless / home-assistant-opentherm-thermostat

Home Assistant OpenTherm Thermostat
https://diyless.com/blog/home-assistant-opentherm-thermostat
MIT License
59 stars 17 forks source link

Fix temperature measurement #3

Closed dannyverp closed 1 year ago

dannyverp commented 2 years ago

The temperature was no longer read from the onboard temperature sensor. I reinstated it inside the successful OpenTherm call.

closes #4

peterselie018 commented 2 years ago

There is stil a problem with the temperature sensor. It shows 15 deg, even with the fix added too the arduino sketch. The last working sketch is from feb2021.

aamorin commented 2 years ago

I think the temp reading should be done outside that IF sentence.. that way t_last also gets updated properly, but also the right value gets published and logged.

Since we are at it, I believe the same getTemp() function should be used during setup , but also, lastTempSet needs to be initialised to millis() instead (and before calling getTemp), otherwise it will start with a weird value, making this result instantly bigger than extTempTimeout_ms .. I've been debugging this and with the changes I mention here, it worked flawlessly for me.

So, during setup, instead of this:

  t, t_last = sensors.getTempCByIndex(0);
  ts = millis();
  lastTempSet = -extTempTimeout_ms;

I'm using this:

  ts, lastTempSet = millis();
  t, t_last = getTemp();

And for updateData(), I've added the t = getTemp(); right after the sensors.requestTemperatures() (although I'm still thinking if it shouldn't be at the beginning)..

JazekerXX commented 9 months ago

t = getTemp(); was the missing part for me too, but i needed to place it outside the if statement since i was testing it without a opentherm boiler/heatpump.

so instead placing it at line 112, place it at line 125