Sonoff ZbBridge with Scripting Language

133 views
Skip to first unread message

mrzimgjugl asdf

unread,
Sep 9, 2022, 5:58:58 PM9/9/22
to TasmotaUsers
This is about Sonoff ZbBridge, the first one with ESP8266EX. It has 2048 KB of memory. Console, manage File system says: Free 0.212 MB

Now I have rules mostly filled, with about 3 x 1000 chars. Zigbee asks for many interventions.

I would like to turn on the Scripting Language to replace rules in order to gain more space for programming. Docs mention 1M and 4M flash, not 2M flash.

I would appreciate recommendation on how to maximize available space in Sonoff ZbBridge with 2M flash, without making any mistakes.

Likely, many did that before me. So if someone can point me to or share such already compiled custom version, even better!

Stephan Hadinger

unread,
Sep 9, 2022, 6:02:09 PM9/9/22
to TasmotaUsers
ZbBridge is compiled by default with 2M flash layout, so it should be more than enough for scripting. But to go further, I strongly recommend to move to Sonoff ZBBridge Pro. The ESP32 allows for Berry scripting and much more extensibility.

mrzimgjugl asdf

unread,
Sep 9, 2022, 6:27:31 PM9/9/22
to Stephan Hadinger, TasmotaUsers
This one works perfectly fine, no need to throw it out. I just need some more free space than rules allow. It is mostly used for switches remapping, nothing complicated.

OK, so It is enough to compile my version with defines suggested at the Scripting doc page?

Any additional features recommended?

Thanks for quick answer!

--
You received this message because you are subscribed to the Google Groups "TasmotaUsers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonoffusers...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/sonoffusers/85e686cb-5aca-47aa-8c13-7f6f55a31b9fn%40googlegroups.com.

billy jack newman

unread,
Sep 9, 2022, 6:35:44 PM9/9/22
to mrzimgjugl asdf, Stephan Hadinger, TasmotaUsers
You will find some times, you need to have your compile on computer,  and revert the tasmota to bare basic,  then you can upload your correct binary.
I have had to do that on my esp8266 when I need to add the proper binaries to admire ads1115 communications as well as 1 wire sensors. 


mrzimgjugl asdf

unread,
Sep 9, 2022, 8:42:45 PM9/9/22
to Stephan Hadinger, TasmotaUsers
If docs are in sync with current 12.1. version, something is wrong in my build. I do not have rules any more, but apparently, neither the scripts are there. There is no Consoles -> Edit Script.

I compiled with:
#ifndef USE_TCP_BRIDGE
#define USE_TCP_BRIDGE          //  Add support for Serial to TCP bridge (+1.3k code)
#endif

#ifndef USE_SCRIPT
#define USE_SCRIPT  // adds about 17k flash size, variable ram size
#endif
#ifdef USE_RULES
#undef USE_RULES
#endif

That, I believe, should have given me ZbBridge version with scripting.
I Got ZbBridge and Sonoff is working with it, with no rules and no scripting. What am I doing wrong?

Stephan Hadinger

unread,
Sep 10, 2022, 4:28:33 AM9/10/22
to TasmotaUsers
I don't want to ruin the party, but there is no simple nor supported way to increase the 1500 bytes for rules/scripting. They are stored in the Settings block which is 4kb size (the sage of a Flash page). Increasing this space would require a major refactoring of Tasmota.

A couple of years ago, I added Unishox compression to store text of rules/scripts in a compressed format which doubles on average the available size.

If you want to go further, there are only two options: 1/ move the work to the MQTT broker side, 2/ move to ESP32 hence my suggestion for Sonoff ZBBridge Pro.

mrzimgjugl asdf

unread,
Sep 10, 2022, 5:33:32 AM9/10/22
to Stephan Hadinger, TasmotaUsers
Rules with compression are simply brilliant. Just on some devices, say Zigbee bridge or often on IR blasters, I want them to function on their own: To read inputs and react on them, without bothering the rest of the system. That is the nature of anything that is bridging one system to another. Zigbee is most challenging since it is demanding lengthwise on commands.

But, you say even if I manage to activate scripts (which I was not able) I will not have more than 1500 bytes for the script? I will not gain more programming space than in 3 rules?

That means my only option would be ZbBridge pro.

mrzimgjugl asdf

unread,
Sep 10, 2022, 6:08:03 AM9/10/22
to Stephan Hadinger, TasmotaUsers
Just to be clear: on Sonoff ZbBriddge Pro due to ESP32 I will have more room for programming than the current 3 rules accommodate?

Fw is stable on that, as it is fairly new?

Stephan Hadinger

unread,
Sep 10, 2022, 12:48:50 PM9/10/22
to TasmotaUsers
Not exactly. The limit is still 1500 bytes for rules/scripts because we didn't find a need to go beyond.

The real difference is the Berry language with code in the file system and no limit except the available memory size.

Philip Knowles

unread,
Sep 10, 2022, 1:06:12 PM9/10/22
to mrzimgjugl asdf, TasmotaUsers

I think you may be missing something here. One of the benefits of ZigBee is the ability to ‘bind’ devices together so the ‘rule’ can be in the receiving device rather than the bridge. I’m not saying that it will resolve what you are trying to do but you don’t just have to use Tasmota rules to do everything.

 

Sent from Mail for Windows

mrzimgjugl asdf

unread,
Sep 23, 2022, 4:29:51 PM9/23/22
to Philip Knowles, TasmotaUsers
My SmartHome system is quite complex. I use Zigbee solely for switches turning things on and off. I could not find any Tasmota switches.

So, my shutters or relays or Reed switches or sensors are all Tasmota. Nothing to bind. Rules enabled switches to oeprate directly. Now I reworked them to send commands for Tasmotas (which can be sent) to my SmartHome system, this is just 0,2 sec delay and have lots of space.

I buy only stuff I find on the list of supported devices. So, I bought Moes Zigbee wall no-neutral walls witch. I was able to make it run only due to your great help here! Plus some tricks of mine. But, first key is supported (Power), the second (Power2) was not until the last update. I do not know a working Zigbee command to check the current state of the connected 2 bulbs. So this Zigbee device alone alone takes likely 10 rows in a rule.

I understand ZbB Pro is a superior version for my needs due to more programming space. I bought one for testing, but am stuck... I will put this in another message. Thanks for your always great feedback.

Reply all
Reply to author
Forward
0 new messages