Simply DzVent Stuck on loop

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

Moderator: leecollings

Post Reply
dawsmac
Posts: 7
Joined: Tuesday 22 December 2015 15:08
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Simply DzVent Stuck on loop

Post 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
}

dawsmac
Posts: 7
Joined: Tuesday 22 December 2015 15:08
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Simply DzVent Stuck on loop

Post 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
}

}
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest