home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
72.2k stars 30.23k forks source link

DLNA_DMR component Exception: restricted is mandatory #45888

Closed ptbsare closed 3 years ago

ptbsare commented 3 years ago

The problem

Logger: homeassistant
Source: components/dlna_dmr/media_player.py:386
First occurred: 上午10:51:17 (4308 occurrences)
Last logged: 下午4:16:05

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 283, in async_update_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 322, in _async_write_ha_state
    attr.update(self.state_attributes or {})
  File "/usr/src/homeassistant/homeassistant/components/media_player/__init__.py", line 841, in state_attributes
    value = getattr(self, attr)
  File "/usr/src/homeassistant/homeassistant/components/dlna_dmr/media_player.py", line 386, in media_title
    return self._device.media_title
  File "/usr/local/lib/python3.8/site-packages/async_upnp_client/profiles/dlna.py", line 780, in media_title
    items = didl_lite.from_xml_string(xml)
  File "/usr/local/lib/python3.8/site-packages/didl_lite/didl_lite.py", line 912, in from_xml_string
    return from_xml_el(xml_el)
  File "/usr/local/lib/python3.8/site-packages/didl_lite/didl_lite.py", line 932, in from_xml_el
    didl_object = didl_object_type.from_xml(child_el)
  File "/usr/local/lib/python3.8/site-packages/didl_lite/didl_lite.py", line 119, in from_xml
    return cls(descriptors=descriptors, **properties)
  File "/usr/local/lib/python3.8/site-packages/didl_lite/didl_lite.py", line 52, in __init__
    self._ensure_required_properties(**properties)
  File "/usr/local/lib/python3.8/site-packages/didl_lite/didl_lite.py", line 63, in _ensure_required_properties
    raise Exception(key + ' is mandatory')
Exception: restricted is mandatory

What is version of Home Assistant Core has the issue?

2021.1.5

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

DLNA_DMR

Link to integration documentation on our website

https://www.home-assistant.io/integrations/dlna_dmr/

Example YAML snippet

# Put your YAML below this line
  - platform: dlna_dmr
    url: http://192.168.195.131:9999/95b715f3-2d64-493c-b120-88b6f6ce6f15.xml
    name: 全屋播放

Anything in the logs that might be useful for us?

# Put your logs below this line
```log
Logger: homeassistant
Source: components/dlna_dmr/media_player.py:386
First occurred: 上午10:51:17 (4308 occurrences)
Last logged: 下午4:16:05

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 283, in async_update_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 322, in _async_write_ha_state
    attr.update(self.state_attributes or {})
  File "/usr/src/homeassistant/homeassistant/components/media_player/__init__.py", line 841, in state_attributes
    value = getattr(self, attr)
  File "/usr/src/homeassistant/homeassistant/components/dlna_dmr/media_player.py", line 386, in media_title
    return self._device.media_title
  File "/usr/local/lib/python3.8/site-packages/async_upnp_client/profiles/dlna.py", line 780, in media_title
    items = didl_lite.from_xml_string(xml)
  File "/usr/local/lib/python3.8/site-packages/didl_lite/didl_lite.py", line 912, in from_xml_string
    return from_xml_el(xml_el)
  File "/usr/local/lib/python3.8/site-packages/didl_lite/didl_lite.py", line 932, in from_xml_el
    didl_object = didl_object_type.from_xml(child_el)
  File "/usr/local/lib/python3.8/site-packages/didl_lite/didl_lite.py", line 119, in from_xml
    return cls(descriptors=descriptors, **properties)
  File "/usr/local/lib/python3.8/site-packages/didl_lite/didl_lite.py", line 52, in __init__
    self._ensure_required_properties(**properties)
  File "/usr/local/lib/python3.8/site-packages/didl_lite/didl_lite.py", line 63, in _ensure_required_properties
    raise Exception(key + ' is mandatory')
Exception: restricted is mandatory

```bash
~ >>> python -m netdisco                                                        
Discovered devices:
dlna_dmr:
 {'host': '192.168.195.131',
  'manufacturer': 'Mi, Inc.',
  'model_name': 'S12',
  'model_number': 'S12',
  'name': 'å°\x8fç\x88±é\x9f³ç®±-5703',
  'port': 9999,
  'serial': None,
  'ssdp_description': 'http://192.168.195.131:9999/95b715f3-2d64-493c-b120-88b6f6ce6f15.xml',
  'udn': 'uuid:95b715f3-2d64-493c-b120-88b6f6ce6f15',
  'upnp_device_type': 'urn:schemas-upnp-org:device:MediaRenderer:1'},

Model: Xiaomi Xiaoai Speaker Pro Product Link: https://www.mi.com/aispeaker-pro/specs Content of http://192.168.195.131:9999/95b715f3-2d64-493c-b120-88b6f6ce6f15.xml:

<?xml version="1.0" encoding="utf-8"?>
<root
    xmlns="urn:schemas-upnp-org:device-1-0">
    <specVersion>
        <major>1</major>
        <minor>1</minor>
    </specVersion>
    <device>
        <deviceType>urn:schemas-upnp-org:device:MediaRenderer:1</deviceType>
        <friendlyName>小爱音箱-5703</friendlyName>
        <manufacturer>Mi, Inc.</manufacturer>
        <modelDescription>The Mi AI SoundBox</modelDescription>
        <modelName>S12</modelName>
        <modelNumber>S12</modelNumber>
        <qq:X_QPlay_SoftwareCapability
            xmlns:qq="http://www.tencent.com">QPlay:2
        </qq:X_QPlay_SoftwareCapability>
        <dlna:X_DLNADOC
            xmlns:dlna="urn:schemas-dlna-org:device-1-0">DMR-1.50
        </dlna:X_DLNADOC>
        <dlna:X_DLNACAP
            xmlns:dlna="urn:schemas-dlna-org:device-1-0">,
        </dlna:X_DLNACAP>
        <UDN>uuid:95b715f3-2d64-493c-b120-88b6f6ce6f15</UDN>
        <serviceList>
            <service>
                <serviceType>urn:schemas-upnp-org:service:AVTransport:1</serviceType>
                <serviceId>urn:upnp-org:serviceId:AVTransport</serviceId>
                <SCPDURL>AVTransport1.xml</SCPDURL>
                <controlURL>/AVTransport/control</controlURL>
                <eventSubURL>/AVTransport/event</eventSubURL>
            </service>
            <service>
                <serviceType>urn:schemas-upnp-org:service:ConnectionManager:1</serviceType>
                <serviceId>urn:upnp-org:serviceId:ConnectionManager</serviceId>
                <SCPDURL>ConnectionManager1.xml</SCPDURL>
                <controlURL>/ConnectionManager/control</controlURL>
                <eventSubURL>/ConnectionManager/event</eventSubURL>
            </service>
            <service>
                <serviceType>urn:schemas-upnp-org:service:RenderingControl:1</serviceType>
                <serviceId>urn:upnp-org:serviceId:RenderingControl</serviceId>
                <SCPDURL>RenderingControl1.xml</SCPDURL>
                <controlURL>/RenderingControl/control</controlURL>
                <eventSubURL>/RenderingControl/event</eventSubURL>
            </service>
            <service>
                <serviceType>urn:xiaomi-com:service:Queue:1</serviceType>
                <serviceId>urn:xiaomi-com:serviceId:Queue</serviceId>
                <SCPDURL>Queue1.xml</SCPDURL>
                <controlURL>Queue1/control</controlURL>
                <eventSubURL>Queue1/event</eventSubURL>
            </service>
            <service>
                <serviceType>urn:xiaomi-com:service:Playlist:1</serviceType>
                <serviceId>urn:xiaomi-com:serviceId:Playlist</serviceId>
                <SCPDURL>Playlist1.xml</SCPDURL>
                <controlURL>Playlist1/control</controlURL>
                <eventSubURL>Playlist1/event</eventSubURL>
            </service>
            <service>
                <serviceType>urn:schemas-tencent-com:service:QPlay:1</serviceType>
                <serviceId>urn:tencent-com:serviceId:QPlay</serviceId>
                <SCPDURL>QPlay1.xml</SCPDURL>
                <controlURL>QPlay1/control</controlURL>
                <eventSubURL>QPlay1/event</eventSubURL>
            </service>
            <service>
                <serviceType>urn:xiaomi-com:service:Favorites:1</serviceType>
                <serviceId>urn:xiaomi-com:serviceId:Favorites</serviceId>
                <SCPDURL>Favorites1.xml</SCPDURL>
                <controlURL>Favorites1/control</controlURL>
                <eventSubURL>Favorites1/event</eventSubURL>
            </service>
        </serviceList>
    </device>
</root>
ptbsare commented 3 years ago

Code line: https://github.com/StevenLooman/python-didl-lite/blob/3acaa31e51b7055a1e3812c2722d3e11928cbdb6/didl_lite/didl_lite.py#L65

probot-home-assistant[bot] commented 3 years ago

dlna_dmr documentation dlna_dmr source (message by IssueLinks)

Vebryn commented 3 years ago

Hello,

Same here, I'm using core-2021.3.3 version.

Best regards

2021-03-29 15:32:23 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 621, in _update_entity_states
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 282, in async_update_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 321, in _async_write_ha_state
    attr.update(self.state_attributes or {})
  File "/usr/src/homeassistant/homeassistant/components/media_player/__init__.py", line 843, in state_attributes
    value = getattr(self, attr)
  File "/usr/src/homeassistant/homeassistant/components/dlna_dmr/media_player.py", line 388, in media_title
    return self._device.media_title
  File "/usr/local/lib/python3.8/site-packages/async_upnp_client/profiles/dlna.py", line 780, in media_title
    items = didl_lite.from_xml_string(xml)
  File "/usr/local/lib/python3.8/site-packages/didl_lite/didl_lite.py", line 912, in from_xml_string
    return from_xml_el(xml_el)
  File "/usr/local/lib/python3.8/site-packages/didl_lite/didl_lite.py", line 932, in from_xml_el
    didl_object = didl_object_type.from_xml(child_el)
  File "/usr/local/lib/python3.8/site-packages/didl_lite/didl_lite.py", line 119, in from_xml
    return cls(descriptors=descriptors, **properties)
  File "/usr/local/lib/python3.8/site-packages/didl_lite/didl_lite.py", line 52, in __init__
    self._ensure_required_properties(**properties)
  File "/usr/local/lib/python3.8/site-packages/didl_lite/didl_lite.py", line 63, in _ensure_required_properties
    raise Exception(key + ' is mandatory')
Exception: restricted is mandatory
media_player:
  - platform: dlna_dmr
    url: http://192.168.1.18:62158/
service: media_player.play_media
data:
  media_content_id: 'media-source://media/file_example_MP3_700KB.mp3'
  media_content_type: music/mp3
target:
  entity_id: media_player.dlna_digital_media_renderer
Vebryn commented 3 years ago

I reset my HomeAssistant configuration with 2021.4.4 version. Issue is gone ! Hope, it will help !

StevenLooman commented 3 years ago

Yes, this is recently fixed. Please update and this specific error should no longer appear.

StevenLooman commented 3 years ago

I'm closing this issue. If this is still happening please let me know through this issue.