.afterSec(xx) not working? :(

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

Moderator: leecollings

Post Reply
BarryT
Posts: 358
Joined: Tuesday 31 March 2015 22:06
Target OS: Linux
Domoticz version: 2024.3
Location: east netherlands
Contact:

.afterSec(xx) not working? :(

Post by BarryT »

hi all,

can somebody help me out why my delay does not work?
i'm trying to make a heating script with zones, a buffertank with pump and an weather temperature based heatpump with an on/off input.
the rest of the scripts works (with thermostats, heatcommand to heatpump and opening the valves,
but i want to have my tankpump to have a delay of 3 minutes before it goes ON due opening of the valves that takes some minutes before they are open...

This code

Code: Select all

local heating if hp.heater ~= nil then heating = dz.devices(hp.heater) end 
works correctly but does not have any delay. when one of the valves has turned ON the pump is also going ON directly.

The next code does NOT work :(

Code: Select all

local Delay = 30
local heating if hp.heater ~= nil then heating = dz.devices(t.heater).afterSec(Delay) end
I was hoping this would do the trick, but then i'm getting an error:

Code: Select all

 attempt to call a nil value (field 'afterSec')
Why does this delay not work?

Many thanks!
Raspberry / ESP Boards / Relais / Milight / Hue / OTGW / P1 / Xiaomi / RFXCom / RFLink / ZWave / Conbee II / Z2M / MQTT / A lot of scripts and many more..
Software: Linux, Android and Windows
Fredom
Posts: 140
Joined: Saturday 19 September 2020 21:02
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Location: Krimpen aan den IJssel
Contact:

Re: .afterSec(xx) not working? :(

Post by Fredom »

BarryT wrote: Friday 22 November 2024 21:35 hi all,

can somebody help me out why my delay does not work?
i'm trying to make a heating script with zones, a buffertank with pump and an weather temperature based heatpump with an on/off input.
the rest of the scripts works (with thermostats, heatcommand to heatpump and opening the valves,
but i want to have my tankpump to have a delay of 3 minutes before it goes ON due opening of the valves that takes some minutes before they are open...

This code

Code: Select all

local heating if hp.heater ~= nil then heating = dz.devices(hp.heater) end 
works correctly but does not have any delay. when one of the valves has turned ON the pump is also going ON directly.

The next code does NOT work :(

Code: Select all

local Delay = 30
local heating if hp.heater ~= nil then heating = dz.devices(t.heater).afterSec(Delay) end
I was hoping this would do the trick, but then i'm getting an error:

Code: Select all

 attempt to call a nil value (field 'afterSec')
Why does this delay not work?

Many thanks!
Hi
I use

Code: Select all

local Delay = 30
local heating if hp.heater ~= nil then heating = dz.devices(t.heater).switchOff().afterSec(Delay) end
Yours sincerely,
Fred

Rasberry Pi 3B+ - Debian Buster - Domoticz 2022.2
RFLink - RFXCom - Zigbee (CC2531)
P1 Smart Meter - KaKu
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: .afterSec(xx) not working? :(

Post by waltervl »

AfterSec() is a command option so should be used in combination with a supported command like .switchOn() .switchOff() etc

In the wiki there is a general availability table https://wiki.domoticz.com/DzVents:_next ... ailability

Also per device command it is noted in the wiki if it supports by command options.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
BarryT
Posts: 358
Joined: Tuesday 31 March 2015 22:06
Target OS: Linux
Domoticz version: 2024.3
Location: east netherlands
Contact:

Re: .afterSec(xx) not working? :(

Post by BarryT »

waltervl wrote: Friday 22 November 2024 22:43 AfterSec() is a command option so should be used in combination with a supported command like .switchOn() .switchOff() etc

In the wiki there is a general availability table https://wiki.domoticz.com/DzVents:_next ... ailability

Also per device command it is noted in the wiki if it supports by command options.
Ahh i see, so thats why it doesnt work..
Any idea to get it working?
Thanks!
Raspberry / ESP Boards / Relais / Milight / Hue / OTGW / P1 / Xiaomi / RFXCom / RFLink / ZWave / Conbee II / Z2M / MQTT / A lot of scripts and many more..
Software: Linux, Android and Windows
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: .afterSec(xx) not working? :(

Post by waltervl »

Use something like
domoticz.devices('tankpump').switchOn().afterMin(3)
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest