JoDehli / PyLoxone

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

Add reload functionality without HA restart #223

Closed ztamas83 closed 4 months ago

ztamas83 commented 5 months ago

Adding reload functionality, tested locally so far towards a Gen1 Miniserver

JoDehli commented 5 months ago

@ztamas83 pyloxone does never recover from a connection lost. For this I already started a complete rewrite of pyloxone but I never finished it because of the missing time.

I think the best way to solve the problem would be to find the reason for the connection lost. Did you make a update or a restart of loxone. If you make a change on the loxone config the miniserver makes a restart and sometimes pyloxone can not be reconnect.

ztamas83 commented 5 months ago

@ztamas83 pyloxone does never recover from a connection lost. For this I already started a complete rewrite of pyloxone but I never finished it because of the missing time.

I think the best way to solve the problem would be to find the reason for the connection lost. Did you make a update or a restart of loxone. If you make a change on the loxone config the miniserver makes a restart and sometimes pyloxone can not be reconnect.

This reload functionality is actually independent of the problem I'm facing, I just felt it's a good addition to be able to reload the integration without restarting HA. We can continue the conversation about the problem in the #221

JoDehli commented 5 months ago

@ztamas83 I tried you pull request but I got an error. grafik

I tried to replace the cancel_listeners() method with cancel_hass_listeners() but it does not work.

I tried it myself a few years ago to implement a reload functionality but I could not implement it. This is also why I completely started from scratch. May I can continue to work on this implementation over the Christmas Holidays.

ztamas83 commented 5 months ago

It may be my mistake that I checked in wrong, cause it works for me. I did the change on the run directly in the HA editor and could copy wrong. Let me check

ztamas83 commented 5 months ago

@ztamas83 I tried you pull request but I got an error. grafik

I tried to replace the cancel_listeners() method with cancel_hass_listeners() but it does not work.

I tried it myself a few years ago to implement a reload functionality but I could not implement it. This is also why I completely started from scratch. May I can continue to work on this implementation over the Christmas Holidays.

Should be fixed now. If you plan to rewrite and need some help with specific parts let me know, I can for sure spend some time with some coding. But maybe it's enough to break out the WS layer and rewrite that so it can reconnect when needed?

JoDehli commented 5 months ago

@ztamas83 It is still not working.

grafik

It is reloading but after the reload I can not control any entity.

ztamas83 commented 5 months ago

@ztamas83 It is still not working.

grafik

It is reloading but after the reload I can not control any entity.

It's something with the events, the HA is not really listening to the responses. I will check it. Honestly I had it working but must have missed something crucial when moving the code between windows.

JoDehli commented 5 months ago

@ztamas83 I think it would make more sense if we could work on the new implementation together than improving the old code. Maybe I can show you what I have done so far and what I would to improve.

ztamas83 commented 5 months ago

@ztamas83 I think it would make more sense if we could work on the new implementation together than improving the old code. Maybe I can show you what I have done so far and what I would to improve.

Sounds like a good plan. I hoped for a quick reload functionality to fix my problems and then everyone could benefit from it. But obviously if it gets too complicated it doesn't make sense to spend time on it.