Skip to content

Conversation

nasWebio
Copy link
Contributor

@nasWebio nasWebio commented Aug 9, 2023

Breaking change

Proposed change

Add integration for WEBIO controller.
WEBIO is a specialized microprocessor controller that integrates building automation, intrusion and access control systems.
Eventually device will include few different platforms: switch, sensor, alarm control panel, climate.
Initial PR is limited to implement only relay switches.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

To help with the load of incoming pull requests:

@home-assistant
Copy link

home-assistant bot commented Aug 9, 2023

Hello @nasWebio,

When attempting to inspect the commits of your pull request for CLA signature status among all authors we encountered commit(s) which were not linked to a GitHub account, thus not allowing us to determine their status(es).

The commits that are missing a linked GitHub account are the following:

Unfortunately, we are unable to accept this pull request until this situation is corrected.

Here are your options:

  1. If you had an email address set for the commit that simply wasn't linked to your GitHub account you can link that email now and it will retroactively apply to your commits. The simplest way to do this is to click the link to one of the above commits and look for a blue question mark in a blue circle in the top left. Hovering over that bubble will show you what email address you used. Clicking on that button will take you to your email address settings on GitHub. Just add the email address on that page and you're all set. GitHub has more information about this option in their help center.

  2. If you didn't use an email address at all, it was an invalid email, or it's one you can't link to your GitHub, you will need to change the authorship information of the commit and your global Git settings so this doesn't happen again going forward. GitHub provides some great instructions on how to change your authorship information in their help center.

    • If you only made a single commit you should be able to run
      git commit --amend --author="Author Name <email@address.com>"
      
      (substituting "Author Name" and "email@address.com" for your actual information) to set the authorship information.
    • If you made more than one commit and the commit with the missing authorship information is not the most recent one you have two options:
      1. You can re-create all commits missing authorship information. This is going to be the easiest solution for developers that aren't extremely confident in their Git and command line skills.
      2. You can use this script that GitHub provides to rewrite history. Please note: this should be used only if you are very confident in your abilities and understand its impacts.
    • Whichever method you choose, I will come by to re-check the pull request once you push the fixes to this branch.

We apologize for this inconvenience, especially since it usually bites new contributors to Home Assistant. We hope you understand the need for us to protect ourselves and the great community we all have built legally. The best thing to come out of this is that you only need to fix this once and it benefits the entire Home Assistant and GitHub community.

Thanks, I look forward to checking this PR again soon! ❤️

@home-assistant
Copy link

home-assistant bot commented Aug 9, 2023

Hi @nasWebio

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

Copy link

github-actions bot commented Dec 9, 2023

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.
If you are the author of this PR, please leave a comment if you want to keep it open. Also, please rebase your PR onto the latest dev branch to ensure that it's up to date with the latest changes.
Thank you for your contribution!

@github-actions github-actions bot added the stale label Dec 9, 2023
@nasWebio
Copy link
Contributor Author

Still waiting for the review

@github-actions github-actions bot removed the stale label Dec 11, 2023
@emontnemery emontnemery reopened this Dec 14, 2023
Copy link
Contributor

@emontnemery emontnemery left a comment

Choose a reason for hiding this comment

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

Some initial comments.

@emontnemery emontnemery reopened this Oct 15, 2024
@emontnemery
Copy link
Contributor

(Close + Open to run CI against the tip of dev)

@emontnemery emontnemery reopened this Oct 15, 2024
@emontnemery
Copy link
Contributor

I think the integration is in a good shape now @nasWebio 👍

One concern though: Integrations added to the Home Assistant core repo should be useful for residential users. Looking at your web page, I get the impression you're rather targeting commercial building automation?

@nasWebio
Copy link
Contributor Author

Thank you for your feedback! It's true that our current products are targeted mainly towards commercial building automation. However, we are actively developing a product for the residential market to expand our offering. Home Assistant integration is key to this, as we recognize its importance for homeowners and smart home enthusiasts.
This integration will help us reach residential users and ensure seamless automation for home environments.

@emontnemery
Copy link
Contributor

@nasWebio Thanks for confirming! Based on your response, I'd suggest to initially publish your integration as a custom integration installable via HACS. Once the product intended for residential use materializes, you're most welcome to open another PR to add your integration to Home Assistant Core.

@chomtech
Copy link

@nasWebio I think this is ready for merge soon 👍 There are some old unresolved review comments, can you please go through them and reply to them all? Please don't mark them as resolved yourself. If you need some help getting the PR across the finish line, you're most welcome to contact me on Discord, my username there is @emontnemery.

Hello, and thank you for taking the time to review our integration and share your insights. I truly appreciate your effort and attention to detail!
The nasWebio device is a home and SOHO version of the enterprise Webio system. It has been available for over a year, featuring embedded software for home burglary alarms, one-wire detectors, digital inputs, relay outputs, and some camera-event automation. We’ve already sold several hundred units, many of which use Tuya integration, so this is definitely a real product, not a concept.
I believe moving this to HACS wouldn't be necessary at this stage. Before we started the HA integration process, I had the chance to discuss our approach with Uwe from Nabu Casa. I shared my thoughts and vision for HA, which I’ve been using in my own home. As a result, I chose to shift focus from developing our own cloud solution to embracing the power and versatility of Home Assistant.
Once again, thank you for your support and for helping us refine this integration. If there are any additional comments or feedback, I’d be happy to address them.

@emontnemery
Copy link
Contributor

@chomtech thanks for the additional context, with that in mind I think it's OK to accept this integration as a core integration 👍

@emontnemery
Copy link
Contributor

The link to the product page in the documentation PR, https://autoidentyfikacja.pl/pl/p/NASweb/262, is not working. Is there another link?

@nasWebio
Copy link
Contributor Author

Link was outdated. Documentation is updated with correct link:
https://www.chomtech.pl/produkt/naswebio-multisystemowy-sterownik-automatyki-budynkowej/

Copy link
Contributor

@emontnemery emontnemery left a comment

Choose a reason for hiding this comment

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

I must have missed the lack of checks for serial number. We should store that as the config entry's unique ID.

_LOGGER.exception("Unexpected exception")
errors["base"] = "unknown"
else:
return self.async_create_entry(title=info["title"], data=user_input)
Copy link
Contributor

Choose a reason for hiding this comment

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

We should set the unique ID to the serial number of the device, and abort the flow if there's already a config entry for the same device. Documentation: https://developers.home-assistant.io/docs/config_entries_config_flow_handler#managing-unique-ids-in-config-flows

DATA_NASWEB: HassKey[NASwebData] = HassKey(DOMAIN)


async def async_setup_entry(hass: HomeAssistant, entry: NASwebConfigEntry) -> bool:
Copy link
Contributor

Choose a reason for hiding this comment

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

During setup, we should check that the serial number of the device we're connecting to is matching the stored serial number (the config entry's unique ID), in case the device's IP address has changed.

if unload_ok := await hass.config_entries.async_unload_platforms(entry, PLATFORMS):
nasweb_data = hass.data[DATA_NASWEB]
coordinator = entry.runtime_data
serial = coordinator.webio_api.get_serial_number()
Copy link
Contributor

Choose a reason for hiding this comment

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

Change to config entry's unique id

async_add_entities(entities_to_add)
entity_registry = er.async_get(hass)
for index in removed:
unique_id = f"{DOMAIN}.{coordinator.webio_api.get_serial_number()}.relay_switch.{index}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Change to config entry's unique id

@home-assistant home-assistant bot marked this pull request as draft October 23, 2024 17:49
@nasWebio nasWebio marked this pull request as ready for review October 24, 2024 12:42
@home-assistant home-assistant bot requested a review from emontnemery October 24, 2024 12:42
Copy link
Contributor

@emontnemery emontnemery left a comment

Choose a reason for hiding this comment

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

Please update config entry tests:

  • Assert the config entry's unique id is the serial number of the device
  • Add a test where we try to add the same device twice, the flow should be aborted

@home-assistant home-assistant bot marked this pull request as draft November 7, 2024 09:28
@nasWebio nasWebio marked this pull request as ready for review November 7, 2024 14:42
@home-assistant home-assistant bot requested a review from emontnemery November 7, 2024 14:42
Copy link
Contributor

@emontnemery emontnemery left a comment

Choose a reason for hiding this comment

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

One more remark

@home-assistant home-assistant bot marked this pull request as draft November 8, 2024 08:17
@nasWebio nasWebio marked this pull request as ready for review November 8, 2024 09:29
@home-assistant home-assistant bot requested a review from emontnemery November 8, 2024 09:29
Copy link
Contributor

@emontnemery emontnemery left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the patience with the review @nasWebio 👍

@emontnemery emontnemery merged commit ed1366f into home-assistant:dev Nov 8, 2024
42 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Nov 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants