Jag har använt Google translate. Franska till engelska tycker jag är enklare än till svenska.
Code: Select all
--[[
%% autostart
%% properties
9 value
25 value
37 value
38 value
43 value
47 value
48 value
55 value
59 value
61 value
62 value
66 value
67 value
69 value
74 value
84 value
198 value
199 value
200 value
219 value
Sunset
Sunrise
%% globals
TimeOfDay
PresentState
FiaHemma
MarkusHemma
--]]
-- v 5.30
-- Add GEA Alarms
-- Correction décalage dans le temps
-- ==================================================
-- GEA : Gestionnaire d'Evénements Automatique
-- ==================================================
-- [FR] Scénario permettant de contrôler si une périphérique est
-- activé depuis trop longtemps ou lancer un push d'avertissement
-- Ce scénario permet une annotation plus simple que le code LUA
-- il nécessite néanmoins quelques connaissances
--
-- [EN] This scene allow you to check every X second the status
-- of a module and send actions if the module is activated since too long.
-- This scene allow you a more simple annotation than LUA
-- it requires some knowledge
--
-- Auteur : Steven P. with modification of Hansolo and Shyrka973
-- Version : 5.30
-- Special Thanks to :
-- jompa68, Fredric, Diuck, Domodial, moicphil, lolomail, byackee,
-- JossAlf, Did, sebcbien, chris6783 and all other guy from Domotique-fibaro.fr
-- ------------------------------------------------------------
-- Historique / History
-- ------------------------------------------------------------
-- L'historique complet est diponible ici :
-- http://www.domotique-fibaro.fr/index.php/topic/1082-gea-gestionnaire-dévénements-automatique/?p=12428
function yourcode()
-- ==================================================
-- [FR] A VOUS DE JOUER
-- [EN] YOUR TIME TO PLAY
-- ==================================================
GEA.isVersionFour = true --- On est en version 4.017 Beta ou suppérieur
-- [FR] Votre langue : FR (default)
-- [EN] Your language : EN
GEA.language = "EN";
-- [FR] On vérifie toutes les X secondes (default : 30)
-- [EN] Check every X seconds
GEA.checkEvery = 30
-- [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 = {5, 24, 83, 205}
-- [FR] Affichage des traces dans la console (default : false)
-- [EN] Show trace in the debug window
GEA.debug = false
-- GEA.catchError=false
-- [FR] Tableau d'identifiant (facultatif)
-- [EN] ID table (optional)
local id = {
HALL_PIR = 16,
HALL_LUX = 18,
HALL_LAMPA = 15,
VARDAGSRUM_PIR = 21,
VARDAGSRUM_LUX = 23,
VARDAGSRUM_LEDLIST = 9,
TVATTSTUGA_PIR = 11,
TVATTSTUGA_LUX = 14,
TVATTSTUGA_LAMPA = 10,
PARKERING_PIR = 219,
PARKERING_LUX = 221,
PARKERING_LAMPA = 74,
TILDE_FLAMPA = 62,
TILDE_VLAMPA = 61,
TILDE_LEDLIST = 66,
TILDE_CD = 64,
TILDE_TEMP = 27,
TILDE_TV = 63,
THEA_VLAMPA = 198,
THEA_SANGLAMPA = 199,
THEA_TEMP = 30,
THEA_SONOS = 200,
ALMA_ROSA_LAMPA = 25,
FIA_SANGLAMPA = 55,
MARKUS_SANGLAMPA = 59,
LAMPA_ALLRUM = 43,
KYL_TEMP = 69,
KYL_DORR = 67,
-- FRYS_TEMP = 230,
UPPE_ALLRUM_TV = 39,
-- SKRIVARE_HP = 47, fel id
-- SKRIVARE_CANON = 48, fel id
LAMPA_TVBANK = 47,
POSTLADA = 84,
AVFUKTARE_LITEN = 7,
AVFUKTARE_STOR = 223,
-------- Virtual Device
VD_DOMOTICZ_PING = 71,
VD_TEMPERATUR_NU = 20,
VD_CLOCKSYNC = 72,
VD_EMONCMS = 73,
VD_TIMEOFDAY = 70,
VD_FIAHEMMA = 242,
VD_MARKUSHEMMA = 243
}
-- ------------------------------------------------------------
-- [FR] Variable Globale optionnel pour autorisé GEA de s'exécuté
-- [FR] Usage : GEA.getGlobalForActivation = {"<globalvar>", "<value pour autoriser l'execution>"}
-- [EN] Optional Global Variable to allow GEA to run
-- [EN] Usage : GEA.getGlobalForActivation = {"<globalvar>", "<value for activation>"}
-- ------------------------------------------------------------
--GEA.getGlobalForActivation = {"SuspendreGEA", "non"}
-- ----------------------------------------------------------------
-- [FR] A partir d'ici vous trouverez ma propre configuration
-- [FR] vous permettant ainsi d'avoir une série d'exemple
-- [EN] From here are ma own configuration
-- [EN] just to allow you to see some examples
-- ----------------------------------------------------------------
-- Timer varje minut
-- GEA.add(true , 1*60, "",{
-- {"VirtualDevice", id["VD_FIAHEMMA"], "1"},{"VirtualDevice", id["VD_MARKUSHEMMA"], "1"},{"Repeat"}
-- })
-- Timer var 3:e minut
GEA.add( true , 3*60, "",{
{"VirtualDevice", id["VD_TEMPERATUR_NU"], "1"}, {"Repeat"}
})
-- Timer var 10:e minut
GEA.add( true , 10*60, "",{
{"VirtualDevice", id["VD_EMONCMS"], "1"}, {"Repeat"}
})
-- Timer var 30 minut
GEA.add( true , 30*60, "",{
{"VirtualDevice", id["VD_DOMOTICZ_PING"], "1"}, {"Repeat"}
})
-- Timer var 60 minut
-- GEA.add( true , 60*60, "", {
-- {"VirtualDevice", id["VD_AGENDA"], "12"}, {"Repeat"}
-- })
-- Timer varje dag
-- GEA.add( true , 30, "", {
-- {"Time", "01:00", "01:05"},
-- {"RestartTask", wake1},
-- {"RestartTask", wake2},
-- {"RestartTask", wake3}
-- })
--== Sätt TimeOfDay (global parameter) ==--
GEA.add(true, 30, "", {{"Time", "05:30", "05:32"}, {"VirtualDevice", id["VD_TIMEOFDAY"], "1"}, {"MaxTime", 1}})
GEA.add(true, 30, "", {{"Time", "10:00", "10:02"}, {"VirtualDevice", id["VD_TIMEOFDAY"], "2"}, {"MaxTime", 1}})
GEA.add(true, 30, "", {{"Time", "17:00", "17:02"}, {"VirtualDevice", id["VD_TIMEOFDAY"], "3"}, {"MaxTime", 1}})
GEA.add(true, 30, "", {{"Time", "21:45", "21:47"}, {"VirtualDevice", id["VD_TIMEOFDAY"], "4"}, {"Days", "Monday, Tuesday, Wednesday, Thursday, Sunday"}, {"MaxTime", 1}})
GEA.add(true, 30, "", {{"Time", "22:45", "22:47"}, {"VirtualDevice", id["VD_TIMEOFDAY"], "4"}, {"Days", "Friday, Saturday"}, {"MaxTime", 1}})
--== Krypgrund. Rapportera driftstid över 3 timmar ==--
GEA.add(id["AVFUKTARE_STOR"], 180*60, "Driftstid stor avfuktare = #duration# (#date# #time#)", {{"Portable", 5, 83}})
GEA.add(id["AVFUKTARE_LITEN"], 180*60, "Driftstid liten avfuktare = #duration# (#date# #time#)", {{"Portable", 5, 83}})
--== Parkering, Tänd lampa efter solnedgång, släck kl 20:00 ==--
GEA.add(true, 30, "", {{"Time", "Sunset+30", "Sunset+32"}, {"turnOn", id["PARKERING_LAMPA"]}})
GEA.add(true, 30, "", {{"Time", "20:00", "20:02"}, {"turnOff", id["PARKERING_LAMPA"]}})
-- GEA.add(true, 30, "", {{"Time", "06:35", "06:37"}, {"turnOn", id["PARKERING_LAMPA"]}})
-- GEA.add(true, 30, "", {{"Time", "08:00", "08:02"}, {"turnOn", id["PARKERING_LAMPA"]}})
--== Parkering, Tänd lampa om rörelse sker mellan kl 20:00 till soluppgång ==--
GEA.add(id["PARKERING_PIR"], -1, "", {{"Time", "20:00", "Sunrise+10"}, {"turnOn", id["PARKERING_LAMPA"]}})
GEA.add(id["PARKERING_LAMPA"], 6*60, "", {{"Time", "20:00", "Sunrise+40"}, {"turnOff", id["PARKERING_LAMPA"]}, {"Repeat"}})
--== Push om post i brevlådan ==--
GEA.add(id["POSTLADA"], 1*30, "Kolla posten (#date# #time#)", {{"Time", "08:00", "21:00"}})
--== Tildes lampor och grejer ==--
GEA.add(true, 30, "", {{"Time", "18:50", "18:52"}, {"turnOn", id["TILDE_CD"]}})
GEA.add(true, 30, "", {{"Time", "06:00", "06:02"}, {"turnOff", id["TILDE_CD"]}})
GEA.add(true, 30, "", {{"Time", "11:10", "11:12"}, {"turnOn", id["TILDE_CD"]}, {"Days", "Friday, Weekend"}})
GEA.add(true, 30, "", {{"Time", "13:00", "13:02"}, {"turnOff", id["TILDE_CD"]}})
GEA.add(true, 30, "", {{"Time", "11:10", "11:12"}, {"turnOn", id["TILDE_VLAMPA"]}, {"Days", "Friday, Weekend"}})
GEA.add(true, 30, "", {{"Time", "13:00", "13:02"}, {"turnOff", id["TILDE_VLAMPA"]}})
GEA.add(true, 30, "", {{"Time", "Sunset+10", "Sunset+12"}, {"turnOn", id["TILDE_FLAMPA"]}})
GEA.add(true, 30, "", {{"Time", "21:30", "21:32"}, {"turnOff", id["TILDE_FLAMPA"]}})
GEA.add(true, 30, "", {{"Time", "18:50", "18:52"}, {"turnOn", id["TILDE_VLAMPA"]}})
GEA.add(true, 30, "", {{"Time", "07:30", "07:32"}, {"turnOff", id["TILDE_VLAMPA"]}})
-- GEA.add(true, 30, "", {{"Time", "06:45", "06:47"}, {"turnOn", id["TILDE_VLAMPA"]}})
-- GEA.add(true, 30, "", {{"Time", "08:00", "08:02"}, {"turnOff", id["TILDE_VLAMPA"]}})
--== Theas lampor och grejer ==--
GEA.add(true, 30, "", {{"Time", "18:50", "18:52"}, {"turnOn", id["THEA_VLAMPA"]}})
GEA.add(true, 30, "", {{"Time", "08:10", "08:12"}, {"turnOff", id["THEA_VLAMPA"]}})
GEA.add(true, 30, "", {{"Time", "18:55", "18:57"}, {"turnOn", id["THEA_SANGLAMPA"]}})
GEA.add(true, 30, "", {{"Time", "20:30", "20:32"}, {"turnOff", id["THEA_SANGLAMPA"]}})
GEA.add(true, 30, "", {{"Time", "06:45", "06:47"}, {"turnOn", id["THEA_SANGLAMPA"]}})
GEA.add(true, 30, "", {{"Time", "08:00", "08:02"}, {"turnOff", id["THEA_SANGLAMPA"]}})
-- GEA.add(true, 30, "", {{"Time", "19:00", "19:02"}, {"turnOn", id["THEA_SONOS"]}})
-- GEA.add(true, 30, "", {{"Time", "22:00", "22:02"}, {"turnOff", id["THEA_SONOS"]}})
-- GEA.add(true, 30, "", {{"Time", "06:25", "06:27"}, {"turnOn", id["THEA_SONOS"]}, {"Days", "Monday, Tuesday, Wednesday, Thursday"}}) --Väckning via Sonos
-- GEA.add(true, 30, "", {{"Time", "07:15", "07:17"}, {"turnOff", id["THEA_SONOS"]}, {"Days", "Monday, Tuesday, Wednesday, Thursday"}}) --Väckning via Sonos
-- GEA.add(true, 30, "", {{"Time", "07:30", "07:32"}, {"turnOn", id["THEA_SONOS"]}, {"Days", "Friday, Weekend"}}) --Väckning via Sonos
-- GEA.add(true, 30, "", {{"Time", "08:20", "08:22"}, {"turnOff", id["THEA_SONOS"]}, {"Days", "Friday, Weekend"}}) --Väckning via Sonos
--== Almas lampor och grejer ==--
GEA.add(true, 30, "", {{"Time", "18:00", "18:02"}, {"turnOn", id["ALMA_ROSA_LAMPA"]}})
GEA.add(true, 30, "", {{"Time", "08:00", "08:02"}, {"turnOff", id["ALMA_ROSA_LAMPA"]}})
-- GEA.add(true, 30, "", {{"Time", "11:35", "11:37"}, {"turnOn", id["ALMA_ROSA_LAMPA"]}, {"Days", "Friday, Weekend"}})
-- GEA.add(true, 30, "", {{"Time", "13:40", "13:42"}, {"turnOff", id["ALMA_ROSA_LAMPA"]}})
--== Fia och Markus lampor ==--
GEA.add(true, 30, "", {{"Time", "18:00", "18:02"}, {"turnOn", id["FIA_SANGLAMPA"]}})
GEA.add(true, 30, "", {{"Time", "22:00", "22:02"}, {"turnOff", id["FIA_SANGLAMPA"]}})
GEA.add(true, 30, "", {{"Time", "18:00", "18:02"}, {"turnOn", id["MARKUS_SANGLAMPA"]}})
GEA.add(true, 30, "", {{"Time", "21:30", "21:32"}, {"turnOff", id["MARKUS_SANGLAMPA"]}})
--== Allrum uppe ==--
GEA.add(true, 30, "", {{"Time", "Sunset+40", "Sunset+42"}, {"turnOn", id["LAMPA_ALLRUM"]}})
GEA.add(true, 30, "", {{"Time", "Sunrise+30", "Sunrise+32"}, {"turnOff", id["LAMPA_ALLRUM"]}})
--== Vardagrum nere ==--
GEA.add(true, 30, "", {{"Time", "Sunset-30", "Sunset-28"}, {"turnOn", id["LAMPA_TVBANK"]}})
GEA.add(true, 30, "", {{"Time", "22:00", "22:02"}, {"turnOff", id["LAMPA_TVBANK"]}})
GEA.add(true, 30, "", {{"Time", "05:00", "05:02"}, {"turnOn", id["LAMPA_TVBANK"]}})
GEA.add(true, 30, "", {{"Time", "Sunrise", "Sunrise"}, {"turnOff", id["LAMPA_TVBANK"]}})
--== PUSH om Fia är hemma / borta ==--
GEA.add({"Global", "FiaHemma", "1"}, -1, "Fia är hemma #time#", {{"Time", "07:00", "21:00"}, {"Portable", 205}})
GEA.add({"Global", "FiaHemma", "0"}, -1, "Fia har lämnat huset #time#", {{"Time", "07:00", "21:00"}, {"Portable", 205}})
--== PUSH om Markus är hemma / borta ==--
GEA.add({"Global", "MarkusHemma", "1"}, -1, "Markus är hemma #time#", {{"Portable", 205}, {"Time", "07:00", "21:00"}})
GEA.add({"Global", "MarkusHemma", "0"}, -1, "Markus har lämnat huset #time#", {{"Time", "07:00", "21:00"}, {"Portable", 205}})
--== Saker som stänger av sig på tid ==--
GEA.add(id["TILDE_LEDLIST"], 30*60, "", {{"turnOff", id["TILDE_LEDLIST"]}})
-- GEA.add(id["SKRIVARE_HP"], 60*60, "", {{"turnOff", id["SKRIVARE_HP"]}})
-- GEA.add(id["SKRIVARE_CANON"], 60*60, "", {{"turnOff", id["SKRIVARE_CANON"]}})
--== Kylskåp och frys, rapportera öppen dörr och hög temp ==--
GEA.add({"Value+", id["KYL_TEMP"], 15}, 7*60, "Kolla kylen, #value# grader (#date# #time#)")
GEA.add(id["KYL_DORR"], 3*60, "Öppen kylskåpsdörr #duration# (#date# #time#)")
-- GEA.add({"Value+", id["FRYS_TEMP"], -5}, 5*60, "Kolla frysen, #value# grader (#date# #time#)")
--Checking sometimes dead modules
GEA.add({"Dead", id["PARKERING_LAMPA"]}, 15*60, "Kolla lampan på parkeringen", {{"WakeUp", id["PARKERING_LAMPA"]}, {"Portable", 5}})
GEA.add({"Dead", id["AVFUKTARE_STOR"]}, 15*60, "Kolla stora avfuktaren", {{"WakeUp", id["AVFUKTARE_STOR"]}, {"Portable", 5}})
GEA.add({"Dead", id["AVFUKTARE_LITEN"]}, 15*60, "Kolla lilla avfuktaren", {{"WakeUp", id["AVFUKTARE_LITEN"]}})
GEA.add({"Dead", id["POSTLADA"]}, 30*60, "Kolla brevlådan", {{"WakeUp", id["POSTLADA"]}})