Domoticz-deCONZ icon indicating copy to clipboard operation
Domoticz-deCONZ copied to clipboard

Add setting for HeartBeat ?

Open Smanar opened this issue 4 years ago • 0 comments

Need some test to check if this feature is usefull or not

Here a script that need it

return {
	on = {
		devices = {
			'Conbee dongle - Livingroom Switch'
		}
	},
	execute = function(domoticz, device)
		local dimDevice = domoticz.devices('Bedroom Ceiling Light');
		local dimLevel = dimDevice.level;
		local delay = 0
		
		if device.state == "hold"  then
			repeat
				delay = delay + 0.15
				dimLevel = dimLevel - 10
				domoticz.log('Set ' .. dimDevice.name .. ' to dimLevel '.. dimLevel .. '%, after ' .. delay .. ' seconds', domoticz.LOG_INFO)
				dimDevice.dimTo(dimLevel).afterSec(delay)
			until dimLevel <= 0
		elseif device.state == "Off" then
			domoticz.log('Stop dimming of ' .. dimDevice.name, domoticz.LOG_INFO)
			dimDevice.cancelQueuedCommands()
			if dimDevice.level == 0 then
				dimDevice.switchOff()
			end
		end  
		domoticz.log('dimLevel ' .. dimLevel, domoticz.LOG_INFO)
		domoticz.log('Device ' .. device.name .. ' was changed', domoticz.LOG_INFO)
	end

We have the problem with Aquara single Gang

@markiboy2all

This device is not made for that, just by curiosity, waht happen if you use long press during 15s ? It will reset the device ? I can't trigger the "hold"on my devices (IDK why, however I have the 2 versions), you need to press for more than 3s ? and you will have only 1 websocket return ?

Because I m trying to understand how work your script. If the heartbeat is set a 1s.

You hold the button
You have the "hold" event
1 s after the code set the device to false using heartbeat
and after ....

Deconz will not send again the "hold" event ? So the device state will be to "off" event you are keeping the pression nope ?

Smanar avatar Jun 24 '20 15:06 Smanar