Page 1 of 1

Timer switch error 32256

Posted: Saturday 31 October 2020 20:49
by Dutchsea
I created a simple script to deactivate a device after x amount of time after it has beentriggered in the domoticz dashboard.
(script is called via the "On action:" in the "Edit" page of the device).

Its purpose is to deactivate a heater in my bathroom after it has been activated via the Domoticz dashboard. Not sure if the script is a good method to deactivate the device. Maybe there is a better way but this is what I could think of.......

The script works but when it is activated it generates an error 32256. This seems to be an ownership issue but this script has the same ownerships as my other dzVents scripts and those do not generate this error.

Script:

Code: Select all

-- [ dzVents >= 2.4 ]
-- dzVents Timer: set device to off after x minutes after on
-- script://dzVents/scripts/timer01-on.lua

return { 

--- Script active yes/no
    active = {
    	true,
    },

--- Trigger device

    on = {
    	devices = {
	'Kachel badkamer' -- Device to be turned off after x minutes
    	},
    },	

--- Custom logging for script

    logging = { 
    	level = domoticz.LOG_DEBUG,
	marker = "Timer01-on"
    },

--- Execute functions
    execute = function(domoticz, item)
    	    domoticz.devices('Kachel badkamer').switchOff().afterMin(2) -- change x in .afterMin(x) to number of minutes required
    end
}
What can cause this error?

Next question; even when the device 'Kachel badkamer' is not activated, every minute there are entries in the log. So for some reason each minute this scripts is activated. Is this expected behaviour?
Log

Code: Select all

2020-10-31 20:42:16.616 Status: dzVents: Info: Handling events for: "Kachel badkamer", value: "Off"
2020-10-31 20:42:16.616 Status: dzVents: Info: Timer01-on: ------ Start external script: timer01-on.lua: Device: "Kachel badkamer (Aeon Z-stick 5Gen)", Index: 3
2020-10-31 20:42:16.616 Status: dzVents: Debug: Timer01-on: Constructed timed-command: Off
2020-10-31 20:42:16.616 Status: dzVents: Debug: Timer01-on: Constructed timed-command: Off AFTER 120 SECONDS
2020-10-31 20:42:16.616 Status: dzVents: Info: Timer01-on: ------ Finished timer01-on.lua
2020-10-31 20:42:16.617 Status: EventSystem: Script event triggered: /home/pi/domoticz/dzVents/runtime/dzVents.lua
Thanks

Re: Timer switch error 32256  [Solved]

Posted: Saturday 31 October 2020 21:08
by waaren
Dutchsea wrote: Saturday 31 October 2020 20:49 I created a simple script to deactivate a device after x amount of time after it has been triggered in the domoticz dashboard.
(script is called via the "On action:" in the "Edit" page of the device).
Lua / dzVents scripts should not be called via the action fields of a device. This is to be used for external (OS type of) scripts.

The action you are looking for can be done without any script. Just set the off delay in the edit screen of the device. (from the switches tab)

Re: Timer switch error 32256

Posted: Saturday 31 October 2020 21:20
by Dutchsea
Lua / dzVents scripts should not be called via the action fields of a device. This is to be used for external (OS type of) scripts.
=> clear
The action you are looking for can be done without any script. Just set the off delay in the edit screen of the device. (from the switches tab)
OK, i will do that. (I understood these parameters to control the amount of delay in seconds before turning on the device after it has been triggered to go on - and same delay when device is triggered to go off.)

SOLVED Timer switch error 32256

Posted: Saturday 31 October 2020 23:01
by Dutchsea
And works. Thank you