I have a friend who is gonna use Domoticz as well. We have global_data for some things.
I can use this code on my RPi without errors:
Code: Select all
on = {
devices = {[SceneGoodNight] = { 'at nighttime' }},
},Table is NIL
My RPI runs with latest Beta Domoticz on Rasbian. His RPi runs same Beta Domoticz on OSMC OS.
global_data
Code: Select all
local Version = '18.04.08'
SceneEvening = 11
SceneGoodNight = 12
SceneMovie = 15
SceneDayTime = 13
LivingRoomStatus = 45
iPhone = 10
KodiStatus = 50
return {
helpers = {
TurnOnScene = function(domoticz,idx)
domoticz.devices(idx).switchOn().checkFirst()
end,
TurnOffScene = function(domoticz,idx)
domoticz.devices(idx).switchOff().checkFirst()
end,
On = function(domoticz,idx,dim)
domoticz.devices(idx).switchOn().checkFirst()
domoticz.devices(idx).dimTo(dim)
end,
Off = function(domoticz,idx)
domoticz.devices(idx).switchOff().checkFirst()
end
}
}Code: Select all
local Version = '18.04.08'
local results
return {
active = true,
on = {
devices = {SceneGoodNight},
},
logging = {marker = 'SCENE GOODNIGHT ' ..Version..'........'},
execute = function(domoticz, device)
if (domoticz.devices(SceneGoodNight).active) then
domoticz.helpers.TurnOffScene(domoticz,SceneEvening)
domoticz.helpers.TurnOffScene(domoticz,SceneDaytime)
domoticz.helpers.TurnOffScene(domoticz,SceneMovie)
domoticz.helpers.Off(domoticz,LivingRoomStatus)
domoticz.log('--------------------==<[ Goodnight is activated ]>==-----------------', domoticz.LOG_FORCE)
os.execute('/home/osmc/domoticz/scripts/Peter/speech.sh "The scene goodnight is activated"&')
end
end
}