Utilisation des genericType comme condition

Bonsoir,

Je teste les nouvelles possibilités de la V4.2, notamment les genericType dans mes scénarios afin de limiter leur nombre pour ma gestion d’éclairage sur détection de présence.
Je bloque depuis un moment sur la récupération d’une info issue d’un genericType afin de faire un test dans un bloc SI.
Je serai preneur d’une petite assistance si quelqu’un passe par là :slight_smile:

Les infos qui me semblent pertinente (s’il en manque, n’hésitez pas à me demander le complément):

Mon scénario:

- Mode du scénario : provoke
    - Evènement : #genericType(PRESENCE)#



    
    ACTION
     log - Options : {"enable":"1","background":"0","message":"\"'trigger():'+trigger()"}
     log - Options : {"enable":"1","background":"0","message":"genericType(BRIGHTNESS,name(object,trigger()))"}
     log - Options : {"enable":"1","background":"0","message":"genericType(LIGHT_STATE,name(object,trigger()))"}
     log - Options : {"enable":"1","background":"0","message":"name(object,trigger())"}
     tag - Options : {"enable":"1","background":"0","name":"Correction_HSol","value":"25"}
     tag - Options : {"enable":"1","background":"0","name":"Seuil_Luminosite","value":"3000"}
    
    SI  triggerValue() == 1
    ALORS
         
        SI genericType(LIGHT_STATE,name(object,trigger())) == 0 ET (#time#>=time_op(#[Extérieur][Météo][Coucher du soleil]#,-tag(Correction_HSol)) OR #time#<=time_op(#[Extérieur][Météo][Lever du soleil]#,tag(Correction_HSol)) OR genericType(BRIGHTNESS,#name(object,trigger())#) <= tag(Seuil_Luminosite))
        ALORS
             
            ACTION
             genericType(LIGHT_ON, name(object,trigger())) - Options : {"enable":"0","background":"0"}
             genericType(LIGHT_SLIDER, name(object,trigger())) == 254 - Options : {"enable":"0","background":"0"}
        SINON
         
        ACTION
         remove_inat - Options : {"enable":"1","background":"0"}
    SINON
         
        SI value(name(object,trigger()) name(eqLogic,trigger()) Tempo) != '0'  ET genericType(LIGHT_STATE,name(object,trigger())) == 1  
        ALORS
             
            DANS value(name(object,trigger()) name(eqLogic,trigger()) Tempo) 
            FAIRE
             genericType(LIGHT_OFF, name(object,trigger())) - Options : {"enable":"0","background":"0"}
        SINON

Des logs d’exécution:

------------------------------------
[2022-02-02 20:19:43][SCENARIO] -- Start : Scenario execute automatiquement sur evenement venant de :  genericType(PRESENCE,#[Couloir]#) from [Couloir][Philips.SML001 couloir][Presence].
[2022-02-02 20:19:43][SCENARIO] - Exécution du sous-élément de type [action] : action
[2022-02-02 20:19:43][SCENARIO]    Log : "'[Couloir][Philips.SML001 couloir][Présence]:'+[Couloir][Philips.SML001 couloir][Présence]
[2022-02-02 20:19:43][SCENARIO]    Log : 11068
[2022-02-02 20:19:43][SCENARIO]    Log : 0
[2022-02-02 20:19:43][SCENARIO]    Log : Couloir
[2022-02-02 20:19:43][SCENARIO] Mise à jour du tag #Correction_HSol# => 25
[2022-02-02 20:19:43][SCENARIO] Mise à jour du tag #Seuil_Luminosite# => 3000
[2022-02-02 20:19:43][SCENARIO] - Exécution du sous-élément de type [condition] : if  triggerValue() == 1
[2022-02-02 20:19:43][SCENARIO] Evaluation de la condition : [ 1 == 1] = Vrai
[2022-02-02 20:19:43][SCENARIO] - Exécution du sous-élément de type [action] : then
[2022-02-02 20:19:43][SCENARIO] Exécution d'un bloc élément : 458
[2022-02-02 20:19:43][SCENARIO] - Exécution du sous-élément de type [condition] : if genericType(LIGHT_STATE,name(object,trigger())) == 0 ET (#time#>=time_op(#[Extérieur][Météo][Coucher du soleil]#,-tag(Correction_HSol)) OR #time#<=time_op(#[Extérieur][Météo][Lever du soleil]#,tag(Correction_HSol)) OR genericType(BRIGHTNESS,#name(object,trigger())#) <= tag(Seuil_Luminosite))
[2022-02-02 20:19:44][SCENARIO] Evaluation de la condition : ["" == 0 ET (2019>=1719 OR 2019<=824 OR "" <= 3000)] = Vrai
[2022-02-02 20:19:44][SCENARIO] - Exécution du sous-élément de type [action] : then
[2022-02-02 20:19:44][SCENARIO] Exécution d'un bloc élément : 459
[2022-02-02 20:19:44][SCENARIO] - Exécution du sous-élément de type [action] : action
[2022-02-02 20:19:44][SCENARIO] Exécution d'un bloc élément : 460
[2022-02-02 20:19:44][SCENARIO] - Exécution du sous-élément de type [action] : action
[2022-02-02 20:19:44][SCENARIO] Suppression des blocs DANS et A programmés du scénario
[2022-02-02 20:19:44][SCENARIO] Fin correcte du scénario
------------------------------------
[2022-02-02 20:19:44][SCENARIO] -- Start : Scenario execute automatiquement sur evenement venant de :  genericType(PRESENCE,#[Couloir]#) from [Couloir][Lumieres Couloir][Presence].
[2022-02-02 20:19:44][SCENARIO] - Exécution du sous-élément de type [action] : action
[2022-02-02 20:19:44][SCENARIO]    Log : "'[Couloir][Lumières Couloir][Présence]:'+[Couloir][Lumières Couloir][Présence]
[2022-02-02 20:19:45][SCENARIO]    Log : 0
[2022-02-02 20:19:45][SCENARIO]    Log : 0
[2022-02-02 20:19:45][SCENARIO]    Log : Couloir
[2022-02-02 20:19:45][SCENARIO] Mise à jour du tag #Correction_HSol# => 25
[2022-02-02 20:19:45][SCENARIO] Mise à jour du tag #Seuil_Luminosite# => 3000
[2022-02-02 20:19:45][SCENARIO] - Exécution du sous-élément de type [condition] : if  triggerValue() == 1
[2022-02-02 20:19:45][SCENARIO] Evaluation de la condition : [ 1 == 1] = Vrai
[2022-02-02 20:19:45][SCENARIO] - Exécution du sous-élément de type [action] : then
[2022-02-02 20:19:45][SCENARIO] Exécution d'un bloc élément : 458
[2022-02-02 20:19:45][SCENARIO] - Exécution du sous-élément de type [condition] : if genericType(LIGHT_STATE,name(object,trigger())) == 0 ET (#time#>=time_op(#[Extérieur][Météo][Coucher du soleil]#,-tag(Correction_HSol)) OR #time#<=time_op(#[Extérieur][Météo][Lever du soleil]#,tag(Correction_HSol)) OR genericType(BRIGHTNESS,#name(object,trigger())#) <= tag(Seuil_Luminosite))
[2022-02-02 20:19:45][SCENARIO] Evaluation de la condition : ["" == 0 ET (2019>=1719 OR 2019<=824 OR "" <= 3000)] = Vrai
[2022-02-02 20:19:45][SCENARIO] - Exécution du sous-élément de type [action] : then
[2022-02-02 20:19:45][SCENARIO] Exécution d'un bloc élément : 459
[2022-02-02 20:19:45][SCENARIO] - Exécution du sous-élément de type [action] : action
[2022-02-02 20:19:45][SCENARIO] Exécution d'un bloc élément : 460
[2022-02-02 20:19:45][SCENARIO] - Exécution du sous-élément de type [action] : action
[2022-02-02 20:19:45][SCENARIO] Suppression des blocs DANS et A programmés du scénario
[2022-02-02 20:19:45][SCENARIO] Fin correcte du scénario

çà je pense pas que çà marche …

d’où le Evaluation de la condition : ["" == 0 qui ne test rien

1 « J'aime »

ça marche dans les logs pourtant:

[2022-02-02 20:19:43][SCENARIO] -- Start : Scenario execute automatiquement sur evenement venant de :  genericType(PRESENCE,#[Couloir]#) from [Couloir][Philips.SML001 couloir][Presence].
[2022-02-02 20:19:43][SCENARIO] - Exécution du sous-élément de type [action] : action
[2022-02-02 20:19:43][SCENARIO]    Log : "'[Couloir][Philips.SML001 couloir][Présence]:'+[Couloir][Philips.SML001 couloir][Présence]
[2022-02-02 20:19:43][SCENARIO]    Log : 11068
[2022-02-02 20:19:43][SCENARIO]    Log : 0
[2022-02-02 20:19:43][SCENARIO]    Log : Couloir

Une conversion en tag puis test dessus peu être…je testerai ce soir :smiley:

Sinon au pire regarde du coté du plugin genericTypeManager, il a été conçu pour cela. Sinon le plugin scenarioAdvanced permet l’exécution de ceci par exemple « [#triggerObject#][Lumiere][On] », donc un scénario peut être utilisé pour tous les objets.

1 « J'aime »

Bonsoir
Du coup,j’ai abandonné l’idée. Au final j’ai migré mon eclairage vers zigbeelinker et j’ai remplacé mes scenarios par des envois d’ordres dans le plug in.

Je regarderai leplygin que tu proposes demain et tagguerai ton post en solution si ça repond au problème d’origine.

bonjour,
ça semble effectivement répondre au besoin initial.
Pour ma culture, tu t’es inspiré de nodered pour scénario advanced?

Ce sujet a été automatiquement fermé après 24 heures suivant le dernier commentaire. Aucune réponse n’est permise dorénavant.