HestiaPi / hestia-touch-openhab

OpenHAB2 files for HestiaPi Touch model
GNU General Public License v3.0
60 stars 17 forks source link

Humidity Control not updating LCD or Pin #31

Closed rkoshak closed 4 years ago

rkoshak commented 4 years ago

For EU/Generic systems, humidity control and hot water have the following same issue:

Web UI shows correctly the state as ON LCD UI shows incorrectly the state as OFF (icon stays white) Pin and relay is OFF

gulliverrr commented 4 years ago

Humidity was a typo. 75d87e6 fixes it. Hot water is not depending on a sensor value change so pin state still not getting updated on boot.

rkoshak commented 4 years ago

Hmmmm, that's off because I made that fix already. But if I understand correctly, that typo fixed the humidity, so only hot water is failing to update on boot but otherwise working correctly?

Can you post events.log between the times where openhab.log shows "Initializing settings" and "Initializing settings" plus a second (just in case).

I'm looking at the latest in ONE and some of my changes don't seem to be there. I'm wondering if I failed to do the merge correctly for the Things PR. In this case, the line that sets initializing to false needs to be moved before the for loop that turns off boost modes and there is a missing additional for loop that re sendCommands the Modes to force the devices to operate based on the current state instead of waiting for a sensor update.

I'll make a PR to restore those changes and fix anything else that seems to have been lost somehow.

rkoshak commented 4 years ago

OK, everything should be working now. At the end of initializing I just call the lambdas directly instead of trying to kick off the Mode rule or the sensor reading changed rule. This will work for everything and appears to work based on my tests.

gulliverrr commented 4 years ago

Can you post events.log between the times where openhab.log shows "Initializing settings" and "Initializing settings" plus a second (just in case).

events.log:

2020-02-18 12:10:42.641 [nt.ItemStatePredictedEvent] - MyHumiProxy predicted to become 36.6
2020-02-18 12:10:42.659 [vent.ItemStateChangedEvent] - MyHumiProxy changed from NULL to 36.6
2020-02-18 12:10:42.684 [ome.event.ItemCommandEvent] - Item 'SystemType' received command EU
2020-02-18 12:10:42.692 [nt.ItemStatePredictedEvent] - SystemType predicted to become EU
2020-02-18 12:10:42.826 [ome.event.ItemCommandEvent] - Item 'TempUnit' received command F
2020-02-18 12:10:42.834 [nt.ItemStatePredictedEvent] - TempUnit predicted to become F
2020-02-18 12:10:44.642 [vent.ItemStateChangedEvent] - MyHumi changed from 36.6 to 36.7
2020-02-18 12:10:54.821 [vent.ItemStateChangedEvent] - MyHumi changed from 36.7 to 36.8
2020-02-18 12:10:59.312 [ome.event.ItemCommandEvent] - Item 'MyHumiProxy' received command 36.8
2020-02-18 12:10:59.326 [ome.event.ItemCommandEvent] - Item 'HumidityType' received command Dehumidify
2020-02-18 12:10:59.349 [nt.ItemStatePredictedEvent] - MyHumiProxy predicted to become 36.8
2020-02-18 12:10:59.354 [nt.ItemStatePredictedEvent] - HumidityType predicted to become Dehumidify
2020-02-18 12:10:59.367 [vent.ItemStateChangedEvent] - MyHumiProxy changed from 36.6 to 36.8
2020-02-18 12:10:59.373 [ome.event.ItemCommandEvent] - Item 'MyHumiProxy' received command 36.8
2020-02-18 12:10:59.380 [nt.ItemStatePredictedEvent] - MyHumiProxy predicted to become 36.8
2020-02-18 12:10:59.408 [ome.event.ItemCommandEvent] - Item 'MainSwitch' received command ON
2020-02-18 12:10:59.656 [ome.event.ItemCommandEvent] - Item 'HeatingMode' received command ON
2020-02-18 12:10:59.693 [ome.event.ItemCommandEvent] - Item 'HotWaterMode' received command ON
2020-02-18 12:10:59.955 [ome.event.ItemCommandEvent] - Item 'HumidityMode' received command ON
2020-02-18 12:10:59.966 [ome.event.ItemCommandEvent] - Item 'Heating2' received command OFF
2020-02-18 12:10:59.981 [ome.event.ItemCommandEvent] - Item 'HumidityType' received command Dehumidify
2020-02-18 12:10:59.989 [nt.ItemStatePredictedEvent] - HumidityType predicted to become Dehumidify
2020-02-18 12:11:00.028 [ome.event.ItemCommandEvent] - Item 'TempSetpoint' received command 90
2020-02-18 12:11:00.060 [ome.event.ItemCommandEvent] - Item 'TempSetpointF' received command 90
2020-02-18 12:11:00.090 [ome.event.ItemCommandEvent] - Item 'HumiSetpoint' received command 25
2020-02-18 12:11:00.107 [ome.event.ItemCommandEvent] - Item 'HeatingBoostTime' received command 10
2020-02-18 12:11:00.129 [ome.event.ItemCommandEvent] - Item 'HotWaterBoostTime' received command 10
2020-02-18 12:11:00.184 [ome.event.ItemCommandEvent] - Item 'HumiBoostTime' received command 10
2020-02-18 12:11:00.191 [ome.event.ItemCommandEvent] - Item 'PreviousTempReading' received command 73
2020-02-18 12:11:00.215 [ome.event.ItemCommandEvent] - Item 'PreviousHumiReading' received command 37.0
2020-02-18 12:11:00.223 [ome.event.ItemCommandEvent] - Item 'Heating2Time' received command 3
2020-02-18 12:11:00.236 [ome.event.ItemCommandEvent] - Item 'Heating2Delta' received command 2
2020-02-18 12:11:00.422 [ome.event.ItemCommandEvent] - Item 'Network_WLAN_IP' received command 10.xx.xx.xx
2020-02-18 12:11:00.427 [nt.ItemStatePredictedEvent] - Network_WLAN_IP predicted to become 10.xx.xx.xx
2020-02-18 12:11:00.480 [ome.event.ItemCommandEvent] - Item 'Network_SSID' received command xxx
2020-02-18 12:11:00.497 [nt.ItemStatePredictedEvent] - Network_SSID predicted to become xxx
2020-02-18 12:11:00.598 [ome.event.ItemCommandEvent] - Item 'Network_WLAN_INFO' received command 92
2020-02-18 12:11:00.625 [nt.ItemStatePredictedEvent] - Network_WLAN_INFO predicted to become 92
2020-02-18 12:11:00.630 [vent.ItemStateChangedEvent] - Network_WLAN_INFO changed from 86 to 92
2020-02-18 12:11:00.667 [ome.event.ItemCommandEvent] - Item 'Network_WLAN_MAC' received command b8:27:eb:xx:xx:43
2020-02-18 12:11:00.684 [nt.ItemStatePredictedEvent] - Network_WLAN_MAC predicted to become b8:27:eb:xx:xx:43
2020-02-18 12:11:00.697 [vent.ItemStateChangedEvent] - Network_WLAN_MAC changed from NULL to b8:27:eb:xx:xx:43
2020-02-18 12:11:00.773 [ome.event.ItemCommandEvent] - Item 'System_CPU_TEMP' received command 122 °F
2020-02-18 12:11:00.788 [nt.ItemStatePredictedEvent] - System_CPU_TEMP predicted to become 122 °F
2020-02-18 12:11:01.859 [ome.event.ItemCommandEvent] - Item 'System_CPU_LOAD' received command 37
2020-02-18 12:11:01.866 [nt.ItemStatePredictedEvent] - System_CPU_LOAD predicted to become 37
2020-02-18 12:11:01.870 [vent.ItemStateChangedEvent] - System_CPU_LOAD changed from 49 to 37
2020-02-18 12:11:04.991 [vent.ItemStateChangedEvent] - MyHumi changed from 36.8 to 36.9
2020-02-18 12:11:19.044 [ome.event.ItemCommandEvent] - Item 'SystemType' received command EU
2020-02-18 12:11:19.049 [ome.event.ItemCommandEvent] - Item 'MyHumiProxy' received command 36.9
2020-02-18 12:11:19.060 [nt.ItemStatePredictedEvent] - SystemType predicted to become EU
2020-02-18 12:11:19.069 [nt.ItemStatePredictedEvent] - MyHumiProxy predicted to become 36.9
2020-02-18 12:11:19.082 [ome.event.ItemCommandEvent] - Item 'TempUnit' received command F
2020-02-18 12:11:19.085 [ome.event.ItemCommandEvent] - Item 'HumidityType' received command Dehumidify
2020-02-18 12:11:19.092 [vent.ItemStateChangedEvent] - MyHumiProxy changed from 36.8 to 36.9
2020-02-18 12:11:19.099 [nt.ItemStatePredictedEvent] - TempUnit predicted to become F
2020-02-18 12:11:19.105 [nt.ItemStatePredictedEvent] - HumidityType predicted to become Dehumidify
2020-02-18 12:11:19.126 [ome.event.ItemCommandEvent] - Item 'MainSwitch' received command ON
2020-02-18 12:11:19.145 [ome.event.ItemCommandEvent] - Item 'HeatingMode' received command ON
2020-02-18 12:11:19.164 [ome.event.ItemCommandEvent] - Item 'HotWaterMode' received command ON
2020-02-18 12:11:19.178 [ome.event.ItemCommandEvent] - Item 'HumidityMode' received command ON
2020-02-18 12:11:19.201 [ome.event.ItemCommandEvent] - Item 'Heating2' received command OFF
2020-02-18 12:11:19.232 [ome.event.ItemCommandEvent] - Item 'HumidityType' received command Dehumidify
2020-02-18 12:11:19.237 [nt.ItemStatePredictedEvent] - HumidityType predicted to become Dehumidify
2020-02-18 12:11:19.275 [ome.event.ItemCommandEvent] - Item 'TempSetpoint' received command 90
2020-02-18 12:11:19.306 [ome.event.ItemCommandEvent] - Item 'TempSetpointF' received command 90
2020-02-18 12:11:19.325 [ome.event.ItemCommandEvent] - Item 'HumiSetpoint' received command 25
2020-02-18 12:11:19.353 [ome.event.ItemCommandEvent] - Item 'HeatingBoostTime' received command 10
2020-02-18 12:11:19.368 [ome.event.ItemCommandEvent] - Item 'HotWaterBoostTime' received command 10
2020-02-18 12:11:19.379 [ome.event.ItemCommandEvent] - Item 'HumiBoostTime' received command 10
2020-02-18 12:11:19.406 [ome.event.ItemCommandEvent] - Item 'PreviousTempReading' received command 73
2020-02-18 12:11:19.413 [ome.event.ItemCommandEvent] - Item 'PreviousHumiReading' received command 37.0
2020-02-18 12:11:19.433 [ome.event.ItemCommandEvent] - Item 'Heating2Time' received command 3
2020-02-18 12:11:19.455 [ome.event.ItemCommandEvent] - Item 'Heating2Delta' received command 2
2020-02-18 12:11:19.503 [ome.event.ItemCommandEvent] - Item 'Network_WLAN_IP' received command 10.xx.xx.xx
2020-02-18 12:11:19.512 [nt.ItemStatePredictedEvent] - Network_WLAN_IP predicted to become 10.xx.xx.xx
2020-02-18 12:11:19.552 [ome.event.ItemCommandEvent] - Item 'Network_SSID' received command xxx
2020-02-18 12:11:19.559 [nt.ItemStatePredictedEvent] - Network_SSID predicted to become xxx
2020-02-18 12:11:19.609 [ome.event.ItemCommandEvent] - Item 'Network_WLAN_INFO' received command 90
2020-02-18 12:11:19.614 [nt.ItemStatePredictedEvent] - Network_WLAN_INFO predicted to become 90
2020-02-18 12:11:19.703 [vent.ItemStateChangedEvent] - Network_WLAN_INFO changed from 92 to 90
2020-02-18 12:11:19.745 [ome.event.ItemCommandEvent] - Item 'Network_WLAN_MAC' received command b8:27:eb:xx:xx:43
2020-02-18 12:11:19.750 [nt.ItemStatePredictedEvent] - Network_WLAN_MAC predicted to become b8:27:eb:xx:xx:43
2020-02-18 12:11:19.798 [ome.event.ItemCommandEvent] - Item 'System_CPU_TEMP' received command 122 °F
2020-02-18 12:11:19.802 [nt.ItemStatePredictedEvent] - System_CPU_TEMP predicted to become 122 °F
2020-02-18 12:11:20.859 [ome.event.ItemCommandEvent] - Item 'System_CPU_LOAD' received command 0
2020-02-18 12:11:20.865 [nt.ItemStatePredictedEvent] - System_CPU_LOAD predicted to become 0
2020-02-18 12:11:20.886 [vent.ItemStateChangedEvent] - System_CPU_LOAD changed from 37 to 0
2020-02-18 12:11:20.920 [ome.event.ItemCommandEvent] - Item 'System_Used_Space' received command 45 %
2020-02-18 12:11:20.928 [nt.ItemStatePredictedEvent] - System_Used_Space predicted to become 45 %
2020-02-18 12:11:21.018 [ome.event.ItemCommandEvent] - Item 'MyTempProxy' received command 73
2020-02-18 12:11:21.021 [nt.ItemStatePredictedEvent] - MyTempProxy predicted to become 73
2020-02-18 12:11:21.041 [ome.event.ItemCommandEvent] - Item 'PreviousTempReading' received command 0
2020-02-18 12:11:21.045 [vent.ItemStateChangedEvent] - MyTempProxy changed from NULL to 73
2020-02-18 12:11:21.048 [vent.ItemStateChangedEvent] - PreviousTempReading changed from 73 to 0
2020-02-18 12:11:21.065 [ome.event.ItemCommandEvent] - Item 'MyHumiProxy' received command 36.9
2020-02-18 12:11:21.070 [vent.ItemStateChangedEvent] - MyTempProxyF changed from NULL to 73
2020-02-18 12:11:21.078 [nt.ItemStatePredictedEvent] - MyHumiProxy predicted to become 36.9
2020-02-18 12:11:21.094 [ome.event.ItemCommandEvent] - Item 'PreviousHumiReading' received command 0
2020-02-18 12:11:21.098 [ome.event.ItemCommandEvent] - Item 'MyTempProxy' received command 73
2020-02-18 12:11:21.111 [nt.ItemStatePredictedEvent] - MyTempProxy predicted to become 73
2020-02-18 12:11:21.117 [ome.event.ItemCommandEvent] - Item 'HeatingPin' received command ON
2020-02-18 12:11:21.121 [vent.ItemStateChangedEvent] - PreviousHumiReading changed from 37.0 to 0
2020-02-18 12:11:21.139 [nt.ItemStatePredictedEvent] - HeatingPin predicted to become ON
2020-02-18 12:11:21.148 [vent.ItemStateChangedEvent] - HeatingPin changed from NULL to ON
2020-02-18 12:11:21.150 [ome.event.ItemCommandEvent] - Item 'HumidityPin' received command ON
2020-02-18 12:11:21.185 [nt.ItemStatePredictedEvent] - HumidityPin predicted to become ON
2020-02-18 12:11:21.190 [ome.event.ItemCommandEvent] - Item 'Pin23' received command ON
2020-02-18 12:11:21.194 [vent.ItemStateChangedEvent] - HumidityPin changed from NULL to ON
2020-02-18 12:11:21.207 [ome.event.ItemCommandEvent] - Item 'Pin18' received command ON
2020-02-18 12:11:21.213 [vent.ItemStateChangedEvent] - Pin23 changed from OFF to ON
2020-02-18 12:11:21.215 [vent.ItemStateChangedEvent] - Pin18 changed from OFF to ON

openhab.log

2020-02-18 12:10:42.601 [INFO ] [marthome.model.script.initialization] - Initializing settings
2020-02-18 12:11:01.474 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'default.rules'
2020-02-18 12:11:01.874 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Error during the execution of startup rule 'Initialization': null
2020-02-18 12:11:19.019 [INFO ] [marthome.model.script.initialization] - Initializing settings
2020-02-18 12:11:21.005 [INFO ] [marthome.model.script.initialization] - Sending 73 to MyTempProxy
2020-02-18 12:11:21.011 [INFO ] [marthome.model.script.initialization] - Sending 0 to PreviousTempReading
2020-02-18 12:11:21.037 [INFO ] [marthome.model.script.initialization] - Sending 36.9 to MyHumiProxy
2020-02-18 12:11:21.063 [INFO ] [marthome.model.script.initialization] - Sending 0 to PreviousHumiReading
2020-02-18 12:11:21.080 [INFO ] [smarthome.model.script.temp-setpoint] - Turning ON the heater
2020-02-18 12:11:21.085 [INFO ] [marthome.model.script.initialization] - Done initializing settings
2020-02-18 12:11:21.136 [INFO ] [smarthome.model.script.humi-setpoint] - Turning ON Dehumidify

Testing your commit now. Will update.

gulliverrr commented 4 years ago

@rkoshak 'sometimes' I get this error on boot: 2020-02-19 00:17:36.388 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Error during the execution of startup rule 'Initialization': Could not cast NULL to java.lang.Number; line 53, column 49, length 27 without updating the MyTempProxy I work on a Pi3 which may call of finish some rules faster than a Pi Zero... After some time, everything clears and is back to normal. Not sure if it's a sensor updating issue.

rkoshak commented 4 years ago

Line 53 is where I calculate the difference between the current temp and target temp. And indeed that line would throw an error if MyTemp or TempSetpoint are NULL. The timing is such that I'm not surprised MyTemp would be NULL on an RPi3.

But lines 50-52 is supposed to check for that case and return with a meaningful error (". That's the odd part. DOH! I forgot the return;. Can you confirm that you are seeing

"TempSetpoint == 21 and MyTempProxy == NULL"

in openHAB log right before that error message?

I also noticed that I'm missing a similar check for cooling and humidity.

I'm working on updating boost mode. I'll include the fixes in that PR. In the mean time, insert a return; after the logError on line 50 and this error should go away.

I would only expect to see that error on an RPi 3. On the zero, there is no chance that the Initialization rule will get to the end before the sensors start reporting which would explain why I've not see this.

gulliverrr commented 4 years ago

Can you confirm that you are seeing

"TempSetpoint == 21 and MyTempProxy == NULL"

in openHAB log right before that error message?

No, I don't.

2020-02-19 00:17:34.246 [INFO ] [marthome.model.script.initialization] - Initializing settings
2020-02-19 00:17:36.388 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Error during the execution of startup rule 'Initialization': Could not cast NULL to java.lang.Number; line 53, column 49, length 27
2020-02-19 00:18:11.068 [INFO ] [smarthome.model.script.temp-setpoint] - Turning ON the heater
2020-02-19 00:18:11.133 [INFO ] [smarthome.model.script.temp-setpoint] - Scheduling second stage heating to start in 0 minutes.
2020-02-19 00:18:11.423 [INFO ] [smarthome.model.script.temp-setpoint] - Turning on second stage heating

Does UnDefType catch NULL too?

rkoshak commented 4 years ago

Yes, UnDefType should catch both NULL and UNDEF. I'll change to do the longer and more explicit check for both NULL and UNDEF. Though that should work with instanceof UnDefType...

I've one more test to do for the boost mode changes and I'll submit a PR with these fixes along with that.

rkoshak commented 4 years ago

PR #33 includes the fixes for this.

gulliverrr commented 4 years ago

Testing and reporting back...

gulliverrr commented 4 years ago

Typo 48f74e7