galak / span-hacs

MIT License
16 stars 10 forks source link

Getting 301 redirect for API #3

Open jeffkibuule opened 2 years ago

jeffkibuule commented 2 years ago

I tried installing this integration but it looks like they changed the API location?

Traceback (most recent call last): File "/config/custom_components/span_panel/init.py", line 53, in async_update_data await span_panel.spaces.getData() File "/config/custom_components/span_panel/span_panel.py", line 231, in getData results.raise_for_status() File "/usr/local/lib/python3.10/site-packages/httpx/_models.py", line 736, in raise_for_status raise HTTPStatusError(message, request=request, response=self) httpx.HTTPStatusError: Redirect response '301 Moved Permanently' for url 'http://192.168.0.170/api/v1/spaces' For more information check: https://httpstatuses.com/301

galak commented 2 years ago

What firmware version do you have? Are you able to go to http://192.168.0.170?

jeffkibuule commented 2 years ago

My firmware is spanos2/r202223/03. I ended up fixing that issue in a fork. I want to send you a PR when I have something: https://github.com/jeffkibuule/span-hacs

So far I've added:

Still stumped on:

Screen Shot 2022-08-10 at 10 15 52 AM Screen Shot 2022-08-10 at 10 16 13 AM
galak commented 2 years ago

Interesting, I wonder if that is a newer or older firmware compared to spanos2/r202216/04. How recent is your actual span panel?

jeffkibuule commented 2 years ago

My Span panel installation is from March 2022. I feel like the API on my device is newer, as accessing api/v1/spaces leaves the following message:

{"detail":"'spaces' endpoint has been deprecated, switch to 'circuits'"}

My model is 00200 if that matters.