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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config flow for ONVIF #34520

Merged
merged 7 commits into from May 1, 2020
Merged

Conversation

hunterjm
Copy link
Member

@hunterjm hunterjm commented Apr 22, 2020

Breaking change

The extra_arguments and rtsp_transport configuration from yaml is now a part of the Options flow for the integration, and is not automatically imported to the config flow with the rest of the defined ONVIF platforms.

Proposed change

Migrated the ONVIF integration to config flow and added the ability to automatically discover ONVIF devices on the network as a part of the user step. Also adds validation along the way to ensure successful configuration.

This is the first PR in a larger refactor that will move much of the API logic out of the camera platform and into an ONVIF device as well as add support for creating sensor entities based on ONVIF notifications.

I still need to add tests for the config flow and update the documentation, but wanted to get eyes on this to make sure I was heading in the right direction.

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

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

@Kane610
Copy link
Member

Kane610 commented Apr 22, 2020

When you get to sensors and events; I have written a small RTSP client for the Onvif metadata stream to use with Axis devices, which could be usable here

@hunterjm
Copy link
Member Author

All PR comments resolved & ready for another review as I start work on tests.

@hunterjm
Copy link
Member Author

Just rebased, to also encompass #34420 in this PR. I kind of squashed a few commits in the process because going through each patch was a PITA.

@MartinHjelmare MartinHjelmare moved this from Needs review to Incoming in Dev Apr 26, 2020
@hunterjm
Copy link
Member Author

hunterjm commented Apr 28, 2020

Tests are mostly done. There are a couple of edge cases I haven't covered yet. I want to refactor the entire component to make testing easier as well as add support for ONVIF events, so the test code isn't as clean as I would like it. I wanted to only cover the config flow this go around.

Edge case tests and doc updates incoming (tomorrow probably)

@hunterjm hunterjm changed the title [WIP] Config flow for ONVIF Config flow for ONVIF Apr 28, 2020
@hunterjm hunterjm force-pushed the onvif-config-flow branch 2 times, most recently from 749c635 to 8dc26d6 Compare April 29, 2020 13:37
@hunterjm
Copy link
Member Author

This is g2g for another look.

Comment on lines +161 to 169
LOGGER.debug("Updating service addresses")
await self._camera.update_xaddrs()

await self.async_obtain_device_info()
await self.async_obtain_mac_address()
await self.async_check_date_and_time()
await self.async_obtain_profile_token()
await self.async_obtain_input_uri()
await self.async_obtain_snapshot_uri()
Copy link
Member

Choose a reason for hiding this comment

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

How much of this data is profile specific and how much data can be shared between all entities of 1 camera?

Copy link
Member Author

Choose a reason for hiding this comment

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

The very next PR is going to refactor almost all of this logic out of the Camera entity and into a Device class, which will make it easier to implement events/sensors as well. I wanted to limit the scope of this PR though.

network_interfaces = await devicemgmt.GetNetworkInterfaces()
for interface in network_interfaces:
if interface.Enabled:
self.device_id = interface.Info.HwAddress
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
self.device_id = interface.Info.HwAddress
self.device_id = interface.Info.HwAddress
break

Copy link
Member Author

Choose a reason for hiding this comment

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

I would have normally added a break here as well, but the existing unique ID in the camera entity is set without the break as well, and I didn鈥檛 want to run into any issues, however unlikely.

Dev automation moved this from Incoming to Reviewer approved Apr 30, 2020
@balloob balloob merged commit 850b5cb into home-assistant:dev May 1, 2020
Dev automation moved this from Reviewer approved to Done May 1, 2020
for profile in config_entry.data[CONF_PROFILE]:
config = {**base_config, CONF_PROFILE: profile}
camera = ONVIFHassCamera(hass, config)
await camera.async_initialize()
Copy link
Member

Choose a reason for hiding this comment

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

Does the camera initialization need to happen sequentially? Could we use asyncio.gather to make it concurrent?

@@ -161,9 +113,9 @@ def __init__(self, hass, config):
"""Initialize an ONVIF camera."""
super().__init__()

_LOGGER.debug("Importing dependencies")
LOGGER.debug("Importing dependencies")
Copy link
Member

Choose a reason for hiding this comment

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

We don't want side effects like logging in init method.


_LOGGER.debug("Setting up the ONVIF camera component")
LOGGER.debug("Setting up the ONVIF camera component")
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't sound correct. This is an entity not a component.

if DOMAIN not in self.hass.data:
self.hass.data[DOMAIN] = {}
self.hass.data[DOMAIN][ENTITIES] = []
self.hass.data[DOMAIN][ENTITIES].append(self)
Copy link
Member

Choose a reason for hiding this comment

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

We don't need to store the entity in hass.data anymore.

"""Test ONVIF config flow."""
from asyncio import Future

from asynctest import MagicMock, patch
Copy link
Member

Choose a reason for hiding this comment

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

Please import from tests.async_mock instead.

@hunterjm hunterjm deleted the onvif-config-flow branch May 1, 2020 14:07
@frenck frenck mentioned this pull request May 1, 2020
20 tasks
unixko added a commit to unixko/home-assistant that referenced this pull request May 2, 2020
* Handle flaky SimpliSafe notification registration (home-assistant#34475)

* Bump python-synology to 0.7.0 (home-assistant#34534)

* Update tesla-powerwall to version 0.2.8 (home-assistant#34545)

* Update tesla-powerwall to version 0.2.7

* Update tesla-powerwall to version 0.2.8

* Add All wrapper to deprecated Plex schema (home-assistant#34552)

* Fix deleting and readding nws entry (home-assistant#34555)

* fix deleting and readding nws

* Clean up

* Fix variable name clash

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Remove reconnect logic from MQTT client. (home-assistant#34556)

* Only subscribe when MQTT client is connected. (home-assistant#34557)

* Limit clone/view stats to repos with push access (home-assistant#34575)

* Powerwall sensor add is_active, round state attributes and change thresholding for charging status sensor (home-assistant#34582)

* Change sensor values and thresholding

* Update tests

* Remember homekit aids for entities without a unique id (home-assistant#34587)

* Remember homekit aids for entities without a unique id

* add backwards compat

* increase cover

* Remove old style translations from Atag (home-assistant#34585)

* Fix Garmin Connect i/o in event loop (home-assistant#34598)

* Bumped version to 0.109.0b1

* Upgrade mock-open to 1.4.0 (home-assistant#34606)

* Upgrade pyupgrade to v2.2.1 (home-assistant#34608)

* Restore ability to overwrite homekit max temp bound (home-assistant#34612)

* Upgrade codecov to 2.0.22 (home-assistant#34607)

* Use "arming" state during transition in manual alarm panel (home-assistant#32950)

* Manual Alarm Control Panel: use proper "Arming" state

* Update previous and next attributes

* add CONF_ARMING_TIME

* Split up arming and pending time, pending_time --> arming_time

* update tests

* fix issort

* fix issort

* fix demo platform

* fix alarm test

* remove arming_time from the triggered state

* Match previous default "delay_time"

* fix tests

* fix arming state when triggering

* fix arming _arming_time_by_state for Triggering state

* change to not in list

* Update homeassistant/components/manual/alarm_control_panel.py

Co-Authored-By: Martin Hjelmare <marhje52@gmail.com>

* async_update_ha_state -> async_write_ha_state

* black formatting

* add Callback

Co-Authored-By: Martin Hjelmare <marhje52@gmail.com>

* import callback

* update device triggers alarm_control_panel

* Update test_device_trigger.py

* Update device_trigger.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Fix UVC doing I/O in event loop (home-assistant#34610)

* Move myStrom light and switch to async (home-assistant#34079)

* Fix BloomSky KeyError: 'monitored_conditions' (home-assistant#34613)

Co-Authored-By: Paulus Schoutsen <balloob@gmail.com>

* [ci skip] Translation update

* Handle synology_dsm discovery broadcasting on multiple ip addresses (home-assistant#34623)

* Refactor Plex device/session updates (home-assistant#34616)

* Remove deprecated cert_expiry config (home-assistant#34628)

* Delay sync for Google and limit updates to relevant info (home-assistant#34622)

* Add onvif PTZ GotoPreset (home-assistant#34420)

* Added PTZ GotoPreset support

* Update camera.py

Processed flake8 error

* Update services.yaml

Removed trailing spaces

* Update camera.py

black formatted code

* Updated frontend to 20200424.0 (home-assistant#34645)

* Fix failing vilfo test that was doing i/o (home-assistant#34647)

* Update dynalite library and minor changes (home-assistant#34618)

* Allow flows to know if user is in advanced mode (home-assistant#34629)

* Add NOT condition helper (home-assistant#34624)

* Fix identifying Plex schema when used in packages (home-assistant#34651)

* Delay sync for Google and limit updates to relevant info (home-assistant#34622)

* Bumped version to 0.108.9

* Restore Expected Behavior of Sonarr Upcoming Sensor (home-assistant#34408)

* Store integration type in AirVisual config entry (home-assistant#34621)

* Update ZHA dependency (home-assistant#34661)

Bump up zigpy-deconz

* Log config flow errors (home-assistant#34665)

* Add Home Assistant Started event (home-assistant#34657)

* Fix recording duration flag (home-assistant#34648)

* Restore Expected Behavior of Sonarr Upcoming Sensor (home-assistant#34408)

* Fix UVC doing I/O in event loop (home-assistant#34610)

* Restore ability to overwrite homekit max temp bound (home-assistant#34612)

* Fix BloomSky KeyError: 'monitored_conditions' (home-assistant#34613)

Co-Authored-By: Paulus Schoutsen <balloob@gmail.com>

* Delay sync for Google and limit updates to relevant info (home-assistant#34622)

* Handle synology_dsm discovery broadcasting on multiple ip addresses (home-assistant#34623)

* Updated frontend to 20200424.0 (home-assistant#34645)

* Fix identifying Plex schema when used in packages (home-assistant#34651)

* Add Home Assistant Started event (home-assistant#34657)

* Update ZHA dependency (home-assistant#34661)

Bump up zigpy-deconz

* Log config flow errors (home-assistant#34665)

* Bumped version to 0.109.0b2

* Fix py38 tests (home-assistant#34658)

* [ci skip] Translation update

* Add Signalmessenger group recipients (home-assistant#34419)

* Rename MediaPlayerDevice to MediaPlayerEntity (home-assistant#34592)

* Rename LockDevice to LockEntity (home-assistant#34594)

* Rename ClimateDevice to ClimateEntity (home-assistant#34591)

* Rename AlarmControlPanel to AlarmControlPanelEntity (home-assistant#34590)

* Rename CoverDevice to CoverEntity (home-assistant#34595)

* Fix zero value state rendering sensor unavailable (home-assistant#34694)

Co-Authored-By: Franck Nijhof <git@frenck.dev>

* Fix tests for Python 3.8 (home-assistant#34672)

* Add ability to ignore rachio discovery (home-assistant#34649)

* Add ability to ignore rachio discovery

* update test

* Update tests/components/rachio/test_config_flow.py

Co-Authored-By: Chris Talkington <chris@talkingtontech.com>

* Update tests/components/rachio/test_config_flow.py

Co-Authored-By: Chris Talkington <chris@talkingtontech.com>

Co-authored-by: Chris Talkington <chris@talkingtontech.com>

* Add ability to ignore tado discovery (home-assistant#34650)

* Add ability to ignore tado discovery

* update test

* Update tests/components/tado/test_config_flow.py

Co-Authored-By: Chris Talkington <chris@talkingtontech.com>

* Update tests/components/tado/test_config_flow.py

Co-Authored-By: Chris Talkington <chris@talkingtontech.com>

Co-authored-by: Chris Talkington <chris@talkingtontech.com>

* Add ability to ignore myq discovery (home-assistant#34652)

* Add ability to ignore myq discovery

* update test

* Update tests/components/myq/test_config_flow.py

Co-Authored-By: Chris Talkington <chris@talkingtontech.com>

* Update tests/components/myq/test_config_flow.py

Co-Authored-By: Chris Talkington <chris@talkingtontech.com>

* reset ci

Co-authored-by: Chris Talkington <chris@talkingtontech.com>

* Fix Synology DSM translation (home-assistant#34696)

* Fix fritzbox integration errors (home-assistant#34639)

* Add retry at startup (home-assistant#34656)

* Fix more tests on Python 3.8 (home-assistant#34703)

* Python 3.8 on CI (home-assistant#34654)

* [ci skip] Translation update

* Rename VacuumDevice to VacuumEntity (home-assistant#34674)

* Rename RemoteDevice to RemoteEntity (home-assistant#34676)

* Add frontend version WS command (home-assistant#34701)

* Fix fritzbox integration errors (home-assistant#34639)

* Add retry at startup (home-assistant#34656)

* Fix zero value state rendering sensor unavailable (home-assistant#34694)

Co-Authored-By: Franck Nijhof <git@frenck.dev>

* Fix Synology DSM translation (home-assistant#34696)

* Add frontend version WS command (home-assistant#34701)

* Bumped version to 0.109.0b3

* Bump pyairvisual and remove unused trends (home-assistant#34707)

* Fix fritzbox errors again (home-assistant#34710)

* Rename Light to LightEntity (home-assistant#34593)

* Rename SwitchDevice to SwitchEntity (home-assistant#34673)

* Add missing typing to Spotify (home-assistant#34698)

* Bump python-synology to 0.7.1 (home-assistant#34728)

* Upgrade pillow to 7.1.2 (home-assistant#34733)

* Create a unique_id for velux cover (home-assistant#34668)

* Upgrade pytest-sugar to 0.9.3 (home-assistant#34726)

* Upgrade pytest-timeout to v1.3.4 (home-assistant#34609)

* Add unique ID to TRADFRI (home-assistant#34745)

* [ci skip] Translation update

* Improve error handling for Powerwall (home-assistant#34580)

* Improve error handling
	modified:   homeassistant/components/powerwall/__init__.py
	modified:   homeassistant/components/powerwall/config_flow.py
	modified:   homeassistant/components/powerwall/const.py
	modified:   homeassistant/components/powerwall/strings.json
	modified:   homeassistant/components/powerwall/translations/en.json

* Change exception name
	modified:   homeassistant/components/powerwall/__init__.py
	modified:   homeassistant/components/powerwall/config_flow.py

* Add test

* Rename PowerwallError to POWERWALL_ERROR

* Modify handling of APIChangedErrors
	modified:   homeassistant/components/powerwall/__init__.py
	modified:   homeassistant/components/powerwall/const.py

* Upgrade pytest to 5.4.1 (home-assistant#34739)

* Allow ignoring discovery config flow helper (home-assistant#34740)

* Fix dockerfile

* cleanup

* Make ps4 config flow tests robust (home-assistant#34749)

* Add hadolint to CI (home-assistant#34758)

* Add hadolint to CI

* Fix lint & name

* Update azure-pipelines-ci.yml

Co-Authored-By: Franck Nijhof <git@frenck.dev>

Co-authored-by: Franck Nijhof <git@frenck.dev>

* Refactor squeezebox (home-assistant#34731)

Co-Authored-By: Martin Hjelmare <marhje52@gmail.com>

* Updated frontend to 20200427.0 (home-assistant#34766)

* Fix fritzbox errors again (home-assistant#34710)

* Bump python-synology to 0.7.1 (home-assistant#34728)

* Updated frontend to 20200427.0 (home-assistant#34766)

* Bumped version to 0.109.0b4

* Bump simplisafe-python to 9.2.0 (home-assistant#34750)

* Set up config entries in parallel (home-assistant#34755)

* Add Rachio rain delay switch (home-assistant#34741)

* Add Rachio Rain Delay Switch

* Typo

* Catch KeyError

* Use HA dt module in place of time

* Validate that discovered config flows set a unique ID (home-assistant#34751)

Co-Authored-By: Franck Nijhof <git@frenck.dev>

* Disable upnp SSDP discovery (home-assistant#34756)

* [ci skip] Translation update

* [ci skip] Translation update

* [ci skip] Translation update

* [ci skip] Translation update

* Add unique_id to fritzbox (home-assistant#34716)

* Arcam fmj bump library to 0.4.4 (home-assistant#34687)

* Bump arcam-fmj with better connection failed support

* Log unexpected exceptions in arcam client

* Consider undetected as 2ch to match OSD

* Ask for explicit update on start

* [ci skip] Translation update

* Fix atag timezone bug (home-assistant#34686)

Co-authored-by: Boris Nelissen <borisnelissen91@gmail.com>

* Attempt to fix CI (home-assistant#34800)

* Add script to copy backend translations to frontend (home-assistant#34706)

* deCONZ - device triggers for Aqara Opple switches (home-assistant#34815)

* Added Aqara Opple device triggers

* Update homeassistant/components/deconz/device_trigger.py

Co-Authored-By: Robert Svensson <Kane610@users.noreply.github.com>

* Update homeassistant/components/deconz/device_trigger.py

Co-Authored-By: Robert Svensson <Kane610@users.noreply.github.com>

* Update homeassistant/components/deconz/device_trigger.py

Co-Authored-By: Robert Svensson <Kane610@users.noreply.github.com>

* Fix flake8

Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com>

* Parallelize collections helper (home-assistant#34783)

* Minor helpers cleanup (home-assistant#34786)

* Log threading exceptions properly (home-assistant#34789)

* Add missing blocks (home-assistant#34832)

* Bump python-synology to 0.7.2 (home-assistant#34830)

* Removed defunct punctuality from nederlandse_spoorwegen (home-assistant#34680)

* Update nederlandse_spoorwegen nsapi to 3.0.4 (home-assistant#34681)

* NS version bumped to 3.0.4

* Add Xiaomi miio Alarm Control Panel (home-assistant#32091)

Co-Authored-By: Martin Hjelmare <marhje52@gmail.com>

* Fix async_setup type in components/homeassistant module (home-assistant#34816)

* Fix meteoalarm exception handling with instance of KeyError (home-assistant#34828)

* [ci skip] Translation update

* Fix async call in sync context in steam_online (home-assistant#34823)

* Fix typo in arest sensor (home-assistant#34833)

* Remove unnecessary space in greeneye_monitor unique_id (home-assistant#34834)

* Fix pylint CI (home-assistant#34836)

* Fix race condition in august test under py38 (home-assistant#34775)

* Handle more fritzbox edge cases (home-assistant#34802)

* UniFi - Add a second roaming event (home-assistant#34819)

* Updated frontend to 20200427.1 (home-assistant#34831)

* Remove legacy discovery for roku (home-assistant#34794)

* Remove legacy discovery for directv (home-assistant#34793)

* remove legacy discovery for directv

* Update __init__.py

* Update __init__.py

* Fix sync call in async context generic_thermostat (home-assistant#34822)

* Add unique_id to fritzbox (home-assistant#34716)

* Fix atag timezone bug (home-assistant#34686)

Co-authored-by: Boris Nelissen <borisnelissen91@gmail.com>

* Disable upnp SSDP discovery (home-assistant#34756)

* Remove legacy discovery for directv (home-assistant#34793)

* remove legacy discovery for directv

* Update __init__.py

* Update __init__.py

* Remove legacy discovery for roku (home-assistant#34794)

* Handle more fritzbox edge cases (home-assistant#34802)

* UniFi - Add a second roaming event (home-assistant#34819)

* Fix sync call in async context generic_thermostat (home-assistant#34822)

* Fix meteoalarm exception handling with instance of KeyError (home-assistant#34828)

* Fix async call in sync context in steam_online (home-assistant#34823)

* Bump python-synology to 0.7.2 (home-assistant#34830)

* Updated frontend to 20200427.1 (home-assistant#34831)

* Bumped version to 0.109.0b5

* [ci skip] Translation update

* Fix flapping reload tests (home-assistant#34837)

* Bump version to 0.110.0dev0 (home-assistant#34827)

* Update translations for FRITZ!Box

* Fix Islamic prayer times naming (home-assistant#34784)

* Bump python-synology to 0.7.3 (home-assistant#34847)

* Fix Islamic prayer times naming (home-assistant#34784)

* Bump python-synology to 0.7.3 (home-assistant#34847)

* Fix tuya network failure startup (home-assistant#34057)

* Tuya initialization retry on failure

* Rename exception

* Changed managed exception

* Manage different cases of ConnectionError

* Log messages correction

* Test always catching exceptions

* Update for Lint

* Update tuya library to 0.0.6

- Catch new library exception

* Tuya initialization retry on failure

* Rename exception

* Changed managed exception

* Manage different cases of ConnectionError

* Log messages correction

* Test always catching exceptions

* Update for Lint

* Update tuya library to 0.0.6

- Catch new library exception

* Catch wrong credential

* Revert "Catch wrong credential"

This reverts commit 7fb797d.

* Catch wrong credential

* Remove trailing whitespace

* Black formatting

* Import Exception from tuyaapi

* Remove str to exception

* Force CI checks

* Force CI checks

* Rebase conflict

* Tuya initialization retry on failure

* Rename exception

* Changed managed exception

* Manage different cases of ConnectionError

* Log messages correction

* Test always catching exceptions

* Update for Lint

* Update tuya library to 0.0.6

- Catch new library exception

* Catch wrong credential

* Revert "Catch wrong credential"

This reverts commit 7fb797d.

* Tuya initialization retry on failure

* Rename exception

* Changed managed exception

* Catch wrong credential

* Force CI checks

* Force CI checks

* Rebase conflict

* Rebase

* Force Test

* Force Test

* Update translations for Islamic Prayer Times

* Bumped version to 0.109.0

* Reload braviatv entry after options update (home-assistant#34576)

* Reload entry after options update

* Undo update listener when unloading

* Fix CVE-2020-1967 (home-assistant#34853)

* Remove side effects from rachio switch init (home-assistant#34799)

* Remove side effects from rachio switch init

* Remove useless inits

* Clean up Rachio binary sensor init (home-assistant#34855)

* Update binary sensor

* Move online state to subclass

* Fix Flu Near You exception re: stale coroutines (home-assistant#34880)

* Prevent tplink tests from doing I/O (home-assistant#34879)

* Prevent homekit fans from going to 100% than speed when turning on (home-assistant#34875)

* Abort nexia import if the username is already configured (home-assistant#34863)

* SmartThings continue correct config flow after external auth (home-assistant#34862)

* Config flow for hunterdouglas_powerview (home-assistant#34795)

Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>

* Fix Garmin Connect doing I/O in event loop (home-assistant#34895)

* Fix Toon doing I/O in event loop (home-assistant#34896)

* [ci skip] Translation update

* Fix async scene conversion in Hunter Douglas Powerview (home-assistant#34899)

* Fix async scene conversion in hunter douglas powerview

* Update homeassistant/components/hunterdouglas_powerview/scene.py

Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>

* Make sqlalchemy engine connect listener recorder specific (home-assistant#34908)

* Avoid error when battery appears after homekit has started (home-assistant#34906)

* Fix handling homekit thermostat states (home-assistant#34905)

* Reduce log level for WebOS connection error (home-assistant#34904)

* Use entry ID when IPP printer offers no identifier (home-assistant#34316)

* Add numato integration (home-assistant#33816)

* Add support for Numato 32 port USB GPIO boards

Included are a binary_sensor, sensor and switch component
implementations. The binary_sensor interface pushes updates via
registered callback functions, so no need to poll here.

Unit tests are included to test against a Numato device mockup.

* Refactor numato configuration due to PR finding

* Resolve minor review findings

* Bump numato-gpio requirement

* Load numato platforms during domain setup

According to review finding

* Guard from platform setup without discovery_info

According to review finding

* Move numato API state into hass.data

According to review finding.

* Avoid side effects in numato entity constructors

According to review finding

* Keep only first line of numato module docstrings

Removed reference to the documentation. Requested by reviewer.

* Minor improvements inspired by review findings

* Fix async tests

Pytest fixture was returning from the yield too early executing teardown
code during test execution.

* Improve test coverage

* Configure GPIO ports early

Review finding

* Move read_gpio callback to outside the loop

Also continue on failed switch setup, resolve other minor review
findings and correct some error messages

* Bump numato-gpio requirement

This fixes a crash during cleanup. When any device had a communication
problem, its cleanup would raise an exception which was not handled,
fell through to the caller and prevented the remaining devices from
being cleaned up.

* Call services directly

Define local helper functions for better readability.
Resolves a review finding.

* Assert something in every test

So not only coverage is satisfied but things are actually tested
to be in the expected state.
Resolves a review finding.

* Clarify scope of notification tests

Make unit test for hass NumatoAPI independent of Home Assistant (very basic test of notifications).
Improve the regular operations test for notifications.

* Test for hass.states after operating switches

Resolves a review finding.

* Check for wrong port directions

* WIP: Split numato tests to multiple files

test_hass_binary_sensor_notification still fails.

* Remove pytest asyncio decorator

Apears to be redundant. Resolves a review finding.

* Call switch services directly.

Resolves a review finding.

* Remove obsolete inline pylint config

Co-Authored-By: Martin Hjelmare <marhje52@gmail.com>

* Improve the numato_gpio module mockup

Resolves a review finding.

* Remove needless explicit conversions to str

Resolves review findings.

* Test setup of binary_sensor callbacks

* Fix test_hass_binary_sensor_notification

* Add forgotten await

Review finding.

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Fix crash in NAD integration (home-assistant#34571)

Some amplifiers/receivers do not report any volume (due to them not
knowing), for example NAD C 356BEE is documented to return an empty
string for volume.

At least don't crash when we get None back.

* Add fortigate deprecation message (home-assistant#34854)

* Add overlay options wrapper to rpi_camera (home-assistant#34461)

* add overlay options wrapper to rpi_camera

* Refactor to set config yaml section under the top level integration domain key

* Remove return values that are not checked

Co-Authored-By: Martin Hjelmare <marhje52@gmail.com>

* Remove superfluous debug log messages

* Return if not set up via discovery

* Add convenience reference to hass.data[DOMAIN]

* Black formatting

* Isort

* Exclude all rpi_camera modules

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Bump brother to 0.1.14 (home-assistant#34930)

* Fix preservation of homekit fan speed on toggle (home-assistant#34971)

* Address new issues flagged by flake8 3.8.0a2 (home-assistant#34964)

* Remove panasonic_viera from legacy discovery (home-assistant#34909)

* Improve logging for unregistered webhooks (home-assistant#34882)

* Improve logging for unregistered webhooks

* Address comment, KEY_REAL_IP

* Address comment, read(64)

* Lint

* Use built-in test helpers on 3.8 (home-assistant#34901)

* Fix webhook imports sorting (home-assistant#34988)

* Fix not condition validation and entity/device extraction (home-assistant#34959)

* Cleanup homekit callbacks and jobs (home-assistant#34975)

* Add unique id to esphome config flow (home-assistant#34753)

* Use a future for mock coro (home-assistant#34989)

* Introduce a singleton decorator (home-assistant#34803)

* [ci skip] Translation update

* Refactor Remote class in panasonic_viera (home-assistant#34911)

* Update excess powerwall logging to be debug (home-assistant#34994)

* Log the rachio webhook url (home-assistant#34992)

* Add battery sensors to hunterdouglas_powerview (home-assistant#34917)

* Add allow extra to totalconnect config schema (home-assistant#34993)

* Config flow for homekit (home-assistant#34560)

* Config flow for homekit

Allows multiple homekit bridges to run

HAP-python state is now stored at .storage/homekit.{entry_id}.state
aids is now stored at .storage/homekit.{entry_id}.aids

Overcomes 150 device limit by supporting
multiple bridges.

Name and port are now automatically allocated
to avoid conflicts which was one of the main
reasons pairing failed.

YAML configuration remains available in order to offer entity
specific configuration.

Entries created by config flow can add and remove
included domains and entities without having to restart

* Fix services as there are multiple now

* migrate in executor

* drop title from strings

* Update homeassistant/components/homekit/strings.json

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>

* Make auto_start advanced mode only, add coverage

* put back title

* more references

* delete port since manual config is no longer needed

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>

* Don't attempt to set Vizio is_volume_muted property if Vizio API doesn't provide muted state (home-assistant#34782)

* UniFi - Disconnected clients wrongfully marked as wired not created (home-assistant#34986)

* Support num_repeats for directv remote (home-assistant#34982)

* Support num_repeats for roku remote (home-assistant#34981)

* Fix roomba not reporting error (home-assistant#34996)

* Remove some passings of loop (home-assistant#34995)

* Lint roomba (home-assistant#35000)

* UniFi - Add simple options flow (home-assistant#34990)

* Fix MQTT debug info for same topic (home-assistant#34952)

* Attempt to fix flapping august lock test (home-assistant#34998)

* Fix restoring isy994 brightness with no previous state (home-assistant#34972)

* Config flow for ONVIF (home-assistant#34520)

* Add flow and return sensors for MELCloud ATW device (home-assistant#34693)

* Add full options to serial sensor platform (home-assistant#34962)

Improve Serial sensor platform with full options for configuring the serial port.
bytesize, parity, stopbits, xonxoff, rtscts, dsrdtr.

The default values are unchanged so it is 100% compatible with previous config.

* Fix MELCloud temperature unit (home-assistant#35003)

The MELCLoud API produces and consumes only Celsius.

* Fix unknown exception being caught (home-assistant#35005)

* Fix CI, incomplete change in melcloud (home-assistant#35016)

* Rename WaterHeaterDevice to WaterHeaterEntity (home-assistant#34675)

* Rename WaterHeaterDevice to WaterHeaterEntity

* Fix stale name

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Several optimizations to automations (home-assistant#35007)

* Use pulsectl library for PulseAudio connection (home-assistant#34965)

Get rid of internal library code and use pulsectl library to communicate
with PulseAudio server.

This is a breaking change as the library uses the much more powerful
native interface instead of the CLI interface, requiring the need to
change the default port.

On the bright side, this also solves some issues with the existing
implementation:

  - There was no test if the complete list of loaded modules was
    already received. If not all data could be read at once, the
    remaining modules not yet in the buffer were considered absent,
    resulting in unreliable behavior when a lot of modules were loaded
    on the server.

  - A switch could be turned on before the list of loaded modules was
    loaded, leading to a loopback module being loaded even though this
    module was already active (home-assistant#32016).

* Include QoS and retain in MQTT debug info (home-assistant#35011)

* Bump HAP-python to 2.8.3 (home-assistant#35023)

* Fixes camera support

* Update AirVisual to use DataUpdateCoordinator (home-assistant#34796)

* Update AirVisual to use DataUpdateCoordinator

* Empty commit to re-trigger build

* Don't include history or trends in config flow

* Code review

* Add more SNMP variable types (home-assistant#33426)

* added support for more SNMP variable types

* Fix SNMP pull request formatting

* retry fix linting errors

* Created SNMP vartype dict

* Moved to Integer instead of Integer32 as default vartype

* Update homeassistant/components/snmp/switch.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update homeassistant/components/snmp/switch.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update homeassistant/components/snmp/switch.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Fix songpal on devices where source!=uri (home-assistant#34699)

* Fix translation merging for custom components without translations (home-assistant#35032)

* Fix ONVIF YAML import (home-assistant#35035)

* Add yeelight meteorite (YLDL01YL, ceiling10) (home-assistant#35018)

* Bump python-synology to 0.7.4 (home-assistant#35052)

* [ci skip] Translation update

* Cleanup homekit strings spacing (home-assistant#35056)

* Bump hass-nabucasa to 0.34.2 (home-assistant#35046)

* Fix another race in august tests (home-assistant#35054)

* Fix Canary doing I/O in the event loop (home-assistant#35039)

* Add scene to default config (home-assistant#35058)

* Bump roombapy to 1.5.2 (home-assistant#35067)

Co-authored-by: Aaron Bach <bachya1208@gmail.com>
Co-authored-by: Quentame <polletquentin74@me.com>
Co-authored-by: jrester <31157644+jrester@users.noreply.github.com>
Co-authored-by: jjlawren <jjlawren@users.noreply.github.com>
Co-authored-by: MatthewFlamm <39341281+MatthewFlamm@users.noreply.github.com>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Erik Montnemery <erik@montnemery.com>
Co-authored-by: Joakim S酶rensen <joasoe@gmail.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
Co-authored-by: Franck Nijhof <git@frenck.dev>
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
Co-authored-by: starkillerOG <starkiller.og@gmail.com>
Co-authored-by: Fabian Affolter <mail@fabian-affolter.ch>
Co-authored-by: HomeAssistant Azure <hello@home-assistant.io>
Co-authored-by: Geronimo2015 <vdschoot@gmail.com>
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
Co-authored-by: Ziv <16467659+ziv1234@users.noreply.github.com>
Co-authored-by: Chris Talkington <chris@talkingtontech.com>
Co-authored-by: Alexei Chetroi <lexoid@gmail.com>
Co-authored-by: Jason Hunter <hunterjm@gmail.com>
Co-authored-by: Bernhard B <schluchti@gmail.com>
Co-authored-by: cgtobi <cgtobi@users.noreply.github.com>
Co-authored-by: escoand <escoand@users.noreply.github.com>
Co-authored-by: Pascal Vizeli <pvizeli@syshack.ch>
Co-authored-by: rako77 <rako77@users.noreply.github.com>
Co-authored-by: Thomas Schamm <thomas@tschamm.de>
Co-authored-by: rajlaud <50647620+rajlaud@users.noreply.github.com>
Co-authored-by: Brian Rogers <brg468@hotmail.com>
Co-authored-by: Joakim Plate <elupus@ecce.se>
Co-authored-by: MatsNl <37705266+MatsNl@users.noreply.github.com>
Co-authored-by: Boris Nelissen <borisnelissen91@gmail.com>
Co-authored-by: Marcin <merdok@users.noreply.github.com>
Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com>
Co-authored-by: Yarmo Mackenbach <yarmo@protonmail.com>
Co-authored-by: Frederik Gladhorn <gladhorn@users.noreply.github.com>
Co-authored-by: Brendon Go <brendon.go@gmail.com>
Co-authored-by: Franck Nijhof <frenck@addons.community>
Co-authored-by: Rami Mosleh <engrbm87@gmail.com>
Co-authored-by: ollo69 <60491700+ollo69@users.noreply.github.com>
Co-authored-by: Maciej Bieniek <bieniu@users.noreply.github.com>
Co-authored-by: Andrew Sayre <6730289+andrewsayre@users.noreply.github.com>
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
Co-authored-by: clssn <code@clssn.de>
Co-authored-by: Thomas Le Gentil <20202649+kifeo@users.noreply.github.com>
Co-authored-by: alxrdn <alxrdn@users.noreply.github.com>
Co-authored-by: Ville Skytt盲 <ville.skytta@iki.fi>
Co-authored-by: Jo茫o Gabriel <joaogabrielps13@hotmail.com>
Co-authored-by: Daniel Perna <danielperna84@gmail.com>
Co-authored-by: Austin Mroczek <austin@mroczek.org>
Co-authored-by: Raman Gupta <7243222+raman325@users.noreply.github.com>
Co-authored-by: Xiaonan Shen <s@sxn.dev>
Co-authored-by: Vilppu Vuorinen <vilppu.vuorinen@jubic.fi>
Co-authored-by: Guillaume DELVIT <guiguid@free.fr>
Co-authored-by: Markus Breitenberger <bre@breiti.cc>
Co-authored-by: Mich-b <Mich-b@users.noreply.github.com>
Co-authored-by: Teemu R <tpr@iki.fi>
@lock lock bot locked and limited conversation to collaborators May 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Dev
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

5 participants