Fixed reboot check, fixes #389

This commit is contained in:
Tomaae 2025-05-01 11:59:18 +02:00
parent fc51c71323
commit a1b2851193
No known key found for this signature in database
GPG key ID: 60C51A657EEF2D87

View file

@ -299,6 +299,7 @@ class MikrotikCoordinator(DataUpdateCoordinator[None]):
self.accessrights_reported = False
self.last_hwinfo_update = datetime(1970, 1, 1)
self.rebootcheck = 0
# ---------------------------
# option_track_iface_clients
@ -1434,10 +1435,6 @@ class MikrotikCoordinator(DataUpdateCoordinator[None]):
# ---------------------------
def get_system_resource(self) -> None:
"""Get system resources data from Mikrotik"""
tmp_rebootcheck = 0
if "uptime_epoch" in self.ds["resource"]:
tmp_rebootcheck = self.ds["resource"]["uptime_epoch"]
self.ds["resource"] = parse_api(
data=self.ds["resource"],
source=self.api.query("/system/resource"),
@ -1522,10 +1519,13 @@ class MikrotikCoordinator(DataUpdateCoordinator[None]):
if (
"uptime_epoch" in self.ds["resource"]
and 0 < tmp_rebootcheck < self.ds["resource"]["uptime_epoch"]
and self.rebootcheck > self.ds["resource"]["uptime_epoch"]
):
self.get_firmware_update()
if "uptime_epoch" in self.ds["resource"]:
self.rebootcheck = self.ds["resource"]["uptime_epoch"]
# ---------------------------
# get_firmware_update
# ---------------------------