dzVents 1.1.1

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:

Re: dzVents 1.1.1

Post by dannybloe »

Good question :) I think you can do it like this:

Code: Select all

domoticz.sendCommand('Security Panel', domoticz.SECURITY_ARMEDHOME)
Maybe you can check this then I can make a dedicated command like:

Code: Select all

domoticz.setSecurity(domoticz.SECURITY_ARMEDHOME)
Or something like that.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
dhanjel
Posts: 102
Joined: Tuesday 05 August 2014 22:16
Target OS: Linux
Domoticz version: 3.5146
Location: Sweden
Contact:

Re: dzVents 1.1.1

Post by dhanjel »

I will test tomorrow, thanks!
Hanfelt
Posts: 4
Joined: Tuesday 29 March 2016 14:30
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: dzVents 1.1.1

Post by Hanfelt »

Update: You can read about the GCM error here: viewtopic.php?t=10505#p74782 and https://developers.google.com/cloud-mes ... server-ref

Hi there just tried it out and it works fine, got one question though dont know if its related to dzvents or not. I tried the test.lua script in the manual and it works as it should. The log gives one error though that i dont know what it means, Error:GCM? Im going to use this alot as om converting to domoticz from fibaro and GEA.

Code: Select all

2016-07-20 00:20:26.868 LUA: Handling events for: "Vardagsrum Golvlampa 1", value: "Off"
2016-07-20 00:20:26.868 LUA: =====================================================
2016-07-20 00:20:26.868 LUA: >>> Handler: test
2016-07-20 00:20:26.868 LUA: >>> Device: "Vardagsrum Golvlampa 1" Index: 18
2016-07-20 00:20:26.869 LUA: .....................................................
2016-07-20 00:20:26.869 LUA: .....................................................
2016-07-20 00:20:26.869 LUA: <<< Done
2016-07-20 00:20:26.869 LUA: -----------------------------------------------------
2016-07-20 00:20:26.869 LUA: [1] = SendNotification: Hey!#I am off!#0#pushover
2016-07-20 00:20:26.869 LUA: =====================================================
2016-07-20 00:20:27.110 Error: GCM
dhanjel
Posts: 102
Joined: Tuesday 05 August 2014 22:16
Target OS: Linux
Domoticz version: 3.5146
Location: Sweden
Contact:

Re: dzVents 1.1.1

Post by dhanjel »

dannybloe wrote:Good question :) I think you can do it like this:

Code: Select all

domoticz.sendCommand('Security Panel', domoticz.SECURITY_ARMEDHOME)
Maybe you can check this then I can make a dedicated command like:

Code: Select all

domoticz.setSecurity(domoticz.SECURITY_ARMEDHOME)
Or something like that.
DId not seem to work, only got the GCM error error :)
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: dzVents 1.1.1

Post by dannybloe »

What is the standard commandArray command then to arm the system?
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
pluggin
Posts: 45
Joined: Tuesday 26 May 2015 22:49
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Argentina
Contact:

Re: dzVents 1.1.1

Post by pluggin »

I cant make it run. I´m googleing but can´t resolve it
My configuration:
Folders structure

/home/pi/domoticz/scripts/lua
drwxr-xr-x 4 root root 4096 Jul 18 17:49 dzVents
-rw-r--r-- 1 root root 710 Jul 19 17:34 dzVents_settings.lua
-rw-r--r-- 1 root root 572 Jul 19 17:35 script_device_main.lua
drwxr-xr-x 2 root root 4096 Jul 19 17:52 scripts
-rw-r--r-- 1 root root 571 Jul 19 17:35 script_time_main.lua

Error on domoticz Log
Error: EventSystem: in /home/pi/domoticz/scripts/lua/script_device_main.lua: /home/pi/domoticz/scripts/lua/script_device_main.lua:9: module 'EventHelpers' not found:
no field package.preload['EventHelpers']
no file '/usr/local/share/lua/5.2/EventHelpers.lua'
no file '/usr/local/share/lua/5.2/EventHelpers/init.lua'
no file '/usr/local/lib/lua/5.2/EventHelpers.lua'
no file '/usr/local/lib/lua/5.2/EventHelpers/init.lua'
no file './EventHelpers.lua'
no file '/home/pi/domoticz/scripts/lua/EventHelpers.lua'
no file '/home/pi/domoticz/scripts/lua/dzVents/EventHelpers.lua'
no file '/home/pi/domoticz/scripts/lua/scripts/EventHelpers.lua'
no file '/home/pi/domoticz/scripts/lua/scripts/storage/EventHelpers.lua'
no file '/usr/local/lib/lua/5.2/EventHelpers.so'
no file '/usr/local/lib/lua/5.2/loadall.so'
no file './EventHelpers.so'

Please some help...
Regards
Last edited by pluggin on Wednesday 20 July 2016 16:14, edited 1 time in total.
Razberry + 4 Eversrping HSM02 + 2 Aeotec Multi-Sensor + 1 Aeotec Micro Dimmer + 4 Aeotec Micro Smart Energy Switch, 2nd + 1 Remotec ZXT-120 + 1 Aeotec Smart Energy Monitor + 1 Everspring SE812 indoor Siren + 2 fibaro motion sensor + Aeotec water sensor
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: dzVents 1.1.1

Post by dannybloe »

Would be nice if Google could help you with this one ;-)
Anyway, weird... can you put the following code between line 3 and 4 in script_device_main.lua:

Code: Select all

print(currentPath, scriptsFolderPath)
And see what it prints.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
pluggin
Posts: 45
Joined: Tuesday 26 May 2015 22:49
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Argentina
Contact:

Re: dzVents 1.1.1

Post by pluggin »

dannybloe wrote:Would be nice if Google could help you with this one ;-)
Anyway, weird... can you put the following code between line 3 and 4 in script_device_main.lua:

Code: Select all

print(currentPath, scriptsFolderPath)
And see what it prints.
2016-07-20 11:09:26.463 Error: EventSystem: in /home/pi/domoticz/scripts/lua/script_device_main.lua: /home/pi/domoticz/scripts/lua/script_device_main.lua:11: module 'EventHelpers' not found:
no field package.preload['EventHelpers']
no file '/usr/local/share/lua/5.2/EventHelpers.lua'
no file '/usr/local/share/lua/5.2/EventHelpers/init.lua'
no file '/usr/local/lib/lua/5.2/EventHelpers.lua'
no file '/usr/local/lib/lua/5.2/EventHelpers/init.lua'
no file './EventHelpers.lua'
no file '/home/pi/domoticz/scripts/lua/EventHelpers.lua'
no file '/home/pi/domoticz/scripts/lua/dzVents/EventHelpers.lua'
no file '/home/pi/domoticz/scripts/lua/scripts/EventHelpers.lua'
no file '/home/pi/domoticz/scripts/lua/scripts/storage/EventHelpers.lua'
no file '/usr/local/lib/lua/5.2/EventHelpers.so'
no file '/usr/local/lib/lua/5.2/loadall.so'
no file './EventHelpers.so'

Response for print(currentPath, scriptsFolderPath)
2016-07-20 11:09:27.545 LUA: /home/pi/domoticz/scripts/lua/
2016-07-20 11:09:27.545 LUA: /home/pi/domoticz/scripts/lua/scripts
Razberry + 4 Eversrping HSM02 + 2 Aeotec Multi-Sensor + 1 Aeotec Micro Dimmer + 4 Aeotec Micro Smart Energy Switch, 2nd + 1 Remotec ZXT-120 + 1 Aeotec Smart Energy Monitor + 1 Everspring SE812 indoor Siren + 2 fibaro motion sensor + Aeotec water sensor
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: dzVents 1.1.1

Post by dannybloe »

Well, that looks good. Seems like Lua cannot find the files. Are you sure that all the files in /home/pi/domoticz/scripts/lua/dzVents are there and accessible by the Domoticz process (in my Pi setup they have pi:pi permissions instead of root).

As you can see in your trace it looks in the right places for the files: no file '/home/pi/domoticz/scripts/lua/dzVents/EventHelpers.lua'
That is exactly the correct path so if it cannot find it, it either isn't there or it doesn't have read access.
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: dzVents 1.1.1

Post by NietGiftig »

I have a couple of SonOff devices (ESP8266 driven with ESPEasy)
Every now or then (about 2 times the last 2 weeks) the device does not respond to a Domoticz command.
It's the Hall Light (in dutch portieklicht) and the neighbors complain ;)
The device is a virtual device controlled by a dzVents script and is only a receiving device.

In the log I find.
Error opening url: http://192.168.0.201/control?cmd=GPIO,12,1

So it is sometimes not responding on that particular command at that moment.

I've seen some example scripts for check for dead devices, but the scripts assume that the device is regular sending data.
do I have to make the device sending some "I'm alive" data?
Even then I'm not sure if the device is responding to the on/off signal, because other days it reacts on the command.

Is it possible in dzVents (or LUA) to check the log after sending the on/off command for an error and send the command again?
Or is there another way to receive the error message in dzVents (LUA)
Or has somebody a waterproof method?
RPI-2 + SSD / ESPEasy Sensors & Switches / Sonoff / RFLink / Action Switches / TP-Link switch / Node-Red / Reacticz
pluggin
Posts: 45
Joined: Tuesday 26 May 2015 22:49
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Argentina
Contact:

Re: dzVents 1.1.1

Post by pluggin »

dannybloe wrote:Well, that looks good. Seems like Lua cannot find the files. Are you sure that all the files in /home/pi/domoticz/scripts/lua/dzVents are there and accessible by the Domoticz process (in my Pi setup they have pi:pi permissions instead of root).

As you can see in your trace it looks in the right places for the files: no file '/home/pi/domoticz/scripts/lua/dzVents/EventHelpers.lua'
That is exactly the correct path so if it cannot find it, it either isn't there or it doesn't have read access.
I resolved my problem!!! It was an directory structure issue.
Thanks for your help
Razberry + 4 Eversrping HSM02 + 2 Aeotec Multi-Sensor + 1 Aeotec Micro Dimmer + 4 Aeotec Micro Smart Energy Switch, 2nd + 1 Remotec ZXT-120 + 1 Aeotec Smart Energy Monitor + 1 Everspring SE812 indoor Siren + 2 fibaro motion sensor + Aeotec water sensor
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: dzVents 1.1.1

Post by dannybloe »

NietGiftig wrote:I have a couple of SonOff devices (ESP8266 driven with ESPEasy)
Every now or then (about 2 times the last 2 weeks) the device does not respond to a Domoticz command.
It's the Hall Light (in dutch portieklicht) and the neighbors complain ;)
The device is a virtual device controlled by a dzVents script and is only a receiving device.

In the log I find.
Error opening url: http://192.168.0.201/control?cmd=GPIO,12,1

So it is sometimes not responding on that particular command at that moment.

I've seen some example scripts for check for dead devices, but the scripts assume that the device is regular sending data.
do I have to make the device sending some "I'm alive" data?
Even then I'm not sure if the device is responding to the on/off signal, because other days it reacts on the command.

Is it possible in dzVents (or LUA) to check the log after sending the on/off command for an error and send the command again?
Or is there another way to receive the error message in dzVents (LUA)
Or has somebody a waterproof method?
Can't you make the esp send a status report as well so it also controls a virtual switch? I have an esp that does just that. I think I connected one of the outputs to an input that controls a virtual switch (with proper resistors or transistors and stuff, don't know from the top of my head). Then you can use that to re-issue the command through a script if the device is not in the desired state after you send the command. In that case you can keep sending the command until it is ok.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
dhanjel
Posts: 102
Joined: Tuesday 05 August 2014 22:16
Target OS: Linux
Domoticz version: 3.5146
Location: Sweden
Contact:

Re: dzVents 1.1.1

Post by dhanjel »

dannybloe wrote:What is the standard commandArray command then to arm the system?
Seems to be like that.

Code: Select all

commandArray['Security Panel'] = 'Arm Away'
I need more testing I guess
Rebels
Posts: 6
Joined: Thursday 04 December 2014 21:52
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: dzVents 1.1.1

Post by Rebels »

I think you've ran into a common problem with the esp8266. I noticed the same issue with some of my own ESP8266 devices. They tend to hang after a few days of operation. Just Google on ESP8266 hangs and you will find that you are not the only one. For Some situations solutions are provided on the Internet, but it is no guarantee that there is one for yours. Mine was solved, because I wrote the software myself and was able to work around the issue thanx to a tip from someone on an other forum.
pluggin
Posts: 45
Joined: Tuesday 26 May 2015 22:49
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Argentina
Contact:

Re: dzVents 1.1.1

Post by pluggin »

Some time ago a wrote a post with a issue I have with domoticz and light switchs (http://www.domoticz.com/forum/viewtopic ... 622#p90622). I upgraded to 3.5446 version but the issue persist so I think may be I can resolve it with Dzvents but I need help.
The symptom are:
The switchlight shows, Data and Status as ON but thats not true the light is really on OFF status. The device have current watt usage too and its 0.0 watt value thats confirm the OFF status.

Querying with json:
DEVICE Switch
{
"result" : [
{
"BatteryLevel" : 255,
"CustomImage" : 0,
"Data" : "On",
"HardwareID" : 2,
"HardwareTypeVal" : 21,
"HaveDimmer" : true,
"HaveGroupCmd" : true,
"HaveTimeout" : false,
"ID" : "00000701",
"Image" : "Light",
"IsSubDevice" : false,
"LastUpdate" : "2016-08-08 14:47:33",
"Level" : 255,
"Name" : "Luz pasillo",
"Notifications" : "false",
"PlanID" : "6",
"PlanIDs" : [ 6 ],
"Protected" : false,
"ShowNotifications" : true,
"SignalLevel" : "-",
"Status" : "On",
"SubType" : "Switch",
"SwitchType" : "On/Off",
"SwitchTypeVal" : 0,
"Timers" : "false",
"Type" : "Light/Switch",
"idx" : "35"
}
],
}

Electric status
{
"result" : [
{
"BatteryLevel" : 255,
"Data" : "0.0 Watt",
"HardwareID" : 2,
"HardwareTypeVal" : 21,
"HaveTimeout" : true,
"ID" : "0000701",
"LastUpdate" : "2016-08-08 14:47:32",
"Name" : "Consumo Pasillo PB",
"Notifications" : "false",
"PlanID" : "5",
"PlanIDs" : [ 5 ],
"Protected" : false,
"ShowNotifications" : true,
"SubType" : "Electric",
"Timers" : "false",
"Type" : "Usage",
"TypeImg" : "current",
"idx" : "36"
}
],
}

What I want to do with dzvents if is the status of any of the switch light change to ON but the watt is 0 change it automaticaly to OFF state with a single script for any of the lightswitch. The script have to know that the switch light have a watt value to look at.

Is this posible?

Kind regards
Razberry + 4 Eversrping HSM02 + 2 Aeotec Multi-Sensor + 1 Aeotec Micro Dimmer + 4 Aeotec Micro Smart Energy Switch, 2nd + 1 Remotec ZXT-120 + 1 Aeotec Smart Energy Monitor + 1 Everspring SE812 indoor Siren + 2 fibaro motion sensor + Aeotec water sensor
dhanjel
Posts: 102
Joined: Tuesday 05 August 2014 22:16
Target OS: Linux
Domoticz version: 3.5146
Location: Sweden
Contact:

Re: dzVents 1.1.1

Post by dhanjel »

just moved my entire domoticz-installation from a linux to a windows machine (don´t ask me why ;)) and copied the .db file.
Everything works, except dzVents.

script_device_main.lua:3: attempt to concatenate local 'currentPath'

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

Re: dzVents 1.1.1

Post by dannybloe »

dhanjel wrote:just moved my entire domoticz-installation from a linux to a windows machine (don´t ask me why ;)) and copied the .db file.
Everything works, except dzVents.

script_device_main.lua:3: attempt to concatenate local 'currentPath'

any ideas?
Yeah, you shouldn't have.

I'm fairly certain that right now it is not going to work on windows. At least not as it is now. There are some places where there's some filepath stuff that is different but I think that can be overcome. But fetching http data is not going to work as it uses linux commands right now. Of course it should be possible but I don't have a windows machine myself so.... pull requests are hapily accepted :lol:

Windows.. for the love of Darwin... why? :roll:
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
dhanjel
Posts: 102
Joined: Tuesday 05 August 2014 22:16
Target OS: Linux
Domoticz version: 3.5146
Location: Sweden
Contact:

Re: dzVents 1.1.1

Post by dhanjel »

I was planning to use another computer for domoticz but my plans got ruined and I don´t have the energy to move back :)

anything more than curl? ´cause that can be installed
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: dzVents 1.1.1

Post by dannybloe »

dhanjel wrote:I was planning to use another computer for domoticz but my plans got ruined and I don´t have the energy to move back :)

anything more than curl? ´cause that can be installed
It also uses sed (sort string search and replace). Look inside the file utils.lua. There the fetching stuff is. There are just a couple of places where there is some path juggling to get the modules loaded. It does check for what kind system it is running by inspecting the path separator. It's not that magical. Maybe you can have a look if you dare to ;-)
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 1.1.1

Post by dannybloe »

pluggin wrote:Some time ago a wrote a post with a issue I have with domoticz and light switchs (http://www.domoticz.com/forum/viewtopic ... 622#p90622). I upgraded to 3.5446 version but the issue persist so I think may be I can resolve it with Dzvents but I need help.
The symptom are:
The switchlight shows, Data and Status as ON but thats not true the light is really on OFF status. The device have current watt usage too and its 0.0 watt value thats confirm the OFF status.

Querying with json:
DEVICE Switch
{
"result" : [
{
"BatteryLevel" : 255,
"CustomImage" : 0,
"Data" : "On",
"HardwareID" : 2,
"HardwareTypeVal" : 21,
"HaveDimmer" : true,
"HaveGroupCmd" : true,
"HaveTimeout" : false,
"ID" : "00000701",
"Image" : "Light",
"IsSubDevice" : false,
"LastUpdate" : "2016-08-08 14:47:33",
"Level" : 255,
"Name" : "Luz pasillo",
"Notifications" : "false",
"PlanID" : "6",
"PlanIDs" : [ 6 ],
"Protected" : false,
"ShowNotifications" : true,
"SignalLevel" : "-",
"Status" : "On",
"SubType" : "Switch",
"SwitchType" : "On/Off",
"SwitchTypeVal" : 0,
"Timers" : "false",
"Type" : "Light/Switch",
"idx" : "35"
}
],
}

Electric status
{
"result" : [
{
"BatteryLevel" : 255,
"Data" : "0.0 Watt",
"HardwareID" : 2,
"HardwareTypeVal" : 21,
"HaveTimeout" : true,
"ID" : "0000701",
"LastUpdate" : "2016-08-08 14:47:32",
"Name" : "Consumo Pasillo PB",
"Notifications" : "false",
"PlanID" : "5",
"PlanIDs" : [ 5 ],
"Protected" : false,
"ShowNotifications" : true,
"SubType" : "Electric",
"Timers" : "false",
"Type" : "Usage",
"TypeImg" : "current",
"idx" : "36"
}
],
}

What I want to do with dzvents if is the status of any of the switch light change to ON but the watt is 0 change it automaticaly to OFF state with a single script for any of the lightswitch. The script have to know that the switch light have a watt value to look at.

Is this posible?

Kind regards
I'm not really sure what you exactly want to accomplish. Can you sketch/describe how you would want the script to behave? What do you mean by 'if the status of the switch light change'? Is that when the switch is operated physically?
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests