Page 1 of 1

Simply DzVent Stuck on loop

Posted: Wednesday 25 January 2017 0:19
by dawsmac
Hi all,

still trying to get my head around the whole DzVent / Lua scripts I have got the below working but it keeps on send the on stat's or off stat's like it stuck in a loop have i missed something silly out ;/ any help would be great..

Code: Select all


return {
    active = true,
    on = { 
   'UFH Electric',
   'UFH Call'
    },
       
	execute = function(domoticz, device)
    	
    	
    	local ufhe = domoticz.devices['UFH Electric']
    	local ufhc = domoticz.devices['UFH Call']
    	
    	if (ufhe.WActual > 9) 
      		then
      		ufhc.switchOn()
			domoticz.log("UFH is Active", domoticz.LOG_ERROR)  
			-- domoticz.notify('Hey!', 'UFH is Active', domoticz.PRIORITY_LOW)     
    	end
    	if (ufhe.WActual == 0)    	
            then
             ufhc.switchOff()
        	 domoticz.log("UFH is Active.", domoticz.LOG_INFO)
        	 -- domoticz.notify('Hey!', 'UFH is De-active', domoticz.PRIORITY_LOW)
        	end
 end
}


Re: Simply DzVent Stuck on loop

Posted: Wednesday 25 January 2017 23:53
by dawsmac
I have amended the code to include the following this seems to have stopped the loop... not sure if it is the correct way tho :)

Code: Select all


return {
    active = true,
    on = { 
   'UFH Electric',
   'UFH Call'
    },
       
   execute = function(domoticz, device)
       
       
       local ufhe = domoticz.devices['UFH Electric']
       local ufhc = domoticz.devices['UFH Call']
       
       if (ufhe.WActual > 0 and ufhc.state == 'Off') 
            then
            ufhc.switchOn()
         domoticz.log("UFH is Active", domoticz.LOG_ERROR)  
         domoticz.notify('Hey!', 'UFH is Active', domoticz.PRIORITY_LOW)     
       end
       if (ufhe.WActual == 0 and ufhc.state == 'On')       
            then
            ufhc.switchOff()
         domoticz.log("UFH is De-active.", domoticz.LOG_INFO)
         domoticz.notify('Hey!', 'UFH is De-active', domoticz.PRIORITY_LOW)
           end
 end
}

}