FHEM Forum

FHEM => Anfängerfragen => Thema gestartet von: tndx am 21 April 2016, 23:53:31

Titel: [erledigt] Notify scheint trotz korrekter Syntax nicht ausgeführt zu werden
Beitrag von: tndx am 21 April 2016, 23:53:31
Hallo zusammen,

ich verzweifle nun schon seit Stunden an einer einfachen Aufgabe, und hoffe, jemand kann mich erlösen.

Ich versuche mit einem Notify den Status eines Dummy-Devices mit dem Status meiner Lüftungsanlage zu synchronisieren.

Meine Konfiguration:


#Dummy devices
define StufeX dummy
attr StufeX devStateIcon abwesend:rc_0 niedrig:rc_1 mittel:rc_2 hoch:rc_3
attr StufeX room Heizungsraum
attr StufeX setList state:abwesend,niedrig,mittel,hoch
attr StufeX webCmd state

#define n_Stufe notify StufeX set ComfoAir350 Stufe $EVENT
define n_caStufe1 notify ComfoAir350:Stufe set StufeX $EVENT
#define n_caStufe2 notify ComfoAir350:Stufe:niedrig set StufeX niedrig

# ComfoAir
define ComfoAir350 ComfoAir /dev/ttyUSB0@9600 0


Es funktioniert weder c_caStufe1 noch n_caStufe2 (ich lasse immer eines der beiden auskommentiert) obwohl auf dem Event Monitor alle 4 Sekunden

ComfoAir ComfoAir350 Stufe: niedrig

erscheint.

Ich bin ein absoluter Neuling in FHEM, aber den umgekehrten Weg, n_Stufe (anstelle von c_caStufe1 und n_caStufe2), habe ich hingekriegt. Deswegen kann ich nicht verstehen wieso c_caStufe1 bzw. n_caStufe2 trotz offenbar gleicher Syntax nicht funktionieren. Habe ich irgendwas Entscheidendes übersehen?
Titel: Antw:Notify scheint trotz korrekter Syntax nicht ausgeführt zu werden
Beitrag von: ht am 22 April 2016, 00:21:50
Hi tndx,

ja, darüber bin ich auch erst gestolpert. Dein Problem ist in der Doku zu notify wie folgt beschrieben:

ZitatDas <Suchmuster> muss exakt (!) entweder dem Gerätenamen entsprechen oder der Zusammenfügung aus Gerätename:Event. Events lassen sich mit "inform" in Telnet oder durch Beobachtung des "Event-Monitors" in FHEMWEB ermitteln.

Entsprechend must Du bei der 1. Form den Rest des Events mit Wildcard suchen. Und bei der zweiten Form ist das Leerzeichen das Problem. Versuche mal

define n_caStufe1 notify ComfoAir350:Stufe.* set StufeX $EVENT
define n_caStufe2 notify ComfoAir350:Stufe:\sniedrig set StufeX niedrig


Hoffe das löst Dein Problem,
Volker
Titel: Antw:Notify scheint trotz korrekter Syntax nicht ausgeführt zu werden
Beitrag von: tndx am 22 April 2016, 17:55:01
Zitat von: ht am 22 April 2016, 00:21:50
Entsprechend must Du bei der 1. Form den Rest des Events mit Wildcard suchen. Und bei der zweiten Form ist das Leerzeichen das Problem.

Vielen Dank, jetzt bin ich schon einen Riesenschritt weiter. Die 2. Form funktioniert ohne Probleme, damit komme ich schon mal weiter. Bei der 1. wird allerdings als Status "Stufe: niedrig" eingetragen, anstelle von "niedrig". Kriegt man das auch noch irgendwie hin? Dann spare ich mir 3 notifys für andere Werte...
Titel: Antw:Notify scheint trotz korrekter Syntax nicht ausgeführt zu werden
Beitrag von: CoolTux am 22 April 2016, 19:00:48
Du kannst die einzelnen Parts von $EVENT nehmen. In Deinem Fall wäre es $EVTPART1
Titel: Antw:Notify scheint trotz korrekter Syntax nicht ausgeführt zu werden
Beitrag von: marvin78 am 22 April 2016, 21:11:41
Bitte die commandref zu notify lesen!
Titel: Antw:[erledigt] Notify scheint trotz korrekter Syntax nicht ausgeführt zu werden
Beitrag von: franky08 am 23 April 2016, 09:47:23
Steht aber da, ziemlich weit oben  ;)
ZitatNotes:
<pattern> is either the name of the triggering device, or devicename:event.
<pattern> must completely (!) match either the device name, or the compound of the device name and the event. To identify the events use the inform command from the telnet prompt or the "Event Monitor" link in the browser (FHEMWEB), and wait for the event to be printed. See also the eventTypes device.
in the command section you can access the event:
The variable $EVENT will contain the complete event, e.g. measured-temp: 21.7 (Celsius)
$EVTPART0,$EVTPART1,$EVTPART2,etc contain the space separated event parts (e.g. $EVTPART0="measured-temp:", $EVTPART1="21.7", $EVTPART2="(Celsius)". This data is available as a local variable in perl, as environment variable for shell scripts, and will be textually replaced for FHEM commands.

VG
Frank
Titel: Antw:[erledigt] Notify scheint trotz korrekter Syntax nicht ausgeführt zu werden
Beitrag von: marvin78 am 25 April 2016, 07:21:05
Interessant. Wenn bei mir was nicht läuft, ist immer der erste Blick in den Code und wenn ich dort nichts entdecke, in die Doku. Dass man sich nicht alles merken kann, ist logisch, wenn man kein entsprechendes idetisches Gedächtnis besitzt.