dzVents behaviour

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

Moderator: leecollings

Post Reply
User avatar
Bospieper
Posts: 174
Joined: Thursday 07 November 2019 10:26
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: NL
Contact:

dzVents behaviour

Post by Bospieper »

Hi,
I am facing the following problem.
I had a RPI3+ en bought a new RPI 4. Did a fresh install, install of the latest Domoticz version beta. Next I copied my RPI3+ dzVents scripts to the new RPI 4. Then added my Zwave and Zigbee devices and tested them.
The problem is that some scripts are working and some don't. I give you a example:

Code: Select all

return {
 	on = {
	        timer = {'every minute'},
	        devices = {'Gang- lamp gang',
	                   131,                  -- Sensor gang
	                   'Overloop dimmer'}
	},
	logging = {
		level = domoticz.LOG_ERROR,
		marker = 'Verlichting gang',
	},
	execute = function(dz)
		
		
	    local sensor = dz.devices(131)
		local lamp = dz.devices('Gang- lamp gang')
		local lamp2 = dz.devices('Overloop dimmer')
		--local currentLux = dz.devices('Lux gang').lux
		--local lux = 35
		
		if dz.time.matchesRule("between 02:00 and 15 minutes before sunset") then
		    if  sensor.active then --and currentLux <= lux-- 
		        lamp.dimTo(40)
		        lamp2.switchOn()
		        lamp.dimTo(10).afterMin(1)
		        lamp2.switchOff().afterMin(3)
		   else lamp.switchOff().checkFirst()
		        end
        elseif dz.time.matchesRule("between 15 minutes before sunset and 23:30") then
             if sensor.active then --and currentLux <= lux-- 
                lamp.dimTo(50)
                lamp.dimTo(10).afterMin(1)
                lamp2.switchOn()
                lamp2.switchOff().afterMin(3)
                end
        elseif dz.time.matchesRule("between 23:30 and 02:00") then
             if sensor.active then
                lamp.dimTo(30)
                lamp2.switchOn()
                lamp.dimTo(5).afterMin(1)
                lamp2.switchOff().afterMin(3)
                end
                end
	end
	
}
This is a simple script in wich a motion sensor switches two lamps both with different delay's.
Next the error I'am getting. Note that I am using both devicename and idx, it makes no difference for the error

Code: Select all

2022-04-01 22:14:00.238 Error: dzVents: Error: (3.1.8) Verlichting gang: There is no device with that name or id: 131
2022-04-01 22:14:00.239 Error: dzVents: Error: (3.1.8) Verlichting gang: An error occurred when calling event handler Lamp gang
2022-04-01 22:14:00.239 Error: dzVents: Error: (3.1.8) Verlichting gang: ...domoticz/scripts/dzVents/generated_scripts/Lamp gang.lua:30: attempt to index a nil value (local 'sensor')
This is the idx and devicename :
131 Aeotec Zwave Gen.5 00011635 1 Sensor gang Light/Switch Switch On
I am using both Zwave and Zigbee devices in the scripts, no difference when there are only Zwave devices or Zwave/Zigbee devices or only Zigbee devices in the script.
Hope someone can point me in the right direction to solve this problem.
Grz. Piet
User avatar
waltervl
Posts: 6691
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: dzVents behaviour

Post by waltervl »

Dzvents cannot handle devices with the same name. So be sure you have unique names.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
Bospieper
Posts: 174
Joined: Thursday 07 November 2019 10:26
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: NL
Contact:

Re: dzVents behaviour

Post by Bospieper »

Hi Waltervl,
What do mean by that? Where in this script I use the same names?
Piet
User avatar
jvdz
Posts: 2446
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: dzVents behaviour

Post by jvdz »

Piet,
Are you sure the IDX 131 is correct as that is what dzvents complains about?
User avatar
waltervl
Posts: 6691
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: dzVents behaviour

Post by waltervl »

Bospieper wrote: Saturday 02 April 2022 9:09 Hi Waltervl,
What do mean by that? Where in this script I use the same names?
Piet
If you have multiple devices (eg idx 120 and 131) having the exactly same name (eg "sensor x") Dzvents is reported to have issues with that. I am not saying it is your issue but perhaps it is related. So please check to be sure it is not the case and rename one device to another name like "sensor X1"
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
Bospieper
Posts: 174
Joined: Thursday 07 November 2019 10:26
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: NL
Contact:

Re: dzVents behaviour

Post by Bospieper »

Hi jvdz,
In my first post you see a copie of device 131 as stated in the devicelist.
Grz Piet
User avatar
Bospieper
Posts: 174
Joined: Thursday 07 November 2019 10:26
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: NL
Contact:

Re: dzVents behaviour

Post by Bospieper »

Hi Waltervl,
Does this mean that I cannot use for examle: Badkamer sensor, Zolder sensor etc etc?
Piet
User avatar
waltervl
Posts: 6691
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: dzVents behaviour

Post by waltervl »

As long as the names are not exactly the same you are fine.
So not do not call a light and a temperature sensor name both "badkamer" but "lamp badkamer" and "temp badkamer"
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
Bospieper
Posts: 174
Joined: Thursday 07 November 2019 10:26
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: NL
Contact:

Re: dzVents behaviour

Post by Bospieper »

waltervl wrote: Saturday 02 April 2022 14:34 As long as the names are not exactly the same you are fine.
So not do not call a light and a temperature sensor name both "badkamer" but "lamp badkamer" and "temp badkamer"
Yes that's what I did and as far as I can see with the search option in the device list there are no double names.
But the problem is still there :(
User avatar
waltervl
Posts: 6691
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: dzVents behaviour

Post by waltervl »

Well, what if you use 'sensor gang' in the script instead of idx 131? Still the same issue?
Is sensor gang an active device (blue arrow in device list)?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
Bospieper
Posts: 174
Joined: Thursday 07 November 2019 10:26
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: NL
Contact:

Re: dzVents behaviour

Post by Bospieper »

waltervl wrote: Saturday 02 April 2022 14:50 Well, what if you use 'sensor gang' in the script instead of idx 131? Still the same issue?
Is sensor gang an active device (blue arrow in device list)?
It's makes now difference using either IDX or Devicename, and yes the device has a blue arrow and active I see the icon changing and the timestamp
User avatar
Bospieper
Posts: 174
Joined: Thursday 07 November 2019 10:26
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: NL
Contact:

Re: dzVents behaviour

Post by Bospieper »

Bospieper wrote: Saturday 02 April 2022 17:55
waltervl wrote: Saturday 02 April 2022 14:50 Well, what if you use 'sensor gang' in the script instead of idx 131? Still the same issue?
Is sensor gang an active device (blue arrow in device list)?
It's makes now difference using either IDX or Devicename, and yes the device has a blue arrow and active I see the icon changing and the timestamp
Strange thing happened, I' ve made a testscript to determine if the motion sensor was able to change the state of the lamp from Off to On. And it dit change the state of the testlamp from Off to On. So the motion sensor was working. I changed the orginal script from idx to devicename and saved it.
In the log there was an error :

Code: Select all

2022-04-02 18:11:17.192 Error: EventSystem: in /home/pi/domoticz/dzVents/runtime/dzVents.lua: /home/pi/domoticz/dzVents/runtime/EventHelpers.lua:454: attempt to concatenate a nil value (field 'hardwareName')
After that I activate the motionsensor by moving and the script is working without errors in the log.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest