Add Huawei LTE operator and network related sensors (#32485)
* Add Huawei LTE operator and network related sensors Adds "Operator search mode", "Operator name", "Operator code", and "Preferred mode" sensors * Blackify * Blackify "Add Huawei LTE operator and network related sensors"
This commit is contained in:
1 parent
007d934214
commit
da7c5518f3
3 files changed
+33
No files matched your search
@@ -20,6 +20,8 @@ from .const import (
|
||||
KEY_MONITORING_MONTH_STATISTICS,
|
||||
KEY_MONITORING_STATUS,
|
||||
KEY_MONITORING_TRAFFIC_STATISTICS,
|
||||
KEY_NET_CURRENT_PLMN,
|
||||
KEY_NET_NET_MODE,
|
||||
SENSOR_KEYS,
|
||||
)
|
||||
|
||||
@@ -170,6 +172,29 @@ SENSOR_META = {
|
||||
(KEY_MONITORING_TRAFFIC_STATISTICS, "TotalUpload"): dict(
|
||||
name="Total upload", unit=DATA_BYTES, icon="mdi:upload"
|
||||
),
|
||||
KEY_NET_CURRENT_PLMN: dict(exclude=re.compile(r"^(Rat|ShortName)$", re.IGNORECASE)),
|
||||
(KEY_NET_CURRENT_PLMN, "State"): dict(
|
||||
name="Operator search mode",
|
||||
formatter=lambda x: ({"0": "Auto", "1": "Manual"}.get(x, "Unknown"), None),
|
||||
),
|
||||
(KEY_NET_CURRENT_PLMN, "FullName"): dict(name="Operator name",),
|
||||
(KEY_NET_CURRENT_PLMN, "Numeric"): dict(name="Operator code",),
|
||||
KEY_NET_NET_MODE: dict(include=re.compile(r"^NetworkMode$", re.IGNORECASE)),
|
||||
(KEY_NET_NET_MODE, "NetworkMode"): dict(
|
||||
name="Preferred mode",
|
||||
formatter=lambda x: (
|
||||
{
|
||||
"00": "4G/3G/2G",
|
||||
"01": "2G",
|
||||
"02": "3G",
|
||||
"03": "4G",
|
||||
"0301": "4G/2G",
|
||||
"0302": "4G/3G",
|
||||
"0201": "3G/2G",
|
||||
}.get(x, "Unknown"),
|
||||
None,
|
||||
),
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user