-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add base_device_url and corresponding tests on Device model #661
base: main
Are you sure you want to change the base?
Conversation
@iMicknl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's wait for a 2nd approver, and then we will merge + release.
I don't see the pro of such property. It will be confusing too have a device url and a base url. From the name, the diff is not obvious. |
@tetienne This is the name currently used in HomeAssistant (as well as in HA-Tahoma) |
@tetienne Regarding why we need it, please see the linked PR for Home Assistant |
Hi @tetienne did you have time to read my replies? |
I have a suggestion related to the various addition we did on the Device model. class DeviceUrl:
def __init__(device_url: str):
self.device_url = device_url
self.base = ...
self.index = ... It will move the boilerplate, and ease the logic. Of course, we should declare it as a breaking change. In the client code: device.url.full
device.url.base
device.url.index |
@tetienne makes sense to me, but will it be worth all the rewriting? Anyway, if accepted, we should have on this DeviceUrl :
@iMicknl what do you think? |
IMO there is too many properties now within Device and we don’t match anymore what’s returned by Overkiz. While previously I suggested to change the type of device_url, it will introduce a breaking change. To avoid this, we can create a DeviceUrlParser class: class DeviceUrlParser:
def __init__(device_url: str):
self.device_url = device_url
self.base = ...
self.index = ...
self.protocol = ...
self.gateway = ...
... So in the client code, you retrieve the device_url, and then instantiate a DeviceUrlParser. We keep the model close from Overkiz, and we introduce an utility class. |
It will still be a breaking change, as you're removing properties that was there before. |
We can do this in two release. First the new class then the remove. |
@nyroDev sorry for the long due merge/review. Can you perhaps rebase on main and see if CI/CD works again? I will have a look at this PR again. If it doesn't have any breaking changes, I am fine with it. |
Done. |
After starting the implementation on HA component, I figured out that we where missing the base_device_url.
We could recreate it there, but I think it's better to have always available on the device info.