Sunny morning Topic is solved

Moderator: leecollings

Post Reply
User avatar
Varazir
Posts: 451
Joined: Friday 20 February 2015 22:23
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

Sunny morning

Post by Varazir »

Hello

I can't get this to work.

Image

Any idea why ?
Raspberry PI 2 with RaZberry Controller 2016 ZWave+ and CC2531(zigbee)
Several IKEA devices/z-wave devices
User avatar
boum
Posts: 135
Joined: Friday 18 January 2019 11:31
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Location: France
Contact:

Re: Sunny morning

Post by boum »

Maybe because nested if blocks don't work in domoticz interpretation of blockly?
User avatar
Varazir
Posts: 451
Joined: Friday 20 February 2015 22:23
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

Re: Sunny morning

Post by Varazir »

I solved it by using dzVents

Code: Select all

return {
	on = {
		timer = {
			'at 06:00 on mon, tue, wed, thu, fri',  -- specific time
			'at 08:30 on sat, sun',					-- specific time
		},
	logging =   { 
        level  = domoticz.LOG_MODULE_EXEC_INFO, 
        marker = "Sovrum" 
                },
	},
	execute = function(dz, timer)
	    local function logWrite(str,level)
            dz.log(tostring(str),level or dz.LOG_MODULE_EXEC_INFO)
        end
        
        -- Devices 
	    local cloudcover = dz.devices(92).percentage
	    local blinder = dz.devices(59)
	    
	    logWrite('10............... Cloudcover ' .. cloudcover )
		
	    if cloudcover > 50 then
		    logWrite('20................It is cloudy outside')
		    blinder.setLevel(30)
	    else 
	        logWrite('30................It is sunny outside')
	        blinder.close()
		end 
	end
}
Raspberry PI 2 with RaZberry Controller 2016 ZWave+ and CC2531(zigbee)
Several IKEA devices/z-wave devices
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest