You can do everything with it. If you using dzVents system then its wonderfull.
Here example of 1 of many scene/scripts i using:
Scene Evening Lua
Code: Select all
local Version = '18.06.16'
local results
return {
active = true,
on = {
timer = {'at nighttime'},
devices = {[iPhonePeter] = { 'at nighttime'},
[iPhoneKay] = { 'at nighttime'},
[LogitechOff] = { 'at nighttime'},
[SceneSexy] = { 'at nighttime'},
},
},
-- logging = {marker = 'EVENING Scene ' ..Version..'..........'},
execute = function(domoticz, device)
if (not domoticz.devices(SceneEvening).active
and domoticz.devices(LogitechOff).active
and not domoticz.devices(SceneSexy).active
and not domoticz.devices(SceneGoodnight).active
and (domoticz.devices(iPhonePeter).active or domoticz.devices(iPhoneKay).active))
then
domoticz.variables(VarGoodNight).set(0)
domoticz.helpers.TurnOnScene(domoticz,SceneEvening)
domoticz.helpers.TurnOffScene(domoticz,SceneDayTime)
domoticz.helpers.TurnOffScene(domoticz,SceneTV)
domoticz.helpers.TurnOffScene(domoticz,SceneMovie)
domoticz.helpers.TurnOffScene(domoticz,SceneAppleTV)
domoticz.helpers.TurnOffScene(domoticz,SceneSexy)
domoticz.helpers.TurnOffScene(domoticz,SceneMorning)
domoticz.helpers.TurnOffScene(domoticz,SceneGoodnight)
domoticz.helpers.RGB(domoticz,BulbWallRight,nil,nil,nil)
domoticz.helpers.RGB(domoticz,BulbWallLeft,nil,nil,nil)
domoticz.helpers.RGB(domoticz,BulbWindowLeft,nil,nil,nil)
domoticz.helpers.RGB(domoticz,BulbWindowRight,nil,nil,nil)
domoticz.helpers.Disco(domoticz,BulbBalcony,nil,nil,nil)
domoticz.helpers.Effect(domoticz,NanoLeaf,40,nil)
if (domoticz.devices(SensorDiningRoomDoor).active) then
domoticz.helpers.Off(domoticz,BulbDressoir,nil,nil,nil)
if (domoticz.devices(SwitchKayLearn).active) then
domoticz.helpers.TurnOn(domoticz,SwitchDiningroom,50,nil)
elseif (not domoticz.devices(SwitchKayLearn).active) then
domoticz.helpers.Off(domoticz,SwitchDiningroom,nil,nil)
end
elseif (not domoticz.devices(SensorDiningRoomDoor).active) then
domoticz.helpers.Kelvin(domoticz,BulbDressoir,nil,nil,nil)
if (domoticz.devices(SwitchKayLearn).active) then
domoticz.helpers.TurnOn(domoticz,SwitchDiningroom,nil,nil)
elseif (not domoticz.devices(SwitchKayLearn).active) then
domoticz.helpers.TurnOn(domoticz,SwitchDiningroom,40,nil)
end
end
os.execute('/home/pi/domoticz/scripts/Peter/speech.sh "The scene evening is activated"&')
-- domoticz.log('------------------------==<[ Scene Evening ]>==-----------------', domoticz.LOG_FORCE)
end
end
}
global_data.lua
Code: Select all
-- VERSION 18.06.11
-- RGB (domoticz,idx,dim,color,sec) (domoticz,idx,100,'white',0)
-- Kelvin (domoticz,idx,dim,kelvin,sec) (domoticz,idx,100,5000,0)
-- Disco (domoticz,idx,dim,disco,sec) (domoticz,idx,100,6,0)
-- TurnOn (domoticz,idx,dim,sec) (domoticz,idx,100,0)
-- TurnOff (domoticz,idx,dim,sec) (domoticz,idx,5,1)
-- TurnOnScene (domoticz,idx)
-- TurnOffScene (domoticz,idx)
-- Effect (domoticz,idx,level,sec) (domoticz,idx,30,0)
BulbMasterBedroom = 441
BulbDressoir = 442
BulbBalcony = 443
BulbHall = 444
BulbWallRight = 435
BulbWallLeft = 436
BulbWindowLeft = 437
BulbWindowRight = 438
BulbBathroomSink = 423
BulbShower = 424
BulbKitchen = 425
BulbKitchenSink = 426
BulbSKMiddleLeft = 430
BulbSKmiddleRight = 431
LogitechOff = 26
LogitechAppleTV = 27
LogitechTV = 28
LogitechKodi = 30
iPhonePeter = 414
iPhoneKay = 415
SwitchKayLearn = 35
SceneDayTime = 36
SceneEvening = 37
SceneTV = 38
SceneMovie = 39
SceneAppleTV = 40
SceneSexy = 41
SceneMorning = 42
SceneGoodnight = 43
LuxDiv = 392
OutsideTemp = 394
SwitchBalcony = 59
SwitchDressoir = 60
SwitchWall = 61
SwitchWindows = 62
SwitchHall = 471 --63
SwitchToilet = 64
SwitchKitchen = 65
SwitchKitchenSink = 66
SwitchCooker = 249
SwitchDiningroom = 70
SwitchBedroom = 71
SensorMasterBedroom = 73
SwitchBathroom = 74
SwitchLowLights = 420
SwitchEarlySleep = 421
SensorMasterBedroomDoor = 75
SensorDiningDoor = 76
SensorKitchen = 77
SensorDiningRoomDoor = 76
SensorHall = 469
Nest = 81
-- Nest = 455 Nest OAUTH
KodiStatus = 99
VarLowLux = 3
VarSKdiscoSleep = 4
VarKodiStop = 5
VarKodiPlay = 6
VarGoodNight = 7
TEST = 193
NanoLeaf = 232
DiscoSleep = 245
MeekPresenceHall = 467
local COLORS = {
['White'] = {255, 225, 255},
['Blue'] = {12, 0, 179},
['Green'] = {150,255,142},
['Romantic'] = {128,0,0}
}
return {
helpers = {
RGB = function(domoticz,idx,dim,color,sec)
if (dim == nil) then dim = 100 end
if (color == nil) then rgb = COLORS['White'] else rgb = COLORS[color] end
if (sec == nil) then sec = 0 end
domoticz.devices(idx).setRGB(rgb[1], rgb[2], rgb[3]).afterSec(sec)
domoticz.devices(idx).dimTo(dim).afterSec(sec)
status = 'aangezet'
movement = 'beweging gedecteerd'
end,
Kelvin = function(domoticz,idx,dim,kelvin,sec)
if (dim == nil) then dim = 100 end
if (kelvin == nil) then kelvin = 4000 end
if (sec == nil) then sec = 0 end
domoticz.devices(idx).setKelvin(kelvin).afterSec(sec)
domoticz.devices(idx).dimTo(dim).afterSec(sec)
status = 'aangezet'
movement = 'beweging gedecteerd'
end,
Disco = function(domoticz,idx,dim,disco,sec)
if (dim == nil) then dim = 100 end
if (disco == nil) then disco = 1 end
if (sec == nil) then sec = 0 end
domoticz.devices(idx).setDiscoMode(disco).afterSec(sec)
domoticz.devices(idx).dimTo(dim).afterSec(sec)
status = 'aangezet'
end,
Effect = function(domoticz,idx,level,sec)
if (level == nil) then level = 0 end
if (sec == nil) then sec = 0 end
domoticz.devices(idx).switchSelector(level).afterSec(sec)
end,
TurnOn = function(domoticz,idx,dim,sec)
if (dim == nil) then dim = 99 end
if (sec == nil) then sec = 0 end
domoticz.devices(idx).dimTo(dim).afterSec(sec)
status = 'aangezet'
movement = 'beweging gedecteerd'
end,
TurnOff = function(domoticz,idx,dim,sec)
if (dim == nil) then dim = 5 end
if (sec == nil) then sec = 1 end
domoticz.devices(idx).dimTo(dim)
domoticz.devices(idx).switchOff().afterSec(sec)
status = 'uitgezet'
movement = 'geen beweging gedecteerd'
end,
TurnOnScene = function(domoticz,idx)
domoticz.devices(idx).switchOn().checkFirst()
status = 'aangezet'
end,
TurnOffScene = function(domoticz,idx)
domoticz.devices(idx).switchOff().checkFirst()
status = 'uitgezet'
movement = 'geen beweging gedecteerd'
end,
On = function(domoticz,idx)
domoticz.devices(idx).switchOn().checkFirst()
status = 'aangezet'
end,
Off = function(domoticz,idx)
domoticz.devices(idx).switchOff().checkFirst()
status = 'uitgezet'
end
}
}