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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Media players cause alexa to fail discovering any devices. #34029

Closed
Petro31 opened this issue Apr 11, 2020 · 15 comments · Fixed by #36285
Closed

Media players cause alexa to fail discovering any devices. #34029

Petro31 opened this issue Apr 11, 2020 · 15 comments · Fixed by #36285
Assignees

Comments

@Petro31
Copy link
Contributor

Petro31 commented Apr 11, 2020

The problem

Certain media players cause Nabu Casa and Alexa SmartHome Skill to fail discovering ALL devices produced by the integration.

@eifinger mentioned his Denon media players in a chat on Discord causing issues.

For me it's 2 Yamaha Receivers (yamaha network receiver).

Here is information on the 2 recievers:

media_player.yamaha_receiver on source_list: AirPlay, Echo, Empty, NET RADIO, Phone, Playstation 4, Roku, SERVER, Switch, TUNER, Xbox One, iPod (USB) sound_mode_list: Hall in Munich, Hall in Vienna, Chamber, Cellar Club, The Roxy Theatre, The Bottom Line, Sports, Action Game, Roleplaying Game, Music Video, Standard, Spectacle, Sci-Fi, Adventure, Drama, Mono Movie, Surround Decoder, 2ch Stereo, 7ch Stereo volume_level: 0.7 is_volume_muted: false source: Xbox One sound_mode: Sci-Fi friendly_name: Yamaha Zone One supported_features: 84364 icon: mdi:numeric-1-box
media_player.yamaha_receiver_zone_2 on source_list: AirPlay, Echo, NET RADIO, Phone, SERVER, TUNER, iPod (USB) volume_level: 0.7 is_volume_muted: false source: Echo friendly_name: Yamaha Zone Two supported_features: 84364 icon: mdi:numeric-2-box

It should be interesting to note that the 2 following universal media_players transfer over properly with discovery:

media_player.dining_room_speakers on source_list: AirPlay, Echo, NET RADIO, Phone, SERVER, TUNER, iPod (USB) volume_level: 0.7 is_volume_muted: false source: Echo active_child: media_player.yamaha_receiver_zone_2 friendly_name: Dining Room Speakers supported_features: 84364
media_player.living_room_speakers on source_list: AirPlay, Echo, Empty, NET RADIO, Phone, Playstation 4, Roku, SERVER, Switch, TUNER, Xbox One, iPod (USB) volume_level: 0.7 is_volume_muted: false source: Xbox One active_child: media_player.yamaha_receiver friendly_name: Living Room Speakers supported_features: 84364

Environment

Buster (Debian 10) on a Nuc running home assistant supervised.

  • Home Assistant Core release with the issue: 107.7
  • Last working Home Assistant Core release (if known): Unknown, first attempt outside universal media integration.
  • Operating environment (Home Assistant/Supervised/Docker/venv): Debian 10
  • Integration causing this issue: Alexa, NabuCasa Alexa. Specifically connecting via the following configuration:
alexa:
  smart_home:
    ... etc ...

Problem-relevant configuration.yaml

Problem is simple. With the 2 yamaha media_players, discovery on alexa's side fails to find ANY devices. Without the 2 media_players, discovery works fine.

Here's a snippit of the json response to alexa. This is just 1 media player item.

        {
          "capabilities": [
            {
              "interface": "Alexa.PowerController",
              "properties": {
                "proactivelyReported": true,
                "retrievable": true,
                "supported": [
                  {
                    "name": "powerState"
                  }
                ]
              },
              "type": "AlexaInterface",
              "version": "3"
            },
            {
              "interface": "Alexa.Speaker",
              "properties": {
                "proactivelyReported": true,
                "retrievable": true,
                "supported": [
                  {
                    "name": "volume"
                  },
                  {
                    "name": "muted"
                  }
                ]
              },
              "type": "AlexaInterface",
              "version": "3"
            },
            {
              "interface": "Alexa.PlaybackController",
              "supportedOperations": [
                "Play"
              ],
              "type": "AlexaInterface",
              "version": "3"
            },
            {
              "interface": "Alexa.PlaybackStateReporter",
              "properties": {
                "proactivelyReported": true,
                "retrievable": true,
                "supported": [
                  {
                    "name": "playbackState"
                  }
                ]
              },
              "type": "AlexaInterface",
              "version": "3"
            },
            {
              "inputs": [
                {
                  "name": "TUNER"
                }
              ],
              "interface": "Alexa.InputController",
              "type": "AlexaInterface",
              "version": "3"
            },
            {
              "interface": "Alexa.EqualizerController",
              "properties": {
                "proactivelyReported": false,
                "retrievable": false,
                "supported": [
                  {
                    "name": "mode"
                  }
                ]
              },
              "type": "AlexaInterface",
              "version": "3"
            },
            {
              "interface": "Alexa.EndpointHealth",
              "properties": {
                "proactivelyReported": true,
                "retrievable": true,
                "supported": [
                  {
                    "name": "connectivity"
                  }
                ]
              },
              "type": "AlexaInterface",
              "version": "3"
            },
            {
              "interface": "Alexa",
              "type": "AlexaInterface",
              "version": "3"
            }
          ],
          "cookie": {},
          "description": "media_player.yamaha_receiver_zone_2 via Home Assistant",
          "displayCategories": [
            "TV"
          ],
          "endpointId": "media_player#yamaha_receiver_zone_2",
          "friendlyName": "Zone One",
          "manufacturerName": "Home Assistant"
        },

Here's a VALID working one

        {
          "capabilities": [
            {
              "interface": "Alexa.PowerController",
              "properties": {
                "proactivelyReported": true,
                "retrievable": true,
                "supported": [
                  {
                    "name": "powerState"
                  }
                ]
              },
              "type": "AlexaInterface",
              "version": "3"
            },
            {
              "interface": "Alexa.Speaker",
              "properties": {
                "proactivelyReported": true,
                "retrievable": true,
                "supported": [
                  {
                    "name": "volume"
                  },
                  {
                    "name": "muted"
                  }
                ]
              },
              "type": "AlexaInterface",
              "version": "3"
            },
            {
              "interface": "Alexa.PlaybackController",
              "supportedOperations": [
                "Play"
              ],
              "type": "AlexaInterface",
              "version": "3"
            },
            {
              "interface": "Alexa.PlaybackStateReporter",
              "properties": {
                "proactivelyReported": true,
                "retrievable": true,
                "supported": [
                  {
                    "name": "playbackState"
                  }
                ]
              },
              "type": "AlexaInterface",
              "version": "3"
            },
            {
              "inputs": [
                {
                  "name": "TUNER"
                }
              ],
              "interface": "Alexa.InputController",
              "type": "AlexaInterface",
              "version": "3"
            },
            {
              "interface": "Alexa.EqualizerController",
              "properties": {
                "proactivelyReported": false,
                "retrievable": false,
                "supported": [
                  {
                    "name": "mode"
                  }
                ]
              },
              "type": "AlexaInterface",
              "version": "3"
            },
            {
              "interface": "Alexa.EndpointHealth",
              "properties": {
                "proactivelyReported": true,
                "retrievable": true,
                "supported": [
                  {
                    "name": "connectivity"
                  }
                ]
              },
              "type": "AlexaInterface",
              "version": "3"
            },
            {
              "interface": "Alexa",
              "type": "AlexaInterface",
              "version": "3"
            }
          ],
          "cookie": {},
          "description": "media_player.dining_room_speakers via Home Assistant",
          "displayCategories": [
            "TV"
          ],
          "endpointId": "media_player#dining_room_speakers",
          "friendlyName": "Dining Room Speakers",
          "manufacturerName": "Home Assistant"
        },

unfortunately, it doesn't look like there are any differences that would be causing the problem. It may be related to the communication process that media_players go through when adding them to Alexa.

Traceback/Error logs

Additional information

@probot-home-assistant
Copy link

Hey there @home-assistant/cloud, @ochlocracy, mind taking a look at this issue as its been labeled with a integration (alexa) you are listed as a codeowner for? Thanks!

@eifinger
Copy link
Contributor

As petro said, I have the same problem for a few releases now.
My denvon avr:

source_list: AUX, Blu-ray, Bluetooth, CBL/SAT, DVD/Blu-ray, Favorites, Game, Internet Radio, Media Player, Media Server, Online Music, Spotify, TV Audio, Tuner, iPod/USB
sound_mode_list: MUSIC, MOVIE, GAME, AUTO, STANDARD, VIRTUAL, MATRIX, ROCK ARENA, JAZZ CLUB, VIDEO GAME, MONO MOVIE, DIRECT, PURE DIRECT, DOLBY DIGITAL, DTS SURROUND, MCH STEREO, STEREO, ALL ZONE STEREO
friendly_name: Denon AVR-X1300W
supported_features: 85949

@ochlocracy
Copy link
Member

@Petro31 I suspect it's the Alexa.EqualizerController capability causing the problem since it doesn't contain any supported configuration.

To help diagnose, customize the entity for the media player, and override the supported_features attribute to subtract 65536 from the value, 18828 should be the result for your Yamaha Receivers. Restart HA and then retry discovering devices. Report back if discovery worked.

Remove the customization when finished.

@ochlocracy
Copy link
Member

@eifinger Can you provide the relevant entity capability information from your discovery response? I just need to section with your Denon Receiver.

https://www.home-assistant.io/integrations/alexa.smart_home/#debugging

@kfcook
Copy link
Contributor

kfcook commented Apr 13, 2020

I'm having the same issue. I believe I've located the problem. I'm using Yamaha receivers (two different models). Looking at the JSON that's passed to the Alexa service, I see this on the non-working receiver under "capabilities":

"configurations":{  
  "modes":{ 
    "supported":[  
    ]  
  } 
}

However, this is missing entirely on the working receiver.

Looking at the states, I can see differences there as well:

Working:

media_player.yamaha_receiver_living_room on source_list: DVR, AirPlay, Apple TV, Bluetooth, Fire TV, Spotify
volume_level: 0.6599999999999999
is_volume_muted: false
source: DVR
friendly_name: Yamaha Receiver Living Room
supported_features: 84364

Not working:

media_player.yamaha_receiver_master_bedroom on source_list: DVR, AirPlay, Apple TV, Bluetooth, Fire TV, Spotify, V-AUX
sound_mode_list: Hall in Munich, Hall in Vienna, Chamber, Cellar Club, The Roxy Theatre, The Bottom Line, Sports, Action Game, Roleplaying Game, Music Video, Standard, Spectacle, Sci-Fi, Adventure, Drama, Mono Movie, Surround Decoder, 2ch Stereo, 7ch Stereo
volume_level: 0.625
is_volume_muted: false
source: Apple TV
sound_mode: 2ch Stereo
friendly_name: Yamaha Receiver Master Bedroom
supported_features: 84364

My theory is that the presence of a "sound_mode_list" in the media_player component causes the Alexa component to generate a blank "configurations"-"modes" list in the JSON sent to Alexa. This must error the device discovery process out.

Please let me know if you'd like me to gather any more information!

@Petro31
Copy link
Contributor Author

Petro31 commented Apr 13, 2020

On an semi-related note. I noticed my workaround is not working either. Discovery is happening but the device does not respond to volume voice commands. Alexa keeps saying that 'it doesn't support that', when it did 2 days ago.

@eifinger
Copy link
Contributor

eifinger commented Apr 13, 2020

@ochlocracy here is my discovery response for denon:

{
    'capabilities': [{
            'interface': 'Alexa.PowerController',
            'properties': {
                'proactivelyReported': True,
                'retrievable': True,
                'supported': [{
                    'name': 'powerState'
                }]
            },
            'type': 'AlexaInterface',
            'version': '3'
        },
        {
            'interface': 'Alexa.Speaker',
            'properties': {
                'proactivelyReported': True,
                'retrievable': True,
                'supported': [{
                        'name': 'volume'
                    },
                    {
                        'name': 'muted'
                    }
                ]
            },
            'type': 'AlexaInterface',
            'version': '3'
        },
        {
            'interface': 'Alexa.PlaybackController',
            'supportedOperations': ['Next',
                'Pause',
                'Play',
                'Previous'
            ],
            'type': 'AlexaInterface',
            'version': '3'
        },
        {
            'interface': 'Alexa.PlaybackStateReporter',
            'properties': {
                'proactivelyReported': True,
                'retrievable': True,
                'supported': [{
                    'name': 'playbackState'
                }]
            },
            'type': 'AlexaInterface',
            'version': '3'
        },
        {
            'inputs': [{
                    'name': 'AUX '
                    '1'
                },
                {
                    'name': 'BLURAY'
                },
                {
                    'name': 'GAME'
                },
                {
                    'name': 'MEDIA '
                    'PLAYER'
                },
                {
                    'name': 'TUNER'
                }
            ],
            'interface': 'Alexa.InputController',
            'type': 'AlexaInterface',
            'version': '3'
        },
        {
            'interface': 'Alexa.ChannelController',
            'type': 'AlexaInterface',
            'version': '3'
        },
        {
            'configurations': {
                'modes': {
                    'supported': [{
                            'name': 'MUSIC'
                        },
                        {
                            'name': 'MOVIE'
                        }
                    ]
                }
            },
            'interface': 'Alexa.EqualizerController',
            'properties': {
                'proactivelyReported': False,
                'retrievable': False,
                'supported': [{
                    'name': 'mode'
                }]
            },
            'type': 'AlexaInterface',
            'version': '3'
        },
        {
            'interface': 'Alexa.EndpointHealth',
            'properties': {
                'proactivelyReported': True,
                'retrievable': True,
                'supported': [{
                    'name': 'connectivity'
                }]
            },
            'type': 'AlexaInterface',
            'version': '3'
        },
        {
            'interface': 'Alexa',
            'type': 'AlexaInterface',
            'version': '3'
        }
    ],
    'cookie': {},
    'description': 'media_player.denon_avr_x1300w '
    'via Home '
    'Assistant',
    'displayCategories': ['TV'],
    'endpointId': 'media_player#denon_avr_x1300w',
    'friendlyName': 'Receiver',
    'manufacturerName': 'Home '
    'Assistant'
}

@raidolo
Copy link

raidolo commented Apr 14, 2020

@ochlocracy here is my discovery from the media players section ( not the complete discovery tough, just a snippet):

{
               "displayCategories":[
                  "TV"
               ],
               "cookie":{

               },
               "endpointId":"media_player#denon_avr_x2000",
               "friendlyName":"Denon AVR-X2000",
               "description":"media_player.denon_avr_x2000 via Home Assistant",
               "manufacturerName":"Home Assistant",
               "capabilities":[
                  {
                     "type":"AlexaInterface",
                     "interface":"Alexa.PowerController",
                     "version":"3",
                     "properties":{
                        "supported":[
                           {
                              "name":"powerState"
                           }
                        ],
                        "proactivelyReported":True,
                        "retrievable":True
                     }
                  },
                  {
                     "type":"AlexaInterface",
                     "interface":"Alexa.Speaker",
                     "version":"3",
                     "properties":{
                        "supported":[
                           {
                              "name":"volume"
                           },
                           {
                              "name":"muted"
                           }
                        ],
                        "proactivelyReported":True,
                        "retrievable":True
                     }
                  },
                  {
                     "type":"AlexaInterface",
                     "interface":"Alexa.InputController",
                     "version":"3",
                     "inputs":[
                        {
                           "name":"AUX 1"
                        },
                        {
                           "name":"BLURAY"
                        },
                        {
                           "name":"CD"
                        },
                        {
                           "name":"DVD"
                        },
                        {
                           "name":"GAME"
                        },
                        {
                           "name":"MEDIA PLAYER"
                        },
                        {
                           "name":"TUNER"
                        }
                     ]
                  },
                  {
                     "type":"AlexaInterface",
                     "interface":"Alexa.EqualizerController",
                     "version":"3",
                     "properties":{
                        "supported":[
                           {
                              "name":"mode"
                           }
                        ],
                        "proactivelyReported":False,
                        "retrievable":False
                     },
                     "configurations":{
                        "modes":{
                           "supported":[
                              {
                                 "name":"MUSIC"
                              },
                              {
                                 "name":"MOVIE"
                              }
                           ]
                        }
                     }
                  },
                  {
                     "type":"AlexaInterface",
                     "interface":"Alexa.EndpointHealth",
                     "version":"3",
                     "properties":{
                        "supported":[
                           {
                              "name":"connectivity"
                           }
                        ],
                        "proactivelyReported":True,
                        "retrievable":True
                     }
                  },
                  {
                     "type":"AlexaInterface",
                     "interface":"Alexa",
                     "version":"3"
                  }
               ]
            },
            {
               "displayCategories":[
                  "TV"
               ],
               "cookie":{

               },
               "endpointId":"media_player#televisione",
               "friendlyName":"Televisione",
               "description":"media_player.televisione via Home Assistant",
               "manufacturerName":"Home Assistant",
               "capabilities":[
                  {
                     "type":"AlexaInterface",
                     "interface":"Alexa.PowerController",
                     "version":"3",
                     "properties":{
                        "supported":[
                           {
                              "name":"powerState"
                           }
                        ],
                        "proactivelyReported":True,
                        "retrievable":True
                     }
                  },
                  {
                     "type":"AlexaInterface",
                     "interface":"Alexa.Speaker",
                     "version":"3",
                     "properties":{
                        "supported":[
                           {
                              "name":"volume"
                           },
                           {
                              "name":"muted"
                           }
                        ],
                        "proactivelyReported":True,
                        "retrievable":True
                     }
                  },
                  {
                     "type":"AlexaInterface",
                     "interface":"Alexa.PlaybackController",
                     "version":"3",
                     "supportedOperations":[
                        "Next",
                        "Pause",
                        "Play",
                        "Previous"
                     ]
                  },
                  {
                     "type":"AlexaInterface",
                     "interface":"Alexa.PlaybackStateReporter",
                     "version":"3",
                     "properties":{
                        "supported":[
                           {
                              "name":"playbackState"
                           }
                        ],
                        "proactivelyReported":True,
                        "retrievable":True
                     }
                  },
                  {
                     "type":"AlexaInterface",
                     "interface":"Alexa.ChannelController",
                     "version":"3"
                  },
                  {
                     "type":"AlexaInterface",
                     "interface":"Alexa.EndpointHealth",
                     "version":"3",
                     "properties":{
                        "supported":[
                           {
                              "name":"connectivity"
                           }
                        ],
                        "proactivelyReported":True,
                        "retrievable":True
                     }
                  },
                  {
                     "type":"AlexaInterface",
                     "interface":"Alexa",
                     "version":"3"
                  }
               ]
            },
            {
               "displayCategories":[
                  "TV"
               ],
               "cookie":{

               },
               "endpointId":"media_player#spotify_REDACTED",
               "friendlyName":"Spotify REDACTED",
               "description":"media_player.spotify_REDACTED via Home Assistant",
               "manufacturerName":"Home Assistant",
               "capabilities":[
                  {
                     "type":"AlexaInterface",
                     "interface":"Alexa.PowerController",
                     "version":"3",
                     "properties":{
                        "supported":[
                           {
                              "name":"powerState"
                           }
                        ],
                        "proactivelyReported":True,
                        "retrievable":True
                     }
                  },
                  {
                     "type":"AlexaInterface",
                     "interface":"Alexa.Speaker",
                     "version":"3",
                     "properties":{
                        "supported":[
                           {
                              "name":"volume"
                           }
                        ],
                        "proactivelyReported":True,
                        "retrievable":True
                     }
                  },
                  {
                     "type":"AlexaInterface",
                     "interface":"Alexa.PlaybackController",
                     "version":"3",
                     "supportedOperations":[
                        "Next",
                        "Pause",
                        "Play",
                        "Previous"
                     ]
                  },
                  {
                     "type":"AlexaInterface",
                     "interface":"Alexa.PlaybackStateReporter",
                     "version":"3",
                     "properties":{
                        "supported":[
                           {
                              "name":"playbackState"
                           }
                        ],
                        "proactivelyReported":True,
                        "retrievable":True
                     }
                  },
                  {
                     "type":"AlexaInterface",
                     "interface":"Alexa.SeekController",
                     "version":"3"
                  },
                  {
                     "type":"AlexaInterface",
                     "interface":"Alexa.ChannelController",
                     "version":"3"
                  },
                  {
                     "type":"AlexaInterface",
                     "interface":"Alexa.EndpointHealth",
                     "version":"3",
                     "properties":{
                        "supported":[
                           {
                              "name":"connectivity"
                           }
                        ],
                        "proactivelyReported":True,
                        "retrievable":True
                     }
                  },
                  {
                     "type":"AlexaInterface",
                     "interface":"Alexa",
                     "version":"3"
                  }
               ]
            },

@IFTTD
Copy link

IFTTD commented Apr 17, 2020

@Petro31 I suspect it's the Alexa.EqualizerController capability causing the problem since it doesn't contain any supported configuration.

To help diagnose, customize the entity for the media player, and override the supported_features attribute to subtract 65536 from the value, 18828 should be the result for your Yamaha Receivers. Restart HA and then retry discovering devices. Report back if discovery worked.

Remove the customization when finished.

I did this for both my Yamaha & Denon and now Alexa can discovered them both as well as control them.

@raidolo
Copy link

raidolo commented Apr 27, 2020

I've done some other tests, I can confirm that removing ONLY the media_player in the alexa included domains did the trick, and the discovery worked fine.

@donkawechico
Copy link
Contributor

donkawechico commented May 14, 2020

Same issue with my Denon AVR-X3500H. It worked for the first night I configured it, but not the following morning. My hunch is that it's because I turned off the receiver that night -- I've noticed that the media player entity won't get created if the receiver is off while Home Assistant starts (by "off" I mean still powered, but red light showing under power button).

@ochlocracy 's suggestion above fixed the issue (thanks @ochlocracy !). Specifically:

  1. Turning on Receiver
  2. Restarting Home Assistant (with denonavr configured in configuration.yaml)
  3. Going to "Customizations" and selecting media_player.denon_receiver (or whatever)
  4. Overriding the "supported_features" property with 3468 (subtracting 65536 from the original value of 69004)
  5. Restarting, and rediscovering in alexa

I'm now able to see the media player in Alexa and control it with my voice.

Happy to help troubleshoot, if testers are needed.

@iophobia
Copy link

Just checking in here with a discovery problem of my Denon AVR-X4500H. Would've liked to try the workaround of "supported-features" customization but since my X4500H only shows 65036, I'd be ending up with a negative value when substracting 65536.
Any model-specific tips, @ochlocracy?

@balloob
Copy link
Member

balloob commented May 30, 2020

I have just opened PR #36285 with a potential fix. Could someone test it?

@starkillerOG
Copy link
Contributor

@balloob I am on version 0.115.6 of HomeAssistant which schould already include PR #36285, However my Marantz receiver (DenonAVR integration) blocks alexa from discovering any devices (also other devices than the Marantz).
If I change the supported features of the Marantz from 85949 to 20413 (substract 65536 for SUPPORT_SELECT_SOUND_MODE) alexa works again and discovers all my devices including the Marantz.
However obviously that means I lose the sound_mode support of the Marantz which I do use in HomeAssistant (actually written the sound_mode support code of HomeAssisant myself).

Bassically PR #36285 did not solve the issue for the DenonAVR integration.
@balloob Schould I open another issue, or can you re-open this issue?
I am happy to test if you like.

@balloob
Copy link
Member

balloob commented Oct 24, 2020

Please open a new issue if you still encounter this issue on the latest version of Home Assistant.

@home-assistant home-assistant locked as resolved and limited conversation to collaborators Oct 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.