Closed angrycatmeowmeow closed 6 months ago
Hello. Sorry for the late reply. Let's try to sort it out, so the issue can be fixed
When you set the block from the mobile app, does it change in HA to the state unknown
?
Or does it become unavailable? Also, any change of the state in HA can take up to 30 seconds depending on the update interval of the integration
In any case, it is supposed to work from HA and change the state in the mobile app.
Can you please turn on debug logging and share the part of the log when you try to set
I've been tooling around this morning and I think it's working correctly, but I was missing a piece.
The switch.zenwifipro_parental_control
needs to be on.
Blocking a device would cause an entity to be created in HA for that device switch.device_block_internet
. This entity would only be available when the block was active, and trying to turn the block off through HA would cause it to temporarily turn off, then turn right back on. Turning the block off in the Asus app or GUI would lead to "this entity is no longer provided by the integration" in HA.
What I did is add everything I want to block to parental control-schedule block in the Asus app with no time scheduling. The switch.device_block_internet
entities immediately came back, and when I flip them in HA it is shown in the Asus app/GUI, and visa-versa. Adding the devices to parental control is key, I didn't realize Asus groups internet blocking under parental controls.
I've got very similar behaviour when I try to switch the internet blocking for a single device. So before I raise a potentially duplicate bug I'll start with a comment here. It behaves the same regardless whether it's added in the parental control list of blocked devices or not.
In Home Assistant, when I go to an entity, for example "switch.livingtv_block_internet" and click on the switch to turn it on or off it won't change the entity state and the log shows:
ERROR (MainThread) [custom_components.asusrouter.switch] Unable to set state with an exception: sequence item 1: expected str instance, NoneType found
When I change the block/disable state in the router admin UI, it does get reflected in the entity state when it is refreshed fine. But it refuses to be controlled from Home Assistant due to the above error. I've also tried to set it with the service and got some more debug info from that:
`ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [546651729728] Error handling message: Unknown error (unknown_error)
Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 26, in _handle_async_response await func(hass, connection, msg) File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 795, in handle_execute_script script_result = await script_obj.async_run( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1600, in async_run return await asyncio.shield(run.async_run()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 435, in async_run await self._async_step(log_exceptions=False) File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 487, in _async_step self._handle_exception( File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 512, in _handle_exception raise exception File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 485, in _async_step await getattr(self, handler)() File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 723, in _async_call_service_step response_data = await self._async_run_long_action( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 685, in _async_run_long_action return long_task.result() ^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2279, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2316, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/asusrouter/router.py", line 759, in async_service_device_internet_access await self.bridge.async_pc_rule(raw=service.data) File "/config/custom_components/asusrouter/bridge.py", line 649, in async_pc_rule result = await self.api.async_set_state(rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/asusrouter/asusrouter.py", line 765, in async_set_state result = await set_state( ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/asusrouter/modules/state.py", line 155, in set_state return await submodule.set_state( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/asusrouter/modules/parental_control.py", line 84, in set_state return await set_rule(callback, state, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/asusrouter/modules/parental_control.py", line 143, in set_rule service_arguments = write_pc_rules(current_rules) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/asusrouter/modules/parental_control.py", line 285, in write_pc_rules data[key] = ">".join( ^^^^^^^^^ TypeError: sequence item 1: expected str instance, NoneType found `
The router is a RT-AX86U running on Asuswrt-Merlin version 3004.388.6
Happy to test a few scenarios if there's something I should be doing or info you need to validate more details...
The new release is already available in HACS and should solve this issue. In case if the issue persists, please, reopen it
The problem
If I use the Asus Router app to block internet to a client, I'll get a "block internet" entity in HA. These entities don't seem to work or update, though. If I turn off Parental Control, the entities are no longer provided by the integration as well. If I block a client in the Asus app, it doesn't reflect in HA, and if I turn it on in HA using the entity, it doesn't reflect in the Asus app.
Your device model
ET12
Firmware type
Stock
Firmware version
3.0.0.4.388.24542_g719e902
Integration version with the issue
0.28.0
Method of the integration installation
HACS
What version and type of Home Assistant installation do you use
2024.1.2
Is there anything useful in the logs?
Diagnostics information
No response
Additional information
No response