benleb / surepy

šŸ¾ Library & CLI to monitor and control the Pet Door & Cat Flap Connect šŸšŖ the Pet Feeder Connect šŸ½ and the Felaqua šŸ’¦ sold by Sure Petcare
https://pypi.org/project/surepy/
MIT License
76 stars 36 forks source link

SurePy.Client Get app.api.surehub.io/api/report/household/xyz/: 404 #208

Open ChristophCaina opened 7 months ago

ChristophCaina commented 7 months ago

I was going through my HA logs, because I was searching for something non related to SurePy / SureHa when I noticed the following information (404 not found)

2024-01-06 10:30:05.039 INFO (MainThread) [surepy.client] šŸ¾ Ā· GET app.api.surehub.io/api/report/household/232498: 404 | <ClientResponse(https://app.api.surehub.io/api/report/household/232498) [404 Not Found]>
<CIMultiDictProxy('Date': 'Sat, 06 Jan 2024 09:30:04 GMT', 'Content-Length': '0', 'Connection': 'keep-alive', 'Server': 'nginx', 'Access-Control-Allow-Origin': '*', 'Strict-Transport-Security': 'max-age=31536000; includeSubdomains; preload', 'X-Frame-Options': 'DENY', 'X-Content-Type-Options': 'nosniff', 'X-XSS-Protection': '1; mode=block')>

2024-01-06 10:30:05.039 DEBUG (MainThread) [custom_components.sureha] Finished fetching sureha_sensors data in 3.929 seconds (success: True)
2024-01-06 10:30:05.039 INFO (MainThread) [custom_components.sureha] 
2024-01-06 10:30:05.040 INFO (MainThread) [custom_components.sureha]  Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· /į  ._. įŸ\ļ¾‰
2024-01-06 10:30:05.040 INFO (MainThread) [custom_components.sureha]   šŸ¾   meeowww..! to the SureHA integration!
2024-01-06 10:30:05.040 INFO (MainThread) [custom_components.sureha]   šŸ¾     code & issues: https://github.com/benleb/sureha
2024-01-06 10:30:05.040 INFO (MainThread) [custom_components.sureha]  Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā·
2024-01-06 10:30:05.040 INFO (MainThread) [custom_components.sureha] 

I have to say, that the CatFlap seems to work - but the response and changes when a cat comes in and leave the house are delayed... and sometimes do not update at all.

this might be unrelated to the 404 error, but it might indicate a change on the API of SurePetcare.

I am using the SurePetcare integration from HA as well as SureHa in parallel, so I do see the same error for both integrations:

2024-01-06 10:30:07.418 INFO (MainThread) [surepy.client] šŸ¾ Ā· GET app.api.surehub.io/api/report/household/232498: 404 | <ClientResponse(https://app.api.surehub.io/api/report/household/232498) [404 Not Found]>
<CIMultiDictProxy('Date': 'Sat, 06 Jan 2024 09:30:07 GMT', 'Content-Length': '0', 'Connection': 'keep-alive', 'Server': 'nginx', 'Access-Control-Allow-Origin': '*', 'Strict-Transport-Security': 'max-age=31536000; includeSubdomains; preload', 'X-Frame-Options': 'DENY', 'X-Content-Type-Options': 'nosniff', 'X-XSS-Protection': '1; mode=block')>

2024-01-06 10:30:07.419 DEBUG (MainThread) [homeassistant.components.surepetcare] Finished fetching surepetcare data in 1.615 seconds (success: True)
2024-01-06 10:30:09.097 INFO (MainThread) [surepy.client] šŸ¾ Ā· GET app.api.surehub.io/api/report/household/232498: 404 | <ClientResponse(https://app.api.surehub.io/api/report/household/232498) [404 Not Found]>
<CIMultiDictProxy('Date': 'Sat, 06 Jan 2024 09:30:08 GMT', 'Content-Length': '0', 'Connection': 'keep-alive', 'Server': 'nginx', 'Access-Control-Allow-Origin': '*', 'Strict-Transport-Security': 'max-age=31536000; includeSubdomains; preload', 'X-Frame-Options': 'DENY', 'X-Content-Type-Options': 'nosniff', 'X-XSS-Protection': '1; mode=block')>

2024-01-06 10:30:09.097 DEBUG (MainThread) [custom_components.sureha] Finished fetching sureha_sensors data in 0.840 seconds (success: True)
2024-01-06 10:30:09.656 INFO (SyncWorker_4) [ynca.subunit] Subunit Subunit.MAIN initialization end.
cs12ag commented 7 months ago

Have a read of the comment chains on https://github.com/benleb/surepy/issues/199 and https://github.com/benleb/surepy/pull/200. You likely need to upgrade HomeAssistant Core to 2023.12.4 or higher.

ChristophCaina commented 7 months ago

I'm running the lastet ha 2024.1.x

cs12ag commented 7 months ago

That's interesting - I figured the contents of PR 200 were merged under a different PR, given that PR 200 was closed. However, that appears not to be the case when looking at the code. Even if the new API doesn't behave in the same way as the old one, it behaves the same way for some functionality - so while changing the API URI used in surepy might break something, it at least provides some functionality which is better than a 404. I've been using https://app-api.production.surehub.io as my API URI since SurePet started implementing the changes late last year. You can resolve this yourself within the surepy library in HomeAssistant if you're able, but I think there will have to be a PR very similar to PR 200 requested again.

magicmega commented 6 months ago

I'm having the same issue. Also checking the 'production' API on postman renders the same 404 error for a call to report/household/[id]. Interestingly report/household/[id]/pet/[id] does work...

my sensors get set up but have unknown values.

2024-02-02 14:46:43.460 INFO (MainThread) [homeassistant.setup] Setting up sureha
2024-02-02 14:46:43.461 INFO (MainThread) [homeassistant.setup] Setup of domain sureha took 0.0 seconds
2024-02-02 14:46:48.000 INFO (MainThread) [surepy.client] šŸ¾ Ā· GET app.api.surehub.io/api/report/household/[my id]: 404 | <ClientResponse(https://app.api.surehub.io/api/report/household/[my id]) [404 Not Found]>
<CIMultiDictProxy('Date': 'Fri, 02 Feb 2024 03:46:47 GMT', 'Content-Length': '0', 'Connection': 'keep-alive', 'Server': 'nginx', 'Access-Control-Allow-Origin': '*', 'Strict-Transport-Security': 'max-age=31536000; includeSubdomains; preload', 'X-Frame-Options': 'DENY', 'X-Content-Type-Options': 'nosniff', 'X-XSS-Protection': '1; mode=block')>

2024-02-02 14:46:51.933 INFO (MainThread) [custom_components.sureha] 
2024-02-02 14:46:51.933 INFO (MainThread) [custom_components.sureha]  Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· /į ļ½”ā–æļ½”įŸ\*įµ–įµ˜Ź³Ź³
2024-02-02 14:46:51.933 INFO (MainThread) [custom_components.sureha]   šŸ¾   meeowww..! to the SureHA integration!
2024-02-02 14:46:51.933 INFO (MainThread) [custom_components.sureha]   šŸ¾     code & issues: https://github.com/benleb/sureha
2024-02-02 14:46:51.933 INFO (MainThread) [custom_components.sureha]  Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā· Ā·
2024-02-02 14:46:51.933 INFO (MainThread) [custom_components.sureha] 
2024-02-02 14:46:51.955 WARNING (MainThread) [homeassistant.components.binary_sensor] DEVICE_CLASS_CONNECTIVITY was used from sureha, this is a deprecated constant which will be removed in HA Core 2025.1. Use BinarySensorDeviceClass.CONNECTIVITY instead, please create a bug report at https://github.com/benleb/sureha/issues
2024-02-02 14:46:51.967 WARNING (MainThread) [homeassistant.components.binary_sensor] DEVICE_CLASS_PRESENCE was used from sureha, this is a deprecated constant which will be removed in HA Core 2025.1. Use BinarySensorDeviceClass.PRESENCE instead, please create a bug report at https://github.com/benleb/sureha/issues
2024-02-02 14:46:51.978 WARNING (MainThread) [homeassistant.components.binary_sensor] DEVICE_CLASS_CONNECTIVITY was used from sureha, this is a deprecated constant which will be removed in HA Core 2025.1. Use BinarySensorDeviceClass.CONNECTIVITY instead, please create a bug report at https://github.com/benleb/sureha/issues
2024-02-02 14:46:51.989 WARNING (MainThread) [homeassistant.components.binary_sensor] DEVICE_CLASS_PRESENCE was used from sureha, this is a deprecated constant which will be removed in HA Core 2025.1. Use BinarySensorDeviceClass.PRESENCE instead, please create a bug report at https://github.com/benleb/sureha/issues
2024-02-02 14:46:51.990 INFO (MainThread) [homeassistant.components.binary_sensor] Setting up sureha.binary_sensor
2024-02-02 14:46:52.004 WARNING (MainThread) [homeassistant.const] DEVICE_CLASS_BATTERY was used from sureha, this is a deprecated constant which will be removed in HA Core 2025.1. Use SensorDeviceClass.BATTERY instead, please create a bug report at https://github.com/benleb/sureha/issues
2024-02-02 14:46:52.015 WARNING (MainThread) [homeassistant.const] MASS_GRAMS was used from sureha, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfMass.GRAMS instead, please create a bug report at https://github.com/benleb/sureha/issues
2024-02-02 14:46:52.026 WARNING (MainThread) [homeassistant.const] VOLUME_MILLILITERS was used from sureha, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfVolume.MILLILITERS instead, please create a bug report at https://github.com/benleb/sureha/issues
2024-02-02 14:46:52.027 INFO (MainThread) [homeassistant.components.sensor] Setting up sureha.sensor
2024-02-02 14:46:52.032 INFO (MainThread) [homeassistant.components.device_tracker] Setting up sureha.device_tracker
2024-02-02 14:46:52.041 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new binary_sensor.sureha entity: binary_sensor.lunas_bowl_connectivity
2024-02-02 14:46:52.042 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new binary_sensor.sureha entity: binary_sensor.felaqua_connectivity
2024-02-02 14:46:52.044 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new binary_sensor.sureha entity: binary_sensor.hub_surepet_hub
2024-02-02 14:46:52.045 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new binary_sensor.sureha entity: binary_sensor.pet_luna
2024-02-02 14:46:52.049 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new binary_sensor.sureha entity: binary_sensor.pet_blaze
2024-02-02 14:46:52.051 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.sureha entity: sensor.feeder_blazes_bowl
2024-02-02 14:46:52.052 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.sureha entity: sensor.feeder_blazes_bowl_battery_level
2024-02-02 14:46:52.053 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.sureha entity: sensor.feeder_lunas_bowl
2024-02-02 14:46:52.056 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.sureha entity: sensor.feeder_lunas_bowl_battery_level
2024-02-02 14:46:52.058 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.sureha entity: sensor.felaqua_felaqua
2024-02-02 14:46:52.059 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.sureha entity: sensor.felaqua_felaqua_battery_level
2024-02-02 14:46:55.654 INFO (MainThread) [surepy.client] šŸ¾ Ā· GET app.api.surehub.io/api/report/household/[my id]: 404 | <ClientResponse(https://app.api.surehub.io/api/report/household/[my id]) [404 Not Found]>
<CIMultiDictProxy('Date': 'Fri, 02 Feb 2024 03:46:55 GMT', 'Content-Length': '0', 'Connection': 'keep-alive', 'Server': 'nginx', 'Access-Control-Allow-Origin': '*', 'Strict-Transport-Security': 'max-age=31536000; includeSubdomains; preload', 'X-Frame-Options': 'DENY', 'X-Content-Type-Options': 'nosniff', 'X-XSS-Protection': '1; mode=block')>