Morning light idea

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

Moderator: leecollings

Post Reply
poudenes
Posts: 667
Joined: Wednesday 08 March 2017 9:42
Target OS: Linux
Domoticz version: 3.8993
Location: Amsterdam
Contact:

Morning light idea

Post by poudenes »

Hello all,

I want make a morning wakeup light idea of my bulbs in sealing in bedroom. Have this now but is there a way to make it much easier?

a loop code so i have 1 line and the dimTo() and afterSec() will count from 1 sec to 120 for example. Instead add everyone for every second?

Code: Select all

local Version               = '18.01.23'
local FullManualModus	    = 69
local SwitchDaytime		    = 60
local SwitchGoodnight	    = 65
local SwitchMorning		    = 64
local SwitchSexy 		    = 63
local SwitchMovie		    = 62
local SwitchTV		        = 61
local SwitchEvening		    = 59
local MasterBedroom		    = 7

return {
    active = true,
    on = {
        devices = {SwitchMorning},
    },
    logging = {marker = 'SCENE MORNING ' .. Version..'..........'},
    execute = function(domoticz, device)

    if
    domoticz.devices(SwitchMorning).state == 'On' 
    then        
        domoticz.devices(MasterBedroom).dimTo(5)
        domoticz.devices(MasterBedroom).setKelvin(5000)
        domoticz.devices(MasterBedroom).dimTo(6).afterSec(6)
        domoticz.devices(MasterBedroom).dimTo(7).afterSec(7)
        domoticz.devices(MasterBedroom).dimTo(8).afterSec(8)
        domoticz.devices(MasterBedroom).dimTo(9).afterSec(9)
        domoticz.devices(MasterBedroom).dimTo(10).afterSec(10)
        domoticz.devices(MasterBedroom).dimTo(11).afterSec(11)
        domoticz.devices(MasterBedroom).dimTo(12).afterSec(12)
        domoticz.devices(MasterBedroom).dimTo(13).afterSec(13)
        domoticz.devices(MasterBedroom).dimTo(14).afterSec(14)
        domoticz.devices(MasterBedroom).dimTo(15).afterSec(15)
        domoticz.devices(MasterBedroom).dimTo(16).afterSec(16)
        domoticz.devices(MasterBedroom).dimTo(17).afterSec(17)
        domoticz.devices(MasterBedroom).dimTo(18).afterSec(18)
        domoticz.devices(MasterBedroom).dimTo(19).afterSec(19)
        domoticz.devices(MasterBedroom).dimTo(20).afterSec(20)
        domoticz.log('---------------------------------------------------------------------', domoticz.LOG_FORCE)
        domoticz.log('--------------------==<[ SCENE MORNING IS ON ]>==--------------------', domoticz.LOG_FORCE)
        domoticz.log('---------------------------------------------------------------------', domoticz.LOG_FORCE)
        os.execute('/home/pi/domoticz/scripts/Peter/speech.sh "The scene morning is activated"&')
    end
end
}
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: Morning light idea

Post by dannybloe »

Code: Select all

local Version               = '18.01.23'
local FullManualModus	    = 69
local SwitchDaytime		    = 60
local SwitchGoodnight	    = 65
local SwitchMorning		    = 64
local SwitchSexy 		    = 63
local SwitchMovie		    = 62
local SwitchTV		        = 61
local SwitchEvening		    = 59
local MasterBedroom		    = 7

return {
	on = {
		devices = {SwitchMorning},
	},
	logging = {marker = 'SCENE MORNING ' .. Version..'..........'},
	execute = function(domoticz, device)
		local light = domoticz.devices(MasterBedroom)
		if  (device.active)  then
			light.dimTo(5)
			light.setKelvin(5000)
			for i = 6,20 do
				light.dimTo(i).afterSec(i)
			end

			domoticz.log('---------------------------------------------------------------------', domoticz.LOG_FORCE)
			domoticz.log('--------------------==<[ SCENE MORNING IS ON ]>==--------------------', domoticz.LOG_FORCE)
			domoticz.log('---------------------------------------------------------------------', domoticz.LOG_FORCE)
			os.execute('/home/pi/domoticz/scripts/Peter/speech.sh "The scene morning is activated"&')
		end
	end
}
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
poudenes
Posts: 667
Joined: Wednesday 08 March 2017 9:42
Target OS: Linux
Domoticz version: 3.8993
Location: Amsterdam
Contact:

Re: Morning light idea

Post by poudenes »

Mijn dank is groot !!
dannybloe wrote: Wednesday 24 January 2018 16:25

Code: Select all

local Version               = '18.01.23'
local FullManualModus	    = 69
local SwitchDaytime		    = 60
local SwitchGoodnight	    = 65
local SwitchMorning		    = 64
local SwitchSexy 		    = 63
local SwitchMovie		    = 62
local SwitchTV		        = 61
local SwitchEvening		    = 59
local MasterBedroom		    = 7

return {
	on = {
		devices = {SwitchMorning},
	},
	logging = {marker = 'SCENE MORNING ' .. Version..'..........'},
	execute = function(domoticz, device)
		local light = domoticz.devices(MasterBedroom)
		if  (device.active)  then
			light.dimTo(5)
			light.setKelvin(5000)
			for i = 6,20 do
				light.dimTo(i).afterSec(i)
			end

			domoticz.log('---------------------------------------------------------------------', domoticz.LOG_FORCE)
			domoticz.log('--------------------==<[ SCENE MORNING IS ON ]>==--------------------', domoticz.LOG_FORCE)
			domoticz.log('---------------------------------------------------------------------', domoticz.LOG_FORCE)
			os.execute('/home/pi/domoticz/scripts/Peter/speech.sh "The scene morning is activated"&')
		end
	end
}
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest