Skip to content

Commit

Permalink
0.34.0 (#870)
Browse files Browse the repository at this point in the history
* Add DSL datarate_down/up entity in HA sensors (#868)

* Bump asusrouter to `1.13.0`

* Bump version to `0.34.0`

---------

Co-authored-by: GaryHuang-ASUS <[email protected]>
  • Loading branch information
Vaskivskyi and GaryHuang-ASUS authored Sep 7, 2024
1 parent d9752c7 commit 723ed0a
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.
10 changes: 10 additions & 0 deletions custom_components/asusrouter/bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
CONF_MODE,
CPU,
DEFAULT_SENSORS,
DSL,
FIRMWARE,
GWLAN,
LED,
Expand Down Expand Up @@ -207,6 +208,10 @@ async def async_get_available_sensors(self) -> dict[str, dict[str, Any]]:
SENSORS: await self._get_sensors_modern(AsusData.CPU),
METHOD: self._get_data_cpu,
},
DSL: {
SENSORS: await self._get_sensors_modern(AsusData.DSL),
METHOD: self._get_data_dsl,
},
FIRMWARE: {
SENSORS: SENSORS_FIRMWARE,
METHOD: self._get_data_firmware,
Expand Down Expand Up @@ -343,6 +348,11 @@ async def _get_data_cpu(self) -> dict[str, Any]:
"""Get CPU data from the device."""

return await self._get_data(AsusData.CPU)

async def _get_data_dsl(self) -> dict[str, Any]:
"""Get DSL data from the device."""

return await self._get_data_modern(AsusData.DSL)

async def _get_data_firmware(self) -> dict[str, Any]:
"""Get firmware data from the device."""
Expand Down
27 changes: 27 additions & 0 deletions custom_components/asusrouter/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
CPU = "cpu"
DEVICES = "devices"
DNS = "dns"
DSL = "dsl"
FIRMWARE = "firmware"
FREE = "free"
GWLAN = "gwlan"
Expand Down Expand Up @@ -272,6 +273,7 @@
MODE_ROUTER = MODE_ACCESS_POINT.copy()
MODE_ROUTER.extend(
[
DSL,
GWLAN,
"ovpn_client",
"ovpn_server",
Expand Down Expand Up @@ -1121,6 +1123,31 @@
f"{num}_usage": f"core_{num}" for num in NUMERIC_CORES
},
),
# DSL
ARSensorDescription(
key="datarate_up",
key_group=DSL,
name="DSL Datarate Up",
icon="mdi:upload-network-outline",
state_class=SensorStateClass.MEASUREMENT,
device_class=SensorDeviceClass.DATA_RATE,
native_unit_of_measurement=UnitOfDataRate.KILOBITS_PER_SECOND,
suggested_unit_of_measurement=UnitOfDataRate.KILOBITS_PER_SECOND,
suggested_display_precision=0,
entity_registry_enabled_default=True,
),
ARSensorDescription(
key="datarate_down",
key_group=DSL,
name="DSL Datarate Down",
icon="mdi:download-network-outline",
state_class=SensorStateClass.MEASUREMENT,
device_class=SensorDeviceClass.DATA_RATE,
native_unit_of_measurement=UnitOfDataRate.KILOBITS_PER_SECOND,
suggested_unit_of_measurement=UnitOfDataRate.KILOBITS_PER_SECOND,
suggested_display_precision=0,
entity_registry_enabled_default=True,
),
# Latest connected
ARSensorDescription(
key="latest_time",
Expand Down
4 changes: 2 additions & 2 deletions custom_components/asusrouter/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
"iot_class": "local_polling",
"issue_tracker": "https://github.com/Vaskivskyi/ha-asusrouter/issues",
"loggers": ["asusrouter"],
"requirements": ["asusrouter==1.12.2"],
"version": "0.33.2"
"requirements": ["asusrouter==1.13.0"],
"version": "0.34.0"
}

0 comments on commit 723ed0a

Please sign in to comment.