Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Node-Red
    5. Owntracks und node-red

    NEWS

    • 15. 05. Wartungsarbeiten am ioBroker Forum

    • Monatsrückblick - April 2025

    • Minor js-controller 7.0.7 Update in latest repo

    Owntracks und node-red

    This topic has been deleted. Only users with topic management privileges can see it.
    • ruhr70
      ruhr70 last edited by

      @Arminhh:

      Hallo Ruhr70,

      würdest du bitte den Flow für Owntracks als export zur Verfügung stellen?

      mfg

      Arminhh `

      ! ````
      [{"id":"e3fec925.2c1cb","type":"websocket-listener","path":"/ws/location","wholemsg":"false"},{"id":"935915de.8aaf08","type":"mqtt-broker","broker":"localhost","port":"8883","clientid":""},{"id":"f44e79a8.0bb188","type":"tcp in","name":"","server":"server","host":"","port":"8883","datamode":"stream","datatype":"utf8","newline":"","topic":"","base64":false,"x":165,"y":95,"z":"b6ad2ad3.4952d8","wires":[["7fc57e10.803a8"]]},{"id":"7fc57e10.803a8","type":"debug","name":"","active":false,"console":"false","complete":"false","x":359,"y":95,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"7dcf930.f82306c","type":"ioBroker in","name":"mqtt.0.owntracks.ruhr","topic":"mqtt.0.owntracks.ruhr","payloadType":"value","x":168.44442749023438,"y":267.30165672302246,"z":"b6ad2ad3.4952d8","wires":[["814c4ad4.7eb3b8","8cc85523.7337a8","5182c591.ae7d3c"]]},{"id":"abaf7bcc.545088","type":"debug","name":"","active":true,"console":"false","complete":"false","x":1177.4446105957031,"y":277.77784061431885,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"a15b133d.5ea4f","type":"function","name":"Koordinaten (lat)","func":"msg.payload = parseFloat(msg.payload.lat);\nreturn msg;","outputs":"1","x":933.1112594604492,"y":471.44450759887695,"z":"b6ad2ad3.4952d8","wires":[["6a4eb537.95b14c","d8405a65.27bfa8"]]},{"id":"665579db.99aa88","type":"function","name":"Koordinaten (lon)","func":"msg.payload = parseFloat(msg.payload.lon);\nreturn msg;","outputs":"1","x":934.111198425293,"y":502.5556831359863,"z":"b6ad2ad3.4952d8","wires":[["6a4eb537.95b14c","9b926334.646da"]]},{"id":"62ea35ad.9d15cc","type":"json","name":"","x":571.444450378418,"y":284.0000581741333,"z":"b6ad2ad3.4952d8","wires":[["abaf7bcc.545088"]]},{"id":"98b398b2.674c68","type":"comment","name":"Owntracks an ioBroker mqtt Instanz (Port 1883)","info":"Beschreibung der JSON Datenfelder:\n\nhttps://github.com/owntracks/owntracks/wiki/JSON","x":214.44442749023438,"y":228.85719871520996,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"aa20df49.55df2","type":"comment","name":"Ausgabe: Value","info":"","x":338.1110610961914,"y":291.190580368042,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"3c2fb13.fc3d04e","type":"comment","name":"Behandlung als JSON","info":"","x":578.444450378418,"y":250.0000581741333,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"d82a28bf.27d5d8","type":"comment","name":"Auswertung der JSON Daten","info":"","x":932.1111450195312,"y":440.0000476837158,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"5f14b3f9.a0eb4c","type":"mqtt in","name":"owntracks geofence 8883","topic":"owntracks/#","broker":"935915de.8aaf08","x":146.53965759277344,"y":398.825475692749,"z":"b6ad2ad3.4952d8","wires":[["c4beb199.3b415"]]},{"id":"8e10f81d.71ef08","type":"comment","name":"owntracks an mqtt Node","info":"","x":139.8730010986328,"y":362.82545280456543,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"8508796a.7af788","type":"comment","name":"Zum Test: mqtt Stream an Node-red","info":"","x":247,"y":55.4444580078125,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"8085f870.7f7a08","type":"function","name":"Höhe in m (alt)","func":"msg.payload = parseInt(msg.payload.alt);\nreturn msg;","outputs":"1","x":929.000114440918,"y":557.0000190734863,"z":"b6ad2ad3.4952d8","wires":[["6a4eb537.95b14c","3a2352.ffc5dcae"]]},{"id":"bbbf2a6d.4440d8","type":"function","name":"Batterieladestand (batt)","func":"msg.payload = parseInt(msg.payload.batt);\nreturn msg;","outputs":"1","x":932.0000534057617,"y":606.0000495910645,"z":"b6ad2ad3.4952d8","wires":[["6a4eb537.95b14c","1fb9d498.e0462b"]]},{"id":"96d42da.f692bd","type":"switch","name":"","property":"payload.alt","rules":[{"t":"neq","v":"0"}],"checkall":"true","outputs":1,"x":683.3333435058594,"y":454.66668701171875,"z":"b6ad2ad3.4952d8","wires":[["a15b133d.5ea4f","665579db.99aa88","8085f870.7f7a08","bbbf2a6d.4440d8","580577f.fa7fa88","7a3fb950.85c048","7a28f7c7.85d708","ae10b882.51ef48","4c7b5917.b384a8","aebde284.51422","f8deb6fe.072148","a4b9f5dd.5b4608","492c5b31.b6d3a4","4214357a.bdebcc","a9f4c66f.560b38","f03ba82d.0fc458","9caa825.f63558","b06787.ff4f9878"]]},{"id":"e7d2359.f182dc8","type":"comment","name":"Meldungen mit 0 ausfiltern","info":"","x":615.6666259765625,"y":494.6666965484619,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"6a4eb537.95b14c","type":"debug","name":"","active":false,"console":"false","complete":"false","x":1171.0000534057617,"y":396.00002670288086,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"580577f.fa7fa88","type":"function","name":"Kurs 0 = Norden (cog)","func":"msg.payload = parseInt(msg.payload.cog);\nreturn msg;","outputs":"1","x":935.9999923706055,"y":657.0000495910645,"z":"b6ad2ad3.4952d8","wires":[["6a4eb537.95b14c","378ec644.c8713a"]]},{"id":"7a3fb950.85c048","type":"function","name":"Grund für die Meldung (t)","func":"msg.payload = msg.payload.t;\nreturn msg;\n\n\n// "p" ping, issued randomly by background task\n// "c" circular region enter/leave event\n// "b" beacon region enter/leave event\n// "r" response to a "reportLocation" request\n// "u" manual publish requested by the user\n// "t" timer based publish in move move\n// "a" or missing t indicates automatic location update","outputs":"1","x":939.9999923706055,"y":713.0000495910645,"z":"b6ad2ad3.4952d8","wires":[["6a4eb537.95b14c","bbbe09d0.4441f8"]]},{"id":"c295332b.3d6ad","type":"comment","name":"Radius um einen geofence Punkt (wann und wofür?)","info":"","x":331.3332290649414,"y":1218.5833015441895,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"7ba7952c.84586c","type":"function","name":"rad","func":"msg.payload = parseInt(msg.payload.alt);\nreturn msg;","outputs":"1","x":325.33329010009766,"y":1252.5833320617676,"z":"b6ad2ad3.4952d8","wires":[[]]},{"id":"14a0be9.feb5f41","type":"function","name":"event","func":"msg.payload = msg.payload.event;\nreturn msg;","outputs":"1","x":343.33324432373047,"y":1060.2499952316284,"z":"b6ad2ad3.4952d8","wires":[[]]},{"id":"ebd146b7.142eb8","type":"comment","name":"verlassen oder betreten eines Geofence Punkts","info":"event is one of "enter" or "leave" and tells if the app is entering or leaving a geofence","x":344.66654205322266,"y":1027.2499599456787,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"7a28f7c7.85d708","type":"function","name":"Tracker ID (tid)","func":"msg.payload = msg.payload.tid;\nreturn msg;","outputs":"1","x":943.9999923706055,"y":771.0000495910645,"z":"b6ad2ad3.4952d8","wires":[["6a4eb537.95b14c","aeec7628.511388"]]},{"id":"ae10b882.51ef48","type":"function","name":"(Geschwindigkeit in km/h (vel)","func":"msg.payload = parseInt(msg.payload.vel);\nreturn msg;","outputs":"1","x":937.9999923706055,"y":819.0000495910645,"z":"b6ad2ad3.4952d8","wires":[["6a4eb537.95b14c","e50efbf1.1af108"]]},{"id":"4c7b5917.b384a8","type":"function","name":"Genauigkeit Koordinaten in m (acc)","func":"msg.payload = parseInt(msg.payload.acc);\nreturn msg;","outputs":"1","x":930.9999923706055,"y":872.0000495910645,"z":"b6ad2ad3.4952d8","wires":[["6a4eb537.95b14c","7023287f.8fdcd8"]]},{"id":"aebde284.51422","type":"function","name":"GoogleMaps Adresse https","func":"msg.payload = "https://www.google.de/maps/@" \n + msg.payload.lat + "," +\n + msg.payload.lon;\nreturn msg;\n","outputs":"1","x":919.9999923706055,"y":931.6666831970215,"z":"b6ad2ad3.4952d8","wires":[["6a4eb537.95b14c","e9a36.fff165ca"]]},{"id":"d8405a65.27bfa8","type":"ioBroker out","name":"","topic":"OwntracksMHlat","ack":"true","autoCreate":"true","x":1174.9999923706055,"y":470.55559158325195,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"9b926334.646da","type":"ioBroker out","name":"","topic":"OwntracksMHlon","ack":"true","autoCreate":"true","x":1176.9999923706055,"y":515.555591583252,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"3a2352.ffc5dcae","type":"ioBroker out","name":"","topic":"OwntracksMHalt","ack":"true","autoCreate":"true","x":1175.9999923706055,"y":563.555591583252,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"1fb9d498.e0462b","type":"ioBroker out","name":"","topic":"OwntracksMHbatt","ack":"true","autoCreate":"true","x":1177.9999923706055,"y":614.555591583252,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"378ec644.c8713a","type":"ioBroker out","name":"","topic":"OwntracksMHcog","ack":"true","autoCreate":"true","x":1171.9999923706055,"y":662.555591583252,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"bbbe09d0.4441f8","type":"ioBroker out","name":"","topic":"OwntracksMHt","ack":"true","autoCreate":"true","x":1164.9999923706055,"y":711.555591583252,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"aeec7628.511388","type":"ioBroker out","name":"","topic":"OwntracksMHtid","ack":"true","autoCreate":"true","x":1167.9999923706055,"y":761.555591583252,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"e50efbf1.1af108","type":"ioBroker out","name":"","topic":"OwntracksMHvel","ack":"true","autoCreate":"true","x":1166.9999923706055,"y":811.555591583252,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"7023287f.8fdcd8","type":"ioBroker out","name":"","topic":"OwntracksMHacc","ack":"true","autoCreate":"true","x":1172.9999923706055,"y":868.555591583252,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"e9a36.fff165ca","type":"ioBroker out","name":"","topic":"OwntracksMHgoogleMaps","ack":"true","autoCreate":"true","x":1175.9999923706055,"y":935.000057220459,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"f8deb6fe.072148","type":"function","name":"Timestamp (tst)","func":"msg.payload = msg.payload.tst;\nreturn msg;","outputs":"1","x":929.9999923706055,"y":997.4445152282715,"z":"b6ad2ad3.4952d8","wires":[["a367452b.5c98b8","cb17ba4e.34e848"]]},{"id":"a367452b.5c98b8","type":"ioBroker out","name":"","topic":"OwntracksMHtst","ack":"true","autoCreate":"true","x":1140.9999923706055,"y":999.000057220459,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"a4b9f5dd.5b4608","type":"switch","name":"Zwei gleiche Timestamps rausfiltern","property":"payload.tst","rules":[{"t":"eq","v":"node-red.0.OwntracksMHtst"}],"checkall":"true","outputs":1,"x":523.9999313354492,"y":601.0000267028809,"z":"b6ad2ad3.4952d8","wires":[["8a724ea9.758db"]]},{"id":"8a724ea9.758db","type":"debug","name":"Debug: Ausgabe nur bei gleichen Timestamps","active":true,"console":"false","complete":"payload.tst","x":463.99996185302734,"y":644.000057220459,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"d64dde02.29b22","type":"comment","name":"#### todos ####","info":"","x":321.33324432373047,"y":1171.5833683013916,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"492c5b31.b6d3a4","type":"function","name":"Datum (tst) lesbar umwandeln","func":"// (1) wandelt timestamo ins ISO Datumformat um\n//msg.timestamp= new Date().toISOString()\n\n\n// (2) beliebiges Datum festlegbar: hier: YYYY-MM-DD HH:MM.SS\n// (Ausgabeformat wird danz am Ende zusammengestellt)\nvar now = new Date(); \n// var now = new Date(parseInt(msg.payload.tst)); \nvar year = now.getFullYear();\nvar month = now.getMonth()+1; \nvar day = now.getDate();\nvar hour = now.getHours();\nvar minute = now.getMinutes();\nvar second = now.getSeconds(); \nif(month.toString().length == 1) {\nvar month = '0'+month;\n}\nif(day.toString().length == 1) {\nvar day = '0'+day;\n} \nif(hour.toString().length == 1) {\nvar hour = '0'+hour;\n}\nif(minute.toString().length == 1) {\nvar minute = '0'+minute;\n}\nif(second.toString().length == 1) {\nvar second = '0'+second;\n} \n//msg.timestamp = year+'-'+month+'-'+day+' '+hour+':'+minute+':'+second;\nmsg.payload = year+'-'+month+'-'+day+' '+hour+':'+minute+':'+second;\n\n\nreturn msg;","outputs":1,"x":935.1110229492188,"y":1057.7777881622314,"z":"b6ad2ad3.4952d8","wires":[["b3dd7455.4c2288","bf5d8b9d.40a278"]]},{"id":"b3dd7455.4c2288","type":"ioBroker out","name":"","topic":"OwntracksMHdatum","ack":"true","autoCreate":"true","x":1161.7776107788086,"y":1056.111156463623,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"cb17ba4e.34e848","type":"debug","name":"","active":false,"console":"false","complete":"false","x":1347.6110649108887,"y":999.8611545562744,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"bf5d8b9d.40a278","type":"debug","name":"","active":false,"console":"false","complete":"false","x":1352.6110458374023,"y":1052.361141204834,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"dfd5fc7d.202a","type":"comment","name":"Datum auf Date() geändert","info":"Über msg.payload.tst kommt immer ein Datum aus 1970 mit.\nDaher wird nun das aktuelle Datum im Flow erzeugt und verwendet.","x":916.3610572814941,"y":1088.6111555099487,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"a02b2e06.5fd4d","type":"comment","name":"http://osmtools.de/osmlinks/?lang=de","info":"http://osmtools.de/osmlinks/?lang=de&lon=6.7855&lat=51.246498&zoom=18\n","x":802.2539716448102,"y":59.682543073381694,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"d20ecee4.2df13","type":"comment","name":"http://www.openstreetmap.org/?mlon=6.7855&mlat=51.246498&zoom=18#map=18/51.24650/6.78550","info":"","x":1006.5397186279297,"y":91.11111450195312,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"4214357a.bdebcc","type":"function","name":"openstreetmap Adresse http","func":"// http://www.openstreetmap.org/?mlon=6.7855&mlat=51.246498&zoom=18#map=18/51.24650/6.78550\n\n// Koordinate inkl. Marker\nmsg.payload = "http://www.openstreetmap.org/?mlon=" \n + msg.payload.lon + "&mlat="\n + msg.payload.lat + "&zoom=16#map=16/" // Zoom Stufe 16 (beide Werte anpssen, wenn Änderung gewünscht)\n + msg.payload.lat + "/"\n + msg.payload.lon;\nreturn msg;\n","outputs":"1","x":917.9682235717773,"y":1146.8254137039185,"z":"b6ad2ad3.4952d8","wires":[["166203bf.e99dfc","7c4a1782.83b5e8"]]},{"id":"166203bf.e99dfc","type":"ioBroker out","name":"","topic":"OwntracksMHopenstreetmap","ack":"true","autoCreate":"true","x":1186.539665222168,"y":1143.9683017730713,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"7c4a1782.83b5e8","type":"debug","name":"","active":false,"console":"false","complete":"false","x":1397.9682846069336,"y":1143.9682321548462,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"a9f4c66f.560b38","type":"function","name":"öpnv Adresse http","func":"// http://öpnvkarte.de/?lon=6.7855&lat=51.246498&zoom=17\n\nmsg.payload = "http://öpnvkarte.de/?lon=" \n + msg.payload.lon + "&lat="\n + msg.payload.lat + "&zoom=17"; // Zoom Stufe 17 \n\nreturn msg;\n","outputs":"1","x":913.682487487793,"y":1193.9683532714844,"z":"b6ad2ad3.4952d8","wires":[["e109e0c9.1ef62"]]},{"id":"e109e0c9.1ef62","type":"ioBroker out","name":"","topic":"OwntracksMHöpnvkarte","ack":"true","autoCreate":"true","x":1186.539649963379,"y":1196.8254709243774,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"569fb260.a9604c","type":"file","name":"","filename":"/opt/iobroker/wegepunkte.csv","appendNewline":true,"overwriteFile":"false","x":1179.8730163574219,"y":1263.9682607650757,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"f03ba82d.0fc458","type":"function","name":"Daten für eine Datei","func":"msg.payload = msg.payload.lat + ","\n + msg.payload.lon + ","\n + msg.payload.tst + ",";\n\nvar now = new Date(); \n// var now = new Date(parseInt(msg.payload.tst)); \nvar year = now.getFullYear();\nvar month = now.getMonth()+1; \nvar day = now.getDate();\nvar hour = now.getHours();\nvar minute = now.getMinutes();\nvar second = now.getSeconds(); \nif(month.toString().length == 1) {\nvar month = '0'+month;\n}\nif(day.toString().length == 1) {\nvar day = '0'+day;\n} \nif(hour.toString().length == 1) {\nvar hour = '0'+hour;\n}\nif(minute.toString().length == 1) {\nvar minute = '0'+minute;\n}\nif(second.toString().length == 1) {\nvar second = '0'+second;\n} \n//msg.timestamp = year+'-'+month+'-'+day+' '+hour+':'+minute+':'+second;\nmsg.payload = msg.payload + year+'-'+month+'-'+day+' '+hour+':'+minute+':'+second;\n\n\nreturn msg;\n","outputs":"1","x":933.682487487793,"y":1266.8253393173218,"z":"b6ad2ad3.4952d8","wires":[["569fb260.a9604c","732eaf14.8cd15"]]},{"id":"732eaf14.8cd15","type":"debug","name":"","active":false,"console":"false","complete":"false","x":1133.6824989318848,"y":1298.2539434432983,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"53db6e12.ac249","type":"comment","name":"Datei für Import (z.B. in Google Maps)","info":"https://support.google.com/mymaps/answer/3024836?hl=de","x":1449.3967304229736,"y":1264.2062978744507,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"9caa825.f63558","type":"function","name":"Luftlinie in km zwischen Smartphone und daheim","func":"//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::\n//::: :::\n//::: This routine calculates the distance between two points (given the :::\n//::: latitude/longitude of those points). It is being used to calculate :::\n//::: the distance between two locations using GeoDataSource (TM) prodducts :::\n//::: :::\n//::: Definitions: :::\n//::: South latitudes are negative, east longitudes are positive :::\n//::: :::\n//::: Passed to function: :::\n//::: lat1, lon1 = Latitude and Longitude of point 1 (in decimal degrees) :::\n//::: lat2, lon2 = Latitude and Longitude of point 2 (in decimal degrees) :::\n//::: unit = the unit you desire for results :::\n//::: where: 'M' is statute miles (default) :::\n//::: 'K' is kilometers :::\n//::: 'N' is nautical miles :::\n//::: :::\n//::: Worldwide cities and other features databases with latitude longitude :::\n//::: are available at http://www.geodatasource.com :::\n//::: :::\n//::: For enquiries, please contact sales@geodatasource.com :::\n//::: :::\n//::: Official Web site: http://www.geodatasource.com :::\n//::: :::\n//::: GeoDataSource.com (C) All Rights Reserved 2015 :::\n//::: :::\n//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::\n\n\n\nfunction distance(lat1, lon1, lat2, lon2, unit) {\n\tvar radlat1 = Math.PI * lat1/180\n\tvar radlat2 = Math.PI * lat2/180\n\tvar radlon1 = Math.PI * lon1/180\n\tvar radlon2 = Math.PI * lon2/180\n\tvar theta = lon1-lon2\n\tvar radtheta = Math.PI * theta/180\n\tvar dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\n\tdist = Math.acos(dist)\n\tdist = dist * 180/Math.PI\n\tdist = dist * 60 * 1.1515\n\tif (unit=="K") { dist = dist * 1.609344 }\n\tif (unit=="N") { dist = dist * 0.8684 }\n\treturn dist\n}\n\n\n// Home: 51.252596, 6.783141\nvar lat1 = 51.252596;\nvar lon1 = 6.783141;\n// aktueller Standort\nvar lat2 = parseFloat(msg.payload.lat);\nvar lon2 = parseFloat(msg.payload.lon); \n \nvar msg1 = {};\nmsg1.payload = Math.round(distance(lat1, lon1, lat2, lon2, "K")*1000)/1000 // Distanz in km\nvar msg2 = {};\nmsg2.payload = Math.round(distance(lat1, lon1, lat2, lon2, "K")*1000); // in m \nreturn [msg1,msg2];\n\n","outputs":"2","x":1496.7777125040689,"y":431.1111412048339,"z":"b6ad2ad3.4952d8","wires":[["87de0544.7821f8","1815c7be.e7ea38","3c67cfe6.c3983"],["87de0544.7821f8","9839e89f.67c618"]]},{"id":"87de0544.7821f8","type":"debug","name":"","active":false,"console":"false","complete":"payload","x":1798.444480895996,"y":389.4444532394409,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"1815c7be.e7ea38","type":"ioBroker out","name":"","topic":"OwntracksMHDistanzKM","ack":"true","autoCreate":"true","x":1835.1109008789062,"y":429.44446754455566,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"3c67cfe6.c3983","type":"function","name":"als String mit dynamischen Nachkommastellen","func":"function runden(x) {\n var k = (Math.round(x * 100) / 100).toString();\n k += (k.indexOf('.') == -1)? '.0' : '0';\n var p = k.indexOf('.'), m = k.indexOf('-.');\n var f = (p == 0 || m == 0)? '0,' : ',';\n return k.substring(0, p) + f + k.substring(p+1, p+3);\n}\n\n\nvar dist = msg.payload;\nif (dist < 1) {\ndist = Math.round(dist * 1000).toString();\nmsg.payload = dist + " m"; \n} else {\ndist = runden(dist).toString();\nmsg.payload = dist + " km";\n}\n\nreturn msg;","outputs":1,"x":1515.1110191345215,"y":549.4444694519043,"z":"b6ad2ad3.4952d8","wires":[["24e21602.db1dea","b5ba9c19.4a456"]]},{"id":"24e21602.db1dea","type":"ioBroker out","name":"","topic":"OwntracksMHDistanzKMstring","ack":"true","autoCreate":"true","x":1840.1109466552734,"y":547.7777624130249,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"b5ba9c19.4a456","type":"debug","name":"","active":false,"console":"false","complete":"false","x":1785.1110458374021,"y":604.4444745381672,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"fc1122ab.03eee","type":"function","name":"handelt es sich um einen event?","func":"// The received message is stored in 'msg'\n// It will have at least a 'payload' property:\n// console.log(msg.payload);\n// The 'context' object is available to store state\n// between invocations of the function\n// context = {};\nvar now = Date();\nvar message = "";\nvar standort = "";\nvar event = "";\ndata = JSON.parse(msg.payload);\n\n// data.event != undefined => die Meldung enthält kein Feld "event"\n// der if Zweig wird ausgeführt, wenn der Typ der Meldung Location ist und das Feld event vorhanden ist\nif ( (data._type == "location") && (data.event != undefined ) ) {\n\t event = "event";\n\t \n\t // es wird geprüft, ob die Beshreibung für eine location mitgeschickt wird\n\t // ind er Onwtracks app beim Standord "Share" aktiviert\n\t\tif ( data.desc != undefined ) {\n\t\t\t// Shared waypoint, comes with a description:\n\t\t\t\tmessage = data.desc;\n \t\t} else {\n \t\t\t// No description is set, non shared "private" waypoint\n \t\t\t\tmessage = data.lat + "," + data.lon;\n \t\t}\n \t\tstandort = message;\n \n // enthält event == "enter"\n\t\tif ( data.event == "enter" ) {\t\t\t\n\t\t\tmessage = message + " betreten";\n\t\t} else {\n\t\t\tmessage = message + " verlassen";\n\t\t\tstandort = "unbekannt"; // ein Standort wurde verlassen, neuer Standort = "unbekannt"\n\t\t}\n \n \n }\n \nvar msg1 = {};\nvar msg2 = {};\nmsg1.event = event;\nmsg1.payload = message;\n//console.log(msg.payload);\n\nmsg2.event = event;\nmsg2.payload = standort;\n\n\nreturn [msg1,msg2];","outputs":"2","x":1531.7777252197266,"y":751.1110401153564,"z":"b6ad2ad3.4952d8","wires":[["274cc031.d8b34","c677a7fa.398858"],["5abbb50a.a5444c"]]},{"id":"274cc031.d8b34","type":"switch","name":"Prüfen, ob JSON ein event enthielt","property":"event","rules":[{"t":"cont","v":"event"}],"checkall":"true","outputs":1,"x":1540.777603149414,"y":810.4445381164551,"z":"b6ad2ad3.4952d8","wires":[["f00177a7.0ffe88","713d6fe9.8ec29"]]},{"id":"f00177a7.0ffe88","type":"debug","name":"","active":true,"console":"false","complete":"payload","x":1864.1111526489258,"y":782.1108245849609,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"713d6fe9.8ec29","type":"ioBroker out","name":"","topic":"OwntracksMHstandortÄnderung","ack":"true","autoCreate":"true","x":1843.4443359375,"y":812.7777137756348,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"983d3a10.67c2c8","type":"comment","name":"#### todos - erledigt ####","info":"","x":338.44434356689453,"y":989.4444370269775,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"2a0bedc4.d5f412","type":"debug","name":"","active":false,"console":"false","complete":"false","x":893.4444007873535,"y":391.11109828948975,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"2da5d7a3.d25a28","type":"json","name":"","x":540.1110916137695,"y":456.1111011505127,"z":"b6ad2ad3.4952d8","wires":[["96d42da.f692bd","2a0bedc4.d5f412"]]},{"id":"c677a7fa.398858","type":"debug","name":"","active":false,"console":"false","complete":"false","x":1863.4444007873535,"y":732.7776889801025,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"9839e89f.67c618","type":"ioBroker out","name":"","topic":"OwntracksMHDistanzM","ack":"true","autoCreate":"true","x":1838.4443664550781,"y":477.77777099609375,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"3b7b6929.c48496","type":"comment","name":"GEOFENCE = event","info":"","x":1498.444465637207,"y":706.111102104187,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"5abbb50a.a5444c","type":"switch","name":"Prüfen, ob JSON ein event enthielt","property":"event","rules":[{"t":"cont","v":"event"}],"checkall":"true","outputs":1,"x":1541.7777709960938,"y":904.4443807601929,"z":"b6ad2ad3.4952d8","wires":[["2eb71c6c.d148e4","3598ce6c.ca6732"]]},{"id":"2eb71c6c.d148e4","type":"debug","name":"","active":true,"console":"false","complete":"payload","x":1860.111270904541,"y":867.7773723602295,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"3598ce6c.ca6732","type":"ioBroker out","name":"","topic":"OwntracksMHstandort","ack":"true","autoCreate":"true","x":1821.111228942871,"y":906.7775535583496,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"a42a7a54.5bd588","type":"websocket out","name":"","server":"e3fec925.2c1cb","x":875.2064056396484,"y":1516.301570892334,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"14cae0e5.eb351f","type":"websocket in","name":"","server":"e3fec925.2c1cb","x":439.20640563964844,"y":1568.301570892334,"z":"b6ad2ad3.4952d8","wires":[["c27e7ac0.3d8188","fec0f15d.013f1"]]},{"id":"57f652ee.a809ac","type":"http in","name":"","url":"/map","method":"get","x":438.20640563964844,"y":1666.301570892334,"z":"b6ad2ad3.4952d8","wires":[["d49bc33b.2b644"]]},{"id":"156c627b.ea939e","type":"http response","name":"","x":886.2064056396484,"y":1666.301570892334,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"d49bc33b.2b644","type":"template","name":"Google Maps http://eigeneIP:1880/map","field":"","template":"\n\n\n <title>Owntracks & The ThingBox Live Map</title>\n \n \n \n \n \n\n\n \n \n \n\n","x":658.2064056396484,"y":1666.301570892334,"z":"b6ad2ad3.4952d8","wires":[["156c627b.ea939e"]]},{"id":"c27e7ac0.3d8188","type":"function","name":"function 2","func":"// The received message is stored in 'msg'\n// It will have at least a 'payload' property:\n// console.log(msg.payload);\n// The 'context' object is available to store state\n// between invocations of the function\n// context = {};\n\nmsg.payload = context.global.location;\n\nreturn msg;","outputs":1,"x":665.2064056396484,"y":1568.301570892334,"z":"b6ad2ad3.4952d8","wires":[["a42a7a54.5bd588","52e0ab0d.ad1f54"]]},{"id":"40a1c6e1.bf5e38","type":"function","name":"function 1","func":"// The received message is stored in 'msg'\n// It will have at least a 'payload' property:\n// console.log(msg.payload);\n// The 'context' object is available to store state\n// between invocations of the function\n// context = {};\ncontext.global.location = msg.payload;\n\nreturn msg;","outputs":1,"x":668.2064056396484,"y":1472.301570892334,"z":"b6ad2ad3.4952d8","wires":[["a42a7a54.5bd588","7d68d68f.829728"]]},{"id":"b06787.ff4f9878","type":"function","name":"Adaptation","func":"var zoom = 17; // Default = 17\n// In Zeile 20 im Template Node die eigene IP-Adresse vonioBroker/Node-red eintragen\n\n\nvar latitude = msg.payload.lat;\nvar longitude = msg.payload.lon;\nmsg.payload = '[{"lat":"' + latitude + '","lng":"' + longitude + '","zoom":"' + zoom + '"}]'; \nreturn msg;","outputs":1,"x":510.20640563964844,"y":1472.301570892334,"z":"b6ad2ad3.4952d8","wires":[["40a1c6e1.bf5e38"]]},{"id":"7d68d68f.829728","type":"debug","name":"","active":false,"console":"false","complete":"false","x":1039.777816772461,"y":1483.301570892334,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"52e0ab0d.ad1f54","type":"debug","name":"","active":false,"console":"false","complete":"false","x":1039.492172241211,"y":1557.0158042907715,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"fec0f15d.013f1","type":"debug","name":"","active":false,"console":"false","complete":"false","x":1033.777816772461,"y":1611.444393157959,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"d4cafa2.f2b3508","type":"comment","name":"http://eigeneIP:1880/map (eigene IP in Zeile 20 im Template Node eintragen)","info":"","x":741.7778167724609,"y":1425.444393157959,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"c4beb199.3b415","type":"debug","name":"","active":true,"console":"false","complete":"true","x":568.4444580078125,"y":376.11109924316406,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"814c4ad4.7eb3b8","type":"debug","name":"","active":false,"console":"false","complete":"true","x":879.1111145019529,"y":227.11111450195307,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"8cc85523.7337a8","type":"debug","name":"","active":false,"console":"false","complete":"false","x":935.1111145019529,"y":177.1111145019531,"z":"b6ad2ad3.4952d8","wires":[]},{"id":"5182c591.ae7d3c","type":"function","name":"","func":"\nreturn msg;","outputs":1,"x":389.39685249328613,"y":422.0634641647339,"z":"b6ad2ad3.4952d8","wires":[["fc1122ab.03eee","2da5d7a3.d25a28"]]}]

      1 Reply Last reply Reply Quote 0
      • A
        Arminhh last edited by

        Hallo rur70,

        danke für den Flow.

        Versuche gerade soweit alles einzurichten. ich komme soweit, das im Log die Daten ankommen.

        mqtt-0	2015-09-07 16:52:03	info	Send to client [ArminsHandy] "owntracks/armin/ArminsHandy": {"_type": "location", "lat": "53.xxxxx", "lon": "10.0112962", "tst": "1441622918", "acc": "30.0", "batt": "83"}
        mqtt-0	2015-09-07 16:52:03	info	Send to client [ArminsHandy] "owntracks/armin/Armins Handy": {"_type": "location", "lat": "53.xxxxxx", "lon": "10.0113532", "tst": "1441615725", "acc": "30.0", "batt": "96"}
        mqtt-0	2015-09-07 16:52:01	info	Client [ArminsHandy] subscribes on "mqtt.0.owntracks.+.+" with regex /mqtt\.0\.owntracks\.[^.]*\.[^\.].*$/
        mqtt-0	2015-09-07 16:52:01	info	Client [ArminsHandy] subscribes on "owntracks.+.+" with regex /owntracks\.[^.]*\.[^\.].*$/
        mqtt-0	2015-09-07 16:52:01	info	Client [ArminsHandy] publishes "mqtt.0.$SYS.keepalive"(string):
        mqtt-0	2015-09-07 16:52:01	info	Client [ArminsHandy] publishes "mqtt.0.$SYS.keepalive"(string):
        mqtt-0	2015-09-07 16:52:01	info	Client [ArminsHandy] publishes "mqtt.0.$SYS.keepalive"(string):
        mqtt-0	2015-09-07 16:52:01	info	Client [ArminsHandy] publishes "mqtt.0.$SYS.keepalive"(string):
        mqtt-0	2015-09-07 16:52:01	info	Client [ArminsHandy] publishes "mqtt.0.$SYS.keepalive"(string):
        mqtt-0	2015-09-07 16:52:01	info	Client [ArminsHandy] publishes "mqtt.0.$SYS.keepalive"(string):
        mqtt-0	2015-09-07 16:52:01	info	Client [ArminsHandy] publishes "mqtt.0.$SYS.keepalive"(string):
        mqtt-0	2015-09-07 16:52:01	info	Client [ArminsHandy] publishes "mqtt.0.$SYS.keepalive"(string):
        mqtt-0	2015-09-07 16:52:01	info	Client [ArminsHandy] publishes "mqtt.0.$SYS.keepalive"(string):
        mqtt-0	2015-09-07 16:52:01	info	Client [ArminsHandy] publishes "mqtt.0.$SYS.keepalive"(string):
        mqtt-0	2015-09-07 16:52:01	info	Client [ArminsHandy] connected
        

        Der Flow sieht so aus.
        280_screenshot_52.jpg
        Was ich nicht verstehe, sind die unterschiedlichen Ports

        Wo ich im Flow meine Daten eintragen muss. Ich habe mal testweise meine Device ID eingetragen.
        280_screenshot_53.jpg
        Wo werden die events eingetragen?

        Die Variablen wurden auch nicht angelegt

        Danke für die Hilfe!! Super Arbeit!

        mfg

        Armin

        1 Reply Last reply Reply Quote 0
        • ruhr70
          ruhr70 last edited by

          Die unterschiedlichen Ports sind noch "Müll", die beim Testen übrig geblieben sind (Port 8883).

          Der Flow funktioniert mit dem 1883 und dem mqtt Adapter.

          Den Rest muss ich mir nachher mal ansehen. War da schon ewig nicht mehr dran.

          1 Reply Last reply Reply Quote 0
          • A
            Arminhh last edited by

            so bin ein wenig weiter gekommen.

            Nachdem ich MQTT mit User und Kennwort konfiguriert habe, 280_screenshot_55.jpg habe ich auch eine Verbindung. Nur die die Variablen werden nicht angelegt und in Notes kommen diese Fehler. (SIehe Bild. Das Log sieht so aus.

            -0	2015-09-07 18:43:45	info	Client [ArminsHandy] publishes "mqtt.0.$SYS.keepalive"(string):
            host-Test	2015-09-07 18:30:08	info	instance system.adapter.ical.0 terminated with code 0 (OK)
            host-Test	2015-09-07 18:30:00	info	instance system.adapter.ical.0 started with pid 4227
            mqtt-0	2015-09-07 18:28:44	info	Client [ArminsHandy] publishes "mqtt.0.$SYS.keepalive"(string):
            mqtt-0	2015-09-07 18:20:56	info	Client [ArminsHandy] subscribes on "mqtt.0\. owntracks.#" with regex /^mqtt\.0\. owntracks\..*/
            mqtt-0	2015-09-07 18:20:56	info	Client [ArminsHandy] subscribes on " owntracks.#" with regex /^ owntracks\..*/
            mqtt-0	2015-09-07 18:20:56	info	Client [ArminsHandy] connected
            mqtt-0	2015-09-07 18:20:56	info	Client [ArminsHandy] closed
            node-red-0	2015-09-07 18:20:56	info	Save /root/iobroker-data/node-red/flows.json
            mqtt-0	2015-09-07 18:20:55	info	Client [ArminsHandy] disconnected
            mqtt-0	2015-09-07 18:14:18	info	Client [ArminsHandy] publishes "mqtt.0.owntracks.armin.ArminsHandy"(string): {"_type": "location", "lat": "53.xxxxx", "lon": "10.0113643", "tst": "1441642460", "acc": "30.0", "batt": "82"}
            mqtt-0	2015-09-07 18:13:23	info	Send to client [ArminsHandy] "owntracks/armin/ArminsHandy/waypoints": undefined
            mqtt-0	2015-09-07 18:13:23	info	Send to client [ArminsHandy] "owntracks/armin/ArminsHandy": {"_type": "location", "lat": "53.xxxxx", "lon": "10.0112962", "tst": "1441622918", "acc": "30.0", "batt": "83"}
            mqtt-0	2015-09-07 18:13:21	info	Client [ArminsHandy] subscribes on "mqtt.0.owntracks.+.+" with regex /mqtt\.0\.owntracks\.[^.]*\.[^\.].*$/
            mqtt-0	2015-09-07 18:13:21	info	Client [ArminsHandy] subscribes on "owntracks.+.+" with regex /owntracks\.[^.]*\.[^\.].*$/
            mqtt-0	2015-09-07 18:13:21	info	Client [ArminsHandy] connected
            mqtt-0	2015-09-07 18:13:21	info	Client [ArminsHandy] closed
            mqtt-0	2015-09-07 18:13:21	info	Client [ArminsHandy] disconnected
            node-red-0	2015-09-07 18:10:46	warn	7 Sep 18:10:46 - [warn] [switch:f77c1141.0883f] TypeError: Cannot read property 'alt' of null
            node-red-0	2015-09-07 18:10:46	error	7 Sep 18:10:46 - [error] [function:handelt es sich um einen event?] TypeError: Cannot read property '_type' of null
            mqtt-0	2015-09-07 18:10:46	info	Send to client [ArminsHandy] "Owntracks geofence 1883": null
            node-red-0	2015-09-07 18:10:44	info	Save /root/iobroker-data/node-red/flows.json
            mqtt-0	2015-09-07 18:10:44	info	Client [ArminsHandy] subscribes on "mqtt.0.Owntracks geofence 1883"
            mqtt-0	2015-09-07 18:10:44	info	Create state mqtt.0.Owntracks geofence 1883 for subscribe
            mqtt-0	2015-09-07 18:10:44	info	Client [ArminsHandy] connected
            node-red-0	2015-09-07 18:10:43	info	Save /root/iobroker-data/node-red/flows.json
            mqtt-0	2015-09-07 18:09:50	info	Client [ArminsHandy] closed
            node-red-0	2015-09-07 18:09:50	info	Save /root/iobroker-data/node-red/flows.json
            mqtt-0	2015-09-07 18:09:49	info	Client [ArminsHandy] disconnected
            mqtt-0	2015-09-07 18:04:29	info	Send to client [ArminsHandy] "owntracks/armin/ArminsHandy/waypoints": undefined
            mqtt-0	2015-09-07 18:04:29	info	Send to client [ArminsHandy] "owntracks/armin/ArminsHandy": {"_type": "location", "lat": "53.xxxx", "lon": "10.0112962", "tst": "1441622918", "acc": "30.0", "batt": "83"}
            mqtt-0	2015-09-07 18:04:27	info	Client [ArminsHandy] subscribes on "mqtt.0.owntracks.+.+" with regex /mqtt\.0\.owntracks\.[^.]*\.[^\.].*$/
            mqtt-0	2015-09-07 18:04:27	info	Client [ArminsHandy] subscribes on "owntracks.+.+" with regex /owntracks\.[^.]*\.[^\.].*$/
            mqtt-0	2015-09-07 18:04:27	info	Send to client [ArminsHandy] "hue/0/Philips_hue/Holzterasse/command": {"on":true,"hue":10834,"sat":254,"bri":254,"transitiontime":23}
            mqtt-0	2015-09-07 18:04:27	info	Client [ArminsHandy] connected
            mqtt-0	2015-09-07 18:04:26	info	Client [ArminsHandy] closed
            mqtt-0	2015-09-07 18:04:26	info	Client [ArminsHandy] disconnected
            mqtt-0	2015-09-07 18:03:59	info	Client [ArminsHandy] publishes "mqtt.0.owntracks.armin.ArminsHandy.waypoints"(string): {"_type": "waypoint", "desc": "zuhause", "lat": "53.634628", "lon": "10.0113573", "tst": "1441603247", "rad": "1
            mqtt-0	2015-09-07 18:03:41	info	Client [ArminsHandy] publishes "mqtt.0.owntracks.armin.ArminsHandy"(string): {"_type": "location", "lat": "53.xxxxx", "lon": "10.0113298", "tst": "1441641822", "acc": "30.0", "batt": "84"}
            mqtt-0	2015-09-07 18:01:30	info	Send to client [ArminsHandy] "owntracks/armin/ArminsHandy/waypoints": undefined
            mqtt-0	2015-09-07 18:01:30	info	Send to client [ArminsHandy] "owntracks/armin/ArminsHandy": {"_type": "location", "lat": "53.xxxxx", "lon": "10.0112962", "tst": "1441622918", "acc": "30.0", "batt": "83"}
            mqtt-0	2015-09-07 18:01:28	info	Client [ArminsHandy] subscribes on "mqtt.0.owntracks.+.+" with regex /mqtt\.0\.owntracks\.[^.]*\.[^\.].*$/
            mqtt-0	2015-09-07 18:01:28	info	Client [ArminsHandy] subscribes on "owntracks.+.+" with regex /owntracks\.[^.]*\.[^\.].*$/
            mqtt-0	2015-09-07 18:01:28	info	Client [ArminsHandy] connected
            mqtt-0	2015-09-07 18:01:28	info	Client [ArminsHandy] closed
            mqtt-0	2015-09-07 18:01:28	info	Client [ArminsHandy] disconnected
            mqtt-0	2015-09-07 18:01:04	info	Client [ArminsHandy] publishes "mqtt.0.owntracks.armin.ArminsHandy.waypoints" (string): {"_type": "waypoint", "desc": "zuhause", "lat": "53.634628", "lon": "10.0113573", "tst": "1441603247", "rad": "
            mqtt-0	2015-09-07 18:01:04	info	Create state mqtt.0.owntracks.armin.ArminsHandy.waypoints
            mqtt-0	2015-09-07 18:01:03	info	Client [ArminsHandy] publishes "mqtt.0.$SYS.keepalive"(string):
            mqtt-0	2015-09-07 18:00:37	info	Client [ArminsHandy] publishes "mqtt.0.owntracks.armin.ArminsHandy"(string): {"_type": "location", "lat": "53.xxxxx9", "lon": "10.0113298", "tst": "1441641639", "acc": "30.0", "batt": "85"}
            mqtt-0	2015-09-07 18:00:30	info	Client [ArminsHandy] publishes "mqtt.0.owntracks.armin.ArminsHandy"(string): {"_type": "location", "lat": "53.xxxxx", "lon": "10.0113464", "tst": "1441641632", "acc": "30.0", "batt": "86"}
            
            
            1 Reply Last reply Reply Quote 0
            • A
              Arminhh last edited by

              hallo ruhr70,

              so langsam komme ich weiter. Scheinbar habe ich ein Port Problem. Ich bekomme die Fehlermeldung "unable to listen on port 1883, error: Error: listen EADDRINUSE" Der MQTT Adapter läuft auf Port 1883 und der Node-redadapter auf 1880. Kannst Du mir da einen Tip geben? Was ich nicht verstehe ist, warum sehe ich dann die Daten vom MQTT Adapter im IOBroker Log?

              mfg

              Arminhh
              6334_google.jpg

              1 Reply Last reply Reply Quote 0
              • ruhr70
                ruhr70 last edited by

                Du hast es anders eingerichtet als ich.

                Ich nutze den mqtt Adapter von ioBroker und dann in Node-red den Datenpunkt von dem Adapter.

                Du nutzt direkt die mqtt Anbindung von Node-red.

                Du hast nun wahrscheinlich den Port 1883 in Node-red über den mqtt Baustein in Node-red realisiert und den mqtt-Adapter in ioBroker noch Parallel aktiv?

                Dann würden zwei Applikationen um den Port 1883 kämpfen und eine gewinnt. Das würde die Fehlermeldung "unable to listen on port 1883, error: Error: listen EADDRINUSE" erklären.

                Ich sitze gerade nicht vor meiner Installation. Aber der Port 1880 ist doch der Port der Weboberfläche von Node-red oder? Das hat damit nichts zu tun.

                Du hast Dich für die variante entschieden, die bei mir nicht aktiv ist 😉

                das wird etwas schwierig.

                1 Reply Last reply Reply Quote 0
                • A
                  Arminhh last edited by

                  Hallo Ruhr70

                  jetzt ist der Groschen gefallen! Die Variablen werden jetzt gefüllt.

                  Anbei mal screenshot von den Werten. Ich habe das Gefühl die Werte sind so noch nicht richtig formatiert.

                  Was ich nicht verstehe, wie ich die Wegepoints einfüge. Ich habe auf dem Handy einmal zuhause und einen 2 Wegepoint eingerichtet. zuhause wird angezeigt der 2 nicht.

                  Der Batteriestatus stimmt nicht.

                  Obwohl das Handy direkt neben mir liegt zeigt die Distanz über 343 km an.

                  Über ein paar Tips würde ich mich freuen!

                  Sorry für die vielen Fragen!

                  mfg

                  Arminhh

                  280_screenshot_56.jpg

                  1 Reply Last reply Reply Quote 0
                  • A
                    Arminhh last edited by

                    Guten morgen,

                    jetzt läuft es bei mir!

                    Eine Frage zum App Ownreack Sobalb das Handy auf Standby geht sendet das App keine Daten mehr und der Status im Flow geht auf unbekannt. Kann ich da noch was machen?

                    Frage 2

                    Ich habe den Flow erweitert um die Funktion die Waypoints zusätzlich als Zahl auszugeben. Die Funktion habe ich bei der Funktion( Prüfen ob JSON ein Event enthäll)t.

                    Dort greife ich mit

                    msg.payload=msg.payload;

                    if ( msg.payload == "unbekannt" )

                    msg.payload = 0;

                    return msg;

                    oder

                    msg.payload=msg.payload;

                    if ( msg.payload == "zuhause" )

                    msg.payload = 1;

                    return msg;

                    die Werte ab.

                    Das Merkwürdige ist, es Funktioniert kurz. Das bedeutet die Variable wird kurz mit 0 oder 1 gefüllt nach ein paar Sekunden wird wieder der Wert zuhause oder unbekannt in die Variable geschrieben. Was mache ich falsch!

                    Anbei der Flow und ein Screenshot.

                    Erreichen möchte ich damit, die Standorte einem Tile ValueList 8 Widget zuweisen zu können.

                    280_screenshot_58.jpg

                    Hier der Flow

                    [{"id":"2ab4dfa8.d54b2","type":"websocket-listener","path":"/ws/location","wholemsg":"false"},{"id":"a1f9b6e6.5e0648","type":"ioBroker in","name":"owntracks/armin/ArminsHandy","topic":"mqtt.0.owntracks.armin.ArminsHandy","payloadType":"value","x":175.44442749023438,"y":250.85719871520996,"z":"d3db8aa8.2c2478","wires":[["52c56ca0.ad3a94","9d18abf4.62e758","2715045a.d8eafc"]]},{"id":"c3dceab4.3c2318","type":"debug","name":"","active":false,"console":"false","complete":"false","x":1184.4446105957031,"y":261.33338260650635,"z":"d3db8aa8.2c2478","wires":[]},{"id":"7d17eb00.82e814","type":"function","name":"Koordinaten (lat)","func":"msg.payload = parseFloat(msg.payload.lat);\nreturn msg;","outputs":"1","x":940.1112594604492,"y":455.00004959106445,"z":"d3db8aa8.2c2478","wires":[["d62bdfe8.29d42","10f3801a.ef0c8"]]},{"id":"3fc4e765.c03b18","type":"function","name":"Koordinaten (lon)","func":"msg.payload = parseFloat(msg.payload.lon);\nreturn msg;","outputs":"1","x":941.111198425293,"y":486.1112251281738,"z":"d3db8aa8.2c2478","wires":[["d62bdfe8.29d42","d23f5754.2dc0a8"]]},{"id":"20a23cfd.df5dc4","type":"json","name":"","x":578.444450378418,"y":267.5556001663208,"z":"d3db8aa8.2c2478","wires":[["c3dceab4.3c2318"]]},{"id":"6327d64d.9cd828","type":"comment","name":"Owntracks an ioBroker mqtt Instanz (Port 1883)","info":"Beschreibung der JSON Datenfelder:\n\nhttps://github.com/owntracks/owntracks/wiki/JSON","x":221.44442749023438,"y":212.41274070739746,"z":"d3db8aa8.2c2478","wires":[]},{"id":"4dbc57fc.b243a8","type":"comment","name":"Ausgabe: Value","info":"","x":345.1110610961914,"y":274.7461223602295,"z":"d3db8aa8.2c2478","wires":[]},{"id":"ea0f4f3f.15f0b","type":"comment","name":"Behandlung als JSON","info":"","x":585.444450378418,"y":233.5556001663208,"z":"d3db8aa8.2c2478","wires":[]},{"id":"c1d42279.3e2be","type":"comment","name":"Auswertung der JSON Daten","info":"","x":939.1111450195312,"y":423.5555896759033,"z":"d3db8aa8.2c2478","wires":[]},{"id":"d37b63a4.2c84a","type":"function","name":"Höhe in m (alt)","func":"msg.payload = parseInt(msg.payload.alt);\nreturn msg;","outputs":"1","x":936.000114440918,"y":540.5555610656738,"z":"d3db8aa8.2c2478","wires":[["d62bdfe8.29d42","95bb59b7.6a44a8"]]},{"id":"94b876af.6b4788","type":"function","name":"Batterieladestand (batt)","func":"msg.payload = parseInt(msg.payload.batt);\nreturn msg;","outputs":"1","x":939.0000534057617,"y":589.555591583252,"z":"d3db8aa8.2c2478","wires":[["d62bdfe8.29d42","b231ed52.4dce1"]]},{"id":"713e55fc.8ec1ac","type":"switch","name":"","property":"payload.alt","rules":[{"t":"neq","v":"0"}],"checkall":"true","outputs":1,"x":690.3333435058594,"y":438.22222900390625,"z":"d3db8aa8.2c2478","wires":[["7d17eb00.82e814","3fc4e765.c03b18","d37b63a4.2c84a","94b876af.6b4788","fed37e61.012c8","6b95e417.946a1c","3cd77854.c32888","1cb03cf.fe34fc3","57f743c8.a808bc","56a04f2e.a95fb","fdbe760.f024188","5f32add6.a0cd54","a78ac0e7.58754","4fb65101.b049b","5607f660.a9f808","d5757a45.2a8a88","aeb6f8f1.514908","9d9f8ae3.626078"]]},{"id":"c58e474f.3a71b8","type":"comment","name":"Meldungen mit 0 ausfiltern","info":"","x":622.6666259765625,"y":478.2222385406494,"z":"d3db8aa8.2c2478","wires":[]},{"id":"d62bdfe8.29d42","type":"debug","name":"","active":false,"console":"false","complete":"false","x":1178.0000534057617,"y":379.55556869506836,"z":"d3db8aa8.2c2478","wires":[]},{"id":"fed37e61.012c8","type":"function","name":"Kurs 0 = Norden (cog)","func":"msg.payload = parseInt(msg.payload.cog);\nreturn msg;","outputs":"1","x":942.9999923706055,"y":640.555591583252,"z":"d3db8aa8.2c2478","wires":[["d62bdfe8.29d42","203fa93d.dfc056"]]},{"id":"6b95e417.946a1c","type":"function","name":"Grund für die Meldung (t)","func":"msg.payload = msg.payload.t;\nreturn msg;\n\n\n// \"p\" ping, issued randomly by background task\n// \"c\" circular region enter/leave event\n// \"b\" beacon region enter/leave event\n// \"r\" response to a \"reportLocation\" request\n// \"u\" manual publish requested by the user\n// \"t\" timer based publish in move move\n// \"a\" or missing t indicates automatic location update","outputs":"1","x":946.9999923706055,"y":696.555591583252,"z":"d3db8aa8.2c2478","wires":[["d62bdfe8.29d42","46183fe4.b9e7c"]]},{"id":"3cd77854.c32888","type":"function","name":"Tracker ID (tid)","func":"msg.payload = msg.payload.tid;\nreturn msg;","outputs":"1","x":950.9999923706055,"y":754.555591583252,"z":"d3db8aa8.2c2478","wires":[["d62bdfe8.29d42","b72fd3fc.48d03"]]},{"id":"1cb03cf.fe34fc3","type":"function","name":"(Geschwindigkeit in km/h (vel)","func":"msg.payload = parseInt(msg.payload.vel);\nreturn msg;","outputs":"1","x":944.9999923706055,"y":802.555591583252,"z":"d3db8aa8.2c2478","wires":[["d62bdfe8.29d42","a37ad666.5c8528"]]},{"id":"57f743c8.a808bc","type":"function","name":"Genauigkeit Koordinaten in m (acc)","func":"msg.payload = parseInt(msg.payload.acc);\nreturn msg;","outputs":"1","x":937.9999923706055,"y":855.555591583252,"z":"d3db8aa8.2c2478","wires":[["d62bdfe8.29d42","ccd1c76a.332e38"]]},{"id":"56a04f2e.a95fb","type":"function","name":"GoogleMaps Adresse https","func":"msg.payload = \"https://www.google.de/maps/@\" \n       + msg.payload.lat + \",\" +\n       + msg.payload.lon;\nreturn msg;\n","outputs":"1","x":926.9999923706055,"y":915.222225189209,"z":"d3db8aa8.2c2478","wires":[["d62bdfe8.29d42","54c7e36b.ab381c"]]},{"id":"10f3801a.ef0c8","type":"ioBroker out","name":"","topic":"OwntracksMHlat","ack":"true","autoCreate":"true","x":1181.9999923706055,"y":454.11113357543945,"z":"d3db8aa8.2c2478","wires":[]},{"id":"d23f5754.2dc0a8","type":"ioBroker out","name":"","topic":"OwntracksMHlon","ack":"true","autoCreate":"true","x":1183.9999923706055,"y":499.11113357543945,"z":"d3db8aa8.2c2478","wires":[]},{"id":"95bb59b7.6a44a8","type":"ioBroker out","name":"","topic":"OwntracksMHalt","ack":"true","autoCreate":"true","x":1182.9999923706055,"y":547.1111335754395,"z":"d3db8aa8.2c2478","wires":[]},{"id":"b231ed52.4dce1","type":"ioBroker out","name":"","topic":"OwntracksMHbatt","ack":"true","autoCreate":"true","x":1184.9999923706055,"y":598.1111335754395,"z":"d3db8aa8.2c2478","wires":[]},{"id":"203fa93d.dfc056","type":"ioBroker out","name":"","topic":"OwntracksMHcog","ack":"true","autoCreate":"true","x":1178.9999923706055,"y":646.1111335754395,"z":"d3db8aa8.2c2478","wires":[]},{"id":"46183fe4.b9e7c","type":"ioBroker out","name":"","topic":"OwntracksMHt","ack":"true","autoCreate":"true","x":1171.9999923706055,"y":695.1111335754395,"z":"d3db8aa8.2c2478","wires":[]},{"id":"b72fd3fc.48d03","type":"ioBroker out","name":"","topic":"OwntracksMHtid","ack":"true","autoCreate":"true","x":1174.9999923706055,"y":745.1111335754395,"z":"d3db8aa8.2c2478","wires":[]},{"id":"a37ad666.5c8528","type":"ioBroker out","name":"","topic":"OwntracksMHvel","ack":"true","autoCreate":"true","x":1173.9999923706055,"y":795.1111335754395,"z":"d3db8aa8.2c2478","wires":[]},{"id":"ccd1c76a.332e38","type":"ioBroker out","name":"","topic":"OwntracksMHacc","ack":"true","autoCreate":"true","x":1179.9999923706055,"y":852.1111335754395,"z":"d3db8aa8.2c2478","wires":[]},{"id":"54c7e36b.ab381c","type":"ioBroker out","name":"","topic":"OwntracksMHgoogleMaps","ack":"true","autoCreate":"true","x":1182.9999923706055,"y":918.5555992126465,"z":"d3db8aa8.2c2478","wires":[]},{"id":"fdbe760.f024188","type":"function","name":"Timestamp (tst)","func":"msg.payload = msg.payload.tst;\nreturn msg;","outputs":"1","x":936.9999923706055,"y":981.000057220459,"z":"d3db8aa8.2c2478","wires":[["c96d66a9.369298","b2db292e.4d24d8"]]},{"id":"c96d66a9.369298","type":"ioBroker out","name":"","topic":"OwntracksMHtst","ack":"true","autoCreate":"true","x":1147.9999923706055,"y":982.5555992126465,"z":"d3db8aa8.2c2478","wires":[]},{"id":"5f32add6.a0cd54","type":"switch","name":"Zwei gleiche Timestamps rausfiltern","property":"payload.tst","rules":[{"t":"eq","v":"node-red.0.OwntracksMHtst"}],"checkall":"true","outputs":1,"x":530.9999313354492,"y":584.5555686950684,"z":"d3db8aa8.2c2478","wires":[["cae6e6af.351918"]]},{"id":"cae6e6af.351918","type":"debug","name":"Debug: Ausgabe nur bei gleichen Timestamps","active":false,"console":"false","complete":"payload.tst","x":470.99996185302734,"y":627.5555992126465,"z":"d3db8aa8.2c2478","wires":[]},{"id":"a78ac0e7.58754","type":"function","name":"Datum (tst) lesbar umwandeln","func":"// (1) wandelt timestamo ins ISO Datumformat um\n//msg.timestamp= new Date().toISOString()\n\n\n// (2) beliebiges Datum festlegbar: hier: YYYY-MM-DD HH:MM.SS\n//     (Ausgabeformat wird danz am Ende zusammengestellt)\nvar now     = new Date(); \n// var now     = new Date(parseInt(msg.payload.tst)); \nvar year    = now.getFullYear();\nvar month   = now.getMonth()+1; \nvar day     = now.getDate();\nvar hour    = now.getHours();\nvar minute  = now.getMinutes();\nvar second  = now.getSeconds(); \nif(month.toString().length == 1) {\nvar month = '0'+month;\n}\nif(day.toString().length == 1) {\nvar day = '0'+day;\n}   \nif(hour.toString().length == 1) {\nvar hour = '0'+hour;\n}\nif(minute.toString().length == 1) {\nvar minute = '0'+minute;\n}\nif(second.toString().length == 1) {\nvar second = '0'+second;\n}   \n//msg.timestamp = year+'-'+month+'-'+day+' '+hour+':'+minute+':'+second;\nmsg.payload = year+'-'+month+'-'+day+' '+hour+':'+minute+':'+second;\n\n\nreturn msg;","outputs":1,"x":942.1110229492188,"y":1041.333330154419,"z":"d3db8aa8.2c2478","wires":[["c5ae4dd5.3a51b","f27cefc6.0d831"]]},{"id":"c5ae4dd5.3a51b","type":"ioBroker out","name":"","topic":"OwntracksMHdatum","ack":"true","autoCreate":"true","x":1168.7776107788086,"y":1039.6666984558105,"z":"d3db8aa8.2c2478","wires":[]},{"id":"b2db292e.4d24d8","type":"debug","name":"","active":false,"console":"false","complete":"false","x":1354.6110649108887,"y":983.4166965484619,"z":"d3db8aa8.2c2478","wires":[]},{"id":"f27cefc6.0d831","type":"debug","name":"","active":false,"console":"false","complete":"false","x":1359.6110458374023,"y":1035.9166831970215,"z":"d3db8aa8.2c2478","wires":[]},{"id":"4a7ccf70.b5833","type":"comment","name":"Datum auf Date() geändert","info":"Über msg.payload.tst kommt immer ein Datum aus 1970 mit.\nDaher wird nun das aktuelle Datum im Flow erzeugt und verwendet.","x":923.3610572814941,"y":1072.1666975021362,"z":"d3db8aa8.2c2478","wires":[]},{"id":"2bfe9c31.d40164","type":"comment","name":"http://osmtools.de/osmlinks/?lang=de","info":"http://osmtools.de/osmlinks/?lang=de&lon=6.7855&lat=51.246498&zoom=18\n","x":809.2539716448102,"y":43.238085065569194,"z":"d3db8aa8.2c2478","wires":[]},{"id":"6fa2151d.905dec","type":"comment","name":"http://www.openstreetmap.org/?mlon=6.7855&mlat=51.246498&zoom=18#map=18/51.24650/6.78550","info":"","x":1013.5397186279297,"y":74.66665649414062,"z":"d3db8aa8.2c2478","wires":[]},{"id":"4fb65101.b049b","type":"function","name":"openstreetmap Adresse http","func":"// http://www.openstreetmap.org/?mlon=6.7855&mlat=51.246498&zoom=18#map=18/51.24650/6.78550\n\n// Koordinate inkl. Marker\nmsg.payload = \"http://www.openstreetmap.org/?mlon=\" \n       + msg.payload.lon + \"&mlat=\"\n       + msg.payload.lat + \"&zoom=16#map=16/\" // Zoom Stufe 16 (beide Werte anpssen, wenn Änderung gewünscht)\n       + msg.payload.lat + \"/\"\n       + msg.payload.lon;\nreturn msg;\n","outputs":"1","x":924.9682235717773,"y":1130.380955696106,"z":"d3db8aa8.2c2478","wires":[["22ead552.dd152a","127acc53.ed8534"]]},{"id":"22ead552.dd152a","type":"ioBroker out","name":"","topic":"OwntracksMHopenstreetmap","ack":"true","autoCreate":"true","x":1193.539665222168,"y":1127.5238437652588,"z":"d3db8aa8.2c2478","wires":[]},{"id":"127acc53.ed8534","type":"debug","name":"","active":false,"console":"false","complete":"false","x":1404.9682846069336,"y":1127.5237741470337,"z":"d3db8aa8.2c2478","wires":[]},{"id":"5607f660.a9f808","type":"function","name":"öpnv Adresse http","func":"// http://xn--pnvkarte-m4a.de/?lon=6.7855&lat=51.246498&zoom=17\n\nmsg.payload = \"http://xn--pnvkarte-m4a.de/?lon=\" \n       + msg.payload.lon + \"&lat=\"\n       + msg.payload.lat + \"&zoom=17\"; // Zoom Stufe 17 \n\nreturn msg;\n","outputs":"1","x":920.682487487793,"y":1177.5238952636719,"z":"d3db8aa8.2c2478","wires":[["e61780a2.19e88"]]},{"id":"e61780a2.19e88","type":"ioBroker out","name":"","topic":"OwntracksMHöpnvkarte","ack":"true","autoCreate":"true","x":1193.539649963379,"y":1180.381012916565,"z":"d3db8aa8.2c2478","wires":[]},{"id":"3f8c6d6d.c07392","type":"file","name":"","filename":"/opt/iobroker/wegepunkte.csv","appendNewline":true,"overwriteFile":"false","x":1194.8730163574219,"y":1242.5237426757812,"z":"d3db8aa8.2c2478","wires":[]},{"id":"d5757a45.2a8a88","type":"function","name":"Daten für eine Datei","func":"msg.payload = msg.payload.lat + \",\"\n            + msg.payload.lon + \",\"\n            + msg.payload.tst + \",\";\n\nvar now     = new Date(); \n// var now     = new Date(parseInt(msg.payload.tst)); \nvar year    = now.getFullYear();\nvar month   = now.getMonth()+1; \nvar day     = now.getDate();\nvar hour    = now.getHours();\nvar minute  = now.getMinutes();\nvar second  = now.getSeconds(); \nif(month.toString().length == 1) {\nvar month = '0'+month;\n}\nif(day.toString().length == 1) {\nvar day = '0'+day;\n}   \nif(hour.toString().length == 1) {\nvar hour = '0'+hour;\n}\nif(minute.toString().length == 1) {\nvar minute = '0'+minute;\n}\nif(second.toString().length == 1) {\nvar second = '0'+second;\n}   \n//msg.timestamp = year+'-'+month+'-'+day+' '+hour+':'+minute+':'+second;\nmsg.payload = msg.payload + year+'-'+month+'-'+day+' '+hour+':'+minute+':'+second;\n\n\nreturn msg;\n","outputs":"1","x":940.682487487793,"y":1250.3808813095093,"z":"d3db8aa8.2c2478","wires":[["3f8c6d6d.c07392","c7c13407.383ec8"]]},{"id":"c7c13407.383ec8","type":"debug","name":"","active":false,"console":"false","complete":"false","x":1140.6824989318848,"y":1281.8094854354858,"z":"d3db8aa8.2c2478","wires":[]},{"id":"d5a78bd8.2a5878","type":"comment","name":"Datei für Import (z.B. in Google Maps)","info":"https://support.google.com/mymaps/answer/3024836?hl=de","x":1456.3967304229736,"y":1247.7618398666382,"z":"d3db8aa8.2c2478","wires":[]},{"id":"aeb6f8f1.514908","type":"function","name":"Luftlinie in km zwischen Smartphone und daheim","func":"//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::\n//:::                                                                         :::\n//:::  This routine calculates the distance between two points (given the     :::\n//:::  latitude/longitude of those points). It is being used to calculate     :::\n//:::  the distance between two locations using GeoDataSource (TM) prodducts  :::\n//:::                                                                         :::\n//:::  Definitions:                                                           :::\n//:::    South latitudes are negative, east longitudes are positive           :::\n//:::                                                                         :::\n//:::  Passed to function:                                                    :::\n//:::    lat1, lon1 = Latitude and Longitude of point 1 (in decimal degrees)  :::\n//:::    lat2, lon2 = Latitude and Longitude of point 2 (in decimal degrees)  :::\n//:::    unit = the unit you desire for results                               :::\n//:::           where: 'M' is statute miles (default)                         :::\n//:::                  'K' is kilometers                                      :::\n//:::                  'N' is nautical miles                                  :::\n//:::                                                                         :::\n//:::  Worldwide cities and other features databases with latitude longitude  :::\n//:::  are available at http://www.geodatasource.com                          :::\n//:::                                                                         :::\n//:::  For enquiries, please contact sales@geodatasource.com                  :::\n//:::                                                                         :::\n//:::  Official Web site: http://www.geodatasource.com                        :::\n//:::                                                                         :::\n//:::               GeoDataSource.com (C) All Rights Reserved 2015            :::\n//:::                                                                         :::\n//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::\n\n\n\nfunction distance(lat1, lon1, lat2, lon2, unit) {\n\tvar radlat1 = Math.PI * lat1/180\n\tvar radlat2 = Math.PI * lat2/180\n\tvar radlon1 = Math.PI * lon1/180\n\tvar radlon2 = Math.PI * lon2/180\n\tvar theta = lon1-lon2\n\tvar radtheta = Math.PI * theta/180\n\tvar dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\n\tdist = Math.acos(dist)\n\tdist = dist * 180/Math.PI\n\tdist = dist * 60 * 1.1515\n\tif (unit==\"K\") { dist = dist * 1.609344 }\n\tif (unit==\"N\") { dist = dist * 0.8684 }\n\treturn dist\n}\n\n\n// Home: 51.252596, 6.783141\nvar lat1 = 53.6348366;\nvar lon1 = 10.010861;\n// aktueller Standort\nvar lat2 = parseFloat(msg.payload.lat);\nvar lon2 = parseFloat(msg.payload.lon);     \n          \nvar msg1 = {};\nmsg1.payload = Math.round(distance(lat1, lon1, lat2, lon2, \"K\")*1000)/1000 // Distanz in km\nvar msg2 = {};\nmsg2.payload = Math.round(distance(lat1, lon1, lat2, lon2, \"K\")*1000); // in m \nreturn [msg1,msg2];\n\n","outputs":"2","noerr":0,"x":1503.7777125040689,"y":414.6666831970214,"z":"d3db8aa8.2c2478","wires":[["10fbf9bb.ef0406","1deb2a20.e214d6","21a6d400.de592c"],["10fbf9bb.ef0406","d0889097.2f777"]]},{"id":"10fbf9bb.ef0406","type":"debug","name":"","active":false,"console":"false","complete":"payload","x":1805.444480895996,"y":372.9999952316284,"z":"d3db8aa8.2c2478","wires":[]},{"id":"1deb2a20.e214d6","type":"ioBroker out","name":"","topic":"OwntracksMHDistanzKM","ack":"true","autoCreate":"true","x":1842.1109008789062,"y":413.00000953674316,"z":"d3db8aa8.2c2478","wires":[]},{"id":"21a6d400.de592c","type":"function","name":"als String mit dynamischen Nachkommastellen","func":"function runden(x) {\n  var k = (Math.round(x * 100) / 100).toString();\n  k += (k.indexOf('.') == -1)? '.0' : '0';\n  var p = k.indexOf('.'), m = k.indexOf('-.');\n  var f = (p == 0 || m == 0)? '0,' : ',';\n  return k.substring(0, p) + f + k.substring(p+1, p+3);\n}\n\n\nvar dist = msg.payload;\nif (dist < 1) {\ndist = Math.round(dist * 1000).toString();\nmsg.payload = dist + \" m\"; \n} else {\ndist = runden(dist).toString();\nmsg.payload = dist + \" km\";\n}\n\nreturn msg;","outputs":1,"x":1522.1110191345215,"y":533.0000114440918,"z":"d3db8aa8.2c2478","wires":[["e18f0bc3.1e70f8","eb3fa92.f14c058"]]},{"id":"e18f0bc3.1e70f8","type":"ioBroker out","name":"","topic":"OwntracksMHDistanzKMstring","ack":"true","autoCreate":"true","x":1847.1109466552734,"y":531.3333044052124,"z":"d3db8aa8.2c2478","wires":[]},{"id":"eb3fa92.f14c058","type":"debug","name":"","active":false,"console":"false","complete":"false","x":1792.1110458374023,"y":588.0000165303547,"z":"d3db8aa8.2c2478","wires":[]},{"id":"80f8ec84.7f071","type":"function","name":"handelt es sich um einen event?","func":"// The received message is stored in 'msg'\n// It will have at least a 'payload' property:\n//   console.log(msg.payload);\n// The 'context' object is available to store state\n// between invocations of the function\n//   context = {};\nvar now = Date();\nvar message = \"\";\nvar standort = \"\";\nvar event = \"\";\ndata = JSON.parse(msg.payload);\n\n// data.event != undefined => die Meldung enthält kein Feld \"event\"\n// der if Zweig wird ausgeführt, wenn der Typ der Meldung Location ist und das Feld event vorhanden ist\nif ( (data._type == \"location\") && (data.event != undefined ) ) {\n\t    event = \"event\";\n\t    \n\t    // es wird geprüft, ob die Beshreibung für eine location mitgeschickt wird\n\t    // ind er Onwtracks app beim Standord \"Share\" aktiviert\n\t\tif ( data.desc != undefined ) {\n\t\t\t// Shared waypoint, comes with a description:\n\t\t\t\tmessage = data.desc;\n \t\t} else {\n \t\t\t// No description is set, non shared \"private\" waypoint\n \t\t\t\tmessage = data.lat + \",\" + data.lon;\n \t\t}\n \t\tstandort = message;\n       \n       // enthält event == \"enter\"\n\t\tif ( data.event == \"enter\" ) {\t\t\t\n\t\t\tmessage = message + \" betreten\";\n\t\t} else {\n\t\t\tmessage = message + \" verlassen\";\n\t\t\tstandort = \"unbekannt\"; // ein Standort wurde verlassen, neuer Standort = \"unbekannt\"\n\t\t}\n \n \n }\n \nvar msg1 = {};\nvar msg2 = {};\nmsg1.event = event;\nmsg1.payload = message;\n//console.log(msg.payload);\n\nmsg2.event = event;\nmsg2.payload = standort;\n\n\nreturn [msg1,msg2];","outputs":"2","x":1535.7777099609375,"y":672.6665344238281,"z":"d3db8aa8.2c2478","wires":[["3e9bcf7c.c1643","73a1334d.8c5ecc"],["1a700707.e58ff9","8913f6d4.76ec08"]]},{"id":"3e9bcf7c.c1643","type":"switch","name":"Prüfen, ob JSON ein event enthielt","property":"event","rules":[{"t":"cont","v":"event"}],"checkall":"true","outputs":1,"x":1547.777603149414,"y":794.0000801086426,"z":"d3db8aa8.2c2478","wires":[["6c155f47.93eaa","403f792a.bfc088"]]},{"id":"6c155f47.93eaa","type":"debug","name":"","active":true,"console":"false","complete":"payload","x":1871.1111526489258,"y":765.6663665771484,"z":"d3db8aa8.2c2478","wires":[]},{"id":"403f792a.bfc088","type":"ioBroker out","name":"","topic":"OwntracksMHstandortÄnderung","ack":"true","autoCreate":"true","x":1946.4443054199219,"y":825.333251953125,"z":"d3db8aa8.2c2478","wires":[]},{"id":"ba30197a.45cfe8","type":"debug","name":"","active":false,"console":"false","complete":"false","x":900.4444007873535,"y":374.66664028167725,"z":"d3db8aa8.2c2478","wires":[]},{"id":"636c5fbe.9c93a","type":"json","name":"","x":547.1110916137695,"y":439.6666431427002,"z":"d3db8aa8.2c2478","wires":[["713e55fc.8ec1ac","ba30197a.45cfe8"]]},{"id":"73a1334d.8c5ecc","type":"debug","name":"","active":true,"console":"false","complete":"true","x":1906.4443969726562,"y":636.333251953125,"z":"d3db8aa8.2c2478","wires":[]},{"id":"d0889097.2f777","type":"ioBroker out","name":"","topic":"OwntracksMHDistanzM","ack":"true","autoCreate":"true","x":1845.4443664550781,"y":461.33331298828125,"z":"d3db8aa8.2c2478","wires":[]},{"id":"ea3f5adf.15c0a8","type":"comment","name":"GEOFENCE = event","info":"","x":1490.4443969726562,"y":624.6666564941406,"z":"d3db8aa8.2c2478","wires":[]},{"id":"1a700707.e58ff9","type":"switch","name":"Prüfen, ob JSON ein event enthielt","property":"event","rules":[{"t":"cont","v":"event"}],"checkall":"true","outputs":1,"x":1645.7778015136719,"y":1016.9999580383301,"z":"d3db8aa8.2c2478","wires":[["3c920522.c36dfa","fa023ee9.05fdc","35bec916.ca4136","366d7e73.c99282","87213994.78dec8","2dfdeb78.d20214","15e334b2.ea1ccb"]]},{"id":"3c920522.c36dfa","type":"debug","name":"","active":true,"console":"false","complete":"payload","x":1961.1112976074219,"y":945.3329048156738,"z":"d3db8aa8.2c2478","wires":[]},{"id":"fa023ee9.05fdc","type":"ioBroker out","name":"","topic":"OwntracksMHstandort","ack":"true","autoCreate":"true","x":1965.1111755371094,"y":1008.3330879211426,"z":"d3db8aa8.2c2478","wires":[]},{"id":"985e076.f67a1f8","type":"websocket out","name":"","server":"2ab4dfa8.d54b2","x":882.2064056396484,"y":1499.8571128845215,"z":"d3db8aa8.2c2478","wires":[]},{"id":"b9ee93e2.46117","type":"websocket in","name":"","server":"2ab4dfa8.d54b2","x":446.20640563964844,"y":1551.8571128845215,"z":"d3db8aa8.2c2478","wires":[["ede05e89.121fa","e7a01c03.185fe"]]},{"id":"fae24650.051db8","type":"http in","name":"","url":"/map","method":"get","x":445.20640563964844,"y":1649.8571128845215,"z":"d3db8aa8.2c2478","wires":[["15613a46.ea9ec6"]]},{"id":"cc422a3c.33bdd8","type":"http response","name":"","x":893.2064056396484,"y":1649.8571128845215,"z":"d3db8aa8.2c2478","wires":[]},{"id":"15613a46.ea9ec6","type":"template","name":"Google Maps http://eigeneIP:1880/map","field":"","template":"\n\n\n  <title>Owntracks & The ThingBox Live Map</title>\n  \n  \n  \n \n   \n\n\n \n  \n   \n\n","x":665.2064056396484,"y":1649.8571128845215,"z":"d3db8aa8.2c2478","wires":[["cc422a3c.33bdd8"]]},{"id":"ede05e89.121fa","type":"function","name":"function 2","func":"// The received message is stored in 'msg'\n// It will have at least a 'payload' property:\n//   console.log(msg.payload);\n// The 'context' object is available to store state\n// between invocations of the function\n//   context = {};\n\nmsg.payload = context.global.location;\n\nreturn msg;","outputs":1,"x":672.2064056396484,"y":1551.8571128845215,"z":"d3db8aa8.2c2478","wires":[["985e076.f67a1f8","22ed11fa.dd12ee"]]},{"id":"7c21f710.83de08","type":"function","name":"function 1","func":"// The received message is stored in 'msg'\n// It will have at least a 'payload' property:\n//   console.log(msg.payload);\n// The 'context' object is available to store state\n// between invocations of the function\n//   context = {};\ncontext.global.location = msg.payload;\n\nreturn msg;","outputs":1,"x":675.2064056396484,"y":1455.8571128845215,"z":"d3db8aa8.2c2478","wires":[["985e076.f67a1f8","56783279.a987cc"]]},{"id":"9d9f8ae3.626078","type":"function","name":"Adaptation","func":"var zoom = 17; // Default = 17\n// In Zeile 20 im Template Node die eigene IP-Adresse vonioBroker/Node-red eintragen\n\n\nvar latitude = msg.payload.lat;\nvar longitude = msg.payload.lon;\nmsg.payload = '[{\"lat\":\"' + latitude + '\",\"lng\":\"' + longitude + '\",\"zoom\":\"' + zoom + '\"}]'; \nreturn msg;","outputs":1,"x":517.2064056396484,"y":1455.8571128845215,"z":"d3db8aa8.2c2478","wires":[["7c21f710.83de08"]]},{"id":"56783279.a987cc","type":"debug","name":"","active":false,"console":"false","complete":"false","x":1046.777816772461,"y":1466.8571128845215,"z":"d3db8aa8.2c2478","wires":[]},{"id":"22ed11fa.dd12ee","type":"debug","name":"","active":false,"console":"false","complete":"false","x":1046.492172241211,"y":1540.571346282959,"z":"d3db8aa8.2c2478","wires":[]},{"id":"e7a01c03.185fe","type":"debug","name":"","active":false,"console":"false","complete":"false","x":1040.777816772461,"y":1594.9999351501465,"z":"d3db8aa8.2c2478","wires":[]},{"id":"505b375f.afa4c8","type":"comment","name":"http://eigeneIP:1880/map (eigene IP in Zeile 20 im Template Node eintragen)","info":"","x":748.7778167724609,"y":1408.9999351501465,"z":"d3db8aa8.2c2478","wires":[]},{"id":"52c56ca0.ad3a94","type":"debug","name":"","active":false,"console":"false","complete":"true","x":886.1111145019531,"y":210.66665649414057,"z":"d3db8aa8.2c2478","wires":[]},{"id":"9d18abf4.62e758","type":"debug","name":"","active":false,"console":"false","complete":"false","x":942.1111145019531,"y":160.6666564941406,"z":"d3db8aa8.2c2478","wires":[]},{"id":"2715045a.d8eafc","type":"function","name":"","func":"\nreturn msg;","outputs":1,"x":396.39685249328613,"y":405.6190061569214,"z":"d3db8aa8.2c2478","wires":[["80f8ec84.7f071","636c5fbe.9c93a"]]},{"id":"35bec916.ca4136","type":"function","name":"zuhause 1","func":"msg.payload=msg.payload;\nif ( msg.payload == \"zuhause\" ) \n\t\t\t\tmsg.payload = 1;\n\t\t\t\treturn msg;","outputs":1,"noerr":0,"x":1817.1182250976562,"y":1127.6665649414062,"z":"d3db8aa8.2c2478","wires":[["415d3396.bea2cc","92bff9f5.6d4008"]]},{"id":"415d3396.bea2cc","type":"ioBroker out","name":"OwntracksStandortZahl","topic":"OwntracksStandortZahl","ack":"true","autoCreate":"true","x":2096.1182250976562,"y":1199.6665649414062,"z":"d3db8aa8.2c2478","wires":[]},{"id":"92bff9f5.6d4008","type":"debug","name":"","active":true,"console":"false","complete":"true","x":2042.1182250976562,"y":1087.6665649414062,"z":"d3db8aa8.2c2478","wires":[]},{"id":"8913f6d4.76ec08","type":"debug","name":"","active":true,"console":"false","complete":"true","x":1912.6736260991042,"y":689.2222263371505,"z":"d3db8aa8.2c2478","wires":[]},{"id":"366d7e73.c99282","type":"function","name":"unbekannt 0","func":"msg.payload=msg.payload;\nif ( msg.payload == \"unbekannt\" ) \n\t\t\t\tmsg.payload = 0;\n\t\t\t\treturn msg;","outputs":1,"noerr":0,"x":1828.1182250976562,"y":1090.1107788085938,"z":"d3db8aa8.2c2478","wires":[["415d3396.bea2cc"]]},{"id":"87213994.78dec8","type":"function","name":"SybilleWohnung 2","func":"msg.payload=msg.payload;\nif ( msg.payload == \"SybilleWohnung\" ) \n\t\t\t\tmsg.payload = 2;\n\t\t\t\treturn msg;","outputs":1,"noerr":0,"x":1842.1182250976562,"y":1164.1107788085938,"z":"d3db8aa8.2c2478","wires":[["415d3396.bea2cc"]]},{"id":"2dfdeb78.d20214","type":"function","name":"Buero 3","func":"msg.payload=msg.payload;\nif ( msg.payload == \"Buero\" ) \n\t\t\t\tmsg.payload = 3;\n\t\t\t\treturn msg;","outputs":1,"noerr":0,"x":1810.1182250976562,"y":1203.1109008789062,"z":"d3db8aa8.2c2478","wires":[["415d3396.bea2cc"]]},{"id":"15e334b2.ea1ccb","type":"function","name":"nichts","func":"msg.payload=msg.payload;\nif ( msg.payload === \"\" ) \n\t\t\t\tmsg.payload = 0;\n\t\t\t\treturn msg;","outputs":1,"noerr":0,"x":1822.1182250976562,"y":1254.1110229492188,"z":"d3db8aa8.2c2478","wires":[["415d3396.bea2cc"]]}]
                    
                    

                    Danke für die Hilfe!

                    mfg

                    Arminhh

                    1 Reply Last reply Reply Quote 0
                    • A
                      Arminhh last edited by

                      Hallo Ruhr70,

                      ich verzweifele langsam! Alle Variable werden gefüllt. Nur node-red.0.OwntracksMHstandort und node-red.0.OwntracksMHstandortÄnderung nicht! in der Variable node-red.0.OwntracksMHstandortÄnderung steht der Wegepoint drin. Was kann das noch sein?

                      mfg

                      Arminhh

                      1 Reply Last reply Reply Quote 0
                      • S
                        Schnutexxl last edited by

                        Hallo Ihr Künstler,

                        ich bin ein wenig verwirrt durch eure beiden Node-Red Flows. Ich Bekomme beide nicht zum fliegen.

                        Welche Node´s muss ich denn nun konkret anpassen.

                        Was habe ich gemacht:

                        mqtt.0 Instanz konfiguriert, wie beschrieben.

                        Owntracks installiert und konfiguriert, wie beschrieben

                        NodeRed Flow importiert, erst von Ruhr und dann den modifizierten von Arminhh

                        Versucht Node´s zu konfigurieren, aber irgendwie fehlt mir hier das Verständniss.

                        Somit welche Node´s muss ich denn nun konkret wie anpassen?

                        Danke und Gruß

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post

                        Support us

                        ioBroker
                        Community Adapters
                        Donate

                        938
                        Online

                        31.6k
                        Users

                        79.4k
                        Topics

                        1.3m
                        Posts

                        5
                        19
                        7631
                        Loading More Posts
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes
                        Reply
                        • Reply as topic
                        Log in to reply
                        Community
                        Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
                        The ioBroker Community 2014-2023
                        logo