Skip to content

Commit

Permalink
0.27.1 (#755)
Browse files Browse the repository at this point in the history
* Check that parental control rules are valid before saving them (#754)

* Bump version to `0.27.1`
  • Loading branch information
Vaskivskyi authored Dec 31, 2023
1 parent fed171a commit b0b1409
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion custom_components/asusrouter/bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ async def _get_data_ovpn_server(self) -> dict[str, Any]:

return await self._get_data(AsusData.OPENVPN_SERVER)

async def _get_data_parental_control(self) -> dict[str, dict[str, int]]:
async def _get_data_parental_control(self) -> dict[str, Any]:
"""Get parental control data from the device."""

return await self._get_data(
Expand Down
2 changes: 1 addition & 1 deletion custom_components/asusrouter/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
"manufacturer": "ASUSTeK Computer Inc."
}
],
"version": "0.27.0"
"version": "0.27.1"
}
9 changes: 8 additions & 1 deletion custom_components/asusrouter/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ async def update_pc_rules(self) -> None:

new_flag = False

rules = pc_data.get("rules", {})
rules: dict[str, ParentalControlRule] = pc_data.get("rules", {})

rules_to_save = {}

Expand All @@ -664,6 +664,13 @@ async def update_pc_rules(self) -> None:
new_flag = True
rules_to_save[mac] = rule

# Check the rules for non-valid ones
rules_to_save = {
mac: rule
for mac, rule in rules_to_save.items()
if mac != "" and rule.mac is not None
}

# Save rules
self._pc_rules = rules_to_save

Expand Down

0 comments on commit b0b1409

Please sign in to comment.