Définir l'intensité d'une lampe selon plage horaire

Forum dédié aux problématiques concernant les scripts pour DomoticZ.
Entourez votre code et les logs avec les balises nommées code grâce au bouton <\>.
pmontana
Messages : 2
Inscription : 02 mai 2017, 17:07

Re: Définir l'intensité d'une lampe selon plage horaire

Message par pmontana »

Salut,

De mon côté j'ai géré ça avec un script LUA qui appelle un script python (qui gère les Hue Light et les Yeelight).
Ensuite :

Code : Tout sélectionner

commandArray = {}

time = os.date("*t")

-- colors
local Sunrise         = 'fce7b0'
local Sunset          = 'fe5b35'
local Halogen         = 'fff1e0'
local Carbon_Arc      = 'fffaf4'
local Direct_Sunlight = 'fff'
local High_Noon_Sun   = 'fffffb'
local Overcast_Sky    = 'c9e2ff'
local Clear_Blue_Sky  = '409cff'
local Soft_Yellow     = 'f0da93'
local Wheat           = 'ffe7ba'
local Honey           = 'ffe5ac'

if time.hour >= 6 and time.hour < 10 then
    light = Sunrise
elseif time.hour >= 10 and time.hour < 12 then
    light = Direct_Sunlight
elseif time.hour >= 12 and time.hour < 18 then
    light = High_Noon_Sun
elseif time.hour >= 18 and time.hour < 22 then
    light = Soft_Yellow  
elseif time.hour >= 22 and time.hour < 6 then    
    light = Sunset  
end

if (devicechanged['Switch'] == 'Click' or devicechanged['Switch'] == 'Long Click' or devicechanged['Switch'] == 'Long Click Release') then 
    print('Allumage Salle à Manger - couleur '..light)
    os.execute('/home/pi/domoticz/scripts/python/bulbs.py -n Table,Bibliotheque -a toggle -c '..light)
end

if (devicechanged['Switch'] == 'Double Click') then 
    os.execute('/home/pi/domoticz/scripts/python/bulbs.py -n Salon -a toggle -c '..light)
end

return commandArray
Pour le moment je peaufine encore mon script mais je pourrai partager si ça intéresse quelqu'un.
A+
Répondre