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

Reset via URL (with or maybe without PW if it is easier) #643

Closed
GitHag42 opened this issue Feb 27, 2023 · 6 comments
Closed

Reset via URL (with or maybe without PW if it is easier) #643

GitHag42 opened this issue Feb 27, 2023 · 6 comments
Labels
enhancement New feature or request

Comments

@GitHag42
Copy link

Is your feature request related to a problem? Please describe.

I discovered that the MQTT data is not updated anymore once in a while, although the webinterface opens normally.
It can be noticed with a watchdog timer in NodeRed and I would like to software reset the ESP then, because this solved the problem.

Describe the solution you'd like

A software reset via URL that can be triggered with automation (via NodeRed for instance). Or is this already implemented?

Describe alternatives you've considered

No response

Additional context

I somehow thought of this issue that happens to be related to MQTT libraries:
"MQTT client does not connect to MQTT broker after a TCP reconnection" mruettgers/SMLReader#47
But I could not yet reproduce this with the openDTU ESP for sure.
After disconneting and connecting my access point again the ESP with openDTU just rebooted and was working correctly.
With the SMLreader I could reproduce the problem by restarting my Fritzbox and the SMLreader is not sending MQTT data although connected to the WiFi.
But the ESP with openDTU is connected to my Unifi access points in a different WiFi. So it is not the absolute same situation.
For the SMLreader the watchdog soultion is working fine so far.

@GitHag42 GitHag42 added the enhancement New feature or request label Feb 27, 2023
@LustigePerson
Copy link

I just noticed this today with FW 6a6165e. In the morning, no MQTT data was sent. But this only occured today for the first time.

@ehofm3
Copy link

ehofm3 commented Mar 2, 2023

idk if that's a sufficient solution for you, but you can indeed trigger a reboot via web request (your browser does nothing different when you hit the button in the web interface).
I managed it with curl:

curl 'http://opendtu/api/maintenance/reboot' \
  -H 'Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryEKkgmvYBqjoZr06U' \
  -H 'authorization: Basic YW..VT' \
  --data-raw $'------WebKitFormBoundaryEKkgmvYBqjoZr06U\r\nContent-Disposition: form-data; name="data"\r\n\r\n{"reboot":true}\r\n------WebKitFormBoundaryEKkgmvYBqjoZr06U--\r\n'

I just recorded the web requests with Chrome and then copied the reboot one as a curl command, and then cut everything unnecessary. Maybe it can be shortened even further.

I don't know if there is another way to retrieve the auth key (YW..VT), didn't look into the code. You can also supply your credentials in the url (as you would for the api) like http://admin:<pw>@opendtu/api/maintenance/reboot, and then just get rid of the authorization line.


You even get a short response message to check via script or so on:
{"type":"success","message":"Reboot triggered!","code":6001}

@tbnobody
Copy link
Owner

tbnobody commented Mar 6, 2023

As mentioned above and here #656 this is already implemented.

@tbnobody tbnobody closed this as completed Mar 6, 2023
@GitHag42
Copy link
Author

GitHag42 commented Mar 7, 2023

I tried it yesterday but http://admin:@opendtu/api/maintenance/reboot with pw and opendtu replaces by the password and the IP did not work. I need something like this link to use it as a http request in Nodered. I don't know what to do with this curl stuff...

@ehofm3
Copy link

ehofm3 commented Mar 7, 2023

If you press the reboot button while you record the requests via Chrome (F12) you should be able to see the request:
image

All required data for you to build your http request in NodeRed should be in this recording.
As described above, you can even copy the request as a curl command or whatever you like. Just google "chrome inspect network activity" or so.

Copy link

github-actions bot commented Apr 6, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new discussion or issue for related concerns.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants