benzino77 / tasmocompiler

Web GUI for custom Tasmota compilation
MIT License
478 stars 143 forks source link

Build is missing Modbus features with Modbus checked. #344

Open JanX2 opened 1 year ago

JanX2 commented 1 year ago

Thank you for this awesome project!

I tried to get a custom build for either ESP32 devkit or a generic ESP8266 including Modbus bridge and Modbus TCP functionality. The default Tasmota release for ESP32 (tasmota32.bin) contains only the Modbus bridge functionality so this seemed the only way.

I’m using gitpod.io.

At first I simply tried to use the web interface to set up my build: Tasmota source code WiFi configuration (my Wifi) Select features (with Modbus checked) Custom parameters (none) Select version and compile (latest version)

That didn’t work: ModBr RX and ModBr TX were missing from the “Module parameters” for the pins in the Tasmota web UI.

So I tried the official tasmota32.bin and that got me to at least get Modbus serial working. The Modbus TCP apparently isn’t enabled in the official builds. This means for example the that console command “ModbusTCPStart 502” will fail with “RESULT = {"Command":"Unknown"}”.

Then I tried Tasmota again via gitpod.io. Same settings as above, but this time with Modbus checked and these “Custom parameters”

#ifndef USE_MODBUS_BRIDGE
#define USE_MODBUS_BRIDGE       // Add support for software Modbus Bridge (+3k code)
#define USE_MODBUS_BRIDGE_TCP   // Add support for software Modbus TCP Bridge (Must also enable USE_MODBUS_BRIDGE)
#endif

Still no dice.

And finally:

#ifndef USE_MODBUS_BRIDGE
#define USE_MODBUS_BRIDGE       // Add support for software Modbus Bridge (+3k code)
#endif
#ifndef USE_MODBUS_BRIDGE_TCP
#define USE_MODBUS_BRIDGE_TCP   // Add support for software Modbus TCP Bridge (Must also enable USE_MODBUS_BRIDGE)
#endif

And again so support for either “ModBr RX“ or “ModBr TX” for the pins and “ModbusTCPStart 502” is still failing.

I’m at all out of ideas about what to try next. Any pointers? What am I missing?

Thank you again!

benzino77 commented 1 year ago

Jan, try to contact Tasmota Dev Team on discord. As stated here: https://tasmota.github.io/docs/Modbus-Bridge this functionality should be enabled by:

#ifndef USE_MODBUS_BRIDGE
#define USE_MODBUS_BRIDGE       // Add support for software Modbus Bridge (+3k code)
#define USE_MODBUS_BRIDGE_TCP   // Add support for software Modbus TCP Bridge (Must also enable USE_MODBUS_BRIDGE)
#endif

and exactly that is enabled by TasmoCompiler when Modbus Bridge is selected as the feature (described here)

For sure you have to assign GPIO pins in your Tasmota configuration for Modbus to work properly (docs mentioned above)

JanX2 commented 1 year ago

Thanks @benzino77! I got Modbus working with the official release as stated. But not the TCP bridge.

Edit: asked on discord: https://discord.com/channels/479389167382691863/790187952416358460/1082415371807641650

JanX2 commented 1 year ago

I installed the tasmota32-allsensors.bin which, apparently, is build from Tasmota HEAD every time a new commit gets pushed. The allsensors.bin, according to @Jason2866, has the required flags added. Maybe there are some issue in the latest release building everything correctly with the defines above.

These were the Console commands required for my setup:

ModBusBaudrate 9600
ModbusSerialConfig 3
ModbusTCPstart 502
lyazide commented 11 months ago

Thank you for this awesome project!

I tried to get a custom build for either ESP32 devkit or a generic ESP8266 including Modbus bridge and Modbus TCP functionality. The default Tasmota release for ESP32 (tasmota32.bin) contains only the Modbus bridge functionality so this seemed the only way.

I’m using gitpod.io.

At first I simply tried to use the web interface to set up my build: Tasmota source code WiFi configuration (my Wifi) Select features (with Modbus checked) Custom parameters (none) Select version and compile (latest version)

That didn’t work: ModBr RX and ModBr TX were missing from the “Module parameters” for the pins in the Tasmota web UI.

So I tried the official tasmota32.bin and that got me to at least get Modbus serial working. The Modbus TCP apparently isn’t enabled in the official builds. This means for example the that console command “ModbusTCPStart 502” will fail with “RESULT = {"Command":"Unknown"}”.

Then I tried Tasmota again via gitpod.io. Same settings as above, but this time with Modbus checked and these “Custom parameters”

#ifndef USE_MODBUS_BRIDGE
#define USE_MODBUS_BRIDGE       // Add support for software Modbus Bridge (+3k code)
#define USE_MODBUS_BRIDGE_TCP   // Add support for software Modbus TCP Bridge (Must also enable USE_MODBUS_BRIDGE)
#endif

Still no dice.

And finally:

#ifndef USE_MODBUS_BRIDGE
#define USE_MODBUS_BRIDGE       // Add support for software Modbus Bridge (+3k code)
#endif
#ifndef USE_MODBUS_BRIDGE_TCP
#define USE_MODBUS_BRIDGE_TCP   // Add support for software Modbus TCP Bridge (Must also enable USE_MODBUS_BRIDGE)
#endif

And again so support for either “ModBr RX“ or “ModBr TX” for the pins and “ModbusTCPStart 502” is still failing.

I’m at all out of ideas about what to try next. Any pointers? What am I missing?

Thank you again!

I have the same issue. I checked the Modbus Bridge but can not get the "MODBr" RX and TX in the web configuration. Did you get this solved?

JanX2 commented 11 months ago

@lyazide The only fix I found is to roll my own binary locally. This may have changed since then.

nonix commented 4 months ago

Hi I am sorry to add firewood into this older bug report. However, I have hit the exact same issue today. Using tasmocompiler with selection of "ModBus Bridge" the Modbus bridge will not get compiled in. After a short exchange with Sfromis Discord chat

It was clear and confirmed that Tasmocompiler has a typo in the #define USE_MODBUSBRIDGE instead of correct on: #define USE_MODBUSBRIDGE Note: the underscore between MODBUS and() BRIDGE. Hope this helps a bit.

nonix commented 4 months ago

Jan, try to contact Tasmota Dev Team on discord. As stated here: https://tasmota.github.io/docs/Modbus-Bridge this functionality should be enabled by:

#ifndef USE_MODBUS_BRIDGE
#define USE_MODBUS_BRIDGE       // Add support for software Modbus Bridge (+3k code)
#define USE_MODBUS_BRIDGE_TCP   // Add support for software Modbus TCP Bridge (Must also enable USE_MODBUS_BRIDGE)
#endif

and exactly that is enabled by TasmoCompiler when Modbus Bridge is selected as the feature (described here)

For sure you have to assign GPIO pins in your Tasmota configuration for Modbus to work properly (docs mentioned above)

Seem like a typo, the underscores are missing (just cut & paste from Tasmocompiled FW 13.3.0)

#ifdef USE_MODBUSBRIDGE
  #undef USE_MODBUSBRIDGE
#endif
#define USE_MODBUSBRIDGE
benzino77 commented 4 months ago

Thanks for this finding! Great job. I will fix it soon.

benzino77 commented 4 months ago

I've push changes to development branch (link to gitpod) and benzino77/tasmocompiler:development docker image. @nonix could you please check if this is working as expected now?

nonix commented 4 months ago

I've push changes to development branch (link to gitpod) and benzino77/tasmocompiler:development docker image. @nonix could you please check if this is working as expected now?

Hi @benzino77 I've tested using the devel. branch of Tasmocompiler (TasmoCompiler v11.0.0-dev) and I can confirm, the test was successful

Selection used: ESP8266/Wemos D1 with options: ModBus br, Rules, SD card/LittleFS, Timers, Web Interf. Custom params: #define CODE_IMAGE_STR "TasmoCompiler-ModBus4M" Tasmota version: Development

Thank you for the effort. N.

benzino77 commented 4 months ago

I'm glad to hear it. Thanks for your help! I will release new stable version as soon as I have some free time.