Du coup j’en profite pour partager mon scenario qui fait exactement ce que demande @dragonslore.
Le principe est le suivant : Sur ouverture de porte, je sauvegarde la date et j’attends 2min. Si 2min après le frigo n’est toujours pas fermé, je lance une notif, et je recheck 2min après, et ce 5 fois d’affilé, après quoi j’arrête de notifier (donc on est notifié toutes les 2min pendant 10min). Si la porte est fermée entre temps, le scénario termine.
Si y’a moyen de l’améliorer, n’hésitez pas
Scenario porte frigo
[
{
« id »: « 38 »,
« name »: null,
« type »: « if »,
« options »: [],
« order »: « 0 »,
« subElements »: [
{
« id »: « 89 »,
« name »: null,
« scenarioElement_id »: « 38 »,
« type »: « if »,
« subtype »: « condition »,
« options »: {
« enable »: « 1 »,
« allowRepeatCondition »: « 0 »
},
« order »: « 0 »,
« expressions »: [
{
« id »: « 121 »,
« scenarioSubElement_id »: « 89 »,
« type »: « condition »,
« subtype »: null,
« expression »: « #[Cuisine][Etat frigo][etat]# == 1 »,
« options »: [],
« order »: « 0 »
}
]
},
{
« id »: « 90 »,
« name »: null,
« scenarioElement_id »: « 38 »,
« type »: « then »,
« subtype »: « action »,
« options »: [],
« order »: « 1 »,
« expressions »: [
{
« id »: « 391 »,
« scenarioSubElement_id »: « 90 »,
« type »: « action »,
« subtype »: null,
« expression »: « tag »,
« options »: {
« enable »: « 1 »,
« background »: « 0 »,
« name »: « timestamp_debut »,
« value »: « #timestamp# »
},
« order »: « 0 »
},
{
« id »: « 400 »,
« scenarioSubElement_id »: « 90 »,
« type »: « action »,
« subtype »: null,
« expression »: « wait »,
« options »: {
« enable »: « 1 »,
« background »: « 0 »,
« condition »: « #[Cuisine][Etat frigo][etat]# == 0 »,
« timeout »: « 120 »
},
« order »: « 1 »
},
{
« id »: « 399 »,
« scenarioSubElement_id »: « 90 »,
« type »: « element »,
« subtype »: null,
« expression »: « 115 »,
« options »: [],
« order »: « 2 »,
« element »: {
« id »: « 115 »,
« name »: null,
« type »: « for »,
« options »: [],
« order »: « 0 »,
« subElements »: [
{
« id »: « 267 »,
« name »: null,
« scenarioElement_id »: « 115 »,
« type »: « for »,
« subtype »: « condition »,
« options »: {
« enable »: « 1 »
},
« order »: « 0 »,
« expressions »: [
{
« id »: « 392 »,
« scenarioSubElement_id »: « 267 »,
« type »: « condition »,
« subtype »: null,
« expression »: « 5 »,
« options »: [],
« order »: « 0 »
}
]
},
{
« id »: « 268 »,
« name »: null,
« scenarioElement_id »: « 115 »,
« type »: « do »,
« subtype »: « action »,
« options »: [],
« order »: « 1 »,
« expressions »: [
{
« id »: « 401 »,
« scenarioSubElement_id »: « 268 »,
« type »: « action »,
« subtype »: null,
« expression »: « tag »,
« options »: {
« enable »: « 1 »,
« background »: « 0 »,
« name »: « duration »,
« value »: « #timestamp# - #timestamp_debut# »
},
« order »: « 0 »
},
{
« id »: « 397 »,
« scenarioSubElement_id »: « 268 »,
« type »: « element »,
« subtype »: null,
« expression »: « 116 »,
« options »: [],
« order »: « 1 »,
« element »: {
« id »: « 116 »,
« name »: null,
« type »: « if »,
« options »: [],
« order »: « 0 »,
« subElements »: [
{
« id »: « 269 »,
« name »: null,
« scenarioElement_id »: « 116 »,
« type »: « if »,
« subtype »: « condition »,
« options »: {
« enable »: « 1 »,
« allowRepeatCondition »: « 0 »
},
« order »: « 0 »,
« expressions »: [
{
« id »: « 393 »,
« scenarioSubElement_id »: « 269 »,
« type »: « condition »,
« subtype »: null,
« expression »: « #[Cuisine][Etat frigo][etat]# == 1 »,
« options »: [],
« order »: « 0 »
}
]
},
{
« id »: « 270 »,
« name »: null,
« scenarioElement_id »: « 116 »,
« type »: « then »,
« subtype »: « action »,
« options »: [],
« order »: « 1 »,
« expressions »: [
{
« id »: « 394 »,
« scenarioSubElement_id »: « 270 »,
« type »: « action »,
« subtype »: null,
« expression »: « #[Salon][GH Mini][Parle !]# »,
« options »: {
« enable »: « 1 »,
« background »: « 0 »,
« title »: « »,
« message »: « Attention la porte du frigo est rest\u00e9e ouverte depuis substr(convertduration(#duration#), 0, strpos(convertduration(#duration#), "m")) minutes »
},
« order »: « 0 »
},
{
« id »: « 395 »,
« scenarioSubElement_id »: « 270 »,
« type »: « action »,
« subtype »: null,
« expression »: « #[Communication][Pushbullet][Xiaomi Redmi Note 4]# »,
« options »: {
« enable »: « 1 »,
« background »: « 0 »,
« title »: « »,
« message »: « Attention la porte du frigo est rest\u00e9e ouverte depuis substr(convertduration(#duration#), 0, strpos(convertduration(#duration#), "m")) minutes »
},
« order »: « 1 »
}
]
},
{
« id »: « 271 »,
« name »: null,
« scenarioElement_id »: « 116 »,
« type »: « else »,
« subtype »: « action »,
« options »: [],
« order »: « 2 »,
« expressions »: [
{
« id »: « 396 »,
« scenarioSubElement_id »: « 271 »,
« type »: « action »,
« subtype »: null,
« expression »: « stop »,
« options »: {
« enable »: « 1 »,
« background »: « 0 »
},
« order »: « 0 »
}
]
}
]
}
},
{
« id »: « 398 »,
« scenarioSubElement_id »: « 268 »,
« type »: « action »,
« subtype »: null,
« expression »: « wait »,
« options »: {
« enable »: « 1 »,
« background »: « 0 »,
« condition »: « #[Cuisine][Etat frigo][etat]# == 0 »,
« timeout »: « 120 »
},
« order »: « 2 »
}
]
}
]
}
}
]
},
{
« id »: « 93 »,
« name »: null,
« scenarioElement_id »: « 38 »,
« type »: « else »,
« subtype »: « action »,
« options »: [],
« order »: « 2 »,
« expressions »: []
}
]
}
]