en construction

PITP2.lua
--[[
%% autostart
%% properties
15 value
372 value
141 value
6 value
9 value
219 value
222 value
21 value
27 value
61 value
191 sceneActivation
285 sceneActivation
%% globals
--]]
 
 
-- [FR] Liste des portables devant recevoir une notification {70, 71}
-- [EN] Smarphones you want to be notified {XX, XX} for more than one
GEA.portables = {42, 20, 216} 
 
 
local id = {
PRISE_SAPIN = 40,
     PRISE_TV = 372,
     PRISE_CONSOLE = 232,
     PRISE_CAISSON = 231,
     PRISE_BLUERAY = 229,
     PRISE_AMPLI = 230,
     LUMIERE_TV = 6,
     LUMIERE_CHEMINEE = 9,
     LUMIERE_PALIER_CAVE = 27,
     LUMIERE_EXT = 239,
     LUMIERE_ESCALIER_RGBW = 61,
     CPCUISINE = 15,
     CP_SALON = 141,
     CP_EXT = 219,
     CP_PALIER_CAVE = 222,
     OP_ENTREE = 21,
     TELCO_SALON = 191,
     TELCO_ENTREE = 285
}
 
 
 
 
 
function TtsTempCuisine()
local ValeurTemp = fibaro:getGlobalValue ('TempEnOVeranda')
fibaro:debug(ValeurTemp)
local degre = string.gsub(ValeurTemp, '[,]' , ' degret ')
degre = string.gsub(degre, '[.]' , ' degret ')
local notification = "Il fait " .. degre .. " dans la verandaaa";
fibaro:setGlobal("SonosTTS", "lng=fr|dr=auto|vol=50|txt="..notification..". . .|");
end
 
 
 
  -- === Escalier === --
  -- luminotherapie => variation des couleurs du Bleu (le matin) au Rouge (le soir)
  GEA.add({"Sensor+", id["LUMIERE_ESCALIER_RGBW"], 1}, 1*5, "", {{"Days", "All"}, {"Time", "20:01", "05:00"}, {"RGB", id["LUMIERE_ESCALIER_RGBW"], 255, 0, 0, 100}})
  GEA.add({"Sensor+", id["LUMIERE_ESCALIER_RGBW"], 1}, 1*5, "", {{"Days", "All"}, {"Time", "05:01", "10:00"}, {"RGB", id["LUMIERE_ESCALIER_RGBW"], 0, 0, 255, 100}})
  GEA.add({"Sensor+", id["LUMIERE_ESCALIER_RGBW"], 1}, 1*5, "", {{"Days", "All"}, {"Time", "10:01", "15:00"}, {"RGB", id["LUMIERE_ESCALIER_RGBW"], 0, 124, 255, 100}})
  GEA.add({"Sensor+", id["LUMIERE_ESCALIER_RGBW"], 1}, 1*5, "", {{"Days", "All"}, {"Time", "15:01", "20:00"}, {"RGB", id["LUMIERE_ESCALIER_RGBW"], 255, 124, 0, 100}})
 
 
 
 
 
-- === Salon == --
-- veille automatique Multimedia
local veillemultimedia = GEA.add({"Sensor-", id["PRISE_TV"], 50}, 3*60, "Consommation #value# inférieur à 50W depuis 3 minutes",  {{"turnOff", id["PRISE_TV"]},{"turnOff", id["PRISE_CAISSON"]},{"turnOff", id["PRISE_BLUERAY"]},{"turnOff", id["PRISE_AMPLI"]},{"turnOff", id["PRISE_CONSOLE"]}})
 
 
-- Appui court sur le bouton 2 de la telco et je relance l'extinction auto
-- Appui long sur le bouton 2 de la telco je stoppe l'extinction auto
GEA.add({"SceneActivation", id["TELCO_SALON"], 4}, -1, "", {{"StopTask", veillemultimedia}, {"turnOn", id["LUMIERE_TV"]}, {"Function", function() fibaro:sleep(1000) end}, {"turnOff", id["LUMIERE_TV"]}})
GEA.add({"SceneActivation", id["TELCO_SALON"], 3}, -1, "", {{"RestartTask", veillemultimedia}, {"turnOn", id["PRISE_TV"]}, {"turnOn", id["PRISE_AMPLI"]}, {"turnOn", id["PRISE_BLUERAY"]}, {"turnOn", id["PRISE_CONSOLE"]}, {"turnOn", id["PRISE_CAISSON"]} , {"turnOn", id["LUMIERE_TV"]}, {"Function", function() fibaro:sleep(1000) end}, {"turnOff", id["LUMIERE_TV"]}})
 
 
 
  -- Gestion des lumières d'ambiance du salon
 
 
local tvEteinte = {"If", {{"Sensor-", id["PRISE_TV"], 50}}}
local lumieretvEteinte = {"If", {{"Value-", id["LUMIERE_TV"], 1}}}
local lumierechemineeEteinte = {"If", {{"Value-", id["LUMIERE_CHEMINEE"], 1}}}
 
-- Telecommande Salon appui court bouton 1 Allume ou etient lumiere ambiance tv
 
  GEA.add({"SceneActivation", id["TELCO_SALON"], 1}, -1, "", {{"turnOn", id["LUMIERE_TV"]}, lumieretvEteinte}) 
  GEA.add({"SceneActivation", id["TELCO_SALON"], 1}, -1, "", {{"turnOff", id["LUMIERE_TV"]}}) 
 
 
-- Telecommande Salon appui long bouton 1 Allume ou etient lumiere ambiance cheminee
  GEA.add({"SceneActivation", id["TELCO_SALON"], 2}, -1, "", {{"turnOn", id["LUMIERE_CHEMINEE"]}, lumierechemineeEteinte}) 
  GEA.add({"SceneActivation", id["TELCO_SALON"], 2}, -1, "", {{"turnOff", id["LUMIERE_CHEMINEE"]}}) 
 
 
 
 
 -- Lumières d'ambiance du salon ON sur détection de présence
GEA.add( id["CP_SALON"], -1, "", {{"turnOn", id["LUMIERE_TV"]}, lumieretvEteinte, {"Time", "Sunset", "Sunrise"}})
GEA.add( id["CP_SALON"], -1, "", {{"turnOn", id["LUMIERE_CHEMINEE"]}, lumierechemineeEteinte, {"Time", "Sunset", "Sunrise"}})
 
  -- Eteindre la lumière après 5 minutes SI la TV est éteinte
local eteindreLumieretv = GEA.add(id["LUMIERE_TV"], 10*60, "", {{"turnOff",id["LUMIERE_TV"]}, tvEteinte ,{"Repeat"}})
local eteindreLumierecheminee = GEA.add(id["LUMIERE_CHEMINEE"], 10*60, "", {{"turnOff",id["LUMIERE_CHEMINEE"]}, tvEteinte, {"Repeat"}})
 
  -- On redémarre le timer des 5 minutes
GEA.add( id["CP_SALON"], -1, "", {{"RestartTask", eteindreLumieretv}})
GEA.add( id["CP_SALON"], -1, "", {{"RestartTask", eteindreLumierecheminee}})  
 
 
  -- Gestion Sapin de Noel
 
  GEA.add(true, 1*30, "",{{"Days", "Weekday"}, {"Time", "06:10", "06:12"}, {"turnOn",id["PRISE_SAPIN"]}})
  GEA.add(true, 1*30, "",{{"Days", "Weekday"}, {"Time", "07:30", "07:32"}, {"turnOff",id["PRISE_SAPIN"]}})
  GEA.add(true, 1*30, "",{{"Days", "Weekday"}, {"Time", "18:00", "18:02"}, {"turnOn",id["PRISE_SAPIN"]}})
  GEA.add(true, 1*30, "",{{"Days", "Weekday"}, {"Time", "22:00", "22:02"}, {"turnOff",id["PRISE_SAPIN"]}})
 
  GEA.add(true, 1*30, "",{{"Days", "Weekend"}, {"Time", "09:00", "09:02"}, {"turnOn",id["PRISE_SAPIN"]}})
  GEA.add(true, 1*30, "",{{"Days", "Weekend"}, {"Time", "23:00", "23:02"}, {"turnOff",id["PRISE_SAPIN"]}})
 
 
 
 
   -- === Cuisine == --
 
 
GEA.add(id["CPCUISINE"], -1, "TtsTempCuisine", {{"Time", "09:00", "22:00"}, {"Global", "JourNuit", "jour"}, {"Function", function() TtsTempCuisine() end}})
 
  -- === Exterieur == --
 
  -- Gestion de l'éclairage exterieur
  -- Sur détection du capteur de mouvement exterieur ou ouverture de la porte d'entree
 GEA.add(id["CP_EXT"], -1, "", {{"turnOn", id["LUMIERE_EXT"]}, {"Time", "Sunset", "Sunrise"}})
 GEA.add(id["OP_ENTREE"], -1, "", {{"turnOn", id["LUMIERE_EXT"]}, {"Time", "Sunset", "Sunrise"}})
  local arretlumext = GEA.add(id["LUMIERE_EXT"], 10*60, "", {{"turnOff",id["LUMIERE_EXT"]},{"Repeat"}})
 GEA.add(id["CP_EXT"], -1, "", {{"RestartTask", arretlumext}})
 GEA.add(id["OP_ENTREE"], -1, "Ouverture porte d'entrée", {{"RestartTask", arretlumext}})
 
 
 -- === Garage === --
  -- Appui court sur le bouton 1 de la telco ouvre la porte de garage
GEA.add({"SceneActivation", id["TELCO_ENTREE"], 1}, -1, "", {{"VirtualDevice", 84, "1"}})
 
 
  -- === Cave === --
  -- Gestion Eclairage palier cave
  GEA.add(id["CP_PALIER_CAVE"], -1, "Lumiere cave allumee", {{"turnOn", id["LUMIERE_PALIER_CAVE"]}})
  local arretlumpaliercave = GEA.add(id["LUMIERE_PALIER_CAVE"], 3*60, "", {{"turnOff",id["LUMIERE_PALIER_CAVE"]},{"Repeat"}})
 GEA.add(id["CP_PALIER_CAVE"], -1, "", {{"RestartTask", arretlumpaliercave}})