JoDehli / PyLoxone

Python Loxone binding
Apache License 2.0
162 stars 40 forks source link

[Bug]: Entities not updated after connection to Miniserver is dropped #224

Closed zamojski closed 4 months ago

zamojski commented 4 months ago

Describe the bug

During power outage if connection to Miniserver gets broken / lost (in my case it was a switch in between) entities from pyLoxone won't get updates anymore. I tried reloading integration but it doesn't help. The only thing thats brings updates back from Loxone to HA is to restart HA which is not convenient. Especially taking into consideration that heating valves and pumps are controlled by Loxone while heater itself is managed by HA over MQTT. Is there any chance to fix the connection and avoid restart?

Firmware of your Miniserver

Miniserver gen 2 14.1.5.9

HomeAssistant install method

Hassio on Raspberry Pi 4

Version of HomeAssistant

Core 2023.12.3 Supervisor 2023.12.0 Operating System 11.2

Version of Pyloxone

0.4.12

Update pyloxone

Yes, I'm on latest version from HACS.

Log

.

JoDehli commented 4 months ago

@zamojski this is not a bug. Homeassistant must restart after it loses the connection. This is how it is implemented. Reloading is on my list but as I have not time at the moment I can not implement it. Sorry.

zamojski commented 4 months ago

Is there any chance this get implemented in the next couple of months?

JoDehli commented 4 months ago

@zamojski I can not guarantee that this will happend. I do not have any connections lost in years. How long does the connection lost last? How many minutes or hours?

But you can try to implement it without pyloxone. There is a loxone integration for nodered. You can try this one maybe the reconnect is implemented better.

JoDehli commented 4 months ago

@zamojski there is a reconnect timeout pyloxone. Maybe we can increase these values for you if you can make an assumption about how long the connection lost last.

zamojski commented 4 months ago

I had recently partial power loss in my area - 1 of 3 phases were missing for 11 hours. Unfortunately it's the one powering Loxone and the battery doesn't last that long. Home Assistant running pyLoxone is on other phase and was running fine all the time. But once power on 3rd phase was back HA didn't reconnect to Loxone and entities stayed in their last state until I've restarted Loxone. And because power was back in the middle of the night my heater didn't start for another 6 hours because it didn't know that heating is required.

JoDehli commented 4 months ago

@zamojski can you not control the heater directly from loxone. Loxone is a very reliable piece of hardware. Of course if you do not have power it cannot work. But after the outage the loxone should come up and do its job.

zamojski commented 4 months ago

Theoretically yes but with MQTT which is not available directly in Loxone :⁠-⁠( So I have it integrated with HA, not very convenient though. Especially that I need to control when to stop the heater because even if I lose temperature info from Loxone it will run infinitely. My long term goal is to somehow avoid this extra step over many systems but I'm not experienced in programming Loxone.

JoDehli commented 4 months ago

@zamojski I would use nodered for this case. You could pass the values from mqtt direct via virtual inputs and outputs from nodered with mqtt to the loxone. This ist ultra stable. It would immediately work again if the loxone comes back to live after an outage.

JoDehli commented 4 months ago

@zamojski of course the reconnect and reload should also be implemented in pyloxone. But I program the whole day at work and if I come home I do not have enough time to program again. I try to keep the integration updated with new homeassistant versions.