Open agisofttm opened 2 years ago
Hi @agisofttm,
thanks for your feedback. I've already added a wifi reset button to the home page, but I'm not sure if this suits your needs. If the esp can't conntect to the saved wifi it will also start the config portal.
Regarding the timeout. This is only an inactivity timeout. As long as there is modbus traffic going on, the connection is kept alive, but after 10s of silence the connection is dropped to cleanup stale resources. Would it help to make this timeout configurable?
Regards zivillian
Hi @zivillian,
Yes Wifi Reset on web page is do the thing, but because home page is missing after first configuration there is no way to reset settings or to debug. For that reason I added this on loop
void loop() {
// put your main code here, to run repeatedly:
webServer.begin();
and now I have access to home page via new IP on already configured SSID.
Regarding Timeout - it will be amazing if you add this timeout configurable, because a lot of devices that use modbus are tested slowly for unknown registers (for example HVAC).
Also I found that you use function for any function modbus reading
MBbridge.attachServer(i, i, ANY_FUNCTION_CODE, &MBclient);
which is great, but on debug section there are only Functions 03 and 04 which reads registers only. Is it possible to add different functions to debug as well? Like Read Coils, Write Multiple Coils, Write Multiple Registers and etc...
I'm trying to communicate with a lot of HVAC, and depend on brand they have different needs.
Thank you very much :-)
I've added a config option for the tcp timeout. Can you please test the build from here
I'll take a look into the problem, that the webui is not reachable after initial wifi configuration.
Regarding the debug page - initially i wanted to support all functions, but started with those two. For some functions additional input is needed or the output differs and didn't know how the web ui should look like, so this is only the first draft. If you have an idea how the input and output should be laid out, please open a separate issue or pr.
Hi @zivillian
I've added a config option for the tcp timeout. Can you please test the build from here
Thanks I'll test it today and give you feedback immediately.
I'll take a look into the problem, that the webui is not reachable after initial wifi configuration.
Regarding the debug page - initially i wanted to support all functions, but started with those two. For yome functions additional input is needed or the output differs and didn't know how the web ui should look like, so this is only the first draft. If you have an idea how the input and output should be laid out, please open a separate issue or pr.
I'll wait for the webui. I have an idea how it can look. Here is my screenshots from Gree Control page UI - especially for modbus debug commands. For writing registers or coils you need to select ID, address as well and after that you need to select a command value to write coil or register.
@zivillian
I've added a config option for the tcp timeout. Can you please test the build from here
Interesting is that WEB server appears, after I installed firmware from your link, but unfortunately when I change Timeout to 20000 (20sec) it show to save config, but after testing is still 10seconds - here is log:
[11:30:30][webserver] GET /style.css [11:31:03][webserver] GET / [11:31:03][webserver] GET /style.css [11:31:04][webserver] GET /config [11:31:04][webserver] GET /style.css [11:31:09][webserver] POST /config [11:31:09][webserver] saved port [11:31:09][webserver] saved timeout [11:31:09][webserver] saved modbus baud rate [11:31:09][webserver] saved modbus data bits [11:31:09][webserver] saved modbus parity [11:31:09][webserver] saved modbus stop bits [11:31:09][webserver] saved serial baud rate [11:31:09][webserver] saved serial data bits [11:31:09][webserver] saved serial parity [11:31:09][webserver] saved serial stop bits [11:31:09][webserver] GET / [11:31:09][webserver] GET /style.css [11:31:18][D] 433857| ModbusServerTCPtemp.h [ 261] worker: Worker started, timeout=10000 [11:31:18][D] 433857| ModbusServerTCPtemp.h [ 210] accept: Started client 0 task 1073626432 [11:31:18][D] 433868| ModbusServerTCPtemp.h [ 239] serve: Accepted connection - 1 clients running [11:31:28][D] 443857| ModbusServerTCPtemp.h [ 350] worker: Worker stopping due to timeout.
you need to reboot to apply the config changes
you need to reboot to apply the config changes
PErfect - thanks it is working now. I'll do further tests and give a feedback :-)))
Hi @zivillian Great Job! After a serial of trials, included using PlatformIO for the very first time, I think it is working very good. I haven't try everything, but every feature I have tried, is working very good. I used the last version of the repo and the bin you share for update. (works well). Some comment/suggestions:
Finally, @zivillian I have to thank and congratulate you. You really made a great job in a very short time. ;-) All the best!
Hey @maufc,
thanks for your feedback!
ILLEGAL_DATA_ADDRESS
. From the screenshot it look's like you've selected the wrong function. Your instsruction state 04 Read input register
but you've selected 03 Read Holding Register
.Once again, thanks for your feedback. It helps to focus on the relevant parts...
Regards zivillian
@maufc @zivillian I'm also think about ESP8266, but let's focus to run everything on ESP32 and after I'll try to port it to ESP8266 :-))) Also I found something interesting here. I use different types of MODBUS boards. One is cheap china MAX485 board without automatic flow control, and I need to create additional hardware to handle requests. Second one have a full TTL and no need to create anything. With first board there is an often error 0x2 but with second one there is no error, so hardware is important for eModbus I think.
Hello @zivillian
1.I would say yes, a hardware button will be useful on site, when something happened to the connection and you don't got a computer to connect the device and completely flash it. What choices do you have in this case. Am I missing some feature of WiFiManager? You are right, after a blackout it will continue working as long as both devices are down. But if only the router is down for any reason?
Hi again. I have to ask one additional feature:
I took a look to eModbus documentation. The eModbus library already has a function to work with selection pin boards @agisofttm . Ethernet feature is also develop. Just to comment...
I've added a config option for an (optional) RTS pin, but since all of my hardware does AutoRTS I'm not able to test it.
I can confirm, that reading more than 20 registers shows a significant error rate, but I fear that this might be caused by eModbus/eModbus#198
the errors should be fixed with https://github.com/eModbus/eModbus/issues/268
Hi @zivillian
Really nice, simple and working gateway but there is some little problems. First one is when client is connected to the gateway, after 10 seconds is disconnected as the debug says: [11:28:38][D] 93697| ModbusServerTCPtemp.h [ 239] serve: Accepted connection - 1 clients running [11:28:48][D] 103686| ModbusServerTCPtemp.h [ 350] worker: Worker stopping due to timeout.
Second one, can you integrate hardware gpio button for getting config portal on demand? Because with Wifi Manager when you set once SSID, then you cannot make a config to anything now.
Thank you Kind Regards