Introducing dzVents - Domoticz Lua file based event scripting made e-z!

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Locked
NietGiftig
Posts: 121
Joined: Sunday 11 October 2015 8:50
Target OS: Raspberry Pi / ODroid
Domoticz version: V3.6224
Location: Holland
Contact:

Re: Introducing dzVents - Domoticz Lua file based event scripting made e-z!

Post by NietGiftig »

Then you have to wait until the master guru himself returns in the forum.
The last time I synchronized was yesterday morning, no errors whatsoever then
RPI-2 + SSD / ESPEasy Sensors & Switches / Sonoff / RFLink / Action Switches / TP-Link switch / Node-Red / Reacticz
woody4165
Posts: 476
Joined: Monday 14 March 2016 13:55
Target OS: Linux
Domoticz version: beta
Location: Rome, Italy
Contact:

Re: Introducing dzVents - Domoticz Lua file based event scripting made e-z!

Post by woody4165 »

maybe there something in my system...
Just to understand if I am doig right:

Code: Select all

Copy the following to the Domoticz script folder: /path/to/domoticz/scripts/lua:

event_helpers.lua
script_time_main.lua
script_device_main.lua
Domoticz.lua
dzVents_settings.lua and
the folder scripts
Here is written event_helper.lua but the file in the zip is EventHelpers.lua (same name already exist in the /domoticz/scripts/lua folder and I let this one overwrite the other).

This is the only things to do except for modification in the dzVents_settings.lua), right?

Thanks
Cubietruck - Linux cubietruck 4.13.16 (Debian GNU/Linux 8 (jessie)) + Domoticz + RFLink, Xiaomi Gateway, Owl USB, Yeelight Color and B/W, ESP8266, Broadlink RM2, Netatmo Thermostat
NietGiftig
Posts: 121
Joined: Sunday 11 October 2015 8:50
Target OS: Raspberry Pi / ODroid
Domoticz version: V3.6224
Location: Holland
Contact:

Re: Introducing dzVents - Domoticz Lua file based event scripting made e-z!

Post by NietGiftig »

Here is written event_helper.lua


in my folder it is called event_helpers.lua
RPI-2 + SSD / ESPEasy Sensors & Switches / Sonoff / RFLink / Action Switches / TP-Link switch / Node-Red / Reacticz
woody4165
Posts: 476
Joined: Monday 14 March 2016 13:55
Target OS: Linux
Domoticz version: beta
Location: Rome, Italy
Contact:

Re: Introducing dzVents - Domoticz Lua file based event scripting made e-z!

Post by woody4165 »

I missed the s in the post, sorry.

In any case I tried with both, event_helpers.lua and EventHelpers.lua like now you can find in the GitHub folder.

I'll wait for some news...
Cubietruck - Linux cubietruck 4.13.16 (Debian GNU/Linux 8 (jessie)) + Domoticz + RFLink, Xiaomi Gateway, Owl USB, Yeelight Color and B/W, ESP8266, Broadlink RM2, Netatmo Thermostat
NietGiftig
Posts: 121
Joined: Sunday 11 October 2015 8:50
Target OS: Raspberry Pi / ODroid
Domoticz version: V3.6224
Location: Holland
Contact:

Re: Introducing dzVents - Domoticz Lua file based event scripting made e-z!

Post by NietGiftig »

But you are sure you tried the 0.9.13 branch on github?
And start fresh empty dir and so?
RPI-2 + SSD / ESPEasy Sensors & Switches / Sonoff / RFLink / Action Switches / TP-Link switch / Node-Red / Reacticz
woody4165
Posts: 476
Joined: Monday 14 March 2016 13:55
Target OS: Linux
Domoticz version: beta
Location: Rome, Italy
Contact:

Re: Introducing dzVents - Domoticz Lua file based event scripting made e-z!

Post by woody4165 »

:oops: Nope! I was using the master one

Shame on me.

Now it's working!!!

I didn't noticed the branches...

Thanks!!!
Cubietruck - Linux cubietruck 4.13.16 (Debian GNU/Linux 8 (jessie)) + Domoticz + RFLink, Xiaomi Gateway, Owl USB, Yeelight Color and B/W, ESP8266, Broadlink RM2, Netatmo Thermostat
NietGiftig
Posts: 121
Joined: Sunday 11 October 2015 8:50
Target OS: Raspberry Pi / ODroid
Domoticz version: V3.6224
Location: Holland
Contact:

Re: Introducing dzVents - Domoticz Lua file based event scripting made e-z!

Post by NietGiftig »

reading help from other people is mandatory if you ask for help :shock:
RPI-2 + SSD / ESPEasy Sensors & Switches / Sonoff / RFLink / Action Switches / TP-Link switch / Node-Red / Reacticz
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: Introducing dzVents - Domoticz Lua file based event scripting made e-z!

Post by dannybloe »

:evil: :evil: Grrr. notifications for new posts is still not working well.. so I miss new posts here every now and then, sorry about that ..

Indeed.. master branch is currently in flux. I'm refactoring stuff so that installing is even easier (and I wrote 120+ unit-tests for it this weekend for future stability (and caught a few bugs while doing this)).

So, yeah, stick to the tags when installing for now. In the future I will make the master branch the stable one and do dev stuff in another branch.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
NietGiftig
Posts: 121
Joined: Sunday 11 October 2015 8:50
Target OS: Raspberry Pi / ODroid
Domoticz version: V3.6224
Location: Holland
Contact:

Re: Introducing dzVents - Domoticz Lua file based event scripting made e-z!

Post by NietGiftig »

dannybloe wrote::evil: :evil: Grrr. notifications for new posts is still not working well.. so I miss new posts here every now and then
I
I have the Idea (not sure) that if you do not click on the latest notification, you are not going to get a new one
RPI-2 + SSD / ESPEasy Sensors & Switches / Sonoff / RFLink / Action Switches / TP-Link switch / Node-Red / Reacticz
commodore white
Posts: 63
Joined: Sunday 14 July 2013 11:19
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Ipswich, UK
Contact:

Upgrading dzVents

Post by commodore white »

[smug mode] I have to say that all I do to snarf the latest version is: download the zip, unpack it to an empty directory then copy the whole kit and kaboodle EXCEPT THE SETTINGS file to the domoticz/scripts/lua on my Pi

One day I'll come a cropper because Garry will have changed the settings file, but until then ...

[/smug mode]
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Some daredevils needed

Post by dannybloe »

Today I finished refactoring dzVents. As I said earlier, I wrote around 130 unit tests for the code and I moved most of the dzVents code to a subfolder. I also added some new functionality (from the history.txt):
  • Added SMS method.
  • Added toggleSwitch() method to devices that support it.
  • Added more switch states that control device.bState (e.g. on == true, open == true etc)
  • Added secondsAgo next to minutesAgo to the device.lastUpdate attribute
And I updated the documentation mostly regarding the instructions on how to install it (read that part!!!).

So, my intention is that this will become version 1.0 but before releasing it I ask anyone who dares ;-) to test the master branch (perhaps make a copy of your entire lua folder so you can easily restore it). I have tested it locally here and all seems fine.

Fingers crossed :roll:
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
User avatar
remb0
Posts: 499
Joined: Thursday 11 July 2013 22:21
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: The Netherlands
Contact:

Re: Introducing dzVents - Domoticz Lua file based event scripting made e-z!

Post by remb0 »

Lua editor in domoticz is fully compatible with this?
Maybe when its finished it can Be obtained in domoticz?

I Will test tomorrow and put an install script for it in my script.

https://github.com/remb0/Domoticz_configurator
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: Introducing dzVents - Domoticz Lua file based event scripting made e-z!

Post by dannybloe »

remb0 wrote:Lua editor in domoticz is fully compatible with this?
You mean the one that runs in the browser? I don't think so. dzVents has it's own mechanism to figure out which script needs to be called (based on the triggers and active state and timer states). The problem is that the scripts that can be edited inside Domoticz don't live on the file system but in the database. That means that the script dispatchers from dzVents cannot find them and cannot call them. You could pass the domoticz object to these scripts with a bit of effort for easy controlling of the domoticz devices but you would miss some part of the fun.

It would have been nice if the script editor in Domoticz would have stored the scripts on the filesystem as was suggested by a couple of people. That would have made this an awesome combination I guess.
Maybe when its finished it can Be obtained in domoticz?

I Will test tomorrow and put an install script for it in my script.

https://github.com/remb0/Domoticz_configurator
Nice!
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
NietGiftig
Posts: 121
Joined: Sunday 11 October 2015 8:50
Target OS: Raspberry Pi / ODroid
Domoticz version: V3.6224
Location: Holland
Contact:

Re: Introducing dzVents - Domoticz Lua file based event scripting made e-z!

Post by NietGiftig »

eh, ;-)

Code: Select all

2016-03-22 22:36:11.738 Error: EventSystem: in /home/pi/domoticz/scripts/lua/script_device_main.lua: /home/pi/domoticz/scripts/lua/dzVents/EventHelpers.lua:3: module 'utils' not found:
no field package.preload['utils']
no file '/usr/local/share/lua/5.2/utils.lua'
no file '/usr/local/share/lua/5.2/utils/init.lua'
no file '/usr/local/lib/lua/5.2/utils.lua'
no file '/usr/local/lib/lua/5.2/utils/init.lua'
no file './utils.lua'
no file '/home/pi/domoticz/scripts/lua//utils.lua'
no file '/home/pi/domoticz/scripts/lua/dzVents/utils.lua'
no file '/home/pi/domoticz/scripts/lua/scripts/utils.lua'
no file '/usr/local/lib/lua/5.2/utils.so'
no file '/usr/local/lib/lua/5.2/loadall.so'
no file './utils.so'
I have to read it again i think or something to do with rights?
Files copied from windows
RPI-2 + SSD / ESPEasy Sensors & Switches / Sonoff / RFLink / Action Switches / TP-Link switch / Node-Red / Reacticz
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: Introducing dzVents - Domoticz Lua file based event scripting made e-z!

Post by dannybloe »

Can you print the package path right after it is constructed in de main scripts?

Are you sure you did exactly as described in the readme? Replaced all the files with the new ones?

There should be a folder dzEvents inside the lua folder.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
NietGiftig
Posts: 121
Joined: Sunday 11 October 2015 8:50
Target OS: Raspberry Pi / ODroid
Domoticz version: V3.6224
Location: Holland
Contact:

Re: Introducing dzVents - Domoticz Lua file based event scripting made e-z!

Post by NietGiftig »

I will try tomorrow again, I was pretty sure that I followed the "Instructions"
But for now i have put the old scripts back.
Tomorrow another try, with fresh mind

eh?
Can you print the package path right after it is constructed in de main scripts?
RPI-2 + SSD / ESPEasy Sensors & Switches / Sonoff / RFLink / Action Switches / TP-Link switch / Node-Red / Reacticz
NietGiftig
Posts: 121
Joined: Sunday 11 October 2015 8:50
Target OS: Raspberry Pi / ODroid
Domoticz version: V3.6224
Location: Holland
Contact:

Re: Introducing dzVents - Domoticz Lua file based event scripting made e-z!

Post by NietGiftig »

By the way the file devices.lua cannot be removed i see?
RPI-2 + SSD / ESPEasy Sensors & Switches / Sonoff / RFLink / Action Switches / TP-Link switch / Node-Red / Reacticz
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: Introducing dzVents - Domoticz Lua file based event scripting made e-z!

Post by dannybloe »

NietGiftig wrote:I will try tomorrow again, I was pretty sure that I followed the "Instructions"
But for now i have put the old scripts back.
Tomorrow another try, with fresh mind

eh?
Can you print the package path right after it is constructed in de main scripts?
In script_device_main.lua or script_time_main.lua at line 7 add

Code: Select all

print(package.path)
and look in the logs what the result is.

And devices.lua contains the data that is fetched from Domoticz through http for additional data like battery status. You should be able to remove it. If you have set ['Enable http fetch'] = true in the settings file then it will automatically be refetched after a while.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
NietGiftig
Posts: 121
Joined: Sunday 11 October 2015 8:50
Target OS: Raspberry Pi / ODroid
Domoticz version: V3.6224
Location: Holland
Contact:

Re: Introducing dzVents - Domoticz Lua file based event scripting made e-z!

Post by NietGiftig »

And here are the results:

Code: Select all

 2016-03-23 08:24:09.316 Error: EventSystem: in /home/pi/domoticz/scripts/lua/script_device_main.lua: /home/pi/domoticz/scripts/lua/dzVents/EventHelpers.lua:3: module 'utils' not found:
no field package.preload['utils']
no file '/usr/local/share/lua/5.2/utils.lua'
no file '/usr/local/share/lua/5.2/utils/init.lua'
no file '/usr/local/lib/lua/5.2/utils.lua'
no file '/usr/local/lib/lua/5.2/utils/init.lua'
no file './utils.lua'
no file '/home/pi/domoticz/scripts/lua//utils.lua'
no file '/home/pi/domoticz/scripts/lua/dzVents/utils.lua'
no file '/home/pi/domoticz/scripts/lua/scripts/utils.lua'
no file '/usr/local/lib/lua/5.2/utils.so'
no file '/usr/local/lib/lua/5.2/loadall.so'
no file './utils.so'
2016-03-23 08:24:42.915 LUA: /usr/local/share/lua/5.2/?.lua;/usr/local/share/lua/5.2/?/init.lua;/usr/local/lib/lua/5.2/?.lua;/usr/local/lib/lua/5.2/?/init.lua;./?.lua;/home/pi/domoticz/scripts/lua//?.lua;/home/pi/domoticz/scripts/lua/dzVents/?.lua;/home/pi/domoticz/scripts/lua/scripts/?.lua 

It seems that on the Domoticz image no lua 5.2 is installed.
There is no /usr/local/share/lua on my system

The file '/home/pi/domoticz/scripts/lua/dzVents/utils.lua' is named Utils.lua

Installed from the zip file.
RPI-2 + SSD / ESPEasy Sensors & Switches / Sonoff / RFLink / Action Switches / TP-Link switch / Node-Red / Reacticz
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: Introducing dzVents - Domoticz Lua file based event scripting made e-z!

Post by dannybloe »

These package paths are provided by the lua system itself instead of the stuff that I add to it.
I commited some changes in master. Could you try this? The utils.lua file should be with a capital now and both _main.lua files have been changed as well.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
Locked

Who is online

Users browsing this forum: Bing [Bot] and 0 guests