Skip to content

Commit

Permalink
Add icons
Browse files Browse the repository at this point in the history
  • Loading branch information
cyr-ius committed May 8, 2024
1 parent 453ed4c commit f6bc05a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion custom_components/livebox/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from homeassistant.helpers.entity import EntityCategory
from homeassistant.helpers.entity_platform import AddEntitiesCallback

from .const import DOMAIN, MISSED_ICON
from .const import DDNS_ICON, DOMAIN, MISSED_ICON, RA_ICON
from .coordinator import LiveboxDataUpdateCoordinator
from .entity import LiveboxEntity

Expand Down Expand Up @@ -69,7 +69,9 @@ class LiveboxBinarySensorEntityDescription(BinarySensorEntityDescription):
LiveboxBinarySensorEntityDescription(
key="remote_access",
name="Remote Access",
icon=RA_ICON,
value_fn=lambda x: x.get("remote_access"),
attrs={},
translation_key="remote_access",
),
)
Expand All @@ -90,6 +92,7 @@ async def async_setup_entry(
description = LiveboxBinarySensorEntityDescription(
key=f"ddns_{idx}",
index=idx,
icon=DDNS_ICON,
device_class=BinarySensorDeviceClass.PROBLEM,
name=f"Dynamic DNS ({item.get('service')})",
value_fn=lambda x, y: x["ddns"][y].get("status", "").lower() != "updated",
Expand Down
2 changes: 2 additions & 0 deletions custom_components/livebox/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@
RING_ICON = "mdi:phone-classic"
GUESTWIFI_ICON = "mdi:wifi-lock-open"
DEVICE_WANACCESS_ICON = "mdi:wan"
RA_ICON = "mdi:remote-desktop"
DDNS_ICON = "mdi:dns"
2 changes: 2 additions & 0 deletions custom_components/livebox/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ class LiveboxSensorEntityDescription(SensorEntityDescription):
LiveboxSensorEntityDescription(
key="fiber_tx",
name="Fiber Tx",
icon=UPLOAD_ICON,
value_fn=lambda x: round(
x.get("fiber_stats", {}).get("TxBytes", 0) / 1048576, 2
),
Expand All @@ -173,6 +174,7 @@ class LiveboxSensorEntityDescription(SensorEntityDescription):
LiveboxSensorEntityDescription(
key="fiber_rx",
name="Fiber Rx",
icon=DOWNLOAD_ICON,
value_fn=lambda x: round(
x.get("fiber_stats", {}).get("RxBytes", 0) / 1048576, 2
),
Expand Down

0 comments on commit f6bc05a

Please sign in to comment.