-
-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update API Url #200
Update API Url #200
Conversation
I've tested your changes in my local installation and I'm struggling to get it operational.
Oddly, there seems to be another API used too: https://app-api.production.surehub.io/api/start However, I've tested out using this URI instead i.e. removing '.blue' from the URI in const.py and client.py. I'm actually then able to create a token from the CLI. I was also then presented with a final issue that took me an annoyingly long time to work out - the auth token also exists in the hidden file /config/.storage/.core.config_entries . Once I'd copied over the new token from /root/.surepy.token into the 'token' parameter in the 'sureha' json and restarted HA, I was able to authenticate and get the the Sure HA integration up and running again. I wonder if there is an issue with some part of SureHA that either isn't checking for a new token in /root/.surepy.token or isn't replacing the contents of the /config/.storage/.core.config_entries json when it's supposed to. |
@cs12ag are you sending a device id along with the user and password? With this I was able to get a token via the CLI and in postman, but I never went as far as you did to get it going in HASS as I'm not up on how that all works. |
Yep. The device ID is automatically handled by the surepy library, It looks rather basic, in so much as a random UUID is being passed each time: https://github.com/benleb/surepy/blob/dev/surepy/client.py#L113 Apologies for presuming you were also working with a Home Assistant system; I should have figured that the separation of surepy and SureHA was so that anyone could use the underlying API to SurePetcare without being forced to host it within a Home Assistant system. |
I am using home assistant, I just don't know how to modify its components, but I do know how to install and modify stuff in python :P |
Ah! I have quite a specific, non-standard HA set-up. I can tell you how I modified the surepy component on mine for testing, but that may not the same for you - my testing was done on a system where I've explicitly set each part of HA up in its own container in docker. This was so that I didn't have to hand over my entire Raspberry PI to HASS OS. |
I manually modified the lib with the changes in this PR on my HA instance and that did not do the trick unfortunately. But I don't know that much about how the HA architecture works so I might have missed a step. |
@ivo-toby Did you use There might also be some shenanigans going on around using a token generated by |
I'm afraid that changing the URL will not solve the issue. It seems that the specs of the messages were also changed. |
@dieriver I'm surprised and somewhat elated to see that API definition. I didn't think that information would be made public. That's cool. However, the documentation you've found for the Enum set isn't related to the request actually sent to the API. Those Enums are the outcome of the transaction itself, and they appear in the 'results' section of the response json. The actual business bit of the request is within the 'data' section of the request json, which is entirely undefined according to the documentation. I've tested this out using F12 on Chrome and then locked my cat-flap (keep pets in), the content of the 'data' json element is as follows:
The value of |
@cs12ag interesting... if I find some time this weekend, I will try to play a bit more with the "manual" HTTP requests from any browser. As you say, maybe a full re-implementation is not required, but just some adjustments to match the new structures |
Hello, there is at least one thing that seems to have changed in the new API: my old command to add a pet to a feeder doesn't work anymore but surprisingly the command to remove a pet is still working ??? |
I'm going to close this PR for now as it seems insufficient :( |
Oh does it not fix the issue? Sad all my pet automations now are not working. Wish there was a local option for products that do what theirs do their approach to smart home is God awful. |
Hello I am the author of the sure petcare products integration in the Jeedom french home automation software (not using the surepy library but "largely inspired" by its code). As the authentification is still working with the new base url in jeedom (but other part of the plugin are broken for instance curfew and profile requests) I guess you are just missing to add Content-Type: application/json and Content-Length in the headers of the requests to make authentification working again. For the blue/green thing I and totaly unfamiliar with that but I was beleiving that blue is the old API and green the new one. As long as blue is not deprecated we can use blue. Correct ? |
I find some aspects of the API quite surprising: |
@jmvedrine the swagger documentation for all the following APIs all look the same: The new API green is giving me 403 response currently (https://app-api.green.production.surehub.io/index.html). |
Hope you guys can fix it, would be super grateful! |
I think this is used if you let a can in another door. There is a way in the app to mark a cat as in or out. We use it from time to time :) |
@cs12ag might need to switch back over to blue, that works for me at the moment (https://app-api.blue.production.surehub.io/index.html) |
Yes I use that feature in my Jeedom plugin too. And I just found that a call to /api/v2/report/household/{householdId}/pet/{petId} gives results for pet movements with entry_device_id and exit_device_id so they are certainly trying to fix the case of several flaps but I was expecting consistency between GET and PUT calls. |
Following up to see if there are any updates on this? Specifically as it relates to the feeders not working in Home Assistant with sureha integration.. |
closes #199