Add Huawei LTE battery sensor (#41668)
This commit is contained in:
parent
6d1242ffe7
commit
50468c4c8c
1 changed files with 9 additions and 1 deletions
|
@ -8,6 +8,7 @@ from typing import Callable, Dict, List, NamedTuple, Optional, Pattern, Tuple, U
|
||||||
import attr
|
import attr
|
||||||
|
|
||||||
from homeassistant.components.sensor import (
|
from homeassistant.components.sensor import (
|
||||||
|
DEVICE_CLASS_BATTERY,
|
||||||
DEVICE_CLASS_SIGNAL_STRENGTH,
|
DEVICE_CLASS_SIGNAL_STRENGTH,
|
||||||
DOMAIN as SENSOR_DOMAIN,
|
DOMAIN as SENSOR_DOMAIN,
|
||||||
)
|
)
|
||||||
|
@ -16,6 +17,7 @@ from homeassistant.const import (
|
||||||
CONF_URL,
|
CONF_URL,
|
||||||
DATA_BYTES,
|
DATA_BYTES,
|
||||||
DATA_RATE_BYTES_PER_SECOND,
|
DATA_RATE_BYTES_PER_SECOND,
|
||||||
|
PERCENTAGE,
|
||||||
STATE_UNKNOWN,
|
STATE_UNKNOWN,
|
||||||
TIME_SECONDS,
|
TIME_SECONDS,
|
||||||
)
|
)
|
||||||
|
@ -189,9 +191,15 @@ SENSOR_META: Dict[Union[str, Tuple[str, str]], SensorMeta] = {
|
||||||
),
|
),
|
||||||
KEY_MONITORING_STATUS: SensorMeta(
|
KEY_MONITORING_STATUS: SensorMeta(
|
||||||
include=re.compile(
|
include=re.compile(
|
||||||
r"^(currentwifiuser|(primary|secondary).*dns)$", re.IGNORECASE
|
r"^(batterypercent|currentwifiuser|(primary|secondary).*dns)$",
|
||||||
|
re.IGNORECASE,
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
(KEY_MONITORING_STATUS, "BatteryPercent"): SensorMeta(
|
||||||
|
name="Battery",
|
||||||
|
device_class=DEVICE_CLASS_BATTERY,
|
||||||
|
unit=PERCENTAGE,
|
||||||
|
),
|
||||||
(KEY_MONITORING_STATUS, "CurrentWifiUser"): SensorMeta(
|
(KEY_MONITORING_STATUS, "CurrentWifiUser"): SensorMeta(
|
||||||
name="WiFi clients connected", icon="mdi:wifi"
|
name="WiFi clients connected", icon="mdi:wifi"
|
||||||
),
|
),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue