GPS-Daten in FHEM einlesen - gelöst

Begonnen von fstefan1960, 22 August 2017, 18:08:45

Vorheriges Thema - Nächstes Thema

morph

Also, erst mal danke ich dir, das du dich meiner annimmst :-)


Die def bekomme ich natürlich in fhem hinein, aber dann setzt es auch schon aus bei mir.

Was mache ich mit dem anderen Code? und dem Dritten? Eine? Zwei Dateien erstellen? In Welches Verzeichnis?


Verzeih mir bitte, aber da bin ich nicht der Profi...

CBSnake

Kein Problem,

mach die beiden mal per def rein und schau ob du die zwei neuen Readings Link und gpx in deinem GPS Device bekommst und ob die Sinn machen. Dann erklär ich gerne weiter, muss aber erstmal laufen :-)

Achja GPS:lat muss natürlich ein Event "werfen" also falls du was mit event-on-change reading drin hast muss lat mit rein :-)
FHEM auf Debian 10, HM-Wlan, JeeLink-Wlan, Wlanduino, ConBee, TP-Link Steckdose, GHoma Steckdosen, Shelly Steckdosen

morph

Ah, jetzt wird es so langsam im mein Brain :-)

Zitat von: CBSnake am 18 Januar 2018, 08:47:55

define doif_gps doif (["GPS:lat"])((setreading GPS link https://maps.google.de/maps?q=[GPS:lat],[GPS:lon]))DOELSE

Macht im Device "GPS" einen weiteren Eintrag, und ich habe einen Link im Device GPS zu Google-Maps. Funktioniert auch!

Zitat von: CBSnake am 18 Januar 2018, 08:47:55

define doif_gps doif (["GPS:lat"])((setreading GPS gpx <trkpt lat="[GPS:lat]" lon="[GPS:lon]"><time>[GPS:time_utc]</time></trkpt>))DOELSE

Macht nochmal einen Eintrag im Device GPS mit dem Punkt gpx. Damit kann ich aber noch nichts anfangen ;-)

Das kommt dabei raus:


gpx <trkpt lat="48.41" lon="10.29"><time>2018-01-18T19:07:34.000Z</time></trkpt>


Ich nehme mal an, das wir daraus nun eine Datei erstellen? ;-)

CBSnake

Genau das Reading gpx bitte in ein eigenes Logfile. Klar wie man das mach?

Da kommt dann was raus mit

2018-01-18 20:15 GPS gpx <trkpt lat="48.41" lon="10.29"><time>2018-01-18T19:07:34.000Z</time></trkpt>

Bis zu diesem Punkt bin ich bisher gekommen. Nun holt man sich das Log vom FHEM Server auf den PC, macht es mit Excel auf, Excel fragt dann nach dem Trennzeichen, hier nur das Leerzeichen wählen und schwupps kannst du die Spalten die <trkpt........ </trkpt> markieren und kopieren.
Das kommt dann in ne Datei zwischen Anfang und Ende aus einem meiner letzten Beiträge und wird mit .gpx gespeichert. Nun kannst es mit Google Earth öffnen ;-)

Ziel ist das FHEM die gpx erstellt ;-)
FHEM auf Debian 10, HM-Wlan, JeeLink-Wlan, Wlanduino, ConBee, TP-Link Steckdose, GHoma Steckdosen, Shelly Steckdosen

morph

Hm. Also die beiden haben sich jeweils einmal "gemeldet" und danach nicht mehr. Der Datensatz ist noch der von vor einer Stunde.

Ich nehm mal an, das ich den beiden DOIF's sagen muss, das sie z.b. alle 30 sek den Status abfragen sollen? Wie?

CBSnake

Hm ne mach mal bei den doif das Attribut do auf Always
FHEM auf Debian 10, HM-Wlan, JeeLink-Wlan, Wlanduino, ConBee, TP-Link Steckdose, GHoma Steckdosen, Shelly Steckdosen

morph

 :o

Soooo einfach....

und Das mit dem GPX hab ich auch hinbekommen:

define Filelog_GPX FileLog ./log/Filelog_GPX-%Y-%U.log GPS:(gpx).*

Bekomme ich nun die, und nur die Zeilen:


2018-01-18_22:39:24 GPS gpx: <trkpt lat="48.41" lon="10.29"><time>2018-01-18T21:39:24.000Z</time></trkpt>
2018-01-18_22:39:54 GPS gpx: <trkpt lat="48.41" lon="10.2"><time>2018-01-18T21:39:54.000Z</time></trkpt>
2018-01-18_22:40:24 GPS gpx: <trkpt lat="48.41" lon="10.2"><time>2018-01-18T21:40:24.000Z</time></trkpt>
2018-01-18_22:40:54 GPS gpx: <trkpt lat="48.41" lon="10.2"><time>2018-01-18T21:40:54.000Z</time></trkpt>
2018-01-18_22:41:24 GPS gpx: <trkpt lat="48.41" lon="10.29"><time>2018-01-18T21:41:24.000Z</time></trkpt>
2018-01-18_22:41:55 GPS gpx: <trkpt lat="48.41" lon="10.29"><time>2018-01-18T21:41:54.000Z</time></trkpt>
2018-01-18_22:42:25 GPS gpx: <trkpt lat="" lon=""><time>2018-01-18T21:42:25.000Z</time></trkpt>
2018-01-18_22:42:55 GPS gpx: <trkpt lat="48.413" lon="10.29"><time>2018-01-18T21:42:55.000Z</time></trkpt>
2018-01-18_22:43:25 GPS gpx: <trkpt lat="48.411" lon="10.29"><time>2018-01-18T21:43:25.000Z</time></trkpt>
2018-01-18_22:44:01 GPS gpx: <trkpt lat="48.411" lon="10.29"><time>2018-01-18T21:44:01.000Z</time></trkpt>
2018-01-18_22:44:33 GPS gpx: <trkpt lat="48.411" lon="10.29"><time>2018-01-18T21:44:33.000Z</time></trkpt>


Okidoki.. Also soweit wie du :-)



morph

Gerade eben noch gesehen:

https://www.raspberrypi.org/forums/viewtopic.php?f=66&t=87217

Hat ,,leider" nix mit fhem zu tun, aber wird wohl die einfachste Lösung für ein Track sein?

Ich mach das mal morgen eben noch zusätzlich...

CBSnake

klingt, berichte doch mal obs klappt :-)
FHEM auf Debian 10, HM-Wlan, JeeLink-Wlan, Wlanduino, ConBee, TP-Link Steckdose, GHoma Steckdosen, Shelly Steckdosen

morph

Also, das hat tatsächlich geklappt. Das problem ist nur noch die Schreibweise der Datei, damit daraus ein GPX entstehen kann. Also im Prinzip das gleiche Problem das du auch noch hast.

CBSnake

FHEM auf Debian 10, HM-Wlan, JeeLink-Wlan, Wlanduino, ConBee, TP-Link Steckdose, GHoma Steckdosen, Shelly Steckdosen

hanami

#41
Hallo Zusammen,

auch ich beschäftige mich mit dem Thema GPS und FHEM für meinen Camper - durch Zufall bin ich auf diesen Thread gestoßen und habe gleich mal das Modul geladen und eingespielt.

Leider erhalte ich jedoch wenn ich das Device mit define GPS GPSD definiere, die Fehlermeldung Cannot load module GPSD.
Ich habe der Datei den User:fhem zugewiesen da ich Sie leider nur mit Root per SCP kopieren konnte und Sie somit erst Root war.

Habt Ihr eine Ahnung warum FHEM das Modul partout nicht finden will?
Oder muss ich noch etwas anderes machen ausser die config Neuladen bzw. neu zu starten?

Freue mich über Antworten und Tips.

beste Grüße

Edit: ich hab im Log etwas gefunden - wie beheb ich das? Es scheint als hat er ein problem mit demGPSD Parser:

018.04.22 00:30:36 1: reload: Error:Modul 49_GPSD deactivated:
Can't locate GPSD/Parse.pm in @INC (you may need to install the GPSD::Parse module) (@INC contains: . /etc/perl /usr/local/lib/arm-linux-gnueabihf/perl/5.20.2 /usr/local/share/perl/5.20.2 /usr/lib/arm-linux-gnueabihf/perl5/5.20 /usr/share/perl5 /usr/lib/arm-linux-gnueabihf/perl/5.20 /usr/share/perl/5.20 /usr/local/lib/site_perl ./FHEM) at ./FHEM/49_GPSD.pm line 24.
BEGIN failed--compilation aborted at ./FHEM/49_GPSD.pm line 24.

2018.04.22 00:30:36 0: Can't locate GPSD/Parse.pm in @INC (you may need to install the GPSD::Parse module) (@INC contains: . /etc/perl /usr/local/lib/arm-linux-gnueabihf/perl/5.20.2 /usr/local/share/perl/5.20.2 /usr/lib/arm-linux-gnueabihf/perl5/5.20 /usr/share/perl5 /usr/lib/arm-linux-gnueabihf/perl/5.20 /usr/share/perl/5.20 /usr/local/lib/site_perl ./FHEM) at ./FHEM/49_GPSD.pm line 24.
BEGIN failed--compilation aborted at ./FHEM/49_GPSD.pm line 24.

Ich habe das Modul GPSD Parser installiert, hierbei gibt es beim Testen nach der Installation jedoch Fehlerausgaben sodass es nicht abschließend installiert zusein scheint.



Wernieman

Da fehlt Dir ein Perl Modul ....

Kann es jetzt nicht testen, aber mal probiert:
apt-get install libnet-gpsd3-perl

Ansonsten ... steht nicht in der Doku die benötigten Perl-Module?
- Bitte um Input für Output
- When there is a Shell, there is a Way
- Wann war Dein letztes Backup?

Wie man Fragen stellt: https://tty1.net/smart-questions_de.html

hanami

Hallo Wernieman,

Vielen Dank für den Tip - habe das Paket nun installiert, jedoch
Tut sich nach reboot leider nichts.
Hat vielleicht noch jemand einen Tip?

Habe nun mehrfach verschiedene Wege ausprobiert gpsd::parse
Zu installieren, leider will dies nicht Fehlerfrei von statten gehen  :(



Ich habe die Installation sowohl mit als auch ohne Bluetooth GPS Maus
Ausprobiert.
Mit CGPS erhalte ich auch valide Daten.


Vielleicht kann ja jemand in dem Gewusel etwas erkennen:


pi@KaWa:~ $ sudo cpan force install GPSD::Parse
Reading '/root/.cpan/Metadata'
  Database was generated on Sun, 22 Apr 2018 20:29:02 GMT
Warning: Cannot install force, don't know what it is.
Try the command


    i /force/


to find objects with matching identifiers.
install is up to date (0.01).
Running install for module 'GPSD::Parse'
Checksum for /root/.cpan/sources/authors/id/S/ST/STEVEB/GPSD-Parse-1.02.tar.gz ok
'YAML' not installed, will not store persistent state
Configuring S/ST/STEVEB/GPSD-Parse-1.02.tar.gz with Makefile.PL
Checking if your kit is complete...
Looks good
Generating a Unix-style Makefile
Writing Makefile for GPSD::Parse
Writing MYMETA.yml and MYMETA.json
  STEVEB/GPSD-Parse-1.02.tar.gz
  /usr/bin/perl Makefile.PL INSTALLDIRS=site -- OK
Running make for S/ST/STEVEB/GPSD-Parse-1.02.tar.gz
cp lib/GPSD/Parse.pm blib/lib/GPSD/Parse.pm
Manifying blib/man3/GPSD::Parse.3pm
  STEVEB/GPSD-Parse-1.02.tar.gz
  /usr/bin/make -- OK
Running make test
PERL_DL_NONLAZY=1 PERL_USE_UNSAFE_INC=1 /usr/bin/perl "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00-load.t ................ 1/? In socket mode...
t/00-load.t ................ ok   
t/05-poll.t ................


incomplete or empty dataset returned from GPS...


Use of uninitialized value $lat in pattern match (m//) at /root/.cpan/build/GPSD-Parse-1.02-au2pQo/blib/lib/GPSD/Parse.pm line 185, <GEN0> line 4.
t/05-poll.t ................ 1/?


incomplete or empty dataset returned from GPS...


Use of uninitialized value $lat in pattern match (m//) at /root/.cpan/build/GPSD-Parse-1.02-au2pQo/blib/lib/GPSD/Parse.pm line 185, <GEN0> line 5.


#   Failed test '...and it contains TPV ok'
#   at t/05-poll.t line 40.
#                   '{"class":"POLL","time":"2018-04-22T22:50:00.377Z","active":0,"tpv":[],"gst":[],"sky":[]}'
#     doesn't match '(?^:TPV)'
# Looks like you failed 1 test of 11.
t/05-poll.t ................ Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/11 subtests
t/10-time.t ................


incomplete or empty dataset returned from GPS...


Use of uninitialized value $lat in pattern match (m//) at /root/.cpan/build/GPSD-Parse-1.02-au2pQo/blib/lib/GPSD/Parse.pm line 185, <GEN0> line 4.
t/10-time.t ................ 1/?
#   Failed test '...and is ok'
#   at t/10-time.t line 27.
#                   undef
#     doesn't match '(?^:^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$)'
# Looks like you failed 1 test of 2.
t/10-time.t ................ Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/2 subtests
t/15-device.t ..............


incomplete or empty dataset returned from GPS...


Use of uninitialized value $lat in pattern match (m//) at /root/.cpan/build/GPSD-Parse-1.02-au2pQo/blib/lib/GPSD/Parse.pm line 185, <GEN0> line 4.
t/15-device.t .............. 1/?
#   Failed test '...and is ok'
#   at t/15-device.t line 27.
#                   undef
#     doesn't match '(?^:^/dev/ttyS0$)'
# Looks like you failed 1 test of 2.
t/15-device.t .............. Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/2 subtests
t/20-tpv.t .................


incomplete or empty dataset returned from GPS...


Use of uninitialized value $lat in pattern match (m//) at /root/.cpan/build/GPSD-Parse-1.02-au2pQo/blib/lib/GPSD/Parse.pm line 185, <GEN0> line 4.
t/20-tpv.t ................. 1/?
#   Failed test 'tpv() key count matches number of stats'
#   at t/20-tpv.t line 48.
#          got: '2'
#     expected: '17'


#   Failed test 'time stat exists in return'
#   at t/20-tpv.t line 51.
#          got: ''
#     expected: '1'


#   Failed test 'alt stat exists in return'
#   at t/20-tpv.t line 51.
#          got: ''
#     expected: '1'


#   Failed test 'climb stat exists in return'
#   at t/20-tpv.t line 51.
#          got: ''
#     expected: '1'


#   Failed test 'speed stat exists in return'
#   at t/20-tpv.t line 51.
#          got: ''
#     expected: '1'


#   Failed test 'track stat exists in return'
#   at t/20-tpv.t line 51.
#          got: ''
#     expected: '1'


#   Failed test 'device stat exists in return'
#   at t/20-tpv.t line 51.
#          got: ''
#     expected: '1'


#   Failed test 'mode stat exists in return'
#   at t/20-tpv.t line 51.
#          got: ''
#     expected: '1'


#   Failed test 'epx stat exists in return'
#   at t/20-tpv.t line 51.
#          got: ''
#     expected: '1'


#   Failed test 'epy stat exists in return'
#   at t/20-tpv.t line 51.
#          got: ''
#     expected: '1'


#   Failed test 'epc stat exists in return'
#   at t/20-tpv.t line 51.
#          got: ''
#     expected: '1'


#   Failed test 'ept stat exists in return'
#   at t/20-tpv.t line 51.
#          got: ''
#     expected: '1'


#   Failed test 'epv stat exists in return'
#   at t/20-tpv.t line 51.
#          got: ''
#     expected: '1'


#   Failed test 'eps stat exists in return'
#   at t/20-tpv.t line 51.
#          got: ''
#     expected: '1'


#   Failed test 'class stat exists in return'
#   at t/20-tpv.t line 51.
#          got: ''
#     expected: '1'


#   Failed test 'tag stat exists in return'
#   at t/20-tpv.t line 51.
#          got: ''
#     expected: '1'


#   Failed test 'lat is in proper format'
#   at t/20-tpv.t line 55.
#                   undef
#     doesn't match '(?^:^-?\d+\.\d{4,9}$)'


#   Failed test 'lon is in proper format'
#   at t/20-tpv.t line 55.
#                   undef
#     doesn't match '(?^:^-?\d+\.\d{4,9}$)'
# Looks like you failed 18 tests of 39.
t/20-tpv.t ................. Dubious, test returned 18 (wstat 4608, 0x1200)
Failed 18/39 subtests
t/25-satellites.t ..........


incomplete or empty dataset returned from GPS...


Use of uninitialized value $lat in pattern match (m//) at /root/.cpan/build/GPSD-Parse-1.02-au2pQo/blib/lib/GPSD/Parse.pm line 185, <GEN0> line 4.
t/25-satellites.t .......... ok   
t/30-sky.t .................


incomplete or empty dataset returned from GPS...


Use of uninitialized value $lat in pattern match (m//) at /root/.cpan/build/GPSD-Parse-1.02-au2pQo/blib/lib/GPSD/Parse.pm line 185, <GEN0> line 4.
t/30-sky.t ................. 1/?
#   Failed test 'keys match SKY entry count'
#   at t/30-sky.t line 40.
#          got: '1'
#     expected: '11'


#   Failed test 'SKY stat xdop exists'
#   at t/30-sky.t line 43.
#          got: ''
#     expected: '1'


#   Failed test 'SKY stat ydop exists'
#   at t/30-sky.t line 43.
#          got: ''
#     expected: '1'


#   Failed test 'SKY stat pdop exists'
#   at t/30-sky.t line 43.
#          got: ''
#     expected: '1'


#   Failed test 'SKY stat tdop exists'
#   at t/30-sky.t line 43.
#          got: ''
#     expected: '1'


#   Failed test 'SKY stat vdop exists'
#   at t/30-sky.t line 43.
#          got: ''
#     expected: '1'


#   Failed test 'SKY stat gdop exists'
#   at t/30-sky.t line 43.
#          got: ''
#     expected: '1'


#   Failed test 'SKY stat hdop exists'
#   at t/30-sky.t line 43.
#          got: ''
#     expected: '1'


#   Failed test 'SKY stat class exists'
#   at t/30-sky.t line 43.
#          got: ''
#     expected: '1'


#   Failed test 'SKY stat tag exists'
#   at t/30-sky.t line 43.
#          got: ''
#     expected: '1'


#   Failed test 'SKY stat device exists'
#   at t/30-sky.t line 43.
#          got: ''
#     expected: '1'


#   Failed test 'SKY satellite entries are hrefs'
#   at t/30-sky.t line 47.
#          got: ''
#     expected: 'HASH'


#   Failed test 'each SKY sat entry has stats'
#   at t/30-sky.t line 48.
#          got: ''
#     expected: '1'
# Looks like you failed 13 tests of 16.
t/30-sky.t ................. Dubious, test returned 13 (wstat 3328, 0xd00)
Failed 13/16 subtests
t/35-unit_conversion.t ..... ok   
t/40-metres_feet.t ......... ok   
t/45-direction.t ........... ok   
t/50-signed.t .............. ok   
t/55-unsigned.t ............ ok   
t/60-poll_signed_toggle.t .. ok   
t/65-tpv_methods.t .........


incomplete or empty dataset returned from GPS...


Use of uninitialized value $lat in pattern match (m//) at /root/.cpan/build/GPSD-Parse-1.02-au2pQo/blib/lib/GPSD/Parse.pm line 185, <GEN0> line 4.
t/65-tpv_methods.t ......... ok   
t/manifest.t ............... skipped: Author tests not required for installation
t/pod-coverage.t ........... skipped: Author tests not required for installation
t/pod.t .................... skipped: Author tests not required for installation


Test Summary Report
-------------------
t/05-poll.t              (Wstat: 256 Tests: 11 Failed: 1)
  Failed test:  9
  Non-zero exit status: 1
t/10-time.t              (Wstat: 256 Tests: 2 Failed: 1)
  Failed test:  2
  Non-zero exit status: 1
t/15-device.t            (Wstat: 256 Tests: 2 Failed: 1)
  Failed test:  2
  Non-zero exit status: 1
t/20-tpv.t               (Wstat: 4608 Tests: 39 Failed: 18)
  Failed tests:  2-3, 6-21
  Non-zero exit status: 18
t/30-sky.t               (Wstat: 3328 Tests: 16 Failed: 13)
  Failed tests:  2, 4-13, 15-16
  Non-zero exit status: 13
Files=17, Tests=176,  6 wallclock secs ( 0.54 usr  0.10 sys +  5.56 cusr  0.40 csys =  6.60 CPU)
Result: FAIL
Failed 5/17 test programs. 34/176 subtests failed.
Makefile:828: recipe for target 'test_dynamic' failed
make: *** [test_dynamic] Error 255
  STEVEB/GPSD-Parse-1.02.tar.gz
  /usr/bin/make test -- NOT OK
//hint// to see the cpan-testers results for installing this module, try:
  reports STEVEB/GPSD-Parse-1.02.tar.gz


Grüße
Patrick

peterk_de

Hi Patrick,

zieh einfach mal den GPS-Empfänger vor der Installation von GPSD::Parse raus. Danach kannst du ihn wieder ranstecken. Falls es danach nicht läuft, kann ich es dir leider nicht sagen - möglicherweise haut es dann mit deinem speziellen Empfänger und der Library zusammen nicht hin ...

LG!
FHEM auf Ubuntu-VM / 2xNUC Proxmox Cluster
UI: HomeKit, TabletUI, Grafana
IOdevs: 2xHueBridge, RaspiMatic-CCU, CUL868, 2xHarmonyHub, 6xRaspi-Roomnode mit CO2, VOC und lepresenced
Devices: 107xHomematic(IP), 96xPhilips Hue, 17xTECHEM, 12xBTLE, 8xSONOS, 2xHomeConnect, 1xShelly 3em, 1xNanoleaf ...