Some Sonos devices (e.g SUB) does not have
a upnp media renderer, but are discovered as sonos
devices. Creating a SonosDevice object from such a
device will fail.
When a sonos player goes offline an endless stream of
exceptions is raised. That happens because homeassistant keeps trying
to refresh its status.
This can happen even when a sonos player has gone offline **before**
homeassistant is started. The sonos players take some time before
realizing one of their mates is no longer online, leading to the same
stream of exceptions inside of homeassistant.
Three types of exceptions of can be raised:
- `requests.packages.urllib3.exceptions.MaxRetryError`
- `requests.packages.urllib3.exceptions.NewConnectionError`
- `TimeoutError`
It's not possible to handle all of them with a single `except` block
because they are raised in a random order and after some delays. That
means a 2nd or 3rd exception can take place while handling the 1st one.
The only solution is to check whether a a player is actually reachable
by attempting to connect to a service that must be running on it.
Also all the players in a 'unknown' state should not be polled by
homeassistant (despite of their brand).
I'm going to upstream the `_is_reachable` method I added to the
`sonos.py` file into `SoCo`. In the meantime we must ship this piece
of code with homeassistant.
Signed-off-by: Flavio Castelli <fcastelli@suse.com>
Text Update
Additional additions and better support for volume, and mute. Cleanup
Added rxv to requirements_all
Added yamaha.py to .coveragerc
Made uppercase, and removed tabs
Added requirements variable
Added doc string for lint
Removed global variable, and simplified state as per balloobs suggestion
Refactored the component with balloobs suggestions
-Added import in the method
- Only get receiver information on init
- A bit of cleanup
Remove up and down volume
Uneeded as this is handled by set volume instead
Fixed a lint build error
More lint fixes
Removed unused imports
Lint Fixes
Simplified if statement
Minor refactoring since the init calls update.
Fixed lint error
Just variable naming change
Added support for an optional name for the receiver.
Better error handling, a bit of refactoring based on balloobs suggestions
Fixed lint error.
Another lint error fix
Changed raise to return
Disable pylint error handling
Pylint broad exception
Made exception handling in the setup platform instead of the constructor.
Lint error fix
Refactored the way devices are found. This allows for multiple receivers
Because the LMS discovery mechanism uses the SlimProto protocol to discover the
presence of a Logitech Media server which operates on port 3483/udp and
3483/tcp. But HA uses a different 'CLI' protocol that is typically on port
9090/tcp to query player state.
However the CLI port number is configurable and if someone runs the CLI on a
different port, and has the server configured in configuration.yaml, we get an
error in the logs when we try to connect to 9090/tcp when we find the server
through discovery. Because of the way local slim player discover the server
using SlimProto we can be fairly certain only a single server will run on a
given IP address so if one is already configured with a user defined port, we
should ignore the discovered one that assumes the default port.
* Log error for services called without required attributes, in
media_player, notify and thermostat platforms.
* Add fan property and methods in thermostat demo component.
* Add tests for notify file and thermostat demo component.
* Increase coverage of tests for media_player, notify and thermostat
platforms.
* Fix some PEP issues, but not all. Tests still have old linting
errors.
* Add tests to reach full coverage for helpers/state.py.
* Refactor reproduce_state function in helpers/state.py. Add two dicts,
as global constants, service_attributes and service_to_state. Use
these in combination with the dict of services per domain from
ServiceRegistry, to find the correct service to use in a scene state
change.
* Use break statement in for loop, to break if service was selected
to update state, in preference to update state attributes, ie state
update takes precedence.
* Add ATTR_CODE and ATTR_CODE_FORMAT in const. Import these in
alarm_control_panel and lock platforms instead of making duplicate
constants in multiple modules.
* Use ATTR_MEDIA_CONTENT_TYPE and ATTR_MEDIA_CONTENT_ID in media_player
platform in SERVICE_PLAY_MEDIA and play_media methods, instead of
'media_type' and 'media_id'.
* Fix PEP257 in modified files.
Currently we interact with players regardless of thir coordinator
role, hence soco.exceptions.SoCoSlaveException are thrown. The use
of the decorator for each interactive method should address this
* From configuration.yaml is easy to provide iterable elements like lists,
this adds the possibility to provide a list of Sonos hosts using a yaml
and still supports the comma separated string version
* Remove superfluous host reassignment