Skip to content
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

API stopped working: "The requested URL /api_v210707_NE/gdc/InitialApp_v2.php was not found on this server." #46

Open
irekzielinski opened this issue May 17, 2024 · 34 comments · May be fixed by #47

Comments

@irekzielinski
Copy link

irekzielinski commented May 17, 2024

Im in the UK and noticed API stopped working (Nissan app works OK).
This line of code fails:

image

Logged the error message:

`ERROR:pycarwings2.pycarwings2:Invalid JSON returned:
<html>

<title>404 Not Found</title>

Not Found

The requested URL /api_v210707_NE/gdc/InitialApp_v2.php was not found on this server.

Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/pycarwings2/pycarwings2.py", line 160, in _request
j = json.loads(response.text)
File "/usr/local/lib/python3.7/json/init.py", line 348, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.7/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/lib/python3.7/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
`

Anyone else seeing this?
Thanks!

@remuslazar
Copy link

Same here in Germany. The stock Nissan app works, though.

@Ez2517-Git
Copy link

Nissan changed the base URL, the new one can be found here:

https://github.com/joeshaw/carwings

@irekzielinski
Copy link
Author

Nissan changed the base URL, the new one can be found here:

https://github.com/joeshaw/carwings

Great find!
Indeed, this modification fixes the script:

image

remuslazar added a commit to remuslazar/pycarwings2 that referenced this issue May 18, 2024
Obviously the API endpoint has been changed, see filcole#46 (comment)
@remuslazar remuslazar linked a pull request May 18, 2024 that will close this issue
@josemi73
Copy link

josemi73 commented May 18, 2024

Thank you @irekzielinski @Ez2517-Git , in my local HAOS I have just updated the BASE_URL:

  1. SSH to HAOS
  2. docker exec -it homeassistant bash
  3. sed -i 's/api_v210707_/api_v230317_/g' /usr/local/lib/python3.12/site-packages/pycarwings2/pycarwings2.py
  4. I restarted HAOS (I do not know if it is mandatory)
    and it is working again.

@remuslazar
Copy link

I have also crafted #47 which updates the BASE_URL configuration and was able to validate that everything works fine by using this PR on my HA instance.

@badi19
Copy link

badi19 commented May 18, 2024

i am supprised that an external leaf app continues working. Checking the opensource discover that the endpoint on that app was changed 9 months ago. It seams the author of that app was informed earlier and didn't have to wait and discover the api's don't work anymore.

the app i am reffering to: "my leaf".

@mihaicristianpetrescu
Copy link

For anyone who needs access to lower level SSH on a local install check this out: https://developers.home-assistant.io/docs/operating-system/debugging/#generating-ssh-keys
Then you can connect and run the commands from this post #46 (comment)

@callalillity
Copy link

I apologise if this is a stupid question - but after i edit the file how do i save changes? When i restart home assistant the api link I've edited reverts back.

@josemi73
Copy link

I apologise if this is a stupid question - but after i edit the file how do i save changes? When i restart home assistant the api link I've edited reverts back.

Press escape key, then write:
:wq

@remuslazar
Copy link

I apologise if this is a stupid question - but after i edit the file how do i save changes? When i restart home assistant the api link I've edited reverts back.

Press escape key, then write: :wq

or: ESC, then ZZ

@ik3huk
Copy link

ik3huk commented May 19, 2024

Nissan Leaf N-Connecta 2023 working again in Italy, thank you so much for the update

@Ez2517-Git
Copy link

Ez2517-Git commented May 20, 2024 via email

@josemi73
Copy link

Thank you @irekzielinski @Ez2517-Git , in my local HAOS I have just updated the BASE_URL:

  1. SSH to HAOS
  2. docker exec -it homeassistant bash
  3. sed -i 's/api_v210707_/api_v230317_/g' /usr/local/lib/python3.12/site-packages/pycarwings2/pycarwings2.py
  4. I restarted HAOS (I do not know if it is mandatory)
    and it is working again.

I have replaced the step 3, if anybody don't know how to use 'vi command'

@jmason
Copy link

jmason commented May 20, 2024

I can confirm this also fixes the problem for me (I'm in Ireland).

@Hein1966
Copy link

Thank you for the update. It works again on my Nissan Leaf 2018.

@badi19
Copy link

badi19 commented May 21, 2024

I'm afraid this isn't gonna work for homeassistant-core.

@Phatfishie
Copy link

I'm afraid this isn't gonna work for homeassistant-core.

I have literally no idea of what to do here! Should I just wait for an HA update? How long might that take please?

@Hein1966
Copy link

First you have to install a ssh terminal in HA: https://www.youtube.com/watch?v=dAmGYrKDpZE
and then you can execuse line 2,3 of the solutions.

@Phatfishie
Copy link

First you have to install a ssh terminal in HA: https://www.youtube.com/watch?v=dAmGYrKDpZE and then you can execuse line 2,3 of the solutions.

Thanks for this. Have just followed it and it works perfectly!

@badi19
Copy link

badi19 commented May 22, 2024

Works for me too now. I already had ssh and terminal installed. But not the advanced version. The non-advanced version obviously hasn't docker available. After installing the advanced version and following the instructions my Nissan is available.

Thanks!

@arundalep
Copy link

Works for me, (once I realised I needed the advanced ssh addon).
Thank you

@Tatouille7
Copy link

Works for me, (once I realised I needed the advanced ssh addon). Thank you

Same here. Thank you very much.

@niklasgisselman
Copy link

I'm afraid this isn't gonna work for homeassistant-core.

Any ideas how to solve it for core?

@badi19
Copy link

badi19 commented May 26, 2024

I'm afraid this isn't gonna work for homeassistant-core.

Any ideas how to solve it for core?

Yes, just follow the instructions above. Bu sure to install the advanced ssh (also if you already installed the basic ssh)

1:

First you have to install a ssh terminal in HA: https://www.youtube.com/watch?v=dAmGYrKDpZE

2:
During installation you selected to add terminal to your menu. And in the configuration: unset protectionmodus.
Open terminal and perform the steps below beginning with step 2. (You can skip step 1, step 1 is done by opening terminal.

Thank you @irekzielinski @Ez2517-Git , in my local HAOS I have just updated the BASE_URL:

  1. SSH to HAOS
  2. docker exec -it homeassistant bash
  3. sed -i 's/api_v210707_/api_v230317_/g' /usr/local/lib/python3.12/site-packages/pycarwings2/pycarwings2.py
  4. I restarted HAOS (I do not know if it is mandatory)
    and it is working again.

In case you make any typo's on step 3 (i did on my mobile phone :-(, in the second part of the replacement apparently):
You can also edit the pycarwings2.py using vi.
It is not difficult to find the api url. Correct the typo and you're done.

@OldSmurf56
Copy link

TBH, I didn't know what I was doing, but doing this

SSH to HAOS
docker exec -it homeassistant bash
sed -i 's/api_v210707_/api_v230317_/g' /usr/local/lib/python3.12/site-packages/pycarwings2/pycarwings2.py

magically worked!. I also restarted my HA.
My HA is running as a VM on ESXi 6.7.

Thank you so much @irekzielinski @Ez2517-Git

@TyzzyT
Copy link

TyzzyT commented Jun 13, 2024

Not sure if I'm doing something wrong, or if HA changed their folder structure. But it looks like this fix is not working anymore with HA 2024.6.x release. When navigating to /usr/ there is no local folder.
image

Using HA OS, running as a VM

@badi19
Copy link

badi19 commented Jun 13, 2024

@TyzzyT

Not sure if I'm doing something wrong, or if HA changed their folder structure. But it looks like this fix is not working anymore with HA 2024.6.x release. When navigating to /usr/ there is no local folder.

Using HA OS, running as a VM

As mentioned above: use advanced ssh. I ran into the same problem by using the standard ssh.

@TyzzyT
Copy link

TyzzyT commented Jun 13, 2024

I'm using the VM console, which worked a few weeks ago with the HA 2024.5 release. I'll check the advanced SSH add-on.

@Tatouille7
Copy link

I'm using the VM console, which worked a few weeks ago with the HA 2024.5 release. I'll check the advanced SSH add-on.

Advanced ssh worked fine Yesterday for me, as for the previous realeses of HA.

@TyzzyT
Copy link

TyzzyT commented Jun 13, 2024

I'm using the VM console, which worked a few weeks ago with the HA 2024.5 release. I'll check the advanced SSH add-on.

Advanced ssh worked fine Yesterday for me, as for the previous realeses of HA.

Advanced SSH add-on is working, thanks!

remuslazar added a commit to ev-freaks/pycarwings3 that referenced this issue Jun 23, 2024
Obviously the API endpoint has been changed, see filcole#46 (comment)
@ORi0N
Copy link

ORi0N commented Aug 25, 2024

No solution for the pycarwings2 issue yet? Or we need to continue to push this patch after each update of HA?

@remuslazar
Copy link

@ORi0N See https://github.com/remuslazar/homeassistant-carwings

@RPiSpy
Copy link

RPiSpy commented Oct 10, 2024

Thanks to everyone who provided info for this issue. I finally got the original integration working again by editing the pycarwings2.py file via the Advanced SSH Terminal. I initially struggled to get the Advanced SSH addon to run until I realised that the standard SSH addon was using port 22. You either have to Stop that addon, or change the port that the Advanced SSH addon uses from 22 to something else. e.g. 23.

@darnoldser
Copy link

When can I expect that a solution makes it into the official Home assistant?
So without HACS or workaround.

Thanks for the support on this to everyone who is contributing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.