Hello,
I've started a new project. My aim is to read out an inverter using modbus. I use the ESP32 and start an WifiClient to connect to the inverter. My plugin is ready so far. However, there is a problem. The connection cannot be reestablished when the ESP is restarted (wificlient.connect(lIP, 1502) always returns false). If the plugin is "Disabled" and "Enabled", everything works again.
So I think I have to restart or free anything.
Has anyone an idea how to work with WifiClient after use or to restart. Just client.stop() is not enough.
Thank you
regards
Peter
Wifi Client connection failed after reboot
Moderators: grovkillen, Stuntteam, TD-er
-
- New user
- Posts: 3
- Joined: 16 Jun 2022, 14:54
Re: Wifi Client connection failed after reboot
- What build of ESPEasy are you using?
- Are you building your own plugin, or using an existing one?
- Are you building your own plugin, or using an existing one?
/Ton (PayPal.me)
-
- New user
- Posts: 3
- Joined: 16 Jun 2022, 14:54
Re: Wifi Client connection failed after reboot
I use the custom_ESP32_4M316k build. As a basis I used the mega branch of 19.05.22.
It's a new plugin.
It's a new plugin.
Re: Wifi Client connection failed after reboot
Sounds like your plugin is causing a crash.
Do you see the unit rebooting when observing the log?
If you post the code of the plugin, we can have a peek of what might be happening here.
Also you may want to check whether there is a network connection, using the available functions in src/Helpers/Networking.cpp (and .h of course)
Do you see the unit rebooting when observing the log?
If you post the code of the plugin, we can have a peek of what might be happening here.
Also you may want to check whether there is a network connection, using the available functions in src/Helpers/Networking.cpp (and .h of course)
-
- New user
- Posts: 3
- Joined: 16 Jun 2022, 14:54
Re: Wifi Client connection failed after reboot
I found the problem.
As a workaround a tried to "enable" and "disable" with the rules. But although the rule worked, the connection could not be reestablished. So I checked the settings of the plugin.
In short, the IP address was not stored correctly. When pushing on "save" the IP address was rewritten. Then it worked again.
So thanks for your help
As a workaround a tried to "enable" and "disable" with the rules. But although the rule worked, the connection could not be reestablished. So I checked the settings of the plugin.
In short, the IP address was not stored correctly. When pushing on "save" the IP address was rewritten. Then it worked again.
So thanks for your help
Re: Wifi Client connection failed after reboot
Where is the IP address stored that you need?
If it is in your own code, please show how the data structure is made and how you have your save function implemented (and the webform load)
If it is in your own code, please show how the data structure is made and how you have your save function implemented (and the webform load)
Who is online
Users browsing this forum: No registered users and 85 guests