StefanIacobLivisi / aiolivisi

Apache License 2.0
2 stars 6 forks source link

Support for pydantic v2 using v1 shims #12

Open joostlek opened 1 year ago

joostlek commented 1 year ago

See https://github.com/home-assistant/core/issues/99218.

If possible, please give it a test.

planbnet commented 1 year ago

I don't think this is required because not version specific methods are used. If it was, BaseClass in livisi_event should also be changed. Besides that, it's unneccessary to use pydantic just for JSON parsing at all - the whole dependency could be dropped (like here: https://github.com/planbnet/livisi_unofficial/blob/main/custom_components/livisi/websocket.py).

But the reason why I'm writing this comment is this: https://github.com/StefanIacobLivisi/aiolivisi/issues/13

joostlek commented 1 year ago

2 things here.

  1. We should migrate away in a fair amount of time. So maybe we can just try reaching livisi and maybe they respond, maybe they don't. If they don't respond and we've given them enough time I think it's fair to use a new approach in the integration.
  2. All logic that is used to connect to an external device or service has to be in a separate lib. Although your custom component might work, it also couldn't be merged in HA as is.

Let me know if you need help with this migration, I'd be happy to help :)

planbnet commented 1 year ago

I don't think you will get a response from Livisi. They will stop all official support for the platform in March 2024 ( https://community.livisi.de/paq-en/ ) and it does not seem like they still have any official developers - at least @StefanIacobLivisi (the last man standing) does not respond anymore. But let's see...

My custom component is based on the official ha integration but implements support for much more devices and integrates the connection logic from this lib. As this is simply communication with a rest service and a websocket (< 400 loc) and it is only used in the hass integration, this is a totally useless abstraction which causes unneccessary conflicts (just like in this case with pydantic), I see why this rule exists in HASS, but it does not make sense in this case.

If this is a blocker for an official merge, I understand, but I'm fine with keeping my improvements as a custom component. It's just sad to see the official implementation rot away and people reporting errors that have been fixed in my branch for a long time.

joostlek commented 1 year ago

I can help you with some tricks to automate some stuff so you don't have a lot of maintenance on the library. But the problem at this point, it has to be migrated. So instead of making a fork ourselves and fixing the problem, I'd rather sit with you - the expert for these devices - to create a nice solution sustainable for the future.

After typing this, I reread your comment. So after march 2024 you can't control any device anymore?

planbnet commented 1 year ago

Hi, please don't get me wrong - I'm not an expert for these devices (well, maybe I am now :) ) - I'm just a home assistant user that has a bunch of livisi stuff at home and wants to keep it running.

After March 2024, you won't be able to use the official Livisi App and their official web services anymore. They shut down their servers and stop supporting the hardware. But fortunately, the hub and all devices are accessible in the local network, and the homeassistant integration will continue to work. That's why people are jumping on this integration just now and expect all their devices to be supported.

It's just that this library is unmaintained (and unneccessary in my view) so even if someone else would try to backport the additional supported devices from my custom integration to the official integration, they could not because they would also need to touch this lib.

joostlek commented 1 year ago

I don't own any, so any knowledge you have is already way more than I have, so I am seeing you as expert here ;)

It sounds like there will be a lot depending on the integration then. I can help you put the logic you have in your lib into a new lib, and then we replace the lib in HA and then we add the support for the additional devices. How does that sound? You can contact me on discord on @joostlek.

planbnet commented 1 year ago

I think I'm capable of creating my own lib, but why? There's no additional dependencies and the interface of the livisi controller will never change because officially it will cease to exist in 2024. The only domain knowledge in this lib is a few urls and how to send the http requests. If my implementation is bug free (which aiolivisi definitely is not) I may think about releasing it as a separate lib just to fulfill the hass requirement, but until then I prefer keeping it close to the integration code to be able to address bugs and improvements quickly.

joostlek commented 1 year ago

It's more that currently this lib (among others) is blocking other integrations of updating dependencies. And this will be a long process to make sure we are able to bump pydantic to v2.

So it's not something with an urgent priority, but please keep it in mind, and hearing your story about HA being the only way to use these devices, I would very much like to have it in core :)