FHEM Forum

FHEM => Anfängerfragen => Thema gestartet von: Invers am 24 Juni 2013, 15:28:37

Titel: bitte um geduldige, ausführliche Hilfe
Beitrag von: Invers am 24 Juni 2013, 15:28:37
Guten Tag, allen, die helfen wollen.
Ich bin neu hier und das ist natürlich deshalb so, weil ich keine Ahnung, aber dafür Fragen habe.

Vorab möchte ich noch sagen, dass ich Computerfreak bin und auch über Technik- und Programmierkenntnisse verfüge. Leider nicht in Perl.

Nun aber zu meinem Problem:

Ich habe vor einigen Tagen auf meiner Fritzbox 7390 den FHEM (nicht von AVM) installiert und arbeite als rootuser.
nach erfolgreichem Anlegen einiger Steckdosen habe ich nach hiesiger Anleitung Watchdog und Twilight konfiguriert.
nun habe ich leider nicht begriffen, wie ich Meine Steckdose mit Namen Uhr dazu bringen kann, wenn mein Handy im Netzwerk eingeloggt ist. Ich verstehe nicht, wie ich den Zustand von Watchdog zum Schalten nutzen kann.

Also noch einmal kurz mein Anliegen:
Ich bin zu Hause (present), also eingeloggt,             Uhr = an
Ich bin nicht zu Hause (absent), also nicht eingeloggt,  Uhr = aus

Hier noch meine ehfm.cfg




attr global autoload_undefined_devices 1
attr global logfile ./log/fhem-%Y-%m.log
attr global modpath .
attr global statefile ./log/fhem.save
attr global userattr devStateIcon icon sortby webCmd
attr global verbose 3

define telnetPort telnet 7072 global

define WEB FHEMWEB 8083 global
attr WEB stylesheetPrefix dark

define WEBphone FHEMWEB 8084 global
attr WEBphone stylesheetPrefix smallscreen

define WEBtablet FHEMWEB 8085 global
attr WEBtablet stylesheetPrefix touchpad

# Fake FileLog entry, to access the fhem log from FHEMWEB
define Logfile FileLog ./log/fhem-%Y-%m.log fakelog

define autocreate autocreate
attr autocreate autosave 1
attr autocreate device_room %TYPE
attr autocreate filelog ./log/%NAME-%Y.log
attr autocreate weblink 1
attr autocreate weblink_room Plots

# Disable this to avoid looking for new USB devices on startup
# define initialUsbCheck notify global:INITIALIZED usb create


# If the above notify did not helped, then you probably have to enable some of
# the following lines.  Verify first that /dev/xxx ist correct.

#define FHZ FHZ /dev/USB0
#define CUL CUL /dev/ttyACM0@38400 1234
#attr CUL rfmode HomeMatic

#define EUL TCM 310 /dev/ttyACM0@38400
#define BscBor TCM 120 /dev/ttyUSB0@9600
#define BscSmartConnect TCM 310 /dev/ttyUSB0@57600

define fbaha FBAHA localhost:2002

define CUL_0 CUL /dev/ttyACM0@38400 1034

define Rechts IT 0000FFF00F FF F0
attr Rechts IODev CUL_0
attr Rechts model itswitch
attr Rechts room WZ

define Wand IT 0000F00F0F FF F0
attr Wand IODev CUL_0
attr Wand model itswitch
attr Wand room WZ

define Links IT 0000000F0F FF F0
attr Links IODev CUL_0
attr Links model itswitch
attr Links room WZ

define LED IT 00000F000F FF F0
attr LED IODev CUL_0
attr LED model itswitch
attr LED room WZ

define Schlaf IT 000000000F FF F0
attr Schlaf IODev CUL_0
attr Schlaf model itswitch
attr Schlaf room WZ

define PC FBDECT 16 switch
attr PC event-min-interval power:120
attr PC room FBDECT
define FileLog_PC FileLog ./log/PC-%Y.log PC:power.*
attr FileLog_PC logtype power4:Power,text
attr FileLog_PC room FBDECT
define weblink_PC weblink fileplot FileLog_PC:power4:CURRENT
attr weblink_PC label "PC Min $data{min1}, Max $data{max1}, Last $data{currval1}"
attr weblink_PC room WZ

# define Wetter weblink iframe http://www.wetteronline.de/cgi - bin/hpweather?PLZ=12627

define Uhr IT F00000000F FF F0
attr Uhr IODev CUL_0
attr Uhr model itswitch
attr Uhr room WZ

define myTwilight Twilight 52.53264390  13.60628510 3 638242

define Handy PRESENCE lan-ping 192.168.178.21 10

define watchdog_Anwesenheit watchdog Handy:absent 00:01 Handy:present set Uhr on
attr watchdog_Anwesenheit regexp1WontReactivate 1


Vielen Dank im Voraus schon mal für eure Hilfe und Erklärung.

Titel: Aw: bitte um geduldige, ausführliche Hilfe
Beitrag von: bugster_de am 24 Juni 2013, 22:32:45
Hi,

nur als kleiner Schnellschuss:

Deine Zeile:
define watchdog_Anwesenheit watchdog Handy:absent 00:01 Handy:present set Uhr on

Sollte eher das hier sein:
define watchdog_Anwesenheit watchdog Handy:absent 00:01 Handy:present { fhem("set Uhr on;;") }

In den geschweiften Klammern wird dann direkt Perl Code ausfegührt und via fhem( ".." ) dann wieder ein fhem Befehl ausgeführt. Ist zwar doppelt gemoppelt aber sollte wohl gehen
Titel: Aw: bitte um geduldige, ausführliche Hilfe
Beitrag von: Invers am 24 Juni 2013, 23:23:46
Danke für die Erläuterung der Zeile. Hat geholfen. Ich habe nun die Zeile übernommen, die Uhr wird aber nicht geschaltet.

Verstehe ich das richtig?
watchdog Handy:absent 00:01 fragt einmal pro Minute, ob mein Handy im Netzwerk ist. Nicht da, also absent.
Handy:present { fhem("set Uhr on;;") } Falls nicht, schaltet es die Uhr ein? Das wäre ja falsch. Wenn ich nicht da bin, soll sie ja aus?


Wie wird sie nun automatisch wieder ausgeschaltet, wenn ich das Netz verlasse? brauche ich dafür eine neue Zeile? Kann mir jemand zum Vergleich noch diese Zeile vorsagen? :-)

Titel: Aw: bitte um geduldige, ausführliche Hilfe
Beitrag von: Invers am 25 Juni 2013, 22:20:42
So, habe es selber zusammengebastelt.
Weiss jemand, wie ich Twilight als zusaätzliches Schaltkriterium ensetzen kann?
Warum bekomme ich immer folgende Meldung in der cfg: 2013.06.25 21:10:49 1: [TWILIGHT] No Weather location found at yahoo weather for location ID: 638242
Falls die bisherige Lösung wen interessiert:

define Uhr IT F00000000F FF F0
attr Uhr IODev CUL_0
attr Uhr model itswitch
attr Uhr room WZ

define myTwilight Twilight 52.53264390  13.60628510 3 638242

define Handy PRESENCE lan-ping 192.168.178.21 10

define watchdog_Abwesenheit watchdog Handy:absent 00:10 Handy:present setstate watchdog_Anwesenheit defined;;\
set Uhr off
attr watchdog_Abwesenheit regexp1WontReactivate 1

define watchdog_Anwesenheit watchdog Handy:present 00:00:10 Handy:absent setstate watchdog_Abwesenheit defined;;\
set Uhr on
attr watchdog_Anwesenheit regexp1WontReactivate 1