dzVents 2.0 just got integrated into Domoticz (beta v3.8023)

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

Moderator: leecollings

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

dzVents 2.0 just got integrated into Domoticz (beta v3.8023)

Post by dannybloe »

=========================================
Update: dzVents 2.0 has been integrated again. This time it builds and runs on all platforms. Check out build v3.8023+.
=========================================

Hi all,

Happy to tell you all that as of today dzVents is integrated in Domoticz (beta v3.8023). Of course it is beta so I invite everyone to start trying and testing this version. Scott Linn and me worked hard in the past few weeks to come up with a great new release. dzVents is almost completely refactored and has loads of new features. On top of that you can now create and edit dzVents scripts using the built-in web-editor in Domoticz so you don't need file access at all to write event scripts.

So, this version of dzVents (internally versioned 2.0.0) does have a couple of breaking changes with prior versions. These changes require you to make a couple of minor changes to your scripts. They are listed in the change log which can be found in the all-new wiki page for dzVents.
Please take some time to read through the docs!

So... happy testing and using!! Hope you enjoy it.

Oh, on more thing: this also means that I plan to no longer update the separate GitHub version of dzVents.

From the 'Change log':

[2.0.0] Domoticz integration
  • Almost a complete rewrite.
  • BREAKING CHANGE: Accessing a device, scene, group, variable, changedDevice, or changedVariable has been changed: instead of doing domoticz.devices['myDevice'] you now have to call a function: domoticz.devices('myDevice'). This applies also for the other collections: domoticz.scenes(), domoticz.groups(), domoticz.changedDevices(), domoticz.changedVariables(). If you want to use the iterators like forEach, filter and reduce you do this: domoticz.devices().forEach(function() .. end). This change makes dzVents a whole lot faster in processing your event scripts. So please change your existing dzVents scripts!
  • BREAKING CHANGE: after_sec, for_min, after_min, within_min methods have been renamed to the camel-cased variants afterSec, forMin, afterMin, withinMin. Please rename the calls in your script.
  • BREAKING CHANGE: There is no longer an option to check if an attribute was changed as this was quite useless. The device has a changed flag. You can use that. Please change your existing scripts.
  • BREAKING CHANGE: Many device attributes are now in the appropriate type (Number instead of Strings) so you can easily make calculations with them. Units are stripped from the values as much as possible. Check your scripts as this may break stuff.
  • BREAKING CHANGE: on-section now requires subsections for devices, timer, variables, and security. The old way no longer works! Please convert your existing scripts!
  • BREAKING CHANGE: Make sure that in Domoticz settings under Local Networks (no username/password) you add 127.0.0.1 so dzVents can use Domoticz api when needed.
  • dzVents now works on Windows machines!
  • dzVents is no longer a separate library that you have to get from GitHub. All integrated into Domoticz.
  • Added option to create shared utility/helper functions and have them available in all your scripts. Simply add a helpers = { myFunction = function() ... end } to the global_data.lua file in your scripts folder and you can access the function everywhere: domoticz.helpers.myFunction().
  • Created a pluggable system for device adapters so people can easily contribute by creating specific adapters for specific devices. An adapter makes sure that you get the proper methods and attributes for that device. See /path/to/domoticz/scripts/dzVents/runtime/device-adapters.
  • Added a reduce() iterator to the collections in the domoticz object so you can now easily collect data about all your devices. See documentation about iterators.
  • Variables (uservariables) have more attributes. The value is now the same type as it is defined in Domoticz. So no more need for a converted nValue attribute. You can inspect the type using myVar.type. If it is a time variable or date variable you an extra date or time attribute with the same methods as with all other date/time related attributes like lastUpdate. .E.g. myVar.date.minutesAgo.
  • Settings are now moved to the Domoticz GUI (Setup > Settings > Other) and no longer in a settings file.
  • You can now override the log settings per script. So you can turn-off logging globally (see log level in the settings) and still have debug-level logging for that one script you are working on. You can even add a prefix string to the log messages for easy filtering in the Domoticz log. See the documentation about the logging = { .. } section.
  • No more need to do http-calls to get extended data from Domoticz. All relevant internal Domoticz state-data is now available inside your dzVents scripts. Thanks Scotty!!
  • Support for many many more device types and their specific methods. See the documentation for the list of attributes and events that are available. Note that device-type specific attributes are only available for those type of devices. You will receive an error in the log if you try to access an attribute that doesn't exist for that particular device. Hopefully you don't have to use the rawData table anymore. If you still do please file a report or create a device adapter yourself.
  • You can now write dzVents scripts using the internal editor in Domoticz. These scripts will be automatically exported to the filesystem (one-way only) so dzVents can execute them (generated_scripts folder). Thanks again Scotty!
  • Support for variable change events (on = { variables = { 'varA', 'varB'} })
  • Support for security change events (on = { security = { domoticz.SECURITY_ARMEDAWAY } })
  • The triggerInfo passed to the execute function now includes information about which security state triggered the script if it was a security event.
  • Extended the timer-rule with time range e.g. 'at 16:45-21:00' and 'at nighttime' and 'at daytime' and you can provide a custom function. See documentation for examples. The timer rules can be combined as well.
  • Timer rules for 'every xx minutes' or 'every xx hours' are now limited to intervals that will reach *:00 minutes or hours. So for minutes you can only do these intervals: 1, 2, 3, 4, 5, 6, 10, 12, 15, 20 and 30. Likewise for hours.
  • The Time object (e.g. domoticz.time) now has a method matchesRule(rule). rule is a string same as you use for timer options: if (domoticz.time.matchesRule('at 16:32-21:33 on mon,tue,wed')) then ... end. The rule matches if the current system time matches with the rule.
  • A device trigger can have a time-rule constraint: on = { devices = { ['myDevice'] = 'at nighttime' } }. This only triggers the script when myDevice was changed and the time is after sunset and before sunrise.
  • Add support for subsystem selection for domoticz.notify function.
  • Fixed a bug where a new persistent variable wasn't picked up when that variable was added to an already existing data section.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
zicht
Posts: 272
Joined: Sunday 11 May 2014 11:09
Target OS: Windows
Domoticz version: 2023.1+
Location: NL
Contact:

Re: dzVents 2.0 just got integrated into Domoticz (beta v3.7968)

Post by zicht »

Thanks ! Wil for sure start to use in future projects ... :D

Do we need to consider -with this improved implementation- that the 'old' lua support in future will disapear and only dzVents will be supported ?
*In that case i need to start recoding my functions (about 1800 lines of code)
Rpi & Win x64. Using : cam's,RFXCom, LaCrosse, RFY, HuE, google, standard Lua, Tasker, Waze traveltime, NLAlert&grip2+,curtains, vacuum, audioreceiver, smart-heating&cooling + many more (= automate all repetitive simple tasks)
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: dzVents 2.0 just got integrated into Domoticz (beta v3.7968)

Post by dannybloe »

No you don't have to consider this (certainly not in the near future I think). You can wonder though why you need so many lines of code :). I bet that with dzVents you can at least cut that in half (if not more).
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
elmortero
Posts: 247
Joined: Sunday 29 November 2015 20:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.9639
Location: Spain
Contact:

Re: dzVents 2.0 just got integrated into Domoticz (beta v3.7968)

Post by elmortero »

Does that mean we have to remove current installed dzvents?
SweetPants

Re: dzVents 2.0 just got integrated into Domoticz (beta v3.7968)

Post by SweetPants »

Updated my test system and this comes back with 'segmentation fault' only
blacksn0w
Posts: 99
Joined: Friday 10 March 2017 22:27
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Germany
Contact:

Re: dzVents 2.0 just got integrated into Domoticz (beta v3.7968)

Post by blacksn0w »

Same here, did it also with command line ./updatebeta.
Segmentation fault too :(
Migration done, hello Home Assistant.
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: dzVents 2.0 just got integrated into Domoticz (beta v3.7968)

Post by dannybloe »

No as dzVents 1.x is installed in scripts/Lua/dzVents and 2.0 is in scripts/dzVents. So you can have both systems running alongside. So you can move your scripts over one-by-one (after changing them a bit so they work with 2.0).
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: dzVents 2.0 just got integrated into Domoticz (beta v3.7968)

Post by dannybloe »

Turns out there are some problems with the build.. Gizmocus is working on it.
Sorry about that.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
blacksn0w
Posts: 99
Joined: Friday 10 March 2017 22:27
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Germany
Contact:

Re: dzVents 2.0 just got integrated into Domoticz (beta v3.7968)

Post by blacksn0w »

Well, this is the beta channel, anyone who is expecting flawlessly working builds is using the wrong version :D
Migration done, hello Home Assistant.
SweetPants

Re: dzVents 2.0 just got integrated into Domoticz (beta v3.7968)

Post by SweetPants »

blacksn0w wrote:Well, this is the beta channel, anyone who is expecting flawlessly working builds is using the wrong version :D
That is why I have a test system :mrgreen: :mrgreen: :mrgreen:
pavelbor
Posts: 35
Joined: Sunday 18 December 2016 12:18
Target OS: Raspberry Pi / ODroid
Domoticz version: LastBeta
Location: Tallinn / Estonia
Contact:

Re: dzVents 2.0 just got integrated into Domoticz (beta v3.7968)

Post by pavelbor »

How to revert to previos working beta?
SweetPants

Re: dzVents 2.0 just got integrated into Domoticz (beta v3.7968)

Post by SweetPants »

pavelbor wrote:How to revert to previos working beta?
If you are compiling from source, checkout commit 531b648 (V3.7715) this one still works
pavelbor
Posts: 35
Joined: Sunday 18 December 2016 12:18
Target OS: Raspberry Pi / ODroid
Domoticz version: LastBeta
Location: Tallinn / Estonia
Contact:

Re: dzVents 2.0 just got integrated into Domoticz (beta v3.7968)

Post by pavelbor »

SweetPants wrote:
pavelbor wrote:How to revert to previos working beta?
If you are compiling from source, checkout commit 531b648 (V3.7715) this one still works
No, i just updated from menu "Update".
Reason i'm using beta is - Xiaomi Smart Home gateway. There is no support for it in "main" (non-beta) Domoticz (for half an year).
Derik
Posts: 1602
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: dzVents 2.0 just got integrated into Domoticz (beta v3.7968)

Post by Derik »

mmm longtime a go...
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
scottydj2
Posts: 15
Joined: Monday 06 February 2017 11:09
Target OS: Windows
Domoticz version:
Contact:

Re: dzVents 2.0 just got integrated into Domoticz (beta v3.7968)

Post by scottydj2 »

I think the merge has/is being reverted :(

If anyone is building from source, we would welcome testing on the dzVents-integration branch on gihub.

Thanks

Scott.
zicht
Posts: 272
Joined: Sunday 11 May 2014 11:09
Target OS: Windows
Domoticz version: 2023.1+
Location: NL
Contact:

Re: dzVents 2.0 just got integrated into Domoticz (beta v3.7968)

Post by zicht »

dannybloe wrote:No you don't have to consider this (certainly not in the near future I think). You can wonder though why you need so many lines of code :). I bet that with dzVents you can at least cut that in half (if not more).
Agreed, and i am not a coder at all so many things can be done in a much better way.
But as usual if quick and dirty works --> why change something that works great.
Code runs below 0,01 sec, so nothing to worry about :P
Rpi & Win x64. Using : cam's,RFXCom, LaCrosse, RFY, HuE, google, standard Lua, Tasker, Waze traveltime, NLAlert&grip2+,curtains, vacuum, audioreceiver, smart-heating&cooling + many more (= automate all repetitive simple tasks)
Derik
Posts: 1602
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: dzVents 2.0 just got integrated into Domoticz (beta v3.7968)

Post by Derik »

where can i find this in Domoticz?
And some examples?
or just the wiki??
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
scottydj2
Posts: 15
Joined: Monday 06 February 2017 11:09
Target OS: Windows
Domoticz version:
Contact:

Re: dzVents 2.0 just got integrated into Domoticz (beta v3.7968)

Post by scottydj2 »

Derik wrote:where can i find this in Domoticz?
And some examples?
or just the wiki??
Currently you'll have to build yourself from the branch: https://github.com/domoticz/domoticz/tr ... ntegration
as we're still ironing out some integration issues :)

You'll find more examples in the dzvents/examples directory.
Derik
Posts: 1602
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: dzVents 2.0 just got integrated into Domoticz (beta v3.7968)

Post by Derik »

mm then i still wait...
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
User avatar
Egregius
Posts: 2589
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: dzVents 2.0 just got integrated into Domoticz (beta v3.7968)

Post by Egregius »

I already thought that I had removed that folder multiple times...
My opinion is that Domoticz should be more blocks to choose from instead of forcing stuff.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest