Add Netgear entity category and configuration url (#62260)

* add entity category

* add configuration_url

* add import
This commit is contained in:
starkillerOG 2021-12-18 12:34:16 +01:00 committed by GitHub
parent 5fefb5985f
commit c4879d71a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -1,5 +1,6 @@
"""Support for Netgear routers."""
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_HOST
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady
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,
model=router.model,
sw_version=router.firmware_version,
configuration_url=f"http://{entry.data[CONF_HOST]}/",
)
hass.config_entries.async_setup_platforms(entry, PLATFORMS)

View File

@ -7,6 +7,7 @@ from homeassistant.components.sensor import (
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import PERCENTAGE
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.entity import EntityCategory
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from .router import NetgearDeviceEntity, NetgearRouter, async_setup_netgear_entry
@ -15,25 +16,30 @@ SENSOR_TYPES = {
"type": SensorEntityDescription(
key="type",
name="link type",
entity_category=EntityCategory.DIAGNOSTIC,
),
"link_rate": SensorEntityDescription(
key="link_rate",
name="link rate",
native_unit_of_measurement="Mbps",
entity_category=EntityCategory.DIAGNOSTIC,
),
"signal": SensorEntityDescription(
key="signal",
name="signal strength",
native_unit_of_measurement=PERCENTAGE,
device_class=SensorDeviceClass.SIGNAL_STRENGTH,
entity_category=EntityCategory.DIAGNOSTIC,
),
"ssid": SensorEntityDescription(
key="ssid",
name="ssid",
entity_category=EntityCategory.DIAGNOSTIC,
),
"conn_ap_mac": SensorEntityDescription(
key="conn_ap_mac",
name="access point mac",
entity_category=EntityCategory.DIAGNOSTIC,
),
}