Easy to use, 100% Lua-based event scripting framework.
Moderator: leecollings
HvdW
Posts: 593 Joined: Sunday 01 November 2015 22:45
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Location: Twente
Contact:
Post
by HvdW » Tuesday 14 May 2019 1:40
Hi,
In my script timer is set to 'every 10 minutes'
The log tells me that that is understood.
How come the script is executed every 45 seconds?
Code: Select all
2019-05-14 01:30:00.425 Status: dzVents: Info: ------ Start internal script: Verwarming:, trigger: every 10 minutes
2019-05-14 01:30:00.444 Status: dzVents: Info: Average: 20.60000038147
2019-05-14 01:30:00.444 Status: dzVents: Info: Setpoint: 14.2
2019-05-14 01:30:00.445 Status: dzVents: Info: Current boiler state: Off
2019-05-14 01:30:00.445 Status: dzVents: Info: Switch-on temperature: 13.7
2019-05-14 01:30:00.445 Status: dzVents: Info: ------ Finished Verwarming
2019-05-14 01:30:09.327 Status: Incoming connection from: 192.168.2.7
2019-05-14 01:30:34.749 Status: dzVents: Info: Handling events for: "Kamer-temp", value: "20.6;48;1"
2019-05-14 01:30:34.749 Status: dzVents: Info: ------ Start internal script: Verwarming: Device: "Kamer-temp (RFXtfx)", Index: 3
2019-05-14 01:30:34.752 Status: dzVents: Info: Average: 20.60000038147
2019-05-14 01:30:34.752 Status: dzVents: Info: Setpoint: 14.2
2019-05-14 01:30:34.752 Status: dzVents: Info: Current boiler state: Off
2019-05-14 01:30:34.752 Status: dzVents: Info: Switch-on temperature: 13.7
2019-05-14 01:30:34.753 Status: dzVents: Info: ------ Finished Verwarming
2019-05-14 01:31:19.858 Status: dzVents: Info: Handling events for: "Kamer-temp", value: "20.6;48;1"
2019-05-14 01:31:19.858 Status: dzVents: Info: ------ Start internal script: Verwarming: Device: "Kamer-temp (RFXtfx)", Index: 3
2019-05-14 01:31:19.861 Status: dzVents: Info: Average: 20.60000038147
2019-05-14 01:31:19.861 Status: dzVents: Info: Setpoint: 14.2
2019-05-14 01:31:19.861 Status: dzVents: Info: Current boiler state: Off
2019-05-14 01:31:19.861 Status: dzVents: Info: Switch-on temperature: 13.7
2019-05-14 01:31:19.861 Status: dzVents: Info: ------ Finished Verwarming
2019-05-14 01:32:04.754 Status: dzVents: Info: Handling events for: "Kamer-temp", value: "20.6;48;1"
2019-05-14 01:32:04.754 Status: dzVents: Info: ------ Start internal script: Verwarming: Device: "Kamer-temp (RFXtfx)", Index: 3
2019-05-14 01:32:04.757 Status: dzVents: Info: Average: 20.60000038147
2019-05-14 01:32:04.757 Status: dzVents: Info: Setpoint: 14.2
2019-05-14 01:32:04.757 Status: dzVents: Info: Current boiler state: Off
2019-05-14 01:32:04.757 Status: dzVents: Info: Switch-on temperature: 13.7
2019-05-14 01:32:04.758 Status: dzVents: Info: ------ Finished Verwarming
2019-05-14 01:32:49.707 Status: dzVents: Info: Handling events for: "Kamer-temp", value: "20.6;48;1"
2019-05-14 01:32:49.707 Status: dzVents: Info: ------ Start internal script: Verwarming: Device: "Kamer-temp (RFXtfx)", Index: 3
2019-05-14 01:32:49.709 Status: dzVents: Info: Average: 20.60000038147
2019-05-14 01:32:49.709 Status: dzVents: Info: Setpoint: 14.2
2019-05-14 01:32:49.710 Status: dzVents: Info: Current boiler state: Off
2019-05-14 01:32:49.710 Status: dzVents: Info: Switch-on temperature: 13.7
2019-05-14 01:32:49.710 Status: dzVents: Info: ------ Finished Verwarming
It is the script from
this thread .
Bugs bug me.
waaren
Posts: 6028 Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:
Post
by waaren » Tuesday 14 May 2019 7:19
HvdW wrote: ↑ Tuesday 14 May 2019 1:40
In my script timer is set to 'every 10 minutes'
How come the script is executed every 45 seconds?
Code: Select all
01:30:00 trigger: every 10 minutes
01:30:34 Device: "Kamer-temp (RFXtfx)"
14 01:31 Device: "Kamer-temp (RFXtfx)"
14 01:32 Device: "Kamer-temp (RFXtfx)"
01:32:49 Device: "Kamer-temp (RFXtfx)"
If you look at these lines, you see that the script starts at 01:30:00, triggered by the set timer of 'every 10 minutes'
The other starts are triggered by the device 'KLamer-temp (RFXtfx)' as requested in the 'device =' section.
Code: Select all
local TEMPERATURE_SENSOR = 'Kamer-temp (RFXtfx)' -- or (3)
devices = { TEMPERATURE_SENSOR,}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>>
dzVents wiki
HvdW
Posts: 593 Joined: Sunday 01 November 2015 22:45
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Location: Twente
Contact:
Post
by HvdW » Wednesday 15 May 2019 10:39
Hi,
There was an answer here that the author deleted.
Anyway, he was right.
The script is activated by the incoming connection from the thermometer that is plotting every 45 seconds.
Two ways to resolve this:
- Include a wait/sleep/pause into the script
- Change the plotting time from the sensor either in Domoticz or in RFXtfx
Both options are something that I don't know how to achieve.
I would be gratefull for solutions.
Bugs bug me.
waaren
Posts: 6028 Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:
Post
by waaren » Wednesday 15 May 2019 12:19
HvdW wrote: ↑ Wednesday 15 May 2019 10:39
I would be gratefull for solutions.
The way the script works depends on the value from the thermometer coming in and there is no harm that it executes every couple of seconds. That's just how the event system in domoticz works.
Anyway introducing a sleep in an event script is in general a bad idea because it will block the complete event system for the duration of that sleep. (event system is single threaded)
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>>
dzVents wiki
gajotnt
Posts: 70 Joined: Monday 06 February 2017 12:48
Target OS: Raspberry Pi / ODroid
Domoticz version: V4.9700
Location: Azores
Contact:
Post
by gajotnt » Wednesday 15 May 2019 15:33
Dzvents code to turn on every hour
Code: Select all
return {
on = { timer = {"every hour"} },
execute = function(domoticz, _)
local myDevice = domoticz.devices("Fonte")
myDevice.switchOn()
end
}
Lua code (Trigger Device) to turn off after 120seconds
Code: Select all
commandArray = {}
if (devicechanged['Fonte'] == 'On') then
commandArray['Fonte']='Off AFTER 120'
end
return commandArray
FONTE is the name of the device i want to turn on every hour and just run for 2 minutes.
Hope this helps
Users browsing this forum: No registered users and 1 guest