mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 11:47:06 +00:00
Add Netgear entity category and configuration url (#62260)
* add entity category * add configuration_url * add import
This commit is contained in:
parent
5fefb5985f
commit
c4879d71a1
@ -1,5 +1,6 @@
|
|||||||
"""Support for Netgear routers."""
|
"""Support for Netgear routers."""
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
|
from homeassistant.const import CONF_HOST
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.exceptions import ConfigEntryNotReady
|
from homeassistant.exceptions import ConfigEntryNotReady
|
||||||
from homeassistant.helpers import device_registry as dr
|
from homeassistant.helpers import device_registry as dr
|
||||||
@ -30,6 +31,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
name=router.device_name,
|
name=router.device_name,
|
||||||
model=router.model,
|
model=router.model,
|
||||||
sw_version=router.firmware_version,
|
sw_version=router.firmware_version,
|
||||||
|
configuration_url=f"http://{entry.data[CONF_HOST]}/",
|
||||||
)
|
)
|
||||||
|
|
||||||
hass.config_entries.async_setup_platforms(entry, PLATFORMS)
|
hass.config_entries.async_setup_platforms(entry, PLATFORMS)
|
||||||
|
@ -7,6 +7,7 @@ from homeassistant.components.sensor import (
|
|||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import PERCENTAGE
|
from homeassistant.const import PERCENTAGE
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
|
from homeassistant.helpers.entity import EntityCategory
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from .router import NetgearDeviceEntity, NetgearRouter, async_setup_netgear_entry
|
from .router import NetgearDeviceEntity, NetgearRouter, async_setup_netgear_entry
|
||||||
@ -15,25 +16,30 @@ SENSOR_TYPES = {
|
|||||||
"type": SensorEntityDescription(
|
"type": SensorEntityDescription(
|
||||||
key="type",
|
key="type",
|
||||||
name="link type",
|
name="link type",
|
||||||
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
),
|
),
|
||||||
"link_rate": SensorEntityDescription(
|
"link_rate": SensorEntityDescription(
|
||||||
key="link_rate",
|
key="link_rate",
|
||||||
name="link rate",
|
name="link rate",
|
||||||
native_unit_of_measurement="Mbps",
|
native_unit_of_measurement="Mbps",
|
||||||
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
),
|
),
|
||||||
"signal": SensorEntityDescription(
|
"signal": SensorEntityDescription(
|
||||||
key="signal",
|
key="signal",
|
||||||
name="signal strength",
|
name="signal strength",
|
||||||
native_unit_of_measurement=PERCENTAGE,
|
native_unit_of_measurement=PERCENTAGE,
|
||||||
device_class=SensorDeviceClass.SIGNAL_STRENGTH,
|
device_class=SensorDeviceClass.SIGNAL_STRENGTH,
|
||||||
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
),
|
),
|
||||||
"ssid": SensorEntityDescription(
|
"ssid": SensorEntityDescription(
|
||||||
key="ssid",
|
key="ssid",
|
||||||
name="ssid",
|
name="ssid",
|
||||||
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
),
|
),
|
||||||
"conn_ap_mac": SensorEntityDescription(
|
"conn_ap_mac": SensorEntityDescription(
|
||||||
key="conn_ap_mac",
|
key="conn_ap_mac",
|
||||||
name="access point mac",
|
name="access point mac",
|
||||||
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user