FHEM Forum

FHEM => Anfängerfragen => Thema gestartet von: ChrisW am 28 Oktober 2013, 09:06:33

Titel: Watchdog formatierung mehrere befehle ausführen
Beitrag von: ChrisW am 28 Oktober 2013, 09:06:33
Hallo,
irgendwie bekomme ich es nicht hin mit meinem Watchdog mehr als nur 1 befehl auszuführen ; usw. klappt nicht. Vielleicht liegt es auch an dem speziellen befehl ?

Derzeitiges Watchdog:
define watchdog_htpc_abwesenheit watchdog einerda:absent 00:02 einerda:present set notifychris send Keiner ist zuhause HTPC aus|Keiner Zuhause HTPC aus|Keiner Zuhause HTPC aus|Keiner ist zuhause HTPC aus|1
attr watchdog_htpc_abwesenheit regexp1WontReactivate 1


So hinzukommen soll folgendes Formatierung aus der fhem.cfg:



   fhem (GetHttpFile("192.168.2.3:81", "/API/shutdown request noreply"));;\
    Log (3,"Keiner Zuhause HTPC AUSGESCHALTET");;\


Wie bekomme ich das sauber ins Watchdog ? Vor allen der GetHttpFile

So hab ich es davor gelöst:
define HTPC_AUS_ABWESEND notify einerda:.* { \
if (Value("einerda") eq "present") { \
} \
else { \
    fhem (GetHttpFile("192.168.2.3:81", "/API/shutdown request noreply"));;\
    fhem("set notifychris send Keiner ist zuhause alles aus|Keiner Zuahuse|Keiner Zuhause|Keiner ist zuhause alles #aus|1");; \
    Log (3,"Keiner Zuhause HTPC AUSGESCHALTET");;\
}\
}



Und noch eine Frage am ende wieso geb ich im Watchdog "present" an obwohl ich ich ja normal "absent" will?? Wieso ist das umgedreht ?? Es funktioniert ja auch ... ;)
Titel: Antw:Watchdog formatierung mehrere befehle ausführen
Beitrag von: ChrisW am 29 Oktober 2013, 10:56:15
keiner eine idee ? wie ich mit 1 watchdog mehrere dinge ausführen kann??
Titel: Antw:Watchdog formatierung mehrere befehle ausführen
Beitrag von: ritchie am 28 November 2013, 20:35:39
Hallo Chris,

ich würde Dir folgenden Code empfehlen.

Diesen habe ich heute in Betrieb genommen:


define evtwatchdog_HandyAbwesend watchdog HandyBlueTooth:absent|HandyWLAN:absent 00:05 HandyBlueTooth:present|HandyWLAN:present {evtAbsentHandler()}; setstate evtwatchdog_HandyAbwesend defined
attr evtwatchdog_HandyAbwesend regexp1WontReactivate 1
attr evtwatchdog_HandyAbwesend room events

define evtHandy notify HandyBlueTooth:present|HandyWLAN:present { fhem("set Anwesend present") ;; fhem("setstate evtwatchdog_HandyAbwesend defined");; }
attr evtHandy room events




Die Routine in meiner my_utils definiert.


sub evtAbsentHandler()
{
if ( Value("HandyWLAN") eq 'absent' and Value("HandyBlueTooth") eq 'absent' )
{
fhem("set Anwesend absent");
}

   return;
}


Vielleicht hilft Dir das ja.

Gruss R.