Page 1 of 1

Sending 10 On / Off commands in Blockly

Posted: Monday 21 February 2022 17:52
by PWsweden
Hi,

I have a simple Blockly script that turns on / off a few switches at sunrise / sundown etc. It works perfectly on all switches except two Aeotec switches (v7). Regardless of me moving the R-pi and the Aeotec gen5 stick within 3 meters and having free line of sight, it refuses to work properly. Blockly runs fine, Domoticz says the switch is turned off or on - but if it was on and supposed to be turned off, it is still on (and vice versa) if I look at the lamp. If I manually click turn on / off from the control panel it works (all the time). And 1/10 it works from Blockly too (which is infuriating). Classic Z-wave issue, as I have gathered.

Since I have tried all I can do, such as moving the Pi closer, upgrading Domoticz to the latest, taking another plug and setting it close to all of them etc, I am now looking to create some sort of work-around in Blockly, where I can spam the switch with 10 on or offs (and hope one sticks), regardless of the state Domoticz thinks it is in. An ugly hack for sure, but I'm all out of other ideas. As long as it works I'm happy.

Any one have a suggestion on how to achieve this?

IF Virtual Switch Daytime = Off AND Lamp = Off AND Time > 05:00
SET Lamp ON [ send command 10 times ???]

Many thanks.

Re: Sending 10 On / Off commands in Blockly

Posted: Wednesday 23 February 2022 23:31
by BennY
Don't know how to do this, as simple as possible, in Blockly. In DzVents this one schould do what you want:

Code: Select all

return {
	on = {
		devices = {
			'Your Trigger Device',
		}
	},
	execute = function(domoticz, device)
	    local Time = domoticz.devices('Your Trigger Device')
	    local BL1 = domoticz.devices('Your Device to Trigger')
	    
	    if  Time.active then
		        BL1.switchOn()
		    
		        for i = 1,9 do
				    BL1.switchOn().afterSec(i)
			    end
			    
	    end
        
	end
}
First you should try to fix your Z-Wave Network. Disable "Nightly Heal", disable "polling", enable "Perform Return Routes", Refresh Node Information, Heal your Network.
For me healing works best when I heal all Main Powered Nodes first, second all Routing Slaves (First Main powered as Plugs, then Thermostat, etc), then all Battery Nodes.
Don't repeat the "Heal Node" to fast, it do need some time for every node. Be sure you Wake-Up the Battery Nodes after you click "Heal Node".

Benny