Closed dredjohn21 closed 1 year ago
I suspect it has something to do with the switch seeing the device as having internet OFF when it’s just on a schedule.
for example devices without schedules seem to be working ok (maybe that is how I work around this and put the scheduling in home assistant?)
Just so I have this clear...
You have a UI device and are using the switch
entity that belongs to that device?
Can you confirm if the switch changes state after the integration has polled again?
I spotted the trace that you listed but I'm not sure how your scenario should get to that line.
Oh and can you confirm does the device have rules assigned to it when you change the switch state?
Hi @uvjim yes your understanding is correct:
if it’s easier maybe I just disable the Linksys Velop rules and build my own in home assistant? Is that how you are managing on your side?
Oh I don't use any of that functionality at all. I only built it in because I could. 😂
I have one device that I deny access to the Internet at all times until I decide to update it but that's it.
I'll try and have a look at it soon. The trace shows an issue in the library (I wrote that too) and I'm not sure how you've reached that line. However, I'll see if I can recreate the issue, I have plenty of devices on the network I can mess around with and not cause a problem.
Leave it with me.
Ha - you’re so awesome - thank you!! :)
I don't seem to be able to recreate the issue. However, the code isn't quite working correctly. The switch should only show off if Internet is paused for the device, at all other times it will show as on. That doesn't seem to be the case with the way things are at the moment - bizarre because I could have sworn I tested that. Oh well. I'll take a look at what's going on in more details when I get time. I think once that is fixed you'll be able to achieve what you want, i.e.
Thanks so much - all of that would be amazing (kids are on warning 🤪)
I've pushed beta version 2023.7.1b0
can you try that and see how you get on please?
Thanks I just tried it
My observations:
Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/linksys_velop/switch.py:301
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 8:16:03 PM (1 occurrences)
Last logged: 8:16:03 PM
[547125638160] list index out of range
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 205, in handle_call_service
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1910, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1950, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 226, in handle_service
await service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 811, in entity_service_call
future.result() # pop exception if have
^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1034, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 851, in _handle_entity_call
await result
File "/config/custom_components/linksys_velop/switch.py", line 301, in async_turn_on
await action(**action_args)
File "/usr/local/lib/python3.11/site-packages/pyvelop/mesh.py", line 985, in async_set_parental_control_rules
if this_device_rules[0].get("blockedURLs", []):
~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range
2023.7.1b1
is now available. Could you test that please?
RE: your observations...
I have tested multiple scenarios both directly in the library and in Home Assistant. Each time it is doing what I expect. Example...
I've also tested using the Home Assistant services and they all update as expected, albeit on the poll period.
Yay works perfectly! The only issue is the one you noted: the Linksys app doesn’t quickly reflect the change. I waited a minute in one case, going back and forth between screens in the mobile app hoping it would refresh and it didn’t… so I eventually killed the app and reloaded and everything showed correctly. But this is out of your control… thanks so much for all this extra effort. Hopefully others will also benefit from this additional level of control (especially helpful with kids!)
Context: I have kids with laptops I have scheduled to pause internet access on at night. Sometimes we want to cut access sooner (e.g. punishment), or enable later (e.g. finish homework).
I’m noticing with this integration when I add the devices to UI so I can easily enable/disable internet access via switch.chromebook_child1_internet_access the switch will not update properly (it’ll show as off but still on, or visa versa).
I tried to enable logging with query and captured this:
Logger: homeassistant.components.websocket_api.http.connection Source: custom_components/linksys_velop/switch.py:301 Integration: Home Assistant WebSocket API (documentation, issues) First occurred: 6:20:02 AM (1 occurrences) Last logged: 6:20:02 AM
[547767923344] list index out of range Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 205, in handle_call_service await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 1910, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1950, in _execute_service await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)( File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 226, in handle_service await service.entity_service_call( File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 811, in entity_service_call future.result() # pop exception if have ^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1034, in async_request_call await coro File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 851, in _handle_entity_call await result File "/config/custom_components/linksys_velop/switch.py", line 301, in async_turn_on await action(**action_args) File "/usr/local/lib/python3.11/site-packages/pyvelop/mesh.py", line 985, in async_set_parental_control_rules if this_device_rules[0].get("blockedURLs", []):