Skip to content

Commit

Permalink
Bunp pyasuswrt to 0.1.19
Browse files Browse the repository at this point in the history
  • Loading branch information
ollo69 committed Oct 15, 2023
1 parent dd067f6 commit 03a828b
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 13 deletions.
12 changes: 3 additions & 9 deletions custom_components/asuswrt_custom/bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from abc import ABC, abstractmethod
from collections import namedtuple
from datetime import timedelta
from datetime import datetime
import logging
from typing import Any

Expand All @@ -24,7 +24,6 @@
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.device_registry import format_mac
from homeassistant.helpers.update_coordinator import UpdateFailed
from homeassistant.util.dt import utcnow

from .const import (
COMMAND_LED,
Expand Down Expand Up @@ -52,7 +51,6 @@
SENSORS_WAN,
)

HTTP_UPTIME = "uptime"
HTTP_WAN_SENSORS = ["status", "ipaddr", "gateway", "dns"]

SENSORS_TYPE_BYTES = "sensors_bytes"
Expand Down Expand Up @@ -588,12 +586,8 @@ async def _get_uptime(self) -> dict[str, Any]:
except AsusWrtError as exc:
raise UpdateFailed(exc) from exc

uptime = last_boot = None
if HTTP_UPTIME in uptimes:
uptime = uptimes[HTTP_UPTIME]
last_boot = (utcnow() - timedelta(seconds=uptime)).replace(
second=0, microsecond=0
)
last_boot = datetime.fromisoformat(uptimes["last_boot"])
uptime = uptimes["uptime"]

return _get_dict(SENSORS_UPTIME, [last_boot, uptime])

Expand Down
2 changes: 1 addition & 1 deletion custom_components/asuswrt_custom/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/ollo69/ha_asuswrt_custom/issues",
"loggers": ["aioasuswrt", "asyncssh", "pyasuswrt"],
"requirements": ["aioasuswrt==1.4.0", "pyasuswrt==0.1.17"],
"requirements": ["aioasuswrt==1.4.0", "pyasuswrt==0.1.19"],
"version": "0.8.2"
}
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ flake8==6.0.0
isort==5.12.0
black==23.1.0
aioasuswrt==1.4.0
pyasuswrt==0.1.17
pyasuswrt==0.1.19
2 changes: 1 addition & 1 deletion requirements_test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ pytest==7.3.1
pytest-homeassistant-custom-component==0.13.42
# From our manifest.json for our custom component
aioasuswrt==1.4.0
pyasuswrt==0.1.17
pyasuswrt==0.1.19
2 changes: 1 addition & 1 deletion tests/test_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"mem_used": 692624,
}
MOCK_TEMPERATURES = {"2.4GHz": 40.2, "5.0GHz": 0, "CPU": 71.2}
MOCK_UPTIME = {"uptime": 123456}
MOCK_UPTIME = {"last_boot": "2023-10-14T17:24:47+00:00", "uptime": 375001}
MOCK_WAN_INFO = {
"status": "1",
"ipaddr": "192.168.1.50",
Expand Down

0 comments on commit 03a828b

Please sign in to comment.