-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
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 Rointe integration #83069
Add Rointe integration #83069
Conversation
50fe6fc
to
b73e3af
Compare
8043d3e
to
30e8cce
Compare
Thank you for the first look at this @bachya. It was indeed in a very rough state. I cleaned some of the issue and will ping you when I manage to clear the rest. This latest commit contains a reauth flow I've been working. It also contains a bunch of debug statements which I added to help another user setup this integration (it's currently available via HACS so I have a couple of people beta testing this). |
Per my previous comment, I would recommend that you do a reauth flow in a separate PR—this PR already has plenty in it. |
Will do. |
cf88d69
to
e8e09ee
Compare
@bachya I cleared up the issues. I changed No errors, everything appears OK in logs, both removing and adding again. Maybe |
@bachya I fixed the problem with unloading the integration. It was a stupid error where I was using a class variable to store my entities. I also updated the code to use Finally I removed some useless code from |
35594e7
to
5a3720b
Compare
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.
You're doing great—keep going!
f0098d1
to
e394f72
Compare
Hi @bachya, Are there any other tasks you want me to work to help with the review? |
fd36f0c
to
6639879
Compare
What are the test coverage targets for files other than |
Depends on your objective. Config flow tests are required; (almost) everything else is discretionary. More info: https://developers.home-assistant.io/docs/integration_quality_scale_index?_highlight=coverage#gold- |
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.
First pass for cleanups.
Please rebase after the cleanups.
b3ee8d2
to
7fba29c
Compare
8e7d96e
to
20936eb
Compare
e0b6f79
to
7a80011
Compare
|
||
async def async_step_installation( | ||
self, user_input: dict[str, Any] | None | ||
) -> FlowResult: |
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.
Okay so apparently 1 account can lead to more installations? Can you maybe elaborate on what an installation is? Usually we have the guideline that 1 (cloud) account = 1 config entry.
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.
Essentially it represents a house/home. It's part of their hierarchy: Installations -> Zones -> Devices.
During configuration the user must pick one installation (for the majority of cases there will only be one option available). The Installation ID is then stored as it is required to retrieve devices.
update_interval=ROINTE_API_REFRESH_INTERVAL, | ||
) | ||
|
||
self.unregistered_keys = {platform: {} for platform in PLATFORMS} |
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.
What's a key?
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.
In that context a "key" is the unique identifier of each device. It's determined by the manufacturer's API
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.
By the way, do you have discord? Can you maybe pop me a message? (@joostlek)
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.
self.unregistered_keys = {platform: {} for platform in PLATFORMS} |
self, user_input: dict[str, Any] | None = None | ||
) -> FlowResult: | ||
"""Select the installation.""" | ||
if not user_input or CONF_INSTALLATION not in user_input: |
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.
if not user_input or CONF_INSTALLATION not in user_input: | |
if not user_input: |
data_schema=vol.Schema( | ||
{ | ||
vol.Required(CONF_INSTALLATION): vol.In( | ||
self.step_user_installations |
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.
What will be fetched? Do we now only show a list of random numbers or can we also get a list of names with the installation id? This way it can be more user friendly since we can pass a name/value pair
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.
update_interval=ROINTE_API_REFRESH_INTERVAL, | ||
) | ||
|
||
self.unregistered_keys = {platform: {} for platform in PLATFORMS} |
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.
By the way, do you have discord? Can you maybe pop me a message? (@joostlek)
update_interval=ROINTE_API_REFRESH_INTERVAL, | ||
) | ||
|
||
self.unregistered_keys = {platform: {} for platform in PLATFORMS} |
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.
self.unregistered_keys = {platform: {} for platform in PLATFORMS} |
|
||
new_devices = await self.device_manager.update() | ||
|
||
for platform in PLATFORMS: | ||
self.unregistered_keys[platform].update( | ||
{ | ||
device_id: device | ||
for device_id, device in new_devices.items() | ||
if device_id not in self.unregistered_keys[platform] | ||
} | ||
) | ||
|
||
for device in new_devices.values(): | ||
device_update_info(self.hass, device) | ||
|
||
return new_devices |
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.
new_devices = await self.device_manager.update() | |
for platform in PLATFORMS: | |
self.unregistered_keys[platform].update( | |
{ | |
device_id: device | |
for device_id, device in new_devices.items() | |
if device_id not in self.unregistered_keys[platform] | |
} | |
) | |
for device in new_devices.values(): | |
device_update_info(self.hass, device) | |
return new_devices | |
return await self.device_manager.update() |
|
||
|
||
@callback | ||
def device_update_info(hass: HomeAssistant, rointe_device: RointeDevice) -> None: | ||
"""Update device registry info.""" | ||
|
||
LOGGER.debug("Updating device registry info for %s", rointe_device.name) | ||
|
||
dev_registry = dr.async_get(hass) | ||
|
||
if device := dev_registry.async_get_device( | ||
identifiers={(DOMAIN, rointe_device.id)}, | ||
): | ||
dev_registry.async_update_device( | ||
device.id, sw_version=rointe_device.firmware_version | ||
) |
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.
@callback | |
def device_update_info(hass: HomeAssistant, rointe_device: RointeDevice) -> None: | |
"""Update device registry info.""" | |
LOGGER.debug("Updating device registry info for %s", rointe_device.name) | |
dev_registry = dr.async_get(hass) | |
if device := dev_registry.async_get_device( | |
identifiers={(DOMAIN, rointe_device.id)}, | |
): | |
dev_registry.async_update_device( | |
device.id, sw_version=rointe_device.firmware_version | |
) |
There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days. |
Proposed change
This integration provides support for electrical radiators manufactured by Rointe. This is an initial implementation that supports some of Rointe's products:
Type of change
Additional information
The integration uses cloud polling via a REST API owned by Rointe. Config flow requires the user to login to the API and then select which particular installation they want to add to HA.
It's currently available via HACS on https://github.com/tggm/rointe-hacs/
Checklist
black --fast homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.To help with the load of incoming pull requests: