Properly connect sensors to hub (#21414)
* Properly connect sensors to hub Refs #20958 * Don't connect (merge) with main device * Provide manufacturer * Linting * Do connect upnp-sensors to main device * Linting * Fix requirements_all.txt
This commit is contained in:
parent
adca598172
commit
d1f75fcf32
2 changed files with 13 additions and 3 deletions
|
@ -8,8 +8,10 @@ from datetime import datetime
|
|||
import logging
|
||||
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers import device_registry as dr
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
|
||||
from .const import DOMAIN as DOMAIN_UPNP, SIGNAL_REMOVE_SENSOR
|
||||
|
||||
|
@ -46,7 +48,9 @@ OUT = 'sent'
|
|||
KBYTE = 1024
|
||||
|
||||
|
||||
async def async_setup_platform(hass, config, async_add_entities,
|
||||
async def async_setup_platform(hass: HomeAssistantType,
|
||||
config,
|
||||
async_add_entities,
|
||||
discovery_info=None):
|
||||
"""Old way of setting up UPnP/IGD sensors."""
|
||||
_LOGGER.debug('async_setup_platform: config: %s, discovery: %s',
|
||||
|
@ -111,8 +115,11 @@ class UpnpSensor(Entity):
|
|||
'identifiers': {
|
||||
(DOMAIN_UPNP, self.unique_id)
|
||||
},
|
||||
'connections': {
|
||||
(dr.CONNECTION_UPNP, self._device.udn)
|
||||
},
|
||||
'name': self.name,
|
||||
'via_hub': (DOMAIN_UPNP, self._device.udn),
|
||||
'manufacturer': self._device.manufacturer,
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue