mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 20:27:08 +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)},
|
||||
name=device.name,
|
||||
manufacturer=device.manufacturer,
|
||||
model=device.model_name,
|
||||
)
|
||||
|
||||
# set up sensors
|
||||
|
@ -78,6 +78,11 @@ class Device:
|
||||
"""Get the 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):
|
||||
"""Add port mappings."""
|
||||
if local_ip == "127.0.0.1":
|
||||
|
@ -2,6 +2,7 @@
|
||||
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
|
||||
@ -93,9 +94,11 @@ class UpnpSensor(Entity):
|
||||
def device_info(self):
|
||||
"""Get device info."""
|
||||
return {
|
||||
"identifiers": {(DOMAIN_UPNP, self.unique_id)},
|
||||
"name": self.name,
|
||||
"connections": {(dr.CONNECTION_UPNP, self._device.udn)},
|
||||
"identifiers": {(DOMAIN_UPNP, self._device.udn)},
|
||||
"name": self._device.name,
|
||||
"manufacturer": self._device.manufacturer,
|
||||
"model": self._device.model_name,
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user