Aller au contenu
cseb62

pb variable globale

Recommended Posts

Bonjour à tous, 

Je rencontre un soucis depuis un petit moment sur 3 scénario qui utilisent 2 variables globale. 

J'ai créé manuellement c'est variable dans le panneau. Mes scénarios fonctionnent correctement, jusqu'au moment où il faut que je reboote la box...  Le comportement est alors curieux, quand je lance un scénario, les deux autres se lancent comme si il y avait un trigger..... Je suis alors obligé de supprimer les variables et de les recréer à l'identique dans le panneau.  Et cela refonctionne jusqu'au prochain reboot.... 

 

Avez vous une piste pour corriger le soucis ? 

Merci 

Partager ce message


Lien à poster
Partager sur d’autres sites

Est ce que tes scenarios seraient-ils configurés pour etre lancés au démarrage de ta box? Si c'est le cas, il ne faut pas dans ton cas.

 

Partager ce message


Lien à poster
Partager sur d’autres sites

Merci pour la piste, je viens de vérifier mais ils sont tous les trois en manuel... 

J'ai peut être une boulette dans les scènarios... 

Je peux les poster si vous le souhaitez 

Partager ce message


Lien à poster
Partager sur d’autres sites

en effet poste les scénarios, ça aidera à t'aider

Partager ce message


Lien à poster
Partager sur d’autres sites

voici les 3 scénarios

 

--[[
%% properties
%% globals
--]]
-- 185 is the Virtual Device ID SONOS Emma
-- 28 is the Process button ID
local sid, bid = 185, 28
-- Create STREAM params object
local params = {
  -- stream: the file / uri
  stream = "//SYNO/Documents/Sons/new/Alarme-Activation.mp3",
  -- source: "local" or "http", "local" is setted by default
  source = "local",
  -- duration: play duration in seconds (option) or "auto"
  duration = "auto",
  -- volume: the volume for playing the stream
  volume = 95
}
local _f = fibaro
local _x ={root="x_sonos_object",load=function(b)local c=_f:getGlobalValue(b.root)if string.len(c)>0 then local d=json.decode(c)if d and type(d)=="table"then return d else _f:debug("Unable to process data, check variable")end else _f:debug("No data found!")end end,set=function(b,e,d)local f=b:load()if f[e]then for g,h in pairs(d)do f[e][g]=h end else f[e]=d end;_f:setGlobal(b.root,json.encode(f))end,get=function(b,e)local f=b:load()if f and type(f)=="table"then for g,h in pairs(f)do if tostring(g)==tostring(e or"")then return h end end end;return nil end}
-- Make a request to the remote to process params object instantly
_x:set(tostring(sid), { stream = params })
_f:call(sid, "pressButton", bid)

fibaro:call(456, "setArmed", "1")  -- IR Hall
fibaro:call(428, "setArmed", "1") -- IR Salon
fibaro:call(461, "setArmed", "1") -- IR SAM
fibaro:call(418, "setArmed", "1") -- IR WC

--fibaro:call(180, "setArmed", "0") -- IR SDB
--fibaro:call(269, "setArmed", "0") -- IR Veranda

fibaro:call(466, "setArmed", "1") -- Porte SAM D
fibaro:call(416, "setArmed", "1") -- Porte SAM G
fibaro:call(544, "setArmed", "1") -- Porte Cuisine
fibaro:call(298, "setArmed", "1") -- Porte Entree
fibaro:call(552, "setArmed", "1") -- baie coulissant veranda
--  imprimante
fibaro:call(105, "turnOff")
-- volet
fibaro:call(344, "close")
-- mise a jour variable globale
fibaro:setGlobal('EtatAlarm', 1)
-- AV off
fibaro:sleep(6000)
fibaro:call(469, "turnOff")
--[[
%% properties
%% globals
--]]

--Alarme partielle

-- 185 is the Virtual Device ID SONOS Emma
-- 28 is the Process button ID
local sid, bid = 185, 28
-- Create STREAM params object
local params = {
  -- stream: the file / uri
  stream = "//SYNO/Documents/Sons/new/Alarme-partielle-active.mp3",
  -- source: "local" or "http", "local" is setted by default
  source = "local",
  -- duration: play duration in seconds (option) or "auto"
  duration = "auto",
  -- volume: the volume for playing the stream
  volume = 3
}
local _f = fibaro
local _x ={root="x_sonos_object",load=function(b)local c=_f:getGlobalValue(b.root)if string.len(c)>0 then local d=json.decode(c)if d and type(d)=="table"then return d else _f:debug("Unable to process data, check variable")end else _f:debug("No data found!")end end,set=function(b,e,d)local f=b:load()if f[e]then for g,h in pairs(d)do f[e][g]=h end else f[e]=d end;_f:setGlobal(b.root,json.encode(f))end,get=function(b,e)local f=b:load()if f and type(f)=="table"then for g,h in pairs(f)do if tostring(g)==tostring(e or"")then return h end end end;return nil end}
-- Make a request to the remote to process params object instantly
_x:set(tostring(sid), { stream = params })
_f:call(sid, "pressButton", bid)

fibaro:call(466, "setArmed", "1") -- Porte SAM D
fibaro:call(416, "setArmed", "1") -- Porte SAM G
fibaro:call(544, "setArmed", "1") -- Porte Cuisine
fibaro:call(298, "setArmed", "1") -- Porte Entree
fibaro:call(552, "setArmed", "1") -- baie coulissant veranda

fibaro:setGlobal('AlarmePartielle', 1)
fibaro:setGlobal('EtatAlarm', 1)




-- 185 is the Virtual Device ID SONOS Emma
-- 28 is the Process button ID  
  
  local sid, bid = 185, 28
	-- Create STREAM params object
	local params = {
	-- stream: the file / uri
	stream = "//SYNO/Documents/Sons/new/Alarme-Desactivation.mp3",
	-- source: "local" or "http", "local" is setted by default
	source = "local",
	-- duration: play duration in seconds (option) or "auto"
	duration = "auto",
	-- volume: the volume for playing the stream
	volume = 80
	}
	local _f = fibaro
	local _x ={root="x_sonos_object",load=function(b)local c=_f:getGlobalValue(b.root)if string.len(c)>0 then local d=json.decode(c)if d and type(d)=="table"then return d else _f:debug("Unable to process data, check variable")end else _f:debug("No data found!")end end,set=function(b,e,d)local f=b:load()if f[e]then for g,h in pairs(d)do f[e][g]=h end else f[e]=d end;_f:setGlobal(b.root,json.encode(f))end,get=function(b,e)local f=b:load()if f and type(f)=="table"then for g,h in pairs(f)do if tostring(g)==tostring(e or"")then return h end end end;return nil end}
	-- Make a request to the remote to process params object instantly
	_x:set(tostring(sid), { stream = params })
	_f:call(sid, "pressButton", bid)

fibaro:call(83, 'turnOff')
fibaro:killScenes(81)
fibaro:call(456, "setArmed", "0")  -- IR Hall
fibaro:call(428, "setArmed", "0") -- IR Salon
fibaro:call(461, "setArmed", "0") -- IR SAM
fibaro:call(418, "setArmed", "0") -- IR WC

--fibaro:call(180, "setArmed", "0") -- IR SDB
--fibaro:call(269, "setArmed", "0") -- IR Veranda

fibaro:call(466, "setArmed", "0") -- Porte SAM D
fibaro:call(416, "setArmed", "0") -- Porte SAM G
fibaro:call(544, "setArmed", "0") -- Porte Cuisine
fibaro:call(298, "setArmed", "0") -- Porte Entree
fibaro:call(552, "setArmed", "0") -- baie coulissant veranda



fibaro:setGlobal('EtatAlarm', 0)
fibaro:setGlobal('AlarmePartielle', 0)
-- AV
fibaro:call(469, "turnOn")
fibaro:call(544, "setArmed", "0") -- Porte Cuisine
fibaro:call(298, "setArmed", "0") -- Porte Entree
fibaro:call(552, "setArmed", "0") -- baie coulissant veranda



fibaro:setGlobal('EtatAlarm', 0)
fibaro:setGlobal('AlarmePartielle', 0)
-- AV
fibaro:call(469, "turnOn")

 

Modifié par cseb62

Partager ce message


Lien à poster
Partager sur d’autres sites

Bonjour,

 

Mais comment demarres tu tes scènes ? A partir de quoi ? Quel déclencheur ?

 

 

Dans tes scenes, cela manque de "IF" ;-)

Partager ce message


Lien à poster
Partager sur d’autres sites

hello @pepite,

 

je démarre mes scènes manuellement, soit via l'appli mobile, via Alexa, ou via l'appui sur un device, 

Si vous avez des améliorations j'suis preneur. 

Cdlt

Modifié par cseb62

Partager ce message


Lien à poster
Partager sur d’autres sites

Tu n'aurais pas coché à la création des scenes : demarrer avec la HC2 ?

Partager ce message


Lien à poster
Partager sur d’autres sites

non non, le phénomène se passe après un reboot lorsque je lance par moi même une des scènes, les deux autres se lancent. Je recrée les variables et tout refonctionne

Modifié par cseb62

Partager ce message


Lien à poster
Partager sur d’autres sites

C'est bizarre, il n'y a pas de declencheur sur tes scenes. t'es un gourou lol

 

En fait depuis un bouton du VD de Krikroff lors du TTS MP3 tu actives ou desactive l'alarme.

Partager ce message


Lien à poster
Partager sur d’autres sites

Non, je lance le scénario tout court... le tts c'est juste pour confirmer le lancement du scénario. 

:22:

Pour alexa j'utilise Ha bridge qui me lance le scénario via une requêtes http.

Pour la désactivation j'ai un autre scénario qui me remonte l'état d'un capteur d'empreinte digital qui est intégré dans ma porte d'entrée. 

Ça me permet d'ouvrir la porte et de désactiver l'alarme. 

:60:

Modifié par cseb62

Partager ce message


Lien à poster
Partager sur d’autres sites

Personne n'a d'idée ? :P y a pas une énorme boulette dans les scenarios? (qui sont très basique... vu mon niveau :60:

Partager ce message


Lien à poster
Partager sur d’autres sites

Je vois rien de special dans les scenes.

 

Cela buggue systematiquement après un reboot ou c'est aleatoire ?

Partager ce message


Lien à poster
Partager sur d’autres sites

Oui c'est systématique après un reboot.

 

Il me semble avoir lu sur le forum qu'il fallait éviter d'utiliser le panneau de variables car il était bugué et qu'il fallait mieux créer les variables dans les scènes.....

 

Je vais m'intéresser au VD alarme avancé :60: pour remplacer mes trois scénarios.

 

Partager ce message


Lien à poster
Partager sur d’autres sites

Attends que fais tu avec le panneau de variables ??
Tu crees c est toit ? Tu ne changes pas les valeurs depuis le panneau ??

Envoyé de mon BND-L21 en utilisant Tapatalk

Partager ce message


Lien à poster
Partager sur d’autres sites

×