mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 02:07:09 +00:00
huawei_lte: handle icons for None sensor values gracefully (#23649)
This commit is contained in:
parent
bf649e373c
commit
b9a72034f9
@ -62,37 +62,37 @@ SENSOR_META = {
|
|||||||
name="RSRQ",
|
name="RSRQ",
|
||||||
# http://www.lte-anbieter.info/technik/rsrq.php
|
# http://www.lte-anbieter.info/technik/rsrq.php
|
||||||
icon=lambda x:
|
icon=lambda x:
|
||||||
x >= -5 and "mdi:signal-cellular-3"
|
(x is None or x < -11) and "mdi:signal-cellular-outline"
|
||||||
or x >= -8 and "mdi:signal-cellular-2"
|
or x < -8 and "mdi:signal-cellular-1"
|
||||||
or x >= -11 and "mdi:signal-cellular-1"
|
or x < -5 and "mdi:signal-cellular-2"
|
||||||
or "mdi:signal-cellular-outline"
|
or "mdi:signal-cellular-3"
|
||||||
),
|
),
|
||||||
"device_signal.rsrp": dict(
|
"device_signal.rsrp": dict(
|
||||||
name="RSRP",
|
name="RSRP",
|
||||||
# http://www.lte-anbieter.info/technik/rsrp.php
|
# http://www.lte-anbieter.info/technik/rsrp.php
|
||||||
icon=lambda x:
|
icon=lambda x:
|
||||||
x >= -80 and "mdi:signal-cellular-3"
|
(x is None or x < -110) and "mdi:signal-cellular-outline"
|
||||||
or x >= -95 and "mdi:signal-cellular-2"
|
or x < -95 and "mdi:signal-cellular-1"
|
||||||
or x >= -110 and "mdi:signal-cellular-1"
|
or x < -80 and "mdi:signal-cellular-2"
|
||||||
or "mdi:signal-cellular-outline"
|
or "mdi:signal-cellular-3"
|
||||||
),
|
),
|
||||||
"device_signal.rssi": dict(
|
"device_signal.rssi": dict(
|
||||||
name="RSSI",
|
name="RSSI",
|
||||||
# https://eyesaas.com/wi-fi-signal-strength/
|
# https://eyesaas.com/wi-fi-signal-strength/
|
||||||
icon=lambda x:
|
icon=lambda x:
|
||||||
x >= -60 and "mdi:signal-cellular-3"
|
(x is None or x < -80) and "mdi:signal-cellular-outline"
|
||||||
or x >= -70 and "mdi:signal-cellular-2"
|
or x < -70 and "mdi:signal-cellular-1"
|
||||||
or x >= -80 and "mdi:signal-cellular-1"
|
or x < -60 and "mdi:signal-cellular-2"
|
||||||
or "mdi:signal-cellular-outline"
|
or "mdi:signal-cellular-3"
|
||||||
),
|
),
|
||||||
"device_signal.sinr": dict(
|
"device_signal.sinr": dict(
|
||||||
name="SINR",
|
name="SINR",
|
||||||
# http://www.lte-anbieter.info/technik/sinr.php
|
# http://www.lte-anbieter.info/technik/sinr.php
|
||||||
icon=lambda x:
|
icon=lambda x:
|
||||||
x >= 10 and "mdi:signal-cellular-3"
|
(x is None or x < 0) and "mdi:signal-cellular-outline"
|
||||||
or x >= 5 and "mdi:signal-cellular-2"
|
or x < 5 and "mdi:signal-cellular-1"
|
||||||
or x >= 0 and "mdi:signal-cellular-1"
|
or x < 10 and "mdi:signal-cellular-2"
|
||||||
or "mdi:signal-cellular-outline"
|
or "mdi:signal-cellular-3"
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user