pantherale0 / ha-familysafety

Microsoft Family Safety Home Assistant integration
MIT License
14 stars 2 forks source link

500 error when trying to "Block x" #63

Open tucker87 opened 2 days ago

tucker87 commented 2 days ago

System Health details

System Information

version core-2024.11.1
installation_type Home Assistant Container
dev false
hassio false
docker true
user root
virtualenv false
python_version 3.12.4
os_name Linux
os_version 6.8.0-47-generic
arch x86_64
timezone America/New_York
config_dir /config
Home Assistant Community Store GitHub API | ok -- | -- GitHub Content | ok GitHub Web | ok HACS Data | ok GitHub API Calls Remaining | 5000 Installed Version | 2.0.1 Stage | running Available Repositories | 1462 Downloaded Repositories | 8
Home Assistant Cloud logged_in | true -- | -- subscription_expiration | July 18, 2025 at 8:00 PM relayer_connected | true relayer_region | us-east-1 remote_enabled | false remote_connected | false alexa_enabled | true google_enabled | true cloud_ice_servers_enabled | true remote_server | us-east-1-4.ui.nabu.casa certificate_status | ready instance_id | 403f1467f6c74ded8ac5a45b314c4d8a can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | ok
Dashboards dashboards | 3 -- | -- resources | 2 views | 1 mode | storage
Recorder oldest_recorder_run | November 6, 2024 at 11:57 PM -- | -- current_recorder_run | November 13, 2024 at 5:22 AM estimated_db_size | 142.91 MiB database_engine | sqlite database_version | 3.45.3
Sonoff version | 3.8.1 (ffa7e22) -- | -- cloud_online | 1 / 2 local_online | 1 / 1

Checklist

Describe the issue

Two different kids accounts. Either one, when I tried to turn on/off a block option I get this 500.

Reproduction steps

  1. Click any of these image

Debug logs

2024-11-14 23:08:54.202 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration nodered which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-11-14 23:08:54.207 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-11-14 23:08:54.209 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration sonoff which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-11-14 23:08:54.212 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration emporia_vue which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-11-14 23:08:54.215 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration family_safety which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-11-14 23:08:54.219 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration midea_dehumidifier_lan which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-11-14 23:08:54.223 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration frigate which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-11-14 23:09:00.978 WARNING (MainThread) [hass_nabucasa.cloud_api] Fetched https://alexa-api.nabucasa.com/access_token (400) 
2024-11-14 23:09:06.983 DEBUG (MainThread) [custom_components.family_safety] Got request to setup entry.
2024-11-14 23:09:13.319 WARNING (MainThread) [kasa.discover] Got unsupported connection type: {'device_family': 'SMART.IPCAMERA', 'encryption_type': 'AES', 'https': True}
2024-11-14 23:09:13.380 WARNING (MainThread) [kasa.discover] Got unsupported connection type: {'device_family': 'SMART.IPCAMERA', 'encryption_type': 'AES', 'https': True}
2024-11-14 23:09:13.387 WARNING (MainThread) [kasa.discover] Got unsupported connection type: {'device_family': 'SMART.IPCAMERA', 'encryption_type': 'AES', 'https': True}
2024-11-14 23:09:13.414 WARNING (MainThread) [kasa.discover] Got unsupported connection type: {'device_family': 'SMART.IPCAMERA', 'encryption_type': 'AES', 'https': True}
2024-11-14 23:09:14.161 ERROR (MainThread) [custom_components.midea_dehumidifier_lan.hub] Error 'Timeout while connecting to appliance 192.168.2.224:6445' while setting up appliance 000000P0000000Q1B88C29FBB2380000, full configuration {'broadcast_address': ['255.255.255.255'], 'debug': False, 'devices': [{'api_version': 3, 'discovery': 'LAN', 'id': '14733455818****', 'ip_address': '192.168.2.224', 'name': 'Frozone', 'token': '********************************************************************************************************************************', 'token_key': '****************************************************************', 'type': '0xac', 'unique_id': '000000P0000000Q1B88C29FB********'}, {'api_version': 3, 'discovery': 'WAIT', 'id': '15063309356****', 'ip_address': '0.0.0.0', 'name': 'Dehumidifier 2', 'token': '', 'token_key': '', 'ttl': 5, 'type': '0xA1', 'unique_id': '000000P0000000Q12459E57B********'}, {'api_version': 3, 'discovery': 'WAIT', 'id': '14183700000****', 'ip_address': '0.0.0.0', 'name': 'Dehumidifier', 'token': '', 'token_key': '', 'ttl': 5, 'type': '0xA1', 'unique_id': '000000P0000000Q1A0681CB1********'}], 'include': ['0xa1', '0xac'], 'mobile_app': 'MSmartHome', 'password': '**************', 'scan_interval': 15, 'username': '****************'}
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/midea_beautiful/lan.py", line 1011, in appliance_state
    response = sock.recv(512)
               ^^^^^^^^^^^^^^
TimeoutError: timed out

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/config/custom_components/midea_dehumidifier_lan/hub.py", line 210, in async_discover_device
    appliance = await self.hass.async_add_executor_job(
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/midea_dehumidifier_lan/util.py", line 208, in appliance_state
    return midea_beautiful_api.appliance_state(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/midea_beautiful/lan.py", line 1023, in appliance_state
    raise MideaNetworkError(
midea_beautiful.exceptions.MideaNetworkError: Timeout while connecting to appliance 192.168.2.224:6445
2024-11-14 23:09:14.224 WARNING (MainThread) [custom_components.midea_dehumidifier_lan.hub] Device may be offline or unreachable, trying again later. Unable to get state of device Frozone: Timeout while connecting to appliance 192.168.2.224:6445
2024-11-14 23:09:14.253 DEBUG (MainThread) [custom_components.family_safety] Login successful, setting up coordinator.
2024-11-14 23:09:19.293 WARNING (MainThread) [homeassistant.components.climate] Entity None (<class 'custom_components.midea_dehumidifier_lan.climate.AirConditionerEntity'>) does not set ClimateEntityFeature.TURN_OFF but implements the turn_off method. Please create a bug report at https://github.com/nbogojevic/homeassistant-midea-air-appliances-lan/issues
2024-11-14 23:09:19.294 WARNING (MainThread) [homeassistant.components.climate] Entity None (<class 'custom_components.midea_dehumidifier_lan.climate.AirConditionerEntity'>) does not set ClimateEntityFeature.TURN_ON but implements the turn_on method. Please create a bug report at https://github.com/nbogojevic/homeassistant-midea-air-appliances-lan/issues
2024-11-14 23:09:19.294 WARNING (MainThread) [homeassistant.components.climate] Entity None (<class 'custom_components.midea_dehumidifier_lan.climate.AirConditionerEntity'>) implements HVACMode(s): off, auto, cool, heat, dry, fan_only and therefore implicitly supports the turn_on/turn_off methods without setting the proper ClimateEntityFeature. Please create a bug report at https://github.com/nbogojevic/homeassistant-midea-air-appliances-lan/issues
2024-11-14 23:09:19.690 WARNING (ImportExecutor_0) [homeassistant.core] Config was used from frigate, this is a deprecated alias which will be removed in HA Core 2025.11. Use homeassistant.core_config.Config instead, please report it to the author of the 'frigate' custom integration
2024-11-14 23:09:19.726 WARNING (ImportExecutor_0) [homeassistant.components.media_player.const] MEDIA_CLASS_DIRECTORY was used from frigate, this is a deprecated constant which will be removed in HA Core 2025.10. Use MediaClass.DIRECTORY instead, please report it to the author of the 'frigate' custom integration
2024-11-14 23:09:19.738 WARNING (ImportExecutor_0) [homeassistant.components.media_player.const] MEDIA_CLASS_IMAGE was used from frigate, this is a deprecated constant which will be removed in HA Core 2025.10. Use MediaClass.IMAGE instead, please report it to the author of the 'frigate' custom integration
2024-11-14 23:09:19.746 WARNING (ImportExecutor_0) [homeassistant.components.media_player.const] MEDIA_CLASS_MOVIE was used from frigate, this is a deprecated constant which will be removed in HA Core 2025.10. Use MediaClass.MOVIE instead, please report it to the author of the 'frigate' custom integration
2024-11-14 23:09:19.763 WARNING (ImportExecutor_0) [homeassistant.components.media_player.const] MEDIA_CLASS_VIDEO was used from frigate, this is a deprecated constant which will be removed in HA Core 2025.10. Use MediaClass.VIDEO instead, please report it to the author of the 'frigate' custom integration
2024-11-14 23:09:19.775 WARNING (ImportExecutor_0) [homeassistant.components.media_player.const] MEDIA_TYPE_IMAGE was used from frigate, this is a deprecated constant which will be removed in HA Core 2025.10. Use MediaType.IMAGE instead, please report it to the author of the 'frigate' custom integration
2024-11-14 23:09:19.787 WARNING (ImportExecutor_0) [homeassistant.components.media_player.const] MEDIA_TYPE_VIDEO was used from frigate, this is a deprecated constant which will be removed in HA Core 2025.10. Use MediaType.VIDEO instead, please report it to the author of the 'frigate' custom integration
2024-11-14 23:09:19.928 WARNING (MainThread) [homeassistant.helpers.frame] Detected that custom integration 'nodered' registers an entity service with a non entity service schema which will stop working in HA Core 2025.9 at custom_components/nodered/switch.py, line 62: platform.async_register_entity_service(, please create a bug report at https://github.com/zachowj/hass-node-red/issues
2024-11-14 23:09:25.661 DEBUG (MainThread) [custom_components.family_safety.coordinator] Finished fetching Microsoft Family Safety data in 6.340 seconds (success: True)
2024-11-14 23:10:21.389 ERROR (MainThread) [custom_components.midea_dehumidifier_lan.appliance_coordinator] Error fetching Frozone data: Unable to get state of device Frozone: Timeout while connecting to appliance 192.168.2.224:6445

Pretty sure everything above this is noise. The Midea stuff is because we've just unplugged them recently.
-----

2024-11-14 23:10:30.885 DEBUG (MainThread) [custom_components.family_safety.coordinator] Finished fetching Microsoft Family Safety data in 5.724 seconds (success: True)
2024-11-14 23:10:41.013 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [130750542153616] Unexpected exception
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 245, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2802, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2845, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1007, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1079, 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"')
2024-11-14 23:10:43.715 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [130750542153616] Unexpected exception
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 245, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2802, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2845, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1007, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1079, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/config/custom_components/family_safety/switch.py", line 113, in async_turn_on
    return await self._enable_override()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/family_safety/entity_base.py", line 110, in _enable_override
    await self._account.override_device(self._platform, OverrideType.UNTIL, valid_until=until)
  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"')
2024-11-14 23:10:45.723 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [130750542153616] Unexpected exception
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 245, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2802, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2845, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1007, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1079, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/config/custom_components/family_safety/switch.py", line 113, in async_turn_on
    return await self._enable_override()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/family_safety/entity_base.py", line 110, in _enable_override
    await self._account.override_device(self._platform, OverrideType.UNTIL, valid_until=until)
  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"')
2024-11-14 23:10:48.382 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [130750542153616] Unexpected exception
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 245, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2802, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2845, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1007, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1079, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/config/custom_components/family_safety/switch.py", line 113, in async_turn_on
    return await self._enable_override()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/family_safety/entity_base.py", line 110, in _enable_override
    await self._account.override_device(self._platform, OverrideType.UNTIL, valid_until=until)
  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

I cannot find this. :(

pantherale0 commented 2 days ago

Hi,

Can you try the beta version please?

https://github.com/pantherale0/ha-familysafety/releases/tag/2024.12.0b0

tucker87 commented 1 day ago

Issue still present with 2024.12.0b1.

pantherale0 commented 1 day ago

This is very odd as I can't replicate it, something specific to your account perhaps.

tucker87 commented 16 hours ago

image I updated both boys PC to Windows 11 and renamed them.

I am able to see the block status change. But still get a 500 when I try to change it via the integration.

500 error does seem to indicate something up with my account, not the request. :cry:

EDIT:

Logger: custom_components.family_safety.coordinator
Source: helpers/update_coordinator.py:414
integration: Microsoft Family Safety ([documentation](https://github.com/pantherale0/ha-familysafety), [issues](https://github.com/pantherale0/ha-familysafety/issues))
First occurred: 8:45:01 PM (9 occurrences)
Last logged: 10:31:38 PM

    Error fetching Microsoft Family Safety data: Error communicating with API Connection timeout to host https://mobileaggregator.family.microsoft.com/api/v1/Spending/1055519044729996
    Error fetching Microsoft Family Safety data: Error communicating with API Connection timeout to host https://mobileaggregator.family.microsoft.com/api/v1/devicelimits/1055519044729996/overrides
    Error fetching Microsoft Family Safety data: Error communicating with API Connection timeout to host https://mobileaggregator.family.microsoft.com/api/v4/activityreport/deviceScreenTimeUsage/985154654620021?beginTime=2024-11-16T00:00:00-0500&endTime=2024-11-16T23:59:59-0500&topDeviceCount=4
    Error fetching Microsoft Family Safety data: Error communicating with API Connection timeout to host https://mobileaggregator.family.microsoft.com/api/v1/Spending/985154654620021
    Error fetching Microsoft Family Safety data: Error communicating with API Connection timeout to host https://mobileaggregator.family.microsoft.com/api/v1/devicelimits/985154654620021/overrides

I'm also getting consistent "x became unavailable" messages. And the App has been extremely slow. So maybe my account is royally broken.