Sonos Play:1 repeatedly going "unavailable"

My Sonos Play:1 repeatedly becomes “unavailable” in home assistant, seemingly at least once every 10 minutes or so.

I am running Home Assistant inside the raspberrypi3-homeassistant:0.90.0 docker container with host networking enabled.

My Sonos has a statically assigned IP address of 192.168.0.28, which I can ping from the Pi without any drop-outs.

Here is my configuraiton;

homeassistant:
  name: Home
  latitude: 0
  longitude: 0
  elevation: 0
  unit_system: metric
  time_zone: Europe/London
  customize: !include customize.yaml

frontend:

system_health:

history:
  include:
    entities:
      - media_player.bedroom

sonos:
  media_player:
    hosts:
      - 192.168.0.28

There are some messages in the log about the Sonos media_player component taking too long to update which align with the “unavailable” states I’m seeing, but there aren’t messages for every time it becomes unavailable;

2019-03-21 02:07:01 WARNING (MainThread) [homeassistant.helpers.entity] Update of media_player.bedroom is taking over 10 seconds
2019-03-21 02:07:01 WARNING (MainThread) [homeassistant.components.media_player] Updating sonos media_player took longer than the scheduled update interval 0:00:10
2019-03-21 02:07:12 WARNING (MainThread) [homeassistant.components.media_player] Updating sonos media_player took longer than the scheduled update interval 0:00:10
2019-03-21 02:07:23 WARNING (MainThread) [homeassistant.components.media_player] Updating sonos media_player took longer than the scheduled update interval 0:00:10
2019-03-21 03:14:19 WARNING (MainThread) [homeassistant.helpers.entity] Update of media_player.bedroom is taking over 10 seconds
2019-03-21 03:14:20 WARNING (MainThread) [homeassistant.components.media_player] Updating sonos media_player took longer than the scheduled update interval 0:00:10
2019-03-21 03:14:31 WARNING (MainThread) [homeassistant.components.media_player] Updating sonos media_player took longer than the scheduled update interval 0:00:10
2019-03-21 03:14:42 WARNING (MainThread) [homeassistant.components.media_player] Updating sonos media_player took longer than the scheduled update interval 0:00:10
2019-03-21 03:14:53 WARNING (MainThread) [homeassistant.components.media_player] Updating sonos media_player took longer than the scheduled update interval 0:00:10
2019-03-21 03:15:04 WARNING (MainThread) [homeassistant.components.media_player] Updating sonos media_player took longer than the scheduled update interval 0:00:10
2019-03-21 03:15:15 WARNING (MainThread) [homeassistant.components.media_player] Updating sonos media_player took longer than the scheduled update interval 0:00:10
2019-03-21 03:19:03 WARNING (MainThread) [homeassistant.helpers.entity] Update of media_player.bedroom is taking over 10 seconds
2019-03-21 03:19:03 WARNING (MainThread) [homeassistant.components.media_player] Updating sonos media_player took longer than the scheduled update interval 0:00:10
2019-03-21 03:19:14 WARNING (MainThread) [homeassistant.components.media_player] Updating sonos media_player took longer than the scheduled update interval 0:00:10
2019-03-21 03:19:25 WARNING (MainThread) [homeassistant.components.media_player] Updating sonos media_player took longer than the scheduled update interval 0:00:10
2019-03-21 03:44:09 WARNING (MainThread) [homeassistant.helpers.entity] Update of media_player.bedroom is taking over 10 seconds
2019-03-21 03:44:10 WARNING (MainThread) [homeassistant.components.media_player] Updating sonos media_player took longer than the scheduled update interval 0:00:10
2019-03-21 05:52:47 WARNING (MainThread) [homeassistant.helpers.entity] Update of media_player.bedroom is taking over 10 seconds
2019-03-21 05:52:48 WARNING (MainThread) [homeassistant.components.media_player] Updating sonos media_player took longer than the scheduled update interval 0:00:10
2019-03-21 05:52:59 WARNING (MainThread) [homeassistant.components.media_player] Updating sonos media_player took longer than the scheduled update interval 0:00:10
2019-03-21 05:53:10 WARNING (MainThread) [homeassistant.components.media_player] Updating sonos media_player took longer than the scheduled update interval 0:00:10
2019-03-21 07:05:08 WARNING (MainThread) [homeassistant.helpers.entity] Update of media_player.bedroom is taking over 10 seconds
2019-03-21 07:05:09 WARNING (MainThread) [homeassistant.components.media_player] Updating sonos media_player took longer than the scheduled update interval 0:00:10
2019-03-21 07:21:45 WARNING (MainThread) [homeassistant.helpers.entity] Update of media_player.bedroom is taking over 10 seconds
2019-03-21 07:21:46 WARNING (MainThread) [homeassistant.components.media_player] Updating sonos media_player took longer than the scheduled update interval 0:00:10
2019-03-21 07:21:57 WARNING (MainThread) [homeassistant.components.media_player] Updating sonos media_player took longer than the scheduled update interval 0:00:10
2019-03-21 08:53:34 WARNING (MainThread) [homeassistant.helpers.entity] Update of media_player.bedroom is taking over 10 seconds
2019-03-21 08:53:35 WARNING (MainThread) [homeassistant.components.media_player] Updating sonos media_player took longer than the scheduled update interval 0:00:10

Here’s what I see from the history component for last night;

It looks like setting scan_interval to a higher value (default of 10 for media players) has fixed this;

sonos:
  scan_interval: 30
  media_player:
    hosts:
      - 192.168.0.28
1 Like

I still get it on 1 of mine… always the same 1 which is odd

media_player.diningroom_sonos - unavailable

1 HA reboot later and it is back for a few hours… has been like this for 2 years… always this same 1

@MarkR Have you manually specified an IP or are you using HA’s discovery feature?

specified a static IP

How strange! Increasing the scan interval worked fine for me as I believe I was overloading the Pi before. Do you get any log messages regarding the Sonos component taking too long to update?

I do indeed… always have on the Rpi, then NUC and now in a docker on a i5 PC… it did stop for a few months, but strangely came back…

Thanks for the replies ! :smiley: