Hab den Tag heute genutzt mich mit dem Thema Logiken zu beschäftigen und jetzt einige grundlegende Fragen, da ich hier nicht weiterkomme.
1. Logiken triggern mit Visu
Meine Logik hab ich testweise folgendermaßen definiert:
Item.conf:
Dann die Visu:
{{ basic.button('Develop', 'EG.Develop','press')}}
Beim Klick auf den Button wird die Logik sauber getriggert. Dann hab ich folgendes in der Doku gefunden:
Entsprechend Doku 1.0 gibt es das "visu_acl" Attribut ja auch für Logiken.
Kann ich denn die Logik auch direkt auf den Button legen, also ohne die item.conf?
2. Zugriff auf Logik Eigenschaften / Methoden
Entsprechend Doku:
Demnach hab ich versucht mit logic.develop die Logik manuell über die interactive console zu triggern. Allerdings ohne Erfolg. Wie kann ich oben genanntes anwenden?
3. Timer setzen
Bei Änderung des Items EG.Buero.Fenster triggere ich meine Logik [window_alert] und möchte dann einen autotimer setzen. Sollte das Fenster nach 10min immer noch offen sein, soll ein Alarm gesetzt werden.
Hierzu hab ich mit sh.EG.Buero.Fenster.autotimer('10m',1) versucht die Logik erneut zu triggern. Hat allerdings nicht geklappt. Wie geht man hier am besten vor?
Danke und Gruß
1. Logiken triggern mit Visu
Meine Logik hab ich testweise folgendermaßen definiert:
Code:
[develop] filename = logic_develop.py visu_acl = true watch_item = EG.Develop
Code:
[EG] [[Develop]] type = bool visu_acl = rw
{{ basic.button('Develop', 'EG.Develop','press')}}
Beim Klick auf den Button wird die Logik sauber getriggert. Dann hab ich folgendes in der Doku gefunden:
Entsprechend Doku 1.0 gibt es das "visu_acl" Attribut ja auch für Logiken.
logic.conf
You could specify the visu_acl attribute to every logic in your logic.conf. This way you could trigger the logic via the interface.
[dialog]
filename = 'dialog.py'
visu_acl = true
You could specify the visu_acl attribute to every logic in your logic.conf. This way you could trigger the logic via the interface.
[dialog]
filename = 'dialog.py'
visu_acl = true
2. Zugriff auf Logik Eigenschaften / Methoden
Entsprechend Doku:
logic
This object provides access to the current logic object. It is possible to change logic attributes (crontab, cycle, ...) during runtime. They will be lost after restarting SmartHome.py. while logic.alive: creates an endless loop. This way SmartHome.py could stop the loop at shutdown. Next section (trigger) describes the special function logic.trigger(). Predefined attributs of the logic object:
logic.name: with the name of the logic as specified in logic.conf
logic.last_time(): this function provides the last run of this logic (before the recent one)
logic.prio: read and set of the current priority of this logic.
This object provides access to the current logic object. It is possible to change logic attributes (crontab, cycle, ...) during runtime. They will be lost after restarting SmartHome.py. while logic.alive: creates an endless loop. This way SmartHome.py could stop the loop at shutdown. Next section (trigger) describes the special function logic.trigger(). Predefined attributs of the logic object:
logic.name: with the name of the logic as specified in logic.conf
logic.last_time(): this function provides the last run of this logic (before the recent one)
logic.prio: read and set of the current priority of this logic.
3. Timer setzen
Bei Änderung des Items EG.Buero.Fenster triggere ich meine Logik [window_alert] und möchte dann einen autotimer setzen. Sollte das Fenster nach 10min immer noch offen sein, soll ein Alarm gesetzt werden.
Hierzu hab ich mit sh.EG.Buero.Fenster.autotimer('10m',1) versucht die Logik erneut zu triggern. Hat allerdings nicht geklappt. Wie geht man hier am besten vor?
Danke und Gruß
Kommentar