Script run but no command are executed

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

Moderator: leecollings

Post Reply
User avatar
emme
Posts: 909
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Milano, Italy
Contact:

Script run but no command are executed

Post by emme »

Ciao,

DOmoticz 4.10547....
Got a wired issue with dzVents....
script runs correctly as invoked, but no switchOn and switchOff commands are executed....
no telegram on MQTT for that device....
no error on log, devices can be switched manually....

is anyone having the same issue?
The most dangerous phrase in any language is:
"We always done this way"
SweetPants

Re: Script run but no command are executed

Post by SweetPants »

Can you provide the script part that does the actual switching/notification?
User avatar
emme
Posts: 909
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: Script run but no command are executed

Post by emme »

I think I found....
There were 2 devices with the same name (both temp devices...)

somehow it messed up the entire scripting daemon :P :P
The most dangerous phrase in any language is:
"We always done this way"
User avatar
emme
Posts: 909
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: Script run but no command are executed

Post by emme »

still got the issue.... :( even on old beta.... probably I did not discover it before...

wired situation... for any switch I have a double execution:
2019-03-11 19:14:57.297 Status: User: marco initiated a switch command (1827/Luce_Bagnetto/On)
2019-03-11 19:14:57.537 Status: dzVents: Info: [BAGNETTO Ventola]: ------ Start internal script: dzBagnettoFan: Device: "Luce_Bagnetto (net_ZW_Gen5)", Index: 1827
2019-03-11 19:14:57.541 Status: dzVents: Info: [BAGNETTO Ventola]: T: 23.60000038147°C - H: 30%
2019-03-11 19:14:57.543 Status: dzVents: Info: [BAGNETTO Ventola]: Accensione Luce Bagno ==> Ventola ON/Off
2019-03-11 19:14:57.543 Status: dzVents: Info: [BAGNETTO Ventola]: ------ Finished dzBagnettoFan
2019-03-11 19:14:57.673 Status: dzVents: Info: [BAGNETTO Ventola]: ------ Start internal script: dzBagnettoFan: Device: "Luce_Bagnetto (net_ZW_Gen5)", Index: 1827
2019-03-11 19:14:57.675 Status: dzVents: Info: [BAGNETTO Ventola]: T: 23.60000038147°C - H: 30%
2019-03-11 19:14:57.676 Status: dzVents: Info: [BAGNETTO Ventola]: Accensione Luce Bagno ==> Ventola ON/Off
2019-03-11 19:14:57.676 Status: dzVents: Info: [BAGNETTO Ventola]: ------ Finished dzBagnettoFan
I've pushed on the light switch which is supposed to switch on the fan.... script runs twice... and none of them push on the fan...

here is the script:

Code: Select all

local devTempHum = 'TEM_Bagnetto'
local devLuce    = 'Luce_Bagnetto'
local varHMax    = 'bagnettoHumMax'
local varHMin    = 'bagnettoHumMin'
local devFan     = 'Ventola_Bagnetto'


return {
	on = {
		devices = {	devTempHum, devLuce }
	},

    logging = {
        level = domoticz.LOG_INFO,
        marker = "[BAGNETTO Ventola]"
    },

	execute = function(dz, devName)
		local humMax = tonumber(dz.variables(varHMax).value )
		local humMin = tonumber(dz.variables(varHMin).value )
		dz.log('T: '..dz.devices(devTempHum).temperature..'°C - H: '..dz.devices(devTempHum).humidity..'%')
		
		if devName.name == devLuce and devName.state == 'On' then
		    dz.devices(devFan).switchOn().checkFirst()
		    dz.log('Accensione Luce Bagno ==> Ventola ON/'..dz.devices(devFan).state)
		elseif devName.name == devLuce and devName.state == 'Off' then
		    dz.log('Spegnimento Luce Bagno ==> Valutazione')
            if tonumber(dz.devices(devTempHum).humidity) > humMax then
                dz.log('Umidità ['..dz.devices(devTempHum).humidity..'%] sopra il valore impostato.... accensione')
                dz.devices(devFan).switchOn().checkFirst()
            elseif tonumber(dz.devices(devTempHum).humidity) <= humMin then
                dz.log('Umidità ['..dz.devices(devTempHum).humidity..'%] sotto il valore impostato.... spegnimento')
                dz.devices(devFan).switchOff().checkFirst()
            end 
		elseif devName.name == devTempHum and dz.devices(devLuce).state == 'Off' then
		    dz.log('Variazione T e H ==> Valutazione')
            if tonumber(dz.devices(devTempHum).humidity) > humMax then
                dz.log('Umidità ['..dz.devices(devTempHum).humidity..'%] sopra il valore impostato.... accensione')
                dz.devices(devFan).switchOn().checkFirst()
            elseif tonumber(dz.devices(devTempHum).humidity) <= humMin then
                dz.log('Umidità ['..dz.devices(devTempHum).humidity..'%] sotto il valore impostato.... spegnimento')
                dz.devices(devFan).switchOff().checkFirst()
            end 
		    

		end
		
	end
}
The most dangerous phrase in any language is:
"We always done this way"
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Script run but no command are executed

Post by waaren »

emme wrote: Monday 11 March 2019 19:18 still got the issue.... :( even on old beta.... probably I did not discover it before...
Sometimes Zwave or Xiaomi devices does send the state of a device more than 1 time to domoticz. dzVents cannot prevent this but you could do something with an extra check like

Code: Select all

local devTempHum = 'TEM_Bagnetto'               -- temperature bathroom
local devLuce    = 'Luce_Bagnetto'              -- light
local varHMax    = 'bagnettoHumMax'             -- humidity
local varHMin    = 'bagnettoHumMin'          
local devFan     = 'Ventola_Bagnetto'           -- ventilator bathroom

return {
	on = {
		devices = {	devTempHum, devLuce }
	},

    logging = {
        level = domoticz.LOG_INFO,
        marker = "[BAGNETTO Ventola]"
    },

    data =  { lastupdate = { initial = 0 } },

	execute = function(dz, devName)
		local humMax = tonumber(dz.variables(varHMax).value )
	    local humMin = tonumber(dz.variables(varHMin).value )
		
        dz.log('T: '..dz.devices(devTempHum).temperature..'°C - H: '..dz.devices(devTempHum).humidity..'%')
        dz.log(devName.name .. "; State ==>> " .. devName.state,dz.LOG_INFO)

        if tonumber(dz.data.lastupdate) + 2 >  os.time(os.date('*t')) then -- Too soon
            return
        end
        dz.data.lastupdate = os.time(os.date('*t'))
        
        if devName.name == devLuce and devName.state == 'On' then
		    dz.devices(devFan).switchOn().checkFirst()
		    dz.log('Accensione Luce Bagno ==> Ventola ON/'..dz.devices(devFan).state)
		elseif devName.name == devLuce and devName.state == 'Off' then
		    dz.log('Spegnimento Luce Bagno ==> Valutazione')
            if tonumber(dz.devices(devTempHum).humidity) > humMax then
                dz.log('Umidità ['..dz.devices(devTempHum).humidity..'%] sopra il valore impostato.... accensione')
                dz.devices(devFan).switchOn().checkFirst()
            elseif tonumber(dz.devices(devTempHum).humidity) <= humMin then
                dz.log('Umidità ['..dz.devices(devTempHum).humidity..'%] sotto il valore impostato.... spegnimento')
                dz.devices(devFan).switchOff().checkFirst()
            end 
		elseif devName.name == devTempHum and dz.devices(devLuce).state == 'Off' then
		    dz.log('Variazione T e H ==> Valutazione')
            if tonumber(dz.devices(devTempHum).humidity) > humMax then
                dz.log('Umidità ['..dz.devices(devTempHum).humidity..'%] sopra il valore impostato.... accensione')
                dz.devices(devFan).switchOn().checkFirst()
            elseif tonumber(dz.devices(devTempHum).humidity) <= humMin then
                dz.log('Umidità ['..dz.devices(devTempHum).humidity..'%] sotto il valore impostato.... spegnimento')
                dz.devices(devFan).switchOff().checkFirst()
            end 
		end
		
	end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
emme
Posts: 909
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: Script run but no command are executed

Post by emme »

that's not a gateway problem, switches can be correctly operated manually or via mqtt/http... seems to be a event daemon related issue

even with blocky or LUA switches does not operate...

I tried a worst scenario: reinstall from scratch and copy back the DB (dzvents scripts will come from the internal generated scripts :P)
Today worked... I'll se when I'll get home this evening if it does still works... then I assume it was a core/rights related issue
The most dangerous phrase in any language is:
"We always done this way"
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest