mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-06-28 03:30:07 +02:00
Fixed capability differences between RouterOS 6 and 7
This commit is contained in:
parent
1d0fac9d8f
commit
4e6b29b1aa
1 changed files with 17 additions and 4 deletions
|
@ -126,6 +126,7 @@ class MikrotikControllerData:
|
|||
|
||||
self.support_capsman = False
|
||||
self.support_wireless = False
|
||||
self.support_ppp = False
|
||||
|
||||
self.major_fw_version = 0
|
||||
|
||||
|
@ -345,6 +346,9 @@ class MikrotikControllerData:
|
|||
],
|
||||
)
|
||||
|
||||
if "ppp" in packages:
|
||||
self.support_ppp = packages["ppp"]["enabled"]
|
||||
|
||||
if "wireless" in packages:
|
||||
self.support_capsman = packages["wireless"]["enabled"]
|
||||
self.support_wireless = packages["wireless"]["enabled"]
|
||||
|
@ -352,6 +356,11 @@ class MikrotikControllerData:
|
|||
self.support_capsman = False
|
||||
self.support_wireless = False
|
||||
|
||||
if self.major_fw_version >= 7:
|
||||
self.support_capsman = True
|
||||
self.support_wireless = True
|
||||
self.support_ppp = True
|
||||
|
||||
# ---------------------------
|
||||
# async_get_host_hass
|
||||
# ---------------------------
|
||||
|
@ -377,7 +386,11 @@ class MikrotikControllerData:
|
|||
except:
|
||||
return
|
||||
|
||||
await self.hass.async_add_executor_job(self.get_capabilities)
|
||||
await self.hass.async_add_executor_job(self.get_firmware_update)
|
||||
|
||||
if self.api.connected():
|
||||
await self.hass.async_add_executor_job(self.get_capabilities)
|
||||
|
||||
if self.api.connected():
|
||||
await self.hass.async_add_executor_job(self.get_system_routerboard)
|
||||
|
||||
|
@ -532,7 +545,7 @@ class MikrotikControllerData:
|
|||
if self.api.connected() and self.option_sensor_mangle:
|
||||
await self.hass.async_add_executor_job(self.get_mangle)
|
||||
|
||||
if self.api.connected() and self.option_sensor_ppp:
|
||||
if self.api.connected() and self.support_ppp and self.option_sensor_ppp:
|
||||
await self.hass.async_add_executor_job(self.get_ppp)
|
||||
|
||||
if self.api.connected():
|
||||
|
@ -933,8 +946,8 @@ class MikrotikControllerData:
|
|||
},
|
||||
],
|
||||
ensure_vals=[
|
||||
{"name": "caller-id", "default": "not connected"},
|
||||
{"name": "encoding", "default": "not connected"},
|
||||
{"name": "caller-id", "default": ""},
|
||||
{"name": "encoding", "default": ""},
|
||||
{"name": "connected", "default": False},
|
||||
],
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue