|
8 | 8 |
|
9 | 9 | import aiohttp |
10 | 10 | from asusrouter import AsusRouter |
11 | | -from asusrouter.config import ARConfig |
| 11 | +from asusrouter.config import ARConfig, ARConfigKey |
12 | 12 | from asusrouter.error import AsusRouterError |
13 | 13 | from asusrouter.modules.aimesh import AiMeshDevice |
14 | 14 | from asusrouter.modules.client import AsusClient |
|
44 | 44 | CONF_DEFAULT_PORT, |
45 | 45 | CONF_MODE, |
46 | 46 | CPU, |
| 47 | + DDNS, |
47 | 48 | DEFAULT_SENSORS, |
48 | 49 | DSL, |
49 | 50 | FIRMWARE, |
@@ -106,9 +107,15 @@ def __init__( |
106 | 107 | # Initialize API |
107 | 108 | self._api = self._get_api(self._configs, session) |
108 | 109 |
|
109 | | - # Switch API to optimistic |
| 110 | + # Switch API to optimistic mode |
110 | 111 | # Optimistic temperature to avoid scaling issues from some devices |
111 | | - ARConfig.set("optimistic_temperature", True) |
| 112 | + ARConfig.set(ARConfigKey.OPTIMISTIC_TEMPERATURE, True) |
| 113 | + # Switch API to robust mode |
| 114 | + # Robust boottime will avoid 1 second jitter due to the raw data |
| 115 | + # uncertainty. This can provide up to 1 second overestimation |
| 116 | + # of the boottime, but will avoid saving extra data when the |
| 117 | + # integration restarts and loses the previous boottime data. |
| 118 | + ARConfig.set(ARConfigKey.ROBUST_BOOTTIME, True) |
112 | 119 |
|
113 | 120 | self._host = self._configs[CONF_HOST] |
114 | 121 | self._identity: Optional[AsusDevice] = None |
@@ -219,6 +226,10 @@ async def async_get_available_sensors(self) -> dict[str, dict[str, Any]]: |
219 | 226 | SENSORS: await self._get_sensors_modern(AsusData.CPU), |
220 | 227 | METHOD: self._get_data_cpu, |
221 | 228 | }, |
| 229 | + DDNS: { |
| 230 | + SENSORS: await self._get_sensors_modern(AsusData.DDNS), |
| 231 | + METHOD: self._get_data_ddns, |
| 232 | + }, |
222 | 233 | DSL: { |
223 | 234 | SENSORS: await self._get_sensors_modern(AsusData.DSL), |
224 | 235 | METHOD: self._get_data_dsl, |
@@ -360,6 +371,11 @@ async def _get_data_cpu(self) -> dict[str, Any]: |
360 | 371 |
|
361 | 372 | return await self._get_data(AsusData.CPU) |
362 | 373 |
|
| 374 | + async def _get_data_ddns(self) -> dict[str, Any]: |
| 375 | + """Get DDNS data from the device.""" |
| 376 | + |
| 377 | + return await self._get_data_modern(AsusData.DDNS) |
| 378 | + |
363 | 379 | async def _get_data_dsl(self) -> dict[str, Any]: |
364 | 380 | """Get DSL data from the device.""" |
365 | 381 |
|
|
0 commit comments