Skip to content
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 gateways to Device Registry #333

Merged
merged 19 commits into from
Jan 31, 2021
Merged

Add gateways to Device Registry #333

merged 19 commits into from
Jan 31, 2021

Conversation

iMicknl
Copy link
Owner

@iMicknl iMicknl commented Jan 12, 2021

First try to add gateways to the device registry as well. I saw you did do this for the Somfy integration, @tetienne. Any specific reason for it? (or just cosmetic).

Screen Shot 2021-01-12 at 20 58 07

Screen Shot 2021-01-12 at 21 00 35

@tetienne
Copy link
Collaborator

Yes it was just cosmetic. For the moment it's just an useless device 😅
Perhaps later, Core team will use it for something.

Copy link
Collaborator

@tetienne tetienne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have to add a via_hub attribute to the device info too.

@iMicknl
Copy link
Owner Author

iMicknl commented Jan 12, 2021

You have to add a via_hub attribute to the device info too.

Thanks, I was just looking into this. But I can not seem to find a relation between the hub and the devices via the TaHoma API...

Another thought (for a new PR) is to add sensors to the hub, for example reflecting updateStatus / upToDate and connectivity -> status.

@tetienne
Copy link
Collaborator

Perhaps because there is no need for them to return a parent id. We can assume that for each device in the response the parent is the only hub available.

@vlebourl
Copy link
Collaborator

is it really necessary? isn't it cluttering the UI with useless info?

@iMicknl
Copy link
Owner Author

iMicknl commented Jan 13, 2021

is it really necessary? isn't it cluttering the UI with useless info?

You won't see it much in the UI, but it will allow us to also detect if we already have the integration configured for autodiscover. Autodiscover is able to receive the ID of the gateway, via the hostname.

vlebourl
vlebourl previously approved these changes Jan 13, 2021
@iMicknl
Copy link
Owner Author

iMicknl commented Jan 14, 2021

You have to add a via_hub attribute to the device info too.

Done! However, I don't see any mention of it in the interface, is this property still required?

@iMicknl iMicknl force-pushed the feature/add_gateway branch from 32ca9af to 7661d2c Compare January 14, 2021 21:35
@iMicknl
Copy link
Owner Author

iMicknl commented Jan 14, 2021

You have to add a via_hub attribute to the device info too.

Done! However, I don't see any mention of it in the interface, is this property still required?

Apparently it is via_device, instead of via_hub. @tetienne, you have something to change for Somfy as well :D
https://developers.home-assistant.io/docs/device_registry_index/#what-is-a-device

@tetienne
Copy link
Collaborator

Seriously? Why nobody told me that's was wrong?!

@iMicknl
Copy link
Owner Author

iMicknl commented Jan 15, 2021

Screen Shot 2021-01-15 at 17 06 13

Screen Shot 2021-01-15 at 17 05 58

Tested with TaHoma hub and Connexoon Australia! This PR is ready to be merged I believe :)

vlebourl
vlebourl previously approved these changes Jan 15, 2021
custom_components/tahoma/manifest.json Outdated Show resolved Hide resolved
requirements.test.txt Outdated Show resolved Hide resolved
@iMicknl
Copy link
Owner Author

iMicknl commented Jan 15, 2021

@Pol2Tls, @browetd; could you give this branch a try? I would like to understand if it works with Cozytouch as well.

https://github.com/iMicknl/ha-tahoma/archive/feature/add_gateway.zip

@browetd
Copy link

browetd commented Jan 15, 2021

@iMicknl How should we install this "add_gateway.zip" ? What I did, I uninstalled the previous integration, I copied the tahoma directory to custom components, restarted HA, redefined the user/password for cozytouch... but for me nothing changed versus previous version... I will try again tomorrow ...

UPDATE SATURDAY MORNING:
@iMicknl I tried again this morning but still 12 equipements and 31 entities... No climate entity... But the bridge is not on the same Lan than my raspberry pi (it will be in a couple of months), I do not know if this is important or not for the test...

Log file:

2021-01-16 10:10:32 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.

2021-01-16 10:10:32 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for tahoma which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.

2021-01-16 10:10:32 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for argon40 which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.

2021-01-16 10:10:32 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for auto_backup which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.

2021-01-16 10:10:39 DEBUG (MainThread) [custom_components.tahoma.coordinator] Initialized DataUpdateCoordinator with 0:00:30 interval.

2021-01-16 10:10:39 DEBUG (MainThread) [custom_components.tahoma] Finished fetching TaHoma Event Fetcher data in 0.020 seconds

2021-01-16 10:10:39 DEBUG (MainThread) [custom_components.tahoma] Unsupported TaHoma device detected (io:AtlanticElectricalHeaterWithAdjustableTemperatureSetpointIOComponent - HeatingSystem - AtlanticElectricalHeaterWithAdjustableTemperatureSetpoint - io://0806-0588-9588/12338497#1)

2021-01-16 10:10:39 DEBUG (MainThread) [custom_components.tahoma] Added TaHoma device (io:TemperatureInCelciusIOSystemDeviceSensor - TemperatureSensor - TemperatureSensor - io://0806-0588-9588/12338497#2)

2021-01-16 10:10:39 DEBUG (MainThread) [custom_components.tahoma] Added TaHoma device (io:ContactIOSystemDeviceSensor - ContactSensor - ContactSensor - io://0806-0588-9588/12338497#3)

2021-01-16 10:10:39 DEBUG (MainThread) [custom_components.tahoma] Added TaHoma device (io:OccupancyIOSystemDeviceSensor - OccupancySensor - OccupancySensor - io://0806-0588-9588/12338497#4)

2021-01-16 10:10:39 DEBUG (MainThread) [custom_components.tahoma] Added TaHoma device (io:CumulatedElectricalEnergyConsumptionIOSystemDeviceSensor - ElectricitySensor - CumulativeElectricPowerConsumptionSensor - io://0806-0588-9588/12338497#5)

2021-01-16 10:10:39 DEBUG (MainThread) [custom_components.tahoma] Unsupported TaHoma device detected (io:AtlanticElectricalHeaterWithAdjustableTemperatureSetpointIOComponent - HeatingSystem - AtlanticElectricalHeaterWithAdjustableTemperatureSetpoint - io://0806-0588-9588/15461267#1)

2021-01-16 10:10:39 DEBUG (MainThread) [custom_components.tahoma] Added TaHoma device (io:TemperatureInCelciusIOSystemDeviceSensor - TemperatureSensor - TemperatureSensor - io://0806-0588-9588/15461267#2)

2021-01-16 10:10:39 DEBUG (MainThread) [custom_components.tahoma] Added TaHoma device (io:ContactIOSystemDeviceSensor - ContactSensor - ContactSensor - io://0806-0588-9588/15461267#3)

2021-01-16 10:10:39 DEBUG (MainThread) [custom_components.tahoma] Added TaHoma device (io:OccupancyIOSystemDeviceSensor - OccupancySensor - OccupancySensor - io://0806-0588-9588/15461267#4)

2021-01-16 10:10:39 DEBUG (MainThread) [custom_components.tahoma] Added TaHoma device (io:CumulatedElectricalEnergyConsumptionIOSystemDeviceSensor - ElectricitySensor - CumulativeElectricPowerConsumptionSensor - io://0806-0588-9588/15461267#5)

2021-01-16 10:10:39 DEBUG (MainThread) [custom_components.tahoma] Unsupported TaHoma device detected (io:AtlanticElectricalHeaterWithAdjustableTemperatureSetpointIOComponent - HeatingSystem - AtlanticElectricalHeaterWithAdjustableTemperatureSetpoint - io://0806-0588-9588/8228744#1)

2021-01-16 10:10:39 DEBUG (MainThread) [custom_components.tahoma] Added TaHoma device (io:TemperatureInCelciusIOSystemDeviceSensor - TemperatureSensor - TemperatureSensor - io://0806-0588-9588/8228744#2)

2021-01-16 10:10:39 DEBUG (MainThread) [custom_components.tahoma] Added TaHoma device (io:ContactIOSystemDeviceSensor - ContactSensor - ContactSensor - io://0806-0588-9588/8228744#3)

2021-01-16 10:10:39 DEBUG (MainThread) [custom_components.tahoma] Added TaHoma device (io:OccupancyIOSystemDeviceSensor - OccupancySensor - OccupancySensor - io://0806-0588-9588/8228744#4)

2021-01-16 10:10:39 DEBUG (MainThread) [custom_components.tahoma] Added TaHoma device (io:CumulatedElectricalEnergyConsumptionIOSystemDeviceSensor - ElectricitySensor - CumulativeElectricPowerConsumptionSensor - io://0806-0588-9588/8228744#5)

2021-01-16 10:11:09 DEBUG (MainThread) [custom_components.tahoma] Finished fetching TaHoma Event Fetcher data in 0.060 seconds

2021-01-16 10:11:39 DEBUG (MainThread) [custom_components.tahoma] Finished fetching TaHoma Event Fetcher data in 0.071 seconds

2021-01-16 10:12:09 DEBUG (MainThread) [custom_components.tahoma] Finished fetching TaHoma Event Fetcher data in 0.060 seconds

2021-01-16 10:12:39 DEBUG (MainThread) [custom_components.tahoma] Finished fetching TaHoma Event Fetcher data in 0.059 seconds

@iMicknl
Copy link
Owner Author

iMicknl commented Jan 18, 2021

@iMicknl I tried again this morning but still 12 equipements and 31 entities... No climate entity... But the bridge is not on the same Lan than my raspberry pi (it will be in a couple of months), I do not know if this is important or not for the test...

Thanks @browetd. This change was indeed not for the climate entity, hopefully we will be able to spend some time on that soon. Thanks for testing :).

Other news;

2021-01-15 17:50:54 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry [email protected] for tahoma
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 236, in async_setup
    result = await component.async_setup_entry(hass, self)  # type: ignore
  File "/config/custom_components/tahoma/__init__.py", line 206, in async_setup_entry
    beautify_name(gateway.sub_type.name) if gateway.sub_type else None
AttributeError: sub_type

For Cozytouch (without sub_type) I need to make a change in python-tahoma-api first, before merge.

@iMicknl iMicknl requested a review from vlebourl January 19, 2021 19:16

gateway_model = (
beautify_name(gateway.sub_type.name)
if isinstance(gateway.sub_type, Enum)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be something else than an Enum?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately it can be something else... (https://github.com/iMicknl/python-tahoma-api/blob/78587f4f9547b2621a1123817efb2f2a66f21d9b/pyhoma/models.py#L394-L402).

However, maybe we should address it there. And throw a None + warning that we don't have the value in Enum.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Pyhoma the code looks good. But here it sounds weird :S

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can also do this in beautify_name(), but I would prefer to just pass a string to that to keep is reusable.

@iMicknl iMicknl merged commit 2657d9f into master Jan 31, 2021
@iMicknl iMicknl deleted the feature/add_gateway branch January 31, 2021 21:23
iMicknl added a commit that referenced this pull request Jan 31, 2021
commit 2657d9f
Author: Mick Vleeshouwer <[email protected]>
Date:   Sun Jan 31 22:23:53 2021 +0100

    Add gateways to Device Registry (#333)

    Co-authored-by: Vincent Le Bourlot <[email protected]>

commit 323ac9d
Author: Mick Vleeshouwer <[email protected]>
Date:   Sun Jan 31 21:55:44 2021 +0100

    Update README to reflect support of other OverKiz hubs (#363)
iMicknl added a commit that referenced this pull request Jan 31, 2021
commit 2657d9f
Author: Mick Vleeshouwer <[email protected]>
Date:   Sun Jan 31 22:23:53 2021 +0100

    Add gateways to Device Registry (#333)

    Co-authored-by: Vincent Le Bourlot <[email protected]>

commit 323ac9d
Author: Mick Vleeshouwer <[email protected]>
Date:   Sun Jan 31 21:55:44 2021 +0100

    Update README to reflect support of other OverKiz hubs (#363)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants