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>
* SCSGATE: Actually cycle through all devices to register
Modify _activate_next_device function to actually cycle through self-devices_to_register instead of simply checking whether there are any and onl registering one
* Deleted extra white lines
* Add STATE_UNAVAILABLE to states that are ignored when writing to the
database. This will avoid a field type error for string if the field
already contains a different type, eg integer.
* Add test for ignored states for influxdb.
* Clean up influxdb tests.
CONF_PURGE_DAYS so it can be changed easier later.
Use 'recorder' domain instead of 'history' domain.
Pass purge_days config directly into Recorder object instead of passing
the config object around.
Issue https://github.com/balloob/home-assistant/issues/1337
When purge_days is set under the history component, recorder.py will
delete all events and states that are older than purge_days days ago.
Currently, this is only done once at start up. A vacuum command is
also run to free up the disk space sqlite would still use after deleting
records.
Change the sensor name schema so nodes are not mixed up. The dot that was pressent before was ignored by home-assistant.
Before name: <skeatchname> <node_id><child_id> eg. wall 107
New name : <skeatchname> <node_id> <child_id> eg. wall 10 7
This will result in a Home Assistant Entity ID of: sensor.wall_10_7