Exception in Predheat resulted in missed charge for Predbat
Describe the bug Overnight (around 2:45) I appear to have had a network or HA wobble. Predbat tried to grab outdoor temp for predheat and caused an exception and then failed to continue until I restarted Predbat at half 8.
Expected behaviour Gracefully handle an exception
Predbat version
v8.16.5
Environment details
- HAOS
Screenshots
`2025-03-17 02:40:42.109469: Inverter 0 count register writes 0 2025-03-17 02:40:42.164198: Total inverter register writes now 4826 2025-03-17 02:40:42.212121: Completed run status Demand 2025-03-17 02:40:42.221601: Info: record_status Demand 2025-03-17 02:40:42.230272: Saved current settings to /addon_configs/6adb4f0d_predbat/predbat_config.json 2025-03-17 02:40:42.230378: Compare, best tariff: igo_fixed metric -80.6 2025-03-17 02:40:42.337975: Predheat: update at 2025-03-17 02:40:42.337926+00:00 2025-03-17 02:40:42.747622: Predheat: has 2 days of historical data 2025-03-17 02:40:42.747711: Predheat: Hysteresis On 0.5 off 1.5 heat loss 200 W heat loss 0.0149 W per degree 2025-03-17 02:40:42.747734: Predheat: Mode pump Heating active False Heat loss watts 200 degrees 0.0149 watts per degree 13422.818791946309 heating energy so far 0.04 volume temp 20.579 internal temp 19.592 external temp 6.7 2025-03-17 02:40:42.768659: Predheat: Todays energy import 0.04 kwh cost 0.97 p 2025-03-17 02:40:43.072670: Predheat: Completed run status idle 2025-03-17 02:44:57.530449: Warn: Web Socket closed, will try to reconnect in 5 seconds - error count 0 2025-03-17 02:45:00.485741: Error: HTTPConnectionPool(host='supervisor', port=80): Max retries exceeded with url: /core/api/states (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f256e069390>: Failed to establish a new connection: [Errno 111] Connection refused')) 2025-03-17 02:45:00.489717: Predheat: update at 2025-03-17 02:45:00.489627+00:00 2025-03-17 02:45:00.492065: ERROR: Exception raised HTTPConnectionPool(host='supervisor', port=80): Max retries exceeded with url: /core/api/history/period/2025-03-15T02:40:00+0000?filter_entity_id=sensor.espaltherma_outdoor_air_temperature&end_time=2025-03-17T02%3A40%3A00%2B0000 (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f256e0682b0>: Failed to establish a new connection: [Errno 111] Connection refused')) 2025-03-17 02:45:00.493964: Error: HTTPConnectionPool(host='supervisor', port=80): Max retries exceeded with url: /core/api/states/predbat.status (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f256e068640>: Failed to establish a new connection: [Errno 111] Connection refused')) 2025-03-17 02:45:02.534655: Info: Start socket for url http://supervisor/core/api/websocket 2025-03-17 02:45:10.014164: Error: Web Socket exception in startup: 400, message='Invalid response status', url=URL('http://supervisor/core/api/websocket') 2025-03-17 02:45:10.014635: Error: Traceback (most recent call last): File "/config/ha.py", line 198, in socketLoop async with session.ws_connect(url) as websocket: File "/usr/local/lib/python3.10/dist-packages/aiohttp/client.py", line 1167, in aenter self._resp = await self._coro File "/usr/local/lib/python3.10/dist-packages/aiohttp/client.py", line 821, in _ws_connect raise WSServerHandshakeError( aiohttp.client_exceptions.WSServerHandshakeError: 400, message='Invalid response status', url=URL('http://supervisor/core/api/websocket')
2025-03-17 02:45:10.014993: Warn: Web Socket closed, will try to reconnect in 5 seconds - error count 1 2025-03-17 02:45:15.019669: Info: Start socket for url http://supervisor/core/api/websocket 2025-03-17 02:45:15.028054: Info: Web Socket active 2025-03-17 02:50:00.003642: Predheat: update at 2025-03-17 02:50:00.003539+00:00 2025-03-17 02:50:00.454854: Predheat: has 2 days of historical data 2025-03-17 02:50:00.454940: Predheat: Hysteresis On 0.5 off 1.5 heat loss 200 W heat loss 0.0149 W per degree 2025-03-17 02:50:00.454963: Predheat: Mode pump Heating active False Heat loss watts 200 degrees 0.0149 watts per degree 13422.818791946309 heating energy so far 0.04 volume temp 20.579 internal temp 19.592 external temp 6.7 2025-03-17 02:50:00.475176: Predheat: Todays energy import 0.04 kwh cost 0.98 p 2025-03-17 02:50:00.742027: Predheat: Completed run status idle 2025-03-17 02:55:00.263664: Predheat: update at 2025-03-17 02:55:00.263550+00:00 2025-03-17 02:55:00.686561: Predheat: has 2 days of historical data 2025-03-17 02:55:00.686643: Predheat: Hysteresis On 0.5 off 1.5 heat loss 200 W heat loss 0.0149 W per degree 2025-03-17 02:55:00.686666: Predheat: Mode pump Heating active False Heat loss watts 200 degrees 0.0149 watts per degree 13422.818791946309 heating energy so far 0.04 volume temp 20.579 internal temp 19.592 external temp 6.7 2025-03-17 02:55:00.706662: Predheat: Todays energy import 0.04 kwh cost 0.98 p 2025-03-17 02:55:01.022842: Predheat: Completed run status idle 2025-03-17 03:00:00.521693: Predheat: update at 2025-03-17 03:00:00.521600+00:00 2025-03-17 03:00:00.933851: Predheat: has 2 days of historical data 2025-03-17 03:00:00.933937: Predheat: Hysteresis On 0.5 off 1.5 heat loss 200 W heat loss 0.0149 W per degree 2025-03-17 03:00:00.933960: Predheat: Mode pump Heating active False Heat loss watts 200 degrees 0.0149 watts per degree 13422.818791946309 heating energy so far 0.04 volume temp 20.579 internal temp 19.592 external temp 6.7 2025-03-17 03:00:00.952593: Predheat: Todays energy import 0.04 kwh cost 0.98 p 2025-03-17 03:00:01.251714: Predheat: Completed run status idle 2025-03-17 03:05:00.733670: Predheat: update at 2025-03-17 03:05:00.733496+00:00 2025-03-17 03:05:01.156683: Predheat: has 2 days of historical data 2025-03-17 03:05:01.156769: Predheat: Hysteresis On 0.5 off 1.5 heat loss 200 W heat loss 0.0149 W per degree 2025-03-17 03:05:01.156791: Predheat: Mode pump Heating active False Heat loss watts 200 degrees 0.0149 watts per degree 13422.818791946309 heating energy so far 0.04 volume temp 20.579 internal temp 19.592 external temp 6.7 2025-03-17 03:05:01.176368: Predheat: Todays energy import 0.04 kwh cost 0.98 p 2025-03-17 03:05:01.499815: Predheat: Completed run status idle`
have you got the auto health check automations installed ? The predbat one should detect if predbat stops running for any reason
https://springfall2008.github.io/batpred/output-data/#automated-monitoring-that-predbat-and-givtcp-are-running-ok
I haven't no, but will give it a go to help catch it in future runs.
My predbat.status was sat in "Demand" the whole time, although I can't say what the last_updated attribute value was. I'm hoping the last_updated would be what helps catch it.
Odd as the log appears to show it running
It was as if the predheat portion was working, but predbat thread had stopped