Wow, that is certainly weird. I'd have to debug that. Can you PM me your entire script code?Wroopy wrote:Yes I'm sure it is calles several times. I can see it both in Domoticz log and the timestamp of the item is changed in the storage-file.dannybloe wrote:I just tested it here and it works with this script:dannybloe wrote:
Every time the script is executed it reads the persistent data and stores it when the script is finished. So each time the switch changes.
and the data file is like this:Code: Select all
return { active = true, on = { 'mySensor' }, data = { history = {history = true, maxItems = 10} }, execute = function(domoticz, sensor) local reading = sensor.temperature domoticz.data.history.add(reading) local avg = domoticz.data.history.avg() local size = domoticz.data.history.size print(sensor.name .. ": last=" .. reading .. ", avg=" .. avg .. ", size= " .. size) end }
Are you sure that the script is called multiple times?Code: Select all
-- Persistent Data local multiRefObjects = { } -- multiRefObjects local obj1 = { ["history"] = { [1] = { ["time"] = "2016-10-19 09:45:59"; ["data"] = 16.799999237061; }; [2] = { ["time"] = "2016-10-19 09:45:58"; ["data"] = 16.799999237061; }; [3] = { ["time"] = "2016-10-19 09:45:30"; ["data"] = 16.799999237061; }; [4] = { ["time"] = "2016-10-19 09:45:29"; ["data"] = 16.799999237061; }; [5] = { ["time"] = "2016-10-19 09:44:59"; ["data"] = 16.799999237061; }; [6] = { ["time"] = "2016-10-19 09:44:58"; ["data"] = 16.799999237061; }; [7] = { ["time"] = "2016-10-19 09:44:29"; ["data"] = 16.799999237061; }; [8] = { ["time"] = "2016-10-19 09:44:28"; ["data"] = 16.799999237061; }; [9] = { ["time"] = "2016-10-19 09:43:59"; ["data"] = 16.799999237061; }; [10] = { ["time"] = "2016-10-19 09:43:58"; ["data"] = 16.89999961853; }; }; } return obj1
I've tested to increase the logging, i.e. change ['Log level'] = 3 in dzVents_settings.lua too see if I would get som extra useful information. Got some very confusing result
1. The size of the history variable where increasing. So finally I got 10 items as expected.
2. Changed back to ['Log level'] = 2 and now I get only one hisory item.
3. Switch to level 3 again and it worked as expected.
4. Changed back to 2 and got only one history item.
Does that give any hint on what the problem could be?
Introducing dzVents - Domoticz Lua file based event scripting made e-z!
Moderator: leecollings
-
- 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!
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
-
- 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!
I cannot reproduce this. In my test the loglevel has no influence.dannybloe wrote:Wroopy wrote:dannybloe wrote:
Wow, that is certainly weird. I'd have to debug that. Can you PM me your entire script code?
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
-
- Posts: 9
- Joined: Tuesday 18 October 2016 22:06
- Target OS: Linux
- Domoticz version: v3.5745
- Contact:
Re: Introducing dzVents - Domoticz Lua file based event scripting made e-z!
To make sure I don't have ant race conditions, I've removed all other scripts and have only the script that you've tested with.dannybloe wrote:Wow, that is certainly weird. I'd have to debug that. Can you PM me your entire script code?Wroopy wrote:dannybloe wrote:
I just tested it here and it works with this script:
Code: Select all
return { active = true, on = { 'mySensor' }, data = { history = {history = true, maxItems = 10} }, execute = function(domoticz, sensor) local reading = sensor.temperature domoticz.data.history.add(reading) local avg = domoticz.data.history.avg() local size = domoticz.data.history.size print(sensor.name .. ": last=" .. reading .. ", avg=" .. avg .. ", size= " .. size) end }
Still the same problem.
Tested with different loglevels and it is only when having log level 2 it doesn't work.
-
- Posts: 13
- Joined: Monday 19 September 2016 8:12
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Introducing dzVents - Domoticz Lua file based event scripting made e-z!
Hi dannybloe,dannybloe wrote:Yea you can set it to true if you start the stuff in th evening for the first time. That's an easy one
just came back from vacation & quickly implemented your script. It works fine!
Thanks for your input!!!
What I'm still generally searching for is some kind of logic to distinguish if a switch was triggered by a PIR or manually trough the light button which triggers a Fibaro relay.
An example is that someone manually triggers a light switch in our hall. There also is a PIR. So although the switch is triggered manually the PIR detects the motion & the state in the dzVents table changes. So how can I differentiate this case for a proper handling?
Any input is really appreciated
RPi3+UZB1,FIBARO FGMS001(9x),FIBARO FGD212,FIBARO FGRM222(6x),FIBARO FGSD002(1x),FIBARO FGWPE (3x),Neo CoolCam Power plug(5x),NodOn CRC-3-1 Remote(2x),Qubino ZMNHADx(1x),Qubino ZMNHDD1(2x),Z-Wave Weather Sensor(1x),Z-Wave ZME_WALLC-S,FIBARO System FGK10x
-
- Posts: 13
- Joined: Monday 19 September 2016 8:12
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Introducing dzVents - Domoticz Lua file based event scripting made e-z!
Hi dannybloe,
can you please take a look at the latest beta of Domoticz? Something is going wrong with the scenes & dzEvents there. I'm getting the following error with all of my scenes:
I've deleted all scenes & recreated just the one above but the error remains. No more errors even in debug level 3.
I've also stopped Domoticz & deleted the devices.lua file so it can be build up from scratch but no luck at all
Best rergards
Stephan
can you please take a look at the latest beta of Domoticz? Something is going wrong with the scenes & dzEvents there. I'm getting the following error with all of my scenes:
Code: Select all
LUA: Cannot find the device. Skipping: KuecheLichtSchrank 1
I've also stopped Domoticz & deleted the devices.lua file so it can be build up from scratch but no luck at all
Best rergards
Stephan
RPi3+UZB1,FIBARO FGMS001(9x),FIBARO FGD212,FIBARO FGRM222(6x),FIBARO FGSD002(1x),FIBARO FGWPE (3x),Neo CoolCam Power plug(5x),NodOn CRC-3-1 Remote(2x),Qubino ZMNHADx(1x),Qubino ZMNHDD1(2x),Z-Wave Weather Sensor(1x),Z-Wave ZME_WALLC-S,FIBARO System FGK10x
-
- 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!
Upgrade to the latest dzvents release.Glatzi wrote:Hi dannybloe,
can you please take a look at the latest beta of Domoticz? Something is going wrong with the scenes & dzEvents there. I'm getting the following error with all of my scenes:
2016-10-23_20-38-34.gifCode: Select all
LUA: Cannot find the device. Skipping: KuecheLichtSchrank 1
I've deleted all scenes & recreated just the one above but the error remains. No more errors even in debug level 3.
I've also stopped Domoticz & deleted the devices.lua file so it can be build up from scratch but no luck at all
Best rergards
Stephan
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
-
- Posts: 13
- Joined: Monday 19 September 2016 8:12
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Introducing dzVents - Domoticz Lua file based event scripting made e-z!
Thx, that solved the error!
RPi3+UZB1,FIBARO FGMS001(9x),FIBARO FGD212,FIBARO FGRM222(6x),FIBARO FGSD002(1x),FIBARO FGWPE (3x),Neo CoolCam Power plug(5x),NodOn CRC-3-1 Remote(2x),Qubino ZMNHADx(1x),Qubino ZMNHDD1(2x),Z-Wave Weather Sensor(1x),Z-Wave ZME_WALLC-S,FIBARO System FGK10x
-
- Posts: 13
- Joined: Monday 19 September 2016 8:12
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Introducing dzVents - Domoticz Lua file based event scripting made e-z!
I've got a question regarding the switchOn().for_min(x) method.
If I'm using this with a power switch in conjunction with a PIR like this:
What happens with the for_min(x) timer when the elsif section is executed:
Is the first timer just canceled & the second will be executed with 2 minutes or is the
time added to the first timer?
If I'm using this with a power switch in conjunction with a PIR like this:
Code: Select all
if ( PIRKeller.state == 'On' and Keller_Switch.state == 'Off' ) then
Keller_Switch.switchOn().for_min(2)
elseif ( PIRKeller.state == 'On' and Keller_Switch.state == 'On' ) then
Keller_Switch.switchOn().for_min(2)
end
Is the first timer just canceled & the second will be executed with 2 minutes or is the
time added to the first timer?
RPi3+UZB1,FIBARO FGMS001(9x),FIBARO FGD212,FIBARO FGRM222(6x),FIBARO FGSD002(1x),FIBARO FGWPE (3x),Neo CoolCam Power plug(5x),NodOn CRC-3-1 Remote(2x),Qubino ZMNHADx(1x),Qubino ZMNHDD1(2x),Z-Wave Weather Sensor(1x),Z-Wave ZME_WALLC-S,FIBARO System FGK10x
-
- Posts: 13
- Joined: Monday 19 September 2016 8:12
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Introducing dzVents - Domoticz Lua file based event scripting made e-z!
Hi dannybloe,
what is the reason for the __data. Dot files in the scripts/storage folder?
what is the reason for the __data. Dot files in the scripts/storage folder?
RPi3+UZB1,FIBARO FGMS001(9x),FIBARO FGD212,FIBARO FGRM222(6x),FIBARO FGSD002(1x),FIBARO FGWPE (3x),Neo CoolCam Power plug(5x),NodOn CRC-3-1 Remote(2x),Qubino ZMNHADx(1x),Qubino ZMNHDD1(2x),Z-Wave Weather Sensor(1x),Z-Wave ZME_WALLC-S,FIBARO System FGK10x
-
- Posts: 9
- Joined: Tuesday 18 October 2016 22:06
- Target OS: Linux
- Domoticz version: v3.5745
- Contact:
Re: Introducing dzVents - Domoticz Lua file based event scripting made e-z!
I got the same dot-file in the data directory. For me, the reason is that I'm using vi as editor and when you open a file in vi a backup file is created with a leading dot in the filename.Glatzi wrote:Hi dannybloe,
what is the reason for the __data. Dot files in the scripts/storage folder?
2016-10-27_19-15-05.gif
The backupfile is detected and evaluated as a ordinary script by dzVents/lua.
@dannybloe; A possible improvement to dzVents woul be to ignore script-files with a leading dot?
/Andreas
-
- 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!
Aha.. that explains... we should certainly ignore those .dotted scripts completely. Right now they are executed as normal scripts!!Wroopy wrote:I got the same dot-file in the data directory. For me, the reason is that I'm using vi as editor and when you open a file in vi a backup file is created with a leading dot in the filename.Glatzi wrote:Hi dannybloe,
what is the reason for the __data. Dot files in the scripts/storage folder?
2016-10-27_19-15-05.gif
The backupfile is detected and evaluated as a ordinary script by dzVents/lua.
@dannybloe; A possible improvement to dzVents woul be to ignore script-files with a leading dot?
/Andreas
I'm very busy at home right now (renovation) which will take at least one or two weeks so I don't have time to fix that I think. I will try but no promises. On the other hand... pull requests are always welcome
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
-
- Posts: 1
- Joined: Thursday 04 December 2014 18:36
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Introducing dzVents - Domoticz Lua file based event scripting made e-z!
Hi Danny,
I'm trying to read the CounterDelivToday from a P1 Smart Meter device. But I only get a nil value returned. The CounterToday value is working well!
Can you help me?
I'm trying to read the CounterDelivToday from a P1 Smart Meter device. But I only get a nil value returned. The CounterToday value is working well!
Can you help me?
-
- Posts: 13
- Joined: Monday 19 September 2016 8:12
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Introducing dzVents - Domoticz Lua file based event scripting made e-z!
Hi Andreas,Wroopy wrote:I got the same dot-file in the data directory. For me, the reason is that I'm using vi as editor and when you open a file in vi a backup file is created with a leading dot in the filename.Glatzi wrote:Hi dannybloe,
what is the reason for the __data. Dot files in the scripts/storage folder?
2016-10-27_19-15-05.gif
The backupfile is detected and evaluated as a ordinary script by dzVents/lua.
@dannybloe; A possible improvement to dzVents woul be to ignore script-files with a leading dot?
/Andreas
when you edit files with vim the file is marked with a dot as a prefix & a suffix .swp
Anyway, this is no big deal.
Goold luck with your renovation project @dannybloe This year we had do it in our whole house instead of taking a vacation
RPi3+UZB1,FIBARO FGMS001(9x),FIBARO FGD212,FIBARO FGRM222(6x),FIBARO FGSD002(1x),FIBARO FGWPE (3x),Neo CoolCam Power plug(5x),NodOn CRC-3-1 Remote(2x),Qubino ZMNHADx(1x),Qubino ZMNHDD1(2x),Z-Wave Weather Sensor(1x),Z-Wave ZME_WALLC-S,FIBARO System FGK10x
-
- Posts: 9
- Joined: Tuesday 18 October 2016 22:06
- Target OS: Linux
- Domoticz version: v3.5745
- Contact:
Re: Introducing dzVents - Domoticz Lua file based event scripting made e-z!
Made a pull request (my first time, but hope it was done correct).dannybloe wrote: Aha.. that explains... we should certainly ignore those .dotted scripts completely. Right now they are executed as normal scripts!!
I'm very busy at home right now (renovation) which will take at least one or two weeks so I don't have time to fix that I think. I will try but no promises. On the other hand... pull requests are always welcome
The current logic is to include all files that contains .lua
Changed to logic to make sure that the file ends with .lua and does not begin with a dot.
- felix63
- Posts: 244
- Joined: Monday 07 December 2015 9:30
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.1
- Location: Gouda
- Contact:
Re: Introducing dzVents - Domoticz Lua file based event scripting made e-z!
Hi Danny,
Nice piece of software. My compliments. I have ported a few scripts. Easier then I thought. Two small questions. I have one script controlling two devices. If one is changed the other one follows. This requires more lines then I expected because apparently I can't copy the state of one device to the other. Is that true or am I missing something?
Secondly can I use a (selector-type) switch in domoticz to dynamically set the log-level? If yes then how?
Cheers,
Lex
Nice piece of software. My compliments. I have ported a few scripts. Easier then I thought. Two small questions. I have one script controlling two devices. If one is changed the other one follows. This requires more lines then I expected because apparently I can't copy the state of one device to the other. Is that true or am I missing something?
Code: Select all
return {
active = true,
on = { 'Subwoofer',
'Versterker' },
execute = function(domoticz, mySwitch)
if domoticz.devices['Versterker'].changed and domoticz.devices['Subwoofer'].state ~= domoticz.devices['Versterker'].state then
if domoticz.devices['Versterker'].state == 'On' then
domoticz.devices['Subwoofer'].switchOn()
else
domoticz.devices['Subwoofer'].switchOff()
end
elseif domoticz.devices['Subwoofer'].changed and domoticz.devices['Versterker'].state ~= domoticz.devices['Subwoofer'].state then
if domoticz.devices['Subwoofer'].state == 'On' then
domoticz.devices['Versterker'].switchOn()
else
domoticz.devices['Versterker'].switchOff()
end
end
end
}
Cheers,
Lex
-
- Posts: 142
- Joined: Friday 31 July 2015 21:02
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Sint-Oedenrode, Netherlands
- Contact:
Re: Introducing dzVents - Domoticz Lua file based event scripting made e-z!
Something like
Code: Select all
Domoticz.devices['Subwoofer'].setState(Domoticz.devices['Versterker'].state)
Mark: Domoticz Beta on Raspberry Pi 4 running Debian Bookworm - Z-Stick 7 - RFXCom - P1 - MySensors - SolarEdge - Dahua - Philips Hue - Docker - Zigbee2mqtt (plugin) - Zwave-js-ui - dzVents - Nodered
- felix63
- Posts: 244
- Joined: Monday 07 December 2015 9:30
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.1
- Location: Gouda
- Contact:
Re: Introducing dzVents - Domoticz Lua file based event scripting made e-z!
That works better, thanks!Doler wrote:Something likeCode: Select all
Domoticz.devices['Subwoofer'].setState(Domoticz.devices['Versterker'].state)
Verzonden vanaf mijn iPad met Tapatalk
- felix63
- Posts: 244
- Joined: Monday 07 December 2015 9:30
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.1
- Location: Gouda
- Contact:
Re: Introducing dzVents - Domoticz Lua file based event scripting made e-z!
Wouldn't it be possible to set/change the debug level using a (selector)switch?
-
- Posts: 16
- Joined: Tuesday 04 November 2014 10:01
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Introducing dzVents - Domoticz Lua file based event scripting made e-z!
Hi!
Trying to switch on groups with dzvents but don't get it to work...
Shouldn't this work:
domoticz.switchGroups('Innelampor Basement', 'On')
Please advice
/Rickard
Trying to switch on groups with dzvents but don't get it to work...
Shouldn't this work:
domoticz.switchGroups('Innelampor Basement', 'On')
Please advice
/Rickard
Last edited by gus on Saturday 10 December 2016 14:30, edited 2 times in total.
-
- Posts: 142
- Joined: Friday 31 July 2015 21:02
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Sint-Oedenrode, Netherlands
- Contact:
Re: Introducing dzVents - Domoticz Lua file based event scripting made e-z!
You should usegus wrote:Hi!
Trying to switch on groups with dzvents but don't get it to work...
Shouldn't this work:
domoticz.groups['Innelampor Basement'].switchOn()
Please advice
/Rickard
Code: Select all
domoticz.switchGroup('Innelampor Basement', 'On')
Mark: Domoticz Beta on Raspberry Pi 4 running Debian Bookworm - Z-Stick 7 - RFXCom - P1 - MySensors - SolarEdge - Dahua - Philips Hue - Docker - Zigbee2mqtt (plugin) - Zwave-js-ui - dzVents - Nodered
Who is online
Users browsing this forum: No registered users and 1 guest