Hello all,
I share with you a project that I am developing in lua/dzvents.
This is another scripting system. The code (a basic like language) is put in the description field of the device (see screenshot below). It is interpreted every minute and every time the device is triggered.
Have a look here:
- Examples of dzbasic code, to understand better its capabilities
- Github with the code and a light documentation
This is a beta version, so probably with bugs...
Hope it will be useful for you
DzBasic - Another simple script system
Moderator: leecollings
-
- Posts: 4
- Joined: Thursday 06 May 2021 22:06
- Target OS: Linux
- Domoticz version: 2020.2
- Location: France
- Contact:
DzBasic - Another simple script system
Last edited by cyril21 on Sunday 09 May 2021 23:25, edited 1 time in total.
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: DzBasic - Another simple script system
@cyril21,cyril21 wrote: ↑Thursday 06 May 2021 22:37 I share with you a project that I am developing in lua/dzvents.
This is another scripting system. The code (a basic like language) is put in the description field of the device (see screenshot below). It is interpreted every minute and every time the device is triggered.
Thx for sharing, It looks like you spend a lot of time and thoughts on it.
I am probably not in the best position to comment if this scripting approach is easier to understand compared to dzVents or Lua because the experience I gained of these languages / framework by coding and supporting them; so I leave that to others.
However I am in a position to comment on aspects like performance, repsonse-times and resource usage.
I installed your scripts on my relatively quiet test and development system and notice the script is executed > 10 times a minute even now at the most quiet period of the day. In every execution the script reads and interprets all description fields of every device to see if any action needs to be taken.
My system is heavily oversized for what it is intended for but I see that the average execution time of your script without any action to be taken is 0.19 seconds so I expect this to be no less on a Raspberry with a similar amount of devices. On average my other dzVents scripts execution time on this system (with actions performed) is 0.004 seconds.
When this script is executing any other Blockly, Lua or dzVents script needs to wait until it is finished.
Have you looked at the additional CPU and memory usage on a system with a reasonable amount of devices?
btw. It would have been nice if you gave the appropriate credits to @dannybloe (creator of the dzVents framework)
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 4
- Joined: Thursday 06 May 2021 22:06
- Target OS: Linux
- Domoticz version: 2020.2
- Location: France
- Contact:
Re: DzBasic - Another simple script system
Hello,
Thank you for your reply and your tests.
I was unable to reproduce your results with 24 devices . But I'm not sure to have the appropriate method to test the performance (I used os.clock command).
I did make some improvements (ex: only devices with code are scanned), and I will continue my investigations regarding your advices.
Thank you for your reply and your tests.
I was unable to reproduce your results with 24 devices . But I'm not sure to have the appropriate method to test the performance (I used os.clock command).
I did make some improvements (ex: only devices with code are scanned), and I will continue my investigations regarding your advices.
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: DzBasic - Another simple script system
24 devices it not reflecting a typical domoticz setup for users starting with scripting. And the amount of devices is only one part of the equation. For example some smart meter devices do update several devices every 10 seconds.
os.clock can measure only that part of the time where your script is already started en just before it finished. The time spend in dzVents.cpp and dzVents.lua before the script starts and after the script finished is left outBut I'm not sure to have the appropriate method to test the performance (I used os.clock command).
What I see in dzbasic.lua is that it still interprets all description strings. Do I overlook something?I did make some improvements (ex: only devices with code are scanned), and I will continue my investigations regarding your advices.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 4
- Joined: Thursday 06 May 2021 22:06
- Target OS: Linux
- Domoticz version: 2020.2
- Location: France
- Contact:
Re: DzBasic - Another simple script system
Hello,
Thanks again for your comments.
I just released a new version which I think should improve this. This version executes the "dzvents execute function" only for updated devices which include a dzbasic code.
Thanks again for your comments.
In fact it scans the devices but does not interpret the strings. A list of devices is stored in a persistent variable.What I see in dzbasic.lua is that it still interprets all description strings. Do I overlook something?
I just released a new version which I think should improve this. This version executes the "dzvents execute function" only for updated devices which include a dzbasic code.
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: DzBasic - Another simple script system
Good improvement! Initial tests showed indeed significant less resource usage.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 4
- Joined: Thursday 06 May 2021 22:06
- Target OS: Linux
- Domoticz version: 2020.2
- Location: France
- Contact:
Re: DzBasic - Another simple script system
Hello,
Not with this script. But it could be possible to add this function in a next version.
Take a look here instead: viewtopic.php?f=59&t=36400
Not with this script. But it could be possible to add this function in a next version.
Take a look here instead: viewtopic.php?f=59&t=36400
Who is online
Users browsing this forum: No registered users and 0 guests