pantherale0 / ha-familysafety

Microsoft Family Safety Home Assistant integration
MIT License
5 stars 1 forks source link

Can't use toggle to block all devices. 500 error #37

Open Snackington opened 3 months ago

Snackington commented 3 months ago

System Health details

System Information

version core-2024.3.1
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.12.2
os_name Linux
os_version 6.1.73-haos-raspi
arch aarch64
timezone America/Chicago
config_dir /config
Home Assistant Community Store GitHub API | ok -- | -- GitHub Content | ok GitHub Web | ok GitHub API Calls Remaining | 4928 Installed Version | 1.34.0 Stage | running Available Repositories | 1400 Downloaded Repositories | 12
Home Assistant Cloud logged_in | true -- | -- subscription_expiration | February 27, 2025 at 6:00 PM relayer_connected | true relayer_region | us-east-1 remote_enabled | true remote_connected | true alexa_enabled | true google_enabled | true remote_server | us-east-1-10.ui.nabu.casa certificate_status | ready instance_id | ddff79cdc8e647afa7f6ae72c8f35b73 can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | ok
Home Assistant Supervisor host_os | Home Assistant OS 12.1 -- | -- update_channel | stable supervisor_version | supervisor-2024.03.0 agent_version | 1.6.0 docker_version | 24.0.7 disk_total | 27.7 GB disk_used | 6.1 GB healthy | true supported | true board | rpi4-64 supervisor_api | ok version_api | ok installed_addons | Terminal & SSH (9.10.0), Home Assistant Google Drive Backup (0.112.1), Mosquitto broker (6.4.0), Z-Wave JS UI (3.4.1), Studio Code Server (5.15.0)
Dashboards dashboards | 1 -- | -- resources | 6 views | 6 mode | storage
Recorder oldest_recorder_run | March 7, 2024 at 4:01 AM -- | -- current_recorder_run | March 15, 2024 at 9:00 PM estimated_db_size | 73.62 MiB database_engine | sqlite database_version | 3.44.2

Checklist

Describe the issue

Installation of the integration and connection went fine, I can see the screentime hours and the status of the "block all devices" toggle, but attempting to switch it on or off results in 500 internal server error. Tried restarting HA/Re-configuring integration.

Reproduction steps

N/A

Debug logs

2024-03-15 21:38:02.834 WARNING (MainThread) [pyfamilysafety.account] Unknown account spending response, please report to developer. {'askAParentEnabled': True, 'balances': []}
2024-03-15 21:38:05.317 WARNING (MainThread) [pyfamilysafety.account] Unknown account spending response, please report to developer. {'askAParentEnabled': True, 'balances': []}
2024-03-15 21:38:09.061 WARNING (MainThread) [pyfamilysafety.account] Unknown account spending response, please report to developer. {'askAParentEnabled': True, 'balances': []}
2024-03-15 21:38:11.915 WARNING (MainThread) [pyfamilysafety.account] Unknown account spending response, please report to developer. {'askAParentEnabled': True, 'balances': []}
2024-03-15 21:38:14.271 WARNING (MainThread) [pyfamilysafety.account] Unknown account spending response, please report to developer. {'askAParentEnabled': True, 'balances': []}
2024-03-15 21:38:16.623 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [548011862208] ('HTTP Error', 500, '"Internal Server Error"')
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 239, in handle_call_service
response = await hass.services.async_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2319, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2356, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 905, in entity_service_call
single_response = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 975, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/config/custom_components/family_safety/switch.py", line 117, in async_turn_off
return await self._disable_override()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/family_safety/entity_base.py", line 115, in _disable_override
await self._account.override_device(self._platform, OverrideType.CANCEL)
File "/usr/local/lib/python3.12/site-packages/pyfamilysafety/account.py", line 153, in override_device
response = await self._api.send_request(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pyfamilysafety/api.py", line 103, in send_request
raise HttpException("HTTP Error", response.status, await response.text())
pyfamilysafety.exceptions.HttpException: ('HTTP Error', 500, '"Internal Server Error"')

Diagnostics dump

No response

andyearnshaw commented 3 months ago

I have the same issue, HTTP 500 error. Blocking individual systems works, Block Windows/Mobile/Xbox. It's just all devices that doesn't work correctly.

pantherale0 commented 3 months ago

Will take a look at this asap, currently in the middle of moving so haven't got access to any of my dev environments.

devdems commented 1 month ago

@pantherale0 any luck with getting this error resolved?

gormac77 commented 2 weeks ago

Hi, I seem to have the same 500 error issue. I am able to block Windows as a whole but not individual apps. I have selected the apps from the UI, e.g. Roblox, so I do not think it is simply a matter of me spelling things incorrectly. Any ideas?

idorose commented 2 weeks ago

Hi, I seem to have the same 500 error issue. I am able to block Windows as a whole but not individual apps. I have selected the apps from the UI, e.g. Roblox, so I do not think it is simply a matter of me spelling things incorrectly. Any ideas?

same here, I also created switches for specific apps and it gives me the 500 error. Block mobile also doesn't seem to do anything (does it suppose to switch on and off the app time limit toggle in the health app?)

pantherale0 commented 2 weeks ago

Haven't got my other mobile with me at present, but debugging it looks like Microsoft's API has changed. At the moment all I literally have from Microsoft is "Internal Server Error" in the response body so it doesn't actually tell us whats wrong.

I've not used the app for a while, could someone confirm if these features are still available?

@idorose The Block Mobile switch is supposed to block mobile devices (Android), but I've never been able to get this to work. Just something that is exposed in the API.

gormac77 commented 1 week ago

@pantherale0 I can confirm the features are still avalable in the mobile app. I can go in and manage mobile, xbox and Windows for each of the users down to the application level. The interface has changed recently so possibly the API as well.

pantherale0 commented 1 week ago

Thanks @gormac77 if the UI has changed. The API has probably changed too in that case. I'll investigate asap but don't have the right hardware to hand at present.