mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Show all UPNP/IGD sensors in one device (#27517)
* show all UPNP/IGD sensors in one device * use device name correctly * Use id of device
This commit is contained in:
parent
ec373d90c1
commit
82729bef70
@ -162,6 +162,7 @@ async def async_setup_entry(hass: HomeAssistantType, config_entry: ConfigEntry):
|
|||||||
identifiers={(DOMAIN, device.udn)},
|
identifiers={(DOMAIN, device.udn)},
|
||||||
name=device.name,
|
name=device.name,
|
||||||
manufacturer=device.manufacturer,
|
manufacturer=device.manufacturer,
|
||||||
|
model=device.model_name,
|
||||||
)
|
)
|
||||||
|
|
||||||
# set up sensors
|
# set up sensors
|
||||||
|
@ -78,6 +78,11 @@ class Device:
|
|||||||
"""Get the manufacturer."""
|
"""Get the manufacturer."""
|
||||||
return self._igd_device.manufacturer
|
return self._igd_device.manufacturer
|
||||||
|
|
||||||
|
@property
|
||||||
|
def model_name(self):
|
||||||
|
"""Get the model name."""
|
||||||
|
return self._igd_device.model_name
|
||||||
|
|
||||||
async def async_add_port_mappings(self, ports, local_ip):
|
async def async_add_port_mappings(self, ports, local_ip):
|
||||||
"""Add port mappings."""
|
"""Add port mappings."""
|
||||||
if local_ip == "127.0.0.1":
|
if local_ip == "127.0.0.1":
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
|
from homeassistant.helpers import device_registry as dr
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
from homeassistant.helpers.typing import HomeAssistantType
|
||||||
@ -93,9 +94,11 @@ class UpnpSensor(Entity):
|
|||||||
def device_info(self):
|
def device_info(self):
|
||||||
"""Get device info."""
|
"""Get device info."""
|
||||||
return {
|
return {
|
||||||
"identifiers": {(DOMAIN_UPNP, self.unique_id)},
|
"connections": {(dr.CONNECTION_UPNP, self._device.udn)},
|
||||||
"name": self.name,
|
"identifiers": {(DOMAIN_UPNP, self._device.udn)},
|
||||||
|
"name": self._device.name,
|
||||||
"manufacturer": self._device.manufacturer,
|
"manufacturer": self._device.manufacturer,
|
||||||
|
"model": self._device.model_name,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user