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 SIA Alarm systems #36625

Merged
merged 51 commits into from
May 24, 2021
Merged

Add SIA Alarm systems #36625

merged 51 commits into from
May 24, 2021

Conversation

eavanvalkenburg
Copy link
Contributor

@eavanvalkenburg eavanvalkenburg commented Jun 10, 2020

Proposed change

This PR introduces a integration for SIA DC-09 based alarm systems. The SIA protocol is a listen only protocol created by the Security Industry Association (SIA) to allow monitoring companies to listen to alarm systems, with HA that can be done locally on the network and allows you to use the HA ecosystem to act on events from your alarm. It was tested using a alarm system created by Ajax, the SIA specific logic is created in a pypi package, while this component listens to specific types of events and updates entities based on those.

For clarity, the SIA Protocol listens (creates a server) on a port, on each port there can be multiple alarm systems, which are called accounts, each account can have 1 or more zones. This first PR just creates a alarm_control_panel entity per account and zone (so if you setup with 1 account and 1 zone, then you get 1 entity, if you create one with 3 accounts and 2 zones each, you would end up with 6 alarm_control_panel entities. Once this is approved support for Moisture and Smoke binary_sensors will be added. This integration is already running for a number of people through HACS and therefore the additional sensors are expected soon, because of this there are some small things in the code that seem strange, such as having a list of platforms with one value. A user can create multiple instances listening on different ports, that is checked during the config flow.

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)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example entry for configuration.yaml:

# Example configuration.yaml
config flow only

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
  • 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.
  • Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 🥈 Silver
  • 🥇 Gold
  • 🏆 Platinum

@stale
Copy link

stale bot commented Jul 18, 2020

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.
Thank you for your contributions.

@stale stale bot added the stale label Jul 18, 2020
@miafoo
Copy link

miafoo commented Jul 18, 2020

I've been using this through HACS with great success and would love to see it as an official integration.

@stale stale bot removed the stale label Jul 18, 2020
homeassistant/components/sia/const.py Outdated Show resolved Hide resolved
homeassistant/components/sia/translations/en.json Outdated Show resolved Hide resolved
homeassistant/components/sia/strings.json Outdated Show resolved Hide resolved
homeassistant/components/sia/__init__.py Outdated Show resolved Hide resolved
homeassistant/components/sia/__init__.py Outdated Show resolved Hide resolved
homeassistant/components/sia/__init__.py Outdated Show resolved Hide resolved
homeassistant/components/sia/config_flow.py Outdated Show resolved Hide resolved
homeassistant/components/sia/config_flow.py Outdated Show resolved Hide resolved
homeassistant/components/sia/config_flow.py Outdated Show resolved Hide resolved
tests/components/sia/test_config_flow.py Outdated Show resolved Hide resolved
@eavanvalkenburg
Copy link
Contributor Author

Thanks for the review @OnFreund some good comments, I also need to rebase since it has been a while and have made updates to the HACS version that I have not done here yet, so will work on those this week!

homeassistant/components/sia/__init__.py Outdated Show resolved Hide resolved
homeassistant/components/sia/alarm_control_panel.py Outdated Show resolved Hide resolved
homeassistant/components/sia/config_flow.py Outdated Show resolved Hide resolved
homeassistant/components/sia/config_flow.py Outdated Show resolved Hide resolved
homeassistant/components/sia/config_flow.py Outdated Show resolved Hide resolved
homeassistant/components/sia/config_flow.py Outdated Show resolved Hide resolved
homeassistant/components/sia/hub.py Outdated Show resolved Hide resolved
homeassistant/components/sia/hub.py Outdated Show resolved Hide resolved
homeassistant/components/sia/hub.py Outdated Show resolved Hide resolved
homeassistant/components/sia/.translations/en.json Outdated Show resolved Hide resolved
homeassistant/components/sia/__init__.py Outdated Show resolved Hide resolved
homeassistant/components/sia/alarm_control_panel.py Outdated Show resolved Hide resolved
homeassistant/components/sia/config_flow.py Outdated Show resolved Hide resolved
homeassistant/components/sia/config_flow.py Outdated Show resolved Hide resolved
homeassistant/components/sia/config_flow.py Outdated Show resolved Hide resolved
homeassistant/components/sia/hub.py Outdated Show resolved Hide resolved
homeassistant/components/sia/alarm_control_panel.py Outdated Show resolved Hide resolved
homeassistant/components/sia/alarm_control_panel.py Outdated Show resolved Hide resolved
tests/components/sia/test_config_flow.py Outdated Show resolved Hide resolved
tests/components/sia/test_config_flow.py Outdated Show resolved Hide resolved
Copy link
Contributor

@OnFreund OnFreund left a comment

Choose a reason for hiding this comment

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

This mostly looks good to me, other than create Entity instances in the hub, but I'll defer to the core team on that

homeassistant/components/sia/config_flow.py Outdated Show resolved Hide resolved
@eavanvalkenburg
Copy link
Contributor Author

Thanks very much @OnFreund, took some effort but definitely made the code better!

@OnFreund
Copy link
Contributor

It seems like the binary sensor platform is back. Didn't you remove it?

@eavanvalkenburg
Copy link
Contributor Author

yeah, I thought I'd be a good citizen and do a rebase but something went wrong. Fixing now!

@janiversen
Copy link
Member

@bdraco approved and I looked too. Thanks.

@janiversen janiversen merged commit 0bba0f0 into home-assistant:dev May 24, 2021
Copy link
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

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

Please address the comments in a new PR. Thanks!

homeassistant/components/sia/utils.py Show resolved Hide resolved
homeassistant/components/sia/utils.py Show resolved Hide resolved
tests/components/sia/test_config_flow.py Show resolved Hide resolved
tests/components/sia/test_config_flow.py Show resolved Hide resolved
tests/components/sia/test_config_flow.py Show resolved Hide resolved
@janiversen
Copy link
Member

@eavanvalkenburg do you want help solving the new review comments ?

I did part of the old review, but did not catch the new comments.

@eavanvalkenburg
Copy link
Contributor Author

Yeah, I plan to work on this tomorrow

@janiversen
Copy link
Member

super that is the best way.

@eavanvalkenburg eavanvalkenburg deleted the sia branch May 26, 2021 06:13
@eavanvalkenburg eavanvalkenburg mentioned this pull request May 27, 2021
21 tasks
thomasgermain pushed a commit to thomasgermain/home-assistant that referenced this pull request Jun 10, 2021
* initial commit of SIA integration

* translations

* moved reactions to file, typed everything

* fixed no-else-return 3 times

* refactored config and fix coverage of test

* fix requirements_test

* elimated another platform

* forgot some mentions of sensor

* updated config flow steps, fixed restore and small edits

* fixed pylint

* updated config_flow with better schema, small fixes from review

* final comment and small legibility enhancements

* small fix for pylint

* fixed init

* fixes for botched rebase

* fixed port string

* updated common strings

* rebuild component with eventbus

* fixed pylint and tests

* updates based on review by @bdraco

* updates based on new version of package and reviews

* small updates with latest package

* added raise from

* deleted async_setup from test

* fixed tests

* removed unused code from addititional account step

* fixed typo in strings

* clarification and update to update_data func

* added iot_class to manifest

* fixed entity and unique id setup

* small fix in tests

* improved unique_id semantics and load/unload functions

* added typing in order to fix mypy

* further fixes for typing

* final fixes for mypy

* adding None return types

* fix hub DR identifier

* rebased, added DeviceInfo

* rewrite to clean up and make it easier to read

* replaced functions with format for id and name

* renamed tracker remover small fix in state.setter

* improved readibility of state.setter

* no more state.setter and small updates

* mypy fix

* fixed and improved config flow

* added fixtures to test and other cleaner test code

* removed timeband from config, will reintro in a options flow

* removed timeband from tests

* added options flow for zones and timestamps

* removed type ignore

* replaced mapping with collections.abc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants