Gelöst: Probleme mit Plot für Anwesenheit, absent/present

Begonnen von KNUT345, 29 November 2014, 09:38:33

Vorheriges Thema - Nächstes Thema

KNUT345

Hallo,
ich versuche schon seit geraumer Zeit die Anwesenheitsüberwachung in einem "sauberen" Plot, wie ich das für meine Fensterkontakte realisiert habe darzustellen, aber es klappt einfach nicht.
Ich habe das Forum/Internet mehrfach befragt aber keinen verwertbaren Hinweis finden können und hoffe nun, dass ihr mir einen Tipp geben könnt.

Für die Fensterkontakte habe ich:

# Created by FHEM/98_SVG.pm, 2014-10-26 14:53:11
set terminal png transparent size <SIZE> crop
set output '<OUT>.png'
set xdata time
set timefmt "%Y-%m-%d_%H:%M:%S"
set xlabel " "
set title '<TL>'
set ytics ("auf" 1, "gekippt" 0.8, "zu" 0, "ok" 0.5)
set y2tics ("auf" 1, "gekippt" 0.8, "zu" 0, "ok" 0.5)
set grid ytics
set ylabel "Satus"
set y2label ""
set yrange 0:1
set y2range 0:1

#FileLog 4:Fenster_...contact::$fld[3]&&$fld[3]=~"open"?1:($fld[3]&&$fld[3]=~"tilted"?0.8:0)
#FileLog 4:Fenster_...battery::$fld[2]&&$fld[2]=~"ok"?0:0.5

plot "<IN>" using 1:2 axes x1y1 title 'Fenster' ls l0 lw 3 with steps,\
     "<IN>" using 1:2 axes x1y1 title 'Batterie' ls l1 lw 3 with steps


und das liefert mir ein absolut sauberen rechteckigen Plot.

Das zugehörige Log-File sieht so aus:

2014-11-28_07:38:13 Fenster_BZ battery: ok
2014-11-28_07:38:13 Fenster_BZ contact: closed (to CUL1)
2014-11-28_07:53:26 Fenster_BZ Activity: dead
2014-11-28_12:30:04 Fenster_BZ battery: ok
2014-11-28_12:30:04 Fenster_BZ open
2014-11-28_12:30:04 Fenster_BZ contact: open (to Thermostat_BZ)
2014-11-28_12:30:05 Fenster_BZ trigDst_F11234: noConfig
2014-11-28_12:30:05 Fenster_BZ battery: ok
2014-11-28_12:30:05 Fenster_BZ contact: open (to CUL1)
2014-11-28_12:33:27 Fenster_BZ Activity: alive
2014-11-28_12:43:27 Fenster_BZ Activity: dead
2014-11-28_13:12:01 Fenster_BZ battery: ok
2014-11-28_13:12:01 Fenster_BZ closed
2014-11-28_13:12:01 Fenster_BZ contact: closed (to Thermostat_BZ)
2014-11-28_13:12:01 Fenster_BZ trigDst_F11234: noConfig
2014-11-28_13:12:01 Fenster_BZ battery: ok
2014-11-28_13:12:01 Fenster_BZ contact: closed (to CUL1)
2014-11-28_13:13:27 Fenster_BZ Activity: alive
2014-11-28_13:23:27 Fenster_BZ Activity: dead
2014-11-28_21:06:08 Fenster_BZ battery: ok
2014-11-28_21:06:08 Fenster_BZ tilted
2014-11-28_21:06:08 Fenster_BZ contact: tilted (to Thermostat_BZ)
2014-11-28_21:06:09 Fenster_BZ trigDst_F11234: noConfig
2014-11-28_21:06:09 Fenster_BZ battery: ok
2014-11-28_21:06:09 Fenster_BZ contact: tilted (to CUL1)
2014-11-28_21:06:09 Fenster_BZ battery: ok
2014-11-28_21:06:09 Fenster_BZ contact: tilted (to Thermostat_BZ)
2014-11-28_21:13:30 Fenster_BZ Activity: alive
2014-11-28_21:14:58 Fenster_BZ battery: ok
2014-11-28_21:14:58 Fenster_BZ closed
2014-11-28_21:14:58 Fenster_BZ contact: closed (to Thermostat_BZ)
2014-11-28_21:14:59 Fenster_BZ trigDst_F11234: noConfig
2014-11-28_21:14:59 Fenster_BZ battery: ok
2014-11-28_21:14:59 Fenster_BZ contact: closed (to CUL1)
2014-11-28_21:33:30 Fenster_BZ Activity: dead


Wenn ich nun versuche das Gleiche für die Anwesenheitsüberwachung umzusetzen, dann bekomme ich einfach keinen sauberen rechteckigen Plot hin,
der Graph ist immer wieder mit Nullwerten ergänzt.
Ich habe keine Ahnung wo das herkommen soll.
Um das zu umgehen habe ich Points statt Steps verwendet, siehe Line1 und andere Linien.

# Created by FHEM/98_SVG.pm, 2014-11-29 05:55:11
set terminal png transparent size <SIZE> crop
set output '<OUT>.png'
set xdata time
set timefmt "%Y-%m-%d_%H:%M:%S"
set xlabel " "
set title '<TL>'
set ytics ("anwesend" 1, "weg" 0.2)
set y2tics ("anwesend" 1, "weg" 0.2)
set grid ytics
set ylabel " "
set y2label " "
set yrange [0:1.5]
set y2range [0:1.5]

#FileLog 3:Franz_Handy.*::$fld[2]=~"present"?1.5:($fld[2]=~"absent"?0.2:0)
#FileLog 3:Heike_Handy.*::$fld[2]&&$fld[2]=~"present"?1.4:($fld[2]&&$fld[2]=~"absent"?0.2:0)
#FileLog 3:Olivia_Handy.*::$fld[2]&&$fld[2]=~"present"?1.3:($fld[2]&&$fld[2]=~"absent"?0.2:0)
#FileLog 3:Melissa_Handy.*::$fld[2]=~"present"?1.2:($fld[2]=~"absent"?0.2:0)
#FileLog 3:Anwesenheit.*::$fld[2]&&$fld[2]=~"present"?1.0:($fld[2]&&$fld[2]=~"absent"?0.2:0)

plot "<IN>" using 1:2 axes x1y1 title 'H1' ls l0 lw 3 with steps,\
     "<IN>" using 1:2 axes x1y1 title 'H2' ls l1 lw 3 with points,\
     "<IN>" using 1:2 axes x1y1 title 'H3' ls l2 lw 3 with points,\
     "<IN>" using 1:2 axes x1y1 title 'H4' ls l3 lw 3 with points,\
     "<IN>" using 1:2 axes x1y1 title 'Anwesend' ls l4 lw 3 with Points


Das zugehörige Log-File sieht so aus:

2014-11-29_08:56:24 Anwesenheit present
2014-11-29_08:56:24 H1_Handy present
2014-11-29_08:56:24 Anwesenheit LastDevice: H4_Handy
2014-11-29_08:56:24 Anwesenheit LastDevice_Abs: H4_Handy
2014-11-29_08:56:24 H4_Handy present
2014-11-29_08:56:39 Anwesenheit LastDevice: H3_Handy
2014-11-29_08:56:39 Anwesenheit LastDevice_Abs: H3_Handy
2014-11-29_08:56:39 H3_Handy absent
2014-11-29_08:56:39 Anwesenheit LastDevice: H2_Handy
2014-11-29_08:56:39 Anwesenheit LastDevice_Abs: H2_Handy
2014-11-29_08:56:39 H2_Handy absent
2014-11-29_09:01:37 Anwesenheit LastDevice: H4_Handy
2014-11-29_09:01:37 Anwesenheit LastDevice_Abs: H4_Handy
2014-11-29_09:01:37 Anwesenheit present
2014-11-29_09:01:37 H4_Handy present
2014-11-29_09:01:37 Anwesenheit LastDevice: H1_Handy
2014-11-29_09:01:37 Anwesenheit LastDevice_Abs: H1_Handy
2014-11-29_09:01:37 H1_Handy present
2014-11-29_09:01:40 Anwesenheit LastDevice: H3_Handy
2014-11-29_09:01:40 Anwesenheit LastDevice_Abs: H3_Handy
2014-11-29_09:01:40 H3_Handy absent
2014-11-29_09:01:40 Anwesenheit LastDevice: H2_Handy
2014-11-29_09:01:40 Anwesenheit LastDevice_Abs: H2_Handy
2014-11-29_09:01:40 H2_Handy absent
2014-11-29_09:11:54 Anwesenheit LastDevice: H4_Handy
2014-11-29_09:11:54 Anwesenheit LastDevice_Abs: H4_Handy
2014-11-29_09:11:54 Anwesenheit present
2014-11-29_09:11:54 H4_Handy present
2014-11-29_09:11:54 Anwesenheit LastDevice: H1_Handy
2014-11-29_09:11:54 Anwesenheit LastDevice_Abs: H1_Handy
2014-11-29_09:11:54 H1_Handy present
2014-11-29_09:12:10 Anwesenheit LastDevice: H3_Handy
2014-11-29_09:12:10 Anwesenheit LastDevice_Abs: H3_Handy
2014-11-29_09:12:10 H3_Handy absent
2014-11-29_09:12:11 Anwesenheit LastDevice: H2_Handy
2014-11-29_09:12:11 Anwesenheit LastDevice_Abs: H2_Handy
2014-11-29_09:12:10 H2_Handy absent
2014-11-29_09:22:10 Anwesenheit LastDevice: H1_Handy
2014-11-29_09:22:10 Anwesenheit LastDevice_Abs: H1_Handy
2014-11-29_09:22:10 Anwesenheit present
2014-11-29_09:22:10 H1_Handy present
2014-11-29_09:22:10 Anwesenheit LastDevice: H4_Handy
2014-11-29_09:22:10 Anwesenheit LastDevice_Abs: H4_Handy
2014-11-29_09:22:10 H4_Handy present
2014-11-29_09:22:41 Anwesenheit LastDevice: H3_Handy
2014-11-29_09:22:41 Anwesenheit LastDevice_Abs: H3_Handy
2014-11-29_09:22:41 H3_Handy absent
2014-11-29_09:22:41 Anwesenheit LastDevice: H2_Handy
2014-11-29_09:22:41 Anwesenheit LastDevice_Abs: H2_Handy
2014-11-29_09:22:41 H2_Handy absent

Kann man das nicht besser machen?

Danke im voraus.

KNUT345


KNUT345

Problem liegt an den periodischen Einträgen des Presence-Moduls.
Ist mir nicht gelungen in den Einstellungen das entsprechend zu konfigurieren,
habe daraufhin die Anwesenheit mittels einem Notify,
das zuvor überprüft, ob der Status gewechselt hat, überprüft.

strauch

Dann hilft nur ein
attr presence_name event-on-change-reading state

Allerdings hast du dann vorne und hinten Plotabrisse. Da der erste Eintrag dann erst bei der ersten Änderung stattfindet.
FHEM 5.6 VMware mit Debian. 1 CUL für FS20 und HMLAN für Homematic, HM-CC-RT-DN, HM-LC_Sw1PBU-FM, HM-LC-Bl1PBU-FM,  HM-SEC-SC, HM-SEC-SC-2, HM-LC-Sw1-Pl2, HM-Sec-RHS, ASH2200, FHT80B, S20KSE, Sonos, XBMC, FB_Callmonitor, SMLUSB, Arduino Firmata, uvm.

justme1968

die meisten handys lassen sich nicht zuverlässig per wlan überwachen weil sich das wlan zum stromsparen schlafen legt.

je nach hand hilft es das auslösen per watchdog zu verzögern oder auf bluetooth oder snmp umzusteigen.

gegen plotabriss hilft event-min-Intervall zusätzlich zu event-on-change-reading, addLog oder logProxy.

gruß
  andre
hue, tradfri, alexa-fhem, homebridge-fhem, LightScene, readingsGroup, ...

https://github.com/sponsors/justme-1968

KNUT345

ja, da habe ich alles ausprobiert aber leider kam ich da nicht weiter

define KNUT_Handy PRESENCE lan-ping xxx.xxx.xxx.xxx 120 300
attr KNUT_Handy userattr Anwesenheit_structure Anwesenheit_structure_map structexclude
attr KNUT_Handy devStateIcon absent:FS20.off present:FS20.on
attr KNUT_Handy event-on-change-reading state:600
attr KNUT_Handy event-on-update-reading .*
attr KNUT_Handy group Anwesenheit
attr KNUT_Handy icon it_smartphone
attr KNUT_Handy room System
attr KNUT_Handy sortby 100


wie gesagt jetzt habe ich das über ein notify abgefangen,
habe das Ganze zur Heizungssteuerung verwenden wollen,
habe leider von der neuen Variante keinen zusammenhängenden Code, sorry...

Grüße

strauch

Zitat von: KNUT345 am 16 Dezember 2014, 14:21:32

attr KNUT_Handy event-on-change-reading state:600
attr KNUT_Handy event-on-update-reading .*


attr KNUT_Handy event-on-change-reading state

klappt bei mir wunderbar. Das 600 sorgt vermutlich wieder für ein 10min Interval.
FHEM 5.6 VMware mit Debian. 1 CUL für FS20 und HMLAN für Homematic, HM-CC-RT-DN, HM-LC_Sw1PBU-FM, HM-LC-Bl1PBU-FM,  HM-SEC-SC, HM-SEC-SC-2, HM-LC-Sw1-Pl2, HM-Sec-RHS, ASH2200, FHT80B, S20KSE, Sonos, XBMC, FB_Callmonitor, SMLUSB, Arduino Firmata, uvm.