* Handle connection being closed in legacy samsungtv
- Mirror the websocket behavior
Fixes
```
2021-06-24 02:54:13 ERROR (MainThread) [homeassistant.helpers.entity] Update for media_player.89_guestroom fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 401, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 609, in async_device_update
raise exc
File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/samsungtv/media_player.py", line 124, in update
self._state = STATE_ON if self._bridge.is_on() else STATE_OFF
File "/usr/src/homeassistant/homeassistant/components/samsungtv/bridge.py", line 113, in is_on
return self._get_remote() is not None
File "/usr/src/homeassistant/homeassistant/components/samsungtv/bridge.py", line 232, in _get_remote
self._remote = Remote(self.config.copy())
File "/usr/local/lib/python3.8/site-packages/samsungctl/remote.py", line 9, in __init__
self.remote = RemoteLegacy(config)
File "/usr/local/lib/python3.8/site-packages/samsungctl/remote_legacy.py", line 32, in __init__
self._read_response(True)
File "/usr/local/lib/python3.8/site-packages/samsungctl/remote_legacy.py", line 77, in _read_response
raise exceptions.ConnectionClosed()
samsungctl.exceptions.ConnectionClosed
```
* add coverage
* pass instead
* Fix zwave_js migration logic
* revert change to move tests to new module
* Update tests/components/zwave_js/test_init.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Add WS API for listing available statistic ids
* Update homeassistant/components/history/__init__.py
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
* Refactor alarms and favorites into household-level coordinators
Create SonosHouseholdCoodinator class for system-level data
Fix polling for both alarms and favorites
Adjust tests
* Fix docstring
* Review cleanup
* Move exception handling up a level, do not save a failed coordinator
* Apply suggestions from code review
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Add a menu_cursor service to the yamaha component
* Update homeassistant/components/yamaha/media_player.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Update service description to new format
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Franck Nijhof <git@frenck.dev>
* Add zwave_js view to retrieve a node's state
* remove typehints
* Make dump views require admin
* Add version info to node level dump
* Add back typehints
* switch from list to dict
* switch from dump node view to two WS API commands
* switch to snake
* Initial commit for new musiccast integration
* Add zone support
* Get/set volume level
* Remove volume step
* Create custom MusicCastData type
* Create MusicCastDevice
* Fix await
* Add power and mute control
* Implement all basic media_player parts
* Support input switching
* Add duration/position support
* Add advanced tuner functions
* Basic media browser
* Add layer in media browser to see all available list_infos
* Added join/unjoin services and group informations. Known issue: You can not link zone 2 to main at the moment (WIP)
* Many fixes to make multiple zones and grouping work. Next step: implement error handling and remove debugging information
* WIP: Added Multizone Support and allows clients to directly jump from one group to another. Known issue: If a server tries to join a group as client, he has to close his group first. Sometimes the device that was a server previously jumps out of the group directly after joining.
* Updated group management to make it wait for the updated group information before performing the next actions - Timeouts after 1 second, then polls the distribution data. If the data are still not updated, there will be one retry before an Exception is thrown. Extended the state attributes for clients to make them return group details from their servers (leads to inactive group management buttons for the client). Added documentation and restructured the code.
* Make the service handle function name for group specific service calls unique
* Added service descriptions for set_sleep_timer, set_alarm, recall_netusb_preset, store_netusb_preset
* Added data entries for alarm specific values and a netusb preset list. Implemented fetching function for clock and netusb presets.
* Registered and implemented services for set_sleep_timer, set_alarm, recall_netusb_preset, store_netusb_preset. The set_alarm service works with a special mediaplayer alarm lovelace card, I am currently working on.
The NetUSB Presets are also available using the media browser. Maybe we could also add the Tuner presets in the future for both setting up the alarm and recalling them via service and media browser.
* Removed some debug prints
* Moved MusicCast Integration to the aiomusiccast library. This library supports media browsers with multiple pages. Added ssdp support for the discovery
* Minor fix in the group management and tidied up a bit
* Updated manifest of yamaha musiccast
* Update library
* Minor fix in the media browser. get_distribution_num does not have to be async, so it has been changed. Adjusted the client join function to turn on the client before joining a group - the musiccast app does so, so hopefully this fixes the rare errors when adding a turned off client to a group. Some reformating and by hooks fixed most of the requirements of the hooks. Known exception from this: mypy throws an error for line 116.
* Removed some old out commented code. Fixed some error handling, when the user enters a non reachable or non yamaha host in the manual setup. Fixed linting/styling errors. Implemented tests to bring the coverage for the config flow to 100%.
* Fixed linting/styling errors. Return a DeviceInfo object instead of a dict.
* Fixed linting/styling errors. Added a new error type to the translations.
* In the yamaha API the system_id is equal to the serial number in the DLNA description. Due to that it was possible to configure a device twice, because the serial number from the yamaha API was different. This issue was fixed.
* Updated tests and added a test for adding a device manually, which is already present in the system
* Remove print statements
* Fix sleep timer service call
* Fix yamllint error
* Shrink PR down to just new library + config flow with discovery
* Add __init__.py to .coveragerc
* Apply suggestions from code review
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Franck Nijhof <git@frenck.dev>
* Implement suggestions from code review
* Improve identifiers and connections, remove event loop parameter
* Add coordinator back
* Better exception handling
* Fix unique id in ssdp step
* Remove abc.ABC from MusicCasteDeviceEntity
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Update homeassistant/components/yamaha_musiccast/config_flow.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Replace the repeat mode mapping from mc to ha by a generic solution
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* add coordinator to the super call of the mediaplayer
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* add the coordinator to the init function of the MusicCastEntity
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Pass the coordinator from the MusicCastEntity init function to the CoordinatorEntity init function
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* merged _handle_config_flow into async_step_user
* reformated the exception handling of the user step. In the case that the device already exists, the AbortFlow will be raised.
* Removed model from the config entry. It was neither set nor used anymore.
* Fixed the test for the config flow.
* Use async_write_ha_state instead of schedule_update_ha_state.
* Add default value for the system ID gotten in the user step
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Update tests/components/yamaha_musiccast/test_config_flow.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Added a fixture to avoid IO in the test_user_input_device_not_found test
* Use absolute imprt to import data_entry_flow.
* Use local vars for host and serial_number in async_step_user.
* Remove ip_address and zone_id properties.
* Use device id for the unique ID of an entity instead of the macs
* Removed entry_id from the MusicCastEntity init function.
* Updated strings and English translation.
* don't set the coordinator in the mediaplayer init.
* Implemented legacy configuration.yaml support for existing configurations.
* Added tests for the newly added config flow step.
* Use device_id as identifier
* Fix an accidentally relative import
* Fix pylint warnings
* use logger.error instead of logger.exception in the import step.
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Use CONF_HOST instead of 'host'
* Only support the import from configuration.yaml if no config entries are setup for musiccast. If there are already config entries in HA and none of them is a representation of a config given in configuration.yaml (e.g. config added after the first import), an error will be logged.
* Update homeassistant/components/yamaha_musiccast/media_player.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Readded PLATFORM_SCHEMA for configuration.yaml
* Raise an exception for all services, which are only supported for specific sources.
* Bump aiomusiccast to 0.6 to support asyncio sockets
Co-authored-by: Michael Harbarth <michael.harbarth@gmx.de>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Franck Nijhof <git@frenck.dev>
* Pass through metadata when casting an app
* Remove passing kwargs to quick_play
Add metadata to the app_data dict.
* Include pass-through of metadata
* Bump pychromecast to 9.2.0
* Add changes to test to verify metadata
* Fix order of imports
* Add Ecobee humidifier device_info and unique_id
Ecobee humidifier entity was not connected to the thermostat device.
This change will ensure the entitiy is properly connected.
This change also fills out the ecobee-data.json fixutre data a bit
to address failures in the test setup.
* Add Ecobee humidifier device_info and unique_id
Adjust test fixture data to increase pytest coverage
Clean up indenting in ecobee-data.json
* Add Ecobee humidifier device_info and unique_id
Update exception case in device_info to not
be included in codecov tests. This case has
been tested locally.
* Add Ecobee humidifier device_info and unique_id
Address pylint issue
* Add Ecobee humidifier device_info and unique_id
Remove no cover pragma and add ecobee humidifier.py to
.coveragerc
* Add color mode support to WLED
* Update homeassistant/components/wled/light.py
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Update homeassistant/components/wled/light.py
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Update homeassistant/components/wled/light.py
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Update homeassistant/components/wled/light.py
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* black
* property, property
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* Emulate color_temp for lights which support color or white
* Support legacy lights
* Tidy up group.light code
* Improve color_temp to white conversion
* Remove color_temp to white conversion
* Add test
* Tweak deconz test
* Modern Forms integration initial pass
* cleanup of typing and nits
* Stripped PR down to Fan only
* Review cleanup
* Set sleep_time to be required for service
* Adjust minimum sleep time to one minute.
* Code review changes
* cleanup icon init a little
* Ensure ssdp can callback messages that do not have an ST
Sonos sends unsolicited messages when the device reboots. We want
to capture these to ensure we can recover the subscriptions as soon
as the device reboots
* Update homeassistant/components/ssdp/__init__.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Add media group
* Minor improvements
* Use the async api for all methods
* Improve type hints
* Add missing methods
* Add tests
* Rename HomeAssistantType —> HomeAssistant
* Add more tests
* Fix unknown state
* Make some callbacks
* Add more tests
* Fix unknown state properly
* Fix names for callbacks
* Fix stop service test
* Improve tests
* Initial Hyperion camera.
* Improve test coverage.
* Minor state fixes.
* Fix type annotation.
* May rebase and updates (mostly typing).
* Updates to use new camera typing improvements.
* Use new support for returning None from async_get_mjpeg_stream .
* Codereview feedback.
* Lint: Use AsyncGenerator from collections.abc .
* Update homeassistant/components/hyperion/camera.py
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
* Add zwave_js node status sensor
* fix import
* use parent class name property
* Use more entity class attributes
* Update homeassistant/components/zwave_js/sensor.py
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
* return static values in property method
* fix PR
* switch to class atributes
* create sensor platform task if needed
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
* Enable gzip encoding for playlist responses
* Add EXT-X-PROGRAM-DATE-TIME to playlist
* Add EXT-X-START to playlist
* Change EXT-X-VERSION from 7 to 6
* Move idle timer call to recv
* Refactor recv to remove cursor and return bool
* Rename STREAM_TIMEOUT to SOURCE_TIMEOUT
* Add zwave_js.multicast_set_value service
* comment
* Add test for multiple config entries validation
* additional validation test
* brevity
* wrap schema in vol.Schema
* Update homeassistant/components/zwave_js/services.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* do node transform and multicast validation in schema validation
* move poll value entity validation into schema validation, pass helper functions dev and ent reg instead of retrieving it every time
* make validators nested functions since they don't neeed to be externally accessible
* Update homeassistant/components/zwave_js/services.py
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Remove errant ALLOW_EXTRA
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* refactor ModbusRegisterSensor to match the ModbusSwitch interface
* Please pylint, mypy etc.
* Remove PLATFORM.
Co-authored-by: jan Iversen <jancasacondor@gmail.com>
Co-authored-by: Ruslan Sayfutdinov <ruslan@sayfutdinov.com>
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Add WS API support for zwave_js firmware updates
* move file to fixture
* review comments
* fix logic and test based on upstream changes
* handle failure scenario
* handle failure scenario
* fix tests and adjust message
* Update homeassistant/components/zwave_js/api.py
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
* remove return from firmware upload view because client will raise an exception if not successful
* raise if user is not an admin
* raise bad request exception if firmware command fails
* incorporate #50923
* Add test for failed command
* add event name to messages
* change error to not found
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
* add sonos_alarm
* bug fix for _update_device
* fix pylint and black and co
* small bug fix in speaker.available_alarms
* cleanup and add _LOGGER.debug statements, fix pylint
* fix pylint
* _alarm_id to alarm_id
* fixed rare bug due to raceconditions
* Part 2 of raceconditionfix
* address review suggestions
* readd check for not yet subscribed
* - platforms_ready fix
- add alarmClock to pytest mock
* fixture for ListAlarms
* cleanup mock and match UUID for test
* add simple tests for sonos_alarm
* extend test for attributes
* typhint fix
* typo
* use get_alarms() directly
* refactor available_alarms
* fix attributes
* some cleanup
* change logic of fetch_alarms_for_speaker and rename to update_alarms_for_speaker
* update_alarms_for_speaker is now a method
* Update homeassistant/components/sonos/switch.py
Co-authored-by: jjlawren <jjlawren@users.noreply.github.com>
* Update homeassistant/components/sonos/speaker.py
Co-authored-by: jjlawren <jjlawren@users.noreply.github.com>
Co-authored-by: jjlawren <jjlawren@users.noreply.github.com>
* Improve typing
* One more typing fix
* Run hassfest
* Fix test
* Fix return from constructor
* Add missing Final
* Improve long string format
* Use bool for mute
* Remove unnecessary str type
* Fix host type
* Add missing Final
* Increase test coverage
* Suggested change
Co-authored-by: Ruslan Sayfutdinov <ruslan@sayfutdinov.com>
Co-authored-by: Ruslan Sayfutdinov <ruslan@sayfutdinov.com>
As of version 0.14, the venstar_colortouch lib always initializes hum_setpoint to None. When a thermostat actually reports a humidifier state, this value is replaced with the integer value of the setpoint. This changeset corrects the humidifier detection as well as adds basic test cases for the Venstar component.
* Add support for effects, transition/brightness parameters to template light, min_mireds and max_mireds templates
* code fixes
* min_mireds, max_mireds fixes
* test fixes
* more fixes
* format fix
* style fix
* _update_effect_list change
* style fix
* Fixes after review
* additional fixes
* duplicated lines removed
* fixes after CI run
* test fixes
* code and test fixes
* supports transition change, added test cases
* Wallbox component added
* resolved mergeconflicts from upstream
* fixed an incorrect removal in CODEOWNERS file
* fixes for pullrequest automatic test
* clean up code after PR tests
* fixed strings.json
* fix config_flow error > wallbox
* fixed some formatting issues
* fix pylint warnings
* fixed error in number.py > set value
* pylint warnings fixed
* some more pylint fixes
* isort fixes
* fix unused_import pylint
* remove tests
* remove test requirements
* config flow test
* test errors resolved
* test file formatting
* isort on test file
* sensor test
* isort on test
* isort test const
* remove not working sensor test
* remove test const
* add switch, number and lock test
* docstrings for test classes
* sort test_number, create test_sensor
* additional tests
* fix test error
* reduced PR to 1 component
* newline in const
* ignore test coverage -> dependency on external device (wallbox)
* do not ignore config_flow
* add test for validate_input
* remove obsolete import
* additional test config flow
* change test sensor
* docstring
* add additional test for exceptions
* fix test_config
* more tests
* fix test_config_flow
* fixed http error test
* catch connectionerror and introduce testing for this error
* remove .coveragefile
* change comment
* Update homeassistant/components/wallbox/__init__.py
review suggestion by janiversen
Co-authored-by: jan iversen <jancasacondor@gmail.com>
* Update homeassistant/components/wallbox/__init__.py
review suggestion by janiversen (format only)
Co-authored-by: jan iversen <jancasacondor@gmail.com>
* Processed review comments, include more testing for sensor component
* Isolated the async_add_executor_job to make the solution more async
* add a config flow test
* Revert "add a config flow test"
This reverts commit 9c1af82fff.
* Revert "Isolated the async_add_executor_job to make the solution more async"
This reverts commit 0bf034c331.
* Make component more async and add config flow tests
* Changes based on review comments
* made _ methods in WallboxHub for the 'non-async' call to the API and try-catch. Stored the wallbox in the class.
* moved the coordinator to __init__ and pass it as part of the WallboxHub class
* removed obsolete function in __init__
* removed CONNECTION_CLASS = config_entries.CONN_CLASS_CLOUD_POLL
* fixed spelling and imports on test files
* did isort on component files
Co-authored-by: jan iversen <jancasacondor@gmail.com>
* 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
If we have the mac address from discovery, we can use it to wake
the TV. Currently the TV goes unavailable when you turn it off
as the only way to turn it back on is wake on lan or via the remote.
Users who are not using host networking can use a script instead.