Jsonmod - Probleme

Begonnen von guhu, 25 September 2020, 09:18:48

Vorheriges Thema - Nächstes Thema

guhu

Hallo, vielen Dank für das Modul Jsonmod, mit dem ich mich beschäftige derzeit. Leide tue mich mich damit etwas schwer, es wäre toll, wenn mir da jemand ein wenig auf die Sprünge helfen könnte.
Das Auslesen funktioniert soweit, jsonpath ist getestet, allerdings werden noch keine Readings abgelegt.
Ich komme nicht ganz klar mit den Meldungen im Logfile:
2020.09.25 09:12:28.250 5: HttpUtils url=https://api.komoot.de/v007/users/<user>/highlights/?sports=&saved=false&recommended=true&_embedded=bookmark&name=&hl=de&page=0&limit=1000
2020.09.25 09:12:28.267 4: IP: api.komoot.de -> 52.209.64.121
2020.09.25 09:12:28.407 5: HttpUtils request header:
GET /v007/users/<user>/highlights/?sports=&saved=false&recommended=true&_embedded=bookmark&name=&hl=de&page=0&limit=1000 HTTP/1.0
Host: api.komoot.de
User-Agent: fhem
Accept-Encoding: gzip,deflate

Accept: application/json
Accept-Charset: utf-8, iso-8859-1

2020.09.25 09:12:29.394 4: https://api.komoot.de/v007/users/<user>/highlights/?sports=&saved=false&recommended=true&_embedded=bookmark&name=&hl=de&page=0&limit=1000: HTTP response code 200
2020.09.25 09:12:29.394 5: HttpUtils https://api.komoot.de/v007/users/<user>/highlights/?sports=&saved=false&recommended=true&_embedded=bookmark&name=&hl=de&page=0&limit=1000: Got data, length: 1617252
2020.09.25 09:12:29.394 5: HttpUtils response header:
HTTP/1.1 200 OK
Content-Type: application/hal+json;charset=UTF-8
Date: Fri, 25 Sep 2020 07:12:28 GMT
ETag: "0bbe021b5f4379ac34d22da8babe8b09a"
Server: Apache-Coyote/1.1
X-kmt-requestid: AQoACqAAAXTB-pOeAAAAAACbe3I
X-komoot-request-id: AQoACqAAAXTB-pOeAAAAAACbe3I
Content-Length: 1617252
Connection: Close
2020.09.25 09:12:29.395 4: [komootv3] api encoding is UTF-8, designated encoder is utf-8-strict


(user ist anonymisiert)
Was sagt mir die letzte Zeile? Ist das jetzt ein Problem oder nicht?
FHEM 5.9 auf Synology DS918+ (in Docker), HM-CFG-USB2 mit hmlan, HM-CC-RT-DN, HM-SEC-SC-2, nanoCUL,a-culfw,deCONZ,Brennenstuhl-Steckdosen,-FB
Module:ENIGMA2,SONOS,FRITZBOX,FB_CALLLIST,WDT_TIMER,VCONTROL300,WITHINGS

yersinia

#1
list vom device bitte

EDIT: mMn sehen die Meldungen unverdächtig aus, der verbose-level könnte auf 3 gesetzt werden, dann ist das Device nicht so geschwätzig imho.
viele Grüße, yersinia
----
FHEM 6.3 (SVN) on RPi 4B with RasPi OS Bullseye (perl 5.32.1) | FTUI
nanoCUL->2x868(1x ser2net)@tsculfw, 1x433@Sduino | MQTT2 | Tasmota | ESPEasy
VCCU->14xSEC-SCo, 7xCC-RT-DN, 5xLC-Bl1PBU-FM, 3xTC-IT-WM-W-EU, 1xPB-2-WM55, 1xLC-Sw1PBU-FM, 1xES-PMSw1-Pl

guhu

#2
Internals:
   API_LAST_RES 1601024401.06061
   API__LAST_MSG 200
   DEF        https://api.komoot.de/v007/users/<user>/highlights/?sports=&saved=false&recommended=true&_embedded=bookmark&name=&hl=de&page=0&limit=1000
   FUUID      5f6b875e-f33f-dad7-6d3c-4aabd3274c9031a6
   FVERSION   98_JsonMod.pm:0.226510/2020-08-23
   NAME       komootv3
   NEXT       2020-09-25 12:00:00
   NOTIFYDEV  global
   NR         191
   NTFY_ORDER 50-komootv3
   SOURCE     https://api.komoot.de/v007/users/<user>/highlights/?sports=&saved=false&recommended=true&_embedded=bookmark&name=&hl=de&page=0&limit=1000 (200)
   STATE      ???
   SVN        22651 2020-08-23 11:25:52 UTC
   TYPE       JsonMod
   CONFIG:
     IN_REQUEST 0
     SOURCE     https://api.komoot.de/v007/users/<user>/highlights/?sports=&saved=false&recommended=true&_embedded=bookmark&name=&hl=de&page=0&limit=1000
     SECRET:
   READINGS:
Attributes:
   readingList multi(jsonPath("\$..items[?(\@._embedded.creator.username=='<user>')]"), concat(property('id'), '_id'), property('id'))
   room       IT



Hier ein Beispiel:
[
   {
      "items" : [
         {
            "type" : "highlight_point",
            "name" : "Schöne alte Villa bei Laufenbacherhof",
            "sport" : "touringbicycle",
            "routable" : true,
            "distance" : 0,
            "categories" : [
               
            ],
            "flagged" : false,
            "_links" : {
               "self" : {
                  "href" : "https://api.komoot.de/v007/highlights/2663360"
               },
               "seasonality" : {
                  "href" : "https://api.komoot.de/v007/highlights/2663360/seasonality"
               },
               "tips" : {
                  "href" : "https://api.komoot.de/v007/highlights/2663360/tips/"
               },
               "images" : {
                  "href" : "https://api.komoot.de/v007/highlights/2663360/images/"
               },
               "recommenders" : {
                  "href" : "https://api.komoot.de/v007/highlights/2663360/recommenders/"
               },
               "creator" : {
                  "href" : "https://api.komoot.de/v007/users/user/profile_embedded"
               },
               "tours" : {
                  "href" : "https://api.komoot.de/v007/smart_tours/for_highlight/2663360/"
               },
               "bookmark" : {
                  "href" : "https://api.komoot.de/v007/highlights/2663360/bookmark/{username}",
                  "templated" : true
               },
               "recommendation" : {
                  "href" : "https://api.komoot.de/v007/highlights/2663360/recommendation/{username}",
                  "templated" : true
               },
               "seo_regions" : {
                  "href" : "https://api.komoot.de/v007/highlights/2663360/seo_regions/"
               },
               "content" : {
                  "href" : "https://api.komoot.de/v007/highlights/2663360/content"
               },
               "front_image" : {
                  "href" : "https://api.komoot.de/v007/highlights/2663360/images/22784449"
               }
            },
            "_embedded" : {
               "creator" : {
                  "username" : "user",
                  "avatar" : {
                     "src" : "https://d2exd72xrrp1s7.cloudfront.net/www/9r/9rajr54tp9xcypi4cjjrmip92noomzgf-uuser-full/165156e958c?width={width}&height={height}&crop={crop}",
                     "templated" : true,
                     "type" : "image/*"
                  },
                  "status" : "public",
                  "_links" : {
                     "self" : {
                        "href" : "https://api.komoot.de/v007/users/user/profile_embedded"
                     },
                     "relation" : {
                        "href" : "https://api.komoot.de/v007/users/{username}/relations/user",
                        "templated" : true
                     }
                  },
                  "display_name" : "Guido"
               },
               "front_image" : {
                  "id" : 22784449,
                  "src" : "https://d2exd72xrrp1s7.cloudfront.net/www/000/1k4/17/17eczvaokwqib7szcnpe8ohjf3iifdlt2-uhi22784449/0?width={width}&height={height}&crop={crop}",
                  "rating" : {
                     "up" : 0,
                     "down" : 0
                  },
                  "templated" : true,
                  "client_hash" : "990bd8638f81295fdd60c1fa87d1dceff00537e4b60f62ef614bd2905a20ab8d",
                  "type" : "image/*",
                  "_links" : {
                     "self" : {
                        "href" : "https://api.komoot.de/v007/highlights/2663360/images/22784449"
                     },
                     "creator" : {
                        "href" : "https://api.komoot.de/v007/users/user/profile_embedded"
                     },
                     "highlight" : {
                        "href" : "https://api.komoot.de/v007/highlights/2663360"
                     },
                     "rating" : {
                        "href" : "https://api.komoot.de/v007/highlights/2663360/images/22784449/rating/{username}",
                        "templated" : true
                     }
                  },
                  "_embedded" : {
                     "creator" : {
                        "username" : "user",
                        "avatar" : {
                           "src" : "https://d2exd72xrrp1s7.cloudfront.net/www/9r/9rajr54tp9xcypi4cjjrmip92noomzgf-uuser-full/165156e958c?width={width}&height={height}&crop={crop}",
                           "templated" : true,
                           "type" : "image/*"
                        },
                        "status" : "public",
                        "_links" : {
                           "self" : {
                              "href" : "https://api.komoot.de/v007/users/user/profile_embedded"
                           },
                           "relation" : {
                              "href" : "https://api.komoot.de/v007/users/{username}/relations/user",
                              "templated" : true
                           }
                        },
                        "display_name" : "Guido"
                     }
                  }
               }
            },
            "id" : 2663360,
            "created_at" : "2020-09-22T08:53:14.351Z",
            "changed_at" : "2020-09-22T08:53:14.363Z",
            "start_point" : {
               "lat" : 50.433113,
               "lng" : 6.85859,
               "alt" : 314
            },
            "mid_point" : {
               "lat" : 50.433113,
               "lng" : 6.85859,
               "alt" : 314
            },
            "end_point" : {
               "lat" : 50.433113,
               "lng" : 6.85859,
               "alt" : 314
            },
            "elevation_up" : 0,
            "elevation_down" : 0,
            "poor_quality" : true
         }
      ]
   },
   {
      "self" : {
         "href" : "https://api.komoot.de/v007/users/user/highlights/?sports=&saved=false&recommended=true&creator=user&name=&hl=de&page=0&limit=1"
      },
      "next" : {
         "href" : "https://api.komoot.de/v007/users/user/highlights/?sports=&saved=false&recommended=true&creator=user&name=&hl=de&page=1&limit=1"
      }
   },
   {
      "size" : 1,
      "totalElements" : 516,
      "totalPages" : 516,
      "number" : 0
   }
]


EDIT: verbose habe ich bewußt mal so hoch gesetzt, damit ich mir das im Detail mal anschauen kann.
FHEM 5.9 auf Synology DS918+ (in Docker), HM-CFG-USB2 mit hmlan, HM-CC-RT-DN, HM-SEC-SC-2, nanoCUL,a-culfw,deCONZ,Brennenstuhl-Steckdosen,-FB
Module:ENIGMA2,SONOS,FRITZBOX,FB_CALLLIST,WDT_TIMER,VCONTROL300,WITHINGS

yersinia

sieht unaufällig aus, ohne aber den JsonString zu kennen, wird es schwierig zu helfen. Vermutlich findet das JsonModul nichts.
multi(jsonPath("\$..items[?(\@._embedded.creator.username=='<user>')]"), concat(property('id'), '_id'), property('id'))

Eventuell kann ein Punkt
property('.id')[code]
schon Abhilfe schaffen.

Ansonsten: kopiere mal den JsonString von
[code]https://api.komoot.de/v007/users/<user>/highlights/?sports=&saved=false&recommended=true&_embedded=bookmark&name=&hl=de&page=0&limit=1000

hierein: https://jsonpath.curiousconcept.com

Und dann gib dort mal den JsonPath in die Befehlszeile und schau ob du Ergebnisse erhältst:
$..items
Bekommst du dann mehrere Ergebnisse zurück, die ein Element ._embedded.creator.username und .id enthalten?

In der Regel muss man sich langsam ran-iterieren.
viele Grüße, yersinia
----
FHEM 6.3 (SVN) on RPi 4B with RasPi OS Bullseye (perl 5.32.1) | FTUI
nanoCUL->2x868(1x ser2net)@tsculfw, 1x433@Sduino | MQTT2 | Tasmota | ESPEasy
VCCU->14xSEC-SCo, 7xCC-RT-DN, 5xLC-Bl1PBU-FM, 3xTC-IT-WM-W-EU, 1xPB-2-WM55, 1xLC-Sw1PBU-FM, 1xES-PMSw1-Pl

yersinia

id und _embedded.creator.username hängen zwei unter items, also doppelter punkt müsste es finden:
multi(jsonPath("\$..items[?(\@.._embedded.creator.username=='<user>')]"), concat(property('..id'), '_id'), property('..id'))
oder
multi(jsonPath("\$..items.[?(\@._embedded.creator.username=='<user>')]"), concat(property('..id'), '_id'), property('..id'))
viele Grüße, yersinia
----
FHEM 6.3 (SVN) on RPi 4B with RasPi OS Bullseye (perl 5.32.1) | FTUI
nanoCUL->2x868(1x ser2net)@tsculfw, 1x433@Sduino | MQTT2 | Tasmota | ESPEasy
VCCU->14xSEC-SCo, 7xCC-RT-DN, 5xLC-Bl1PBU-FM, 3xTC-IT-WM-W-EU, 1xPB-2-WM55, 1xLC-Sw1PBU-FM, 1xES-PMSw1-Pl

guhu

Vielen Dank, Leute! Werde mich dann mal mit den Hinweisen "ran-iterieren". Das bedeutet dann im Umkehrschluß, dass Ihr meint, dass dieser UTF-8 Hinweis kein Problem ist.
FHEM 5.9 auf Synology DS918+ (in Docker), HM-CFG-USB2 mit hmlan, HM-CC-RT-DN, HM-SEC-SC-2, nanoCUL,a-culfw,deCONZ,Brennenstuhl-Steckdosen,-FB
Module:ENIGMA2,SONOS,FRITZBOX,FB_CALLLIST,WDT_TIMER,VCONTROL300,WITHINGS

herrmannj

Zitat von: guhu am 25 September 2020, 12:10:52
Vielen Dank, Leute! Werde mich dann mal mit den Hinweisen "ran-iterieren". Das bedeutet dann im Umkehrschluß, dass Ihr meint, dass dieser UTF-8 Hinweis kein Problem ist.
Bestätigt!
2020.09.25 09:12:29.395 4: [komootv3] api encoding is UTF-8, designated encoder is utf-8-strict
Übersetzt:
die API liefert UTF-8 -> JsonMod wäht UTF-8 als Eingabe. Genauso so ist es normal & richtig.

guhu

erstaunlicherweise liefert der obige Parser https://jsonpath.curiousconcept.com/# nur Fehlermeldungen. Unter https://jsonpath.herokuapp.com/ klappt die Abfrage. Ich habe hier mal ein Beispiel-JSON.

Wenn ich auf Attribute zurückgreife, die einfache Strings sind, dann klappt alles, bspw:

$..items[?(@.id=="4711")]

Wenn ich auf Attributeaus einer Struktur zugreife, geht es nicht, dann meldet dieser Parser immer Fehler, egal was ich mache.

$..items[?(@._embedded.creator.username=="4711")]

Die Ausgabe hingegen geht:


$..items[?(@.type=="touringbicycle")]._embedded.creator.username

Offenbar liefert die Implementierung von jsonpath im Modul auch einen Fehler.



{"_embedded":{"items":[{"type":"highlight_point","name":"Schöne alte Villa bei Laufenbacherhof","sport":"touringbicycle","routable":true,"distance":0,"categories":[],"flagged":false,"_links":{"self":{"href":"https://api.komoot.de/v007/highlights/2663360"},"seasonality":{"href":"https://api.komoot.de/v007/highlights/2663360/seasonality"},"tips":{"href":"https://api.komoot.de/v007/highlights/2663360/tips/"},"images":{"href":"https://api.komoot.de/v007/highlights/2663360/images/"},"recommenders":{"href":"https://api.komoot.de/v007/highlights/2663360/recommenders/"},"creator":{"href":"https://api.komoot.de/v007/users/671427342383/profile_embedded"},"tours":{"href":"https://api.komoot.de/v007/smart_tours/for_highlight/2663360/"},"bookmark":{"href":"https://api.komoot.de/v007/highlights/2663360/bookmark/{username}","templated":true},"recommendation":{"href":"https://api.komoot.de/v007/highlights/2663360/recommendation/{username}","templated":true},"seo_regions":{"href":"https://api.komoot.de/v007/highlights/2663360/seo_regions/"},"content":{"href":"https://api.komoot.de/v007/highlights/2663360/content"},"front_image":{"href":"https://api.komoot.de/v007/highlights/2663360/images/22784449"}},"_embedded":{"creator":{"username":"671427342383","avatar":{"src":"https://d2exd72xrrp1s7.cloudfront.net/www/9r/9rajr54tp9xcypi4cjjrmip92noomzgf-u671427342383-full/165156e958c?width={width}&height={height}&crop={crop}","templated":true,"type":"image/*"},"status":"public","_links":{"self":{"href":"https://api.komoot.de/v007/users/671427342383/profile_embedded"},"relation":{"href":"https://api.komoot.de/v007/users/{username}/relations/671427342383","templated":true}},"display_name":"Guido"},"front_image":{"id":22784449,"src":"https://d2exd72xrrp1s7.cloudfront.net/www/000/1k4/17/17eczvaokwqib7szcnpe8ohjf3iifdlt2-uhi22784449/0?width={width}&height={height}&crop={crop}","rating":{"up":0,"down":0},"templated":true,"client_hash":"990bd8638f81295fdd60c1fa87d1dceff00537e4b60f62ef614bd2905a20ab8d","type":"image/*","_links":{"self":{"href":"https://api.komoot.de/v007/highlights/2663360/images/22784449"},"creator":{"href":"https://api.komoot.de/v007/users/671427342383/profile_embedded"},"highlight":{"href":"https://api.komoot.de/v007/highlights/2663360"},"rating":{"href":"https://api.komoot.de/v007/highlights/2663360/images/22784449/rating/{username}","templated":true}},"_embedded":{"creator":{"username":"671427342383","avatar":{"src":"https://d2exd72xrrp1s7.cloudfront.net/www/9r/9rajr54tp9xcypi4cjjrmip92noomzgf-u671427342383-full/165156e958c?width={width}&height={height}&crop={crop}","templated":true,"type":"image/*"},"status":"public","_links":{"self":{"href":"https://api.komoot.de/v007/users/671427342383/profile_embedded"},"relation":{"href":"https://api.komoot.de/v007/users/{username}/relations/671427342383","templated":true}},"display_name":"Guido"}}}},"id":2663360,"created_at":"2020-09-22T08:53:14.351Z","changed_at":"2020-09-22T08:53:14.363Z","start_point":{"lat":50.433113,"lng":6.85859,"alt":314},"mid_point":{"lat":50.433113,"lng":6.85859,"alt":314},"end_point":{"lat":50.433113,"lng":6.85859,"alt":314},"elevation_up":0,"elevation_down":0,"poor_quality":true}]},"_links":{"self":{"href":"https://api.komoot.de/v007/users/671427342383/highlights/?sports=&saved=false&recommended=true&_embedded=bookmark&name=&hl=de&page=0&limit=1"},"next":{"href":"https://api.komoot.de/v007/users/671427342383/highlights/?sports=&saved=false&recommended=true&_embedded=bookmark&name=&hl=de&page=1&limit=1"}},"page":{"size":1,"totalElements":516,"totalPages":516,"number":0}}
FHEM 5.9 auf Synology DS918+ (in Docker), HM-CFG-USB2 mit hmlan, HM-CC-RT-DN, HM-SEC-SC-2, nanoCUL,a-culfw,deCONZ,Brennenstuhl-Steckdosen,-FB
Module:ENIGMA2,SONOS,FRITZBOX,FB_CALLLIST,WDT_TIMER,VCONTROL300,WITHINGS

herrmannj

#8
ich nehme auch https://jsonpath.herokuapp.com/

Hilfreich bei völlig verquertem JSON ist es, dort als Ausgabe "Normalized path expressions" (JSONPath options) und als path "$..*" zu wählen. Dann wird die JSON einmal komplett durchstrukturiert (als path) ausgegeben und man blickt besser durch.

[
   "$['_embedded']",
   "$['_links']",
   "$['page']",
   "$['_embedded']['items']",
   "$['_embedded']['items'][0]",
   "$['_embedded']['items'][0]['type']",
   "$['_embedded']['items'][0]['name']",
   "$['_embedded']['items'][0]['sport']",
   "$['_embedded']['items'][0]['routable']",
   "$['_embedded']['items'][0]['distance']",
   "$['_embedded']['items'][0]['categories']",
   "$['_embedded']['items'][0]['flagged']",
   "$['_embedded']['items'][0]['_links']",
   "$['_embedded']['items'][0]['_embedded']",
   "$['_embedded']['items'][0]['id']",
   "$['_embedded']['items'][0]['created_at']",
   "$['_embedded']['items'][0]['changed_at']",
   "$['_embedded']['items'][0]['start_point']",
   "$['_embedded']['items'][0]['mid_point']",
   "$['_embedded']['items'][0]['end_point']",
   "$['_embedded']['items'][0]['elevation_up']",
   "$['_embedded']['items'][0]['elevation_down']",
   "$['_embedded']['items'][0]['poor_quality']",
   "$['_embedded']['items'][0]['_links']['self']",
   "$['_embedded']['items'][0]['_links']['seasonality']",
   "$['_embedded']['items'][0]['_links']['tips']",
   "$['_embedded']['items'][0]['_links']['images']",
   "$['_embedded']['items'][0]['_links']['recommenders']",
   "$['_embedded']['items'][0]['_links']['creator']",
   "$['_embedded']['items'][0]['_links']['tours']",
   "$['_embedded']['items'][0]['_links']['bookmark']",
   "$['_embedded']['items'][0]['_links']['recommendation']",
   "$['_embedded']['items'][0]['_links']['seo_regions']",
   "$['_embedded']['items'][0]['_links']['content']",
   "$['_embedded']['items'][0]['_links']['front_image']",
   "$['_embedded']['items'][0]['_links']['self']['href']",
   "$['_embedded']['items'][0]['_links']['seasonality']['href']",
   "$['_embedded']['items'][0]['_links']['tips']['href']",
   "$['_embedded']['items'][0]['_links']['images']['href']",
   "$['_embedded']['items'][0]['_links']['recommenders']['href']",
   "$['_embedded']['items'][0]['_links']['creator']['href']",
   "$['_embedded']['items'][0]['_links']['tours']['href']",
   "$['_embedded']['items'][0]['_links']['bookmark']['href']",
   "$['_embedded']['items'][0]['_links']['bookmark']['templated']",
   "$['_embedded']['items'][0]['_links']['recommendation']['href']",
   "$['_embedded']['items'][0]['_links']['recommendation']['templated']",
   "$['_embedded']['items'][0]['_links']['seo_regions']['href']",
   "$['_embedded']['items'][0]['_links']['content']['href']",
   "$['_embedded']['items'][0]['_links']['front_image']['href']",
   "$['_embedded']['items'][0]['_embedded']['creator']",
   "$['_embedded']['items'][0]['_embedded']['front_image']",
   "$['_embedded']['items'][0]['_embedded']['creator']['username']",
   "$['_embedded']['items'][0]['_embedded']['creator']['avatar']",
   "$['_embedded']['items'][0]['_embedded']['creator']['status']",
   "$['_embedded']['items'][0]['_embedded']['creator']['_links']",
   "$['_embedded']['items'][0]['_embedded']['creator']['display_name']",
   "$['_embedded']['items'][0]['_embedded']['creator']['avatar']['src']",
   "$['_embedded']['items'][0]['_embedded']['creator']['avatar']['templated']",
   "$['_embedded']['items'][0]['_embedded']['creator']['avatar']['type']",
   "$['_embedded']['items'][0]['_embedded']['creator']['_links']['self']",
   "$['_embedded']['items'][0]['_embedded']['creator']['_links']['relation']",
   "$['_embedded']['items'][0]['_embedded']['creator']['_links']['self']['href']",
   "$['_embedded']['items'][0]['_embedded']['creator']['_links']['relation']['href']",
   "$['_embedded']['items'][0]['_embedded']['creator']['_links']['relation']['templated']",
   "$['_embedded']['items'][0]['_embedded']['front_image']['id']",
   "$['_embedded']['items'][0]['_embedded']['front_image']['src']",
   "$['_embedded']['items'][0]['_embedded']['front_image']['rating']",
   "$['_embedded']['items'][0]['_embedded']['front_image']['templated']",
   "$['_embedded']['items'][0]['_embedded']['front_image']['client_hash']",
   "$['_embedded']['items'][0]['_embedded']['front_image']['type']",
   "$['_embedded']['items'][0]['_embedded']['front_image']['_links']",
   "$['_embedded']['items'][0]['_embedded']['front_image']['_embedded']",
   "$['_embedded']['items'][0]['_embedded']['front_image']['rating']['up']",
   "$['_embedded']['items'][0]['_embedded']['front_image']['rating']['down']",
   "$['_embedded']['items'][0]['_embedded']['front_image']['_links']['self']",
   "$['_embedded']['items'][0]['_embedded']['front_image']['_links']['creator']",
   "$['_embedded']['items'][0]['_embedded']['front_image']['_links']['highlight']",
   "$['_embedded']['items'][0]['_embedded']['front_image']['_links']['rating']",
   "$['_embedded']['items'][0]['_embedded']['front_image']['_links']['self']['href']",
   "$['_embedded']['items'][0]['_embedded']['front_image']['_links']['creator']['href']",
   "$['_embedded']['items'][0]['_embedded']['front_image']['_links']['highlight']['href']",
   "$['_embedded']['items'][0]['_embedded']['front_image']['_links']['rating']['href']",
   "$['_embedded']['items'][0]['_embedded']['front_image']['_links']['rating']['templated']",
   "$['_embedded']['items'][0]['_embedded']['front_image']['_embedded']['creator']",
   "$['_embedded']['items'][0]['_embedded']['front_image']['_embedded']['creator']['username']",
   "$['_embedded']['items'][0]['_embedded']['front_image']['_embedded']['creator']['avatar']",
   "$['_embedded']['items'][0]['_embedded']['front_image']['_embedded']['creator']['status']",
   "$['_embedded']['items'][0]['_embedded']['front_image']['_embedded']['creator']['_links']",
   "$['_embedded']['items'][0]['_embedded']['front_image']['_embedded']['creator']['display_name']",
   "$['_embedded']['items'][0]['_embedded']['front_image']['_embedded']['creator']['avatar']['src']",
   "$['_embedded']['items'][0]['_embedded']['front_image']['_embedded']['creator']['avatar']['templated']",
   "$['_embedded']['items'][0]['_embedded']['front_image']['_embedded']['creator']['avatar']['type']",
   "$['_embedded']['items'][0]['_embedded']['front_image']['_embedded']['creator']['_links']['self']",
   "$['_embedded']['items'][0]['_embedded']['front_image']['_embedded']['creator']['_links']['relation']",
   "$['_embedded']['items'][0]['_embedded']['front_image']['_embedded']['creator']['_links']['self']['href']",
   "$['_embedded']['items'][0]['_embedded']['front_image']['_embedded']['creator']['_links']['relation']['href']",
   "$['_embedded']['items'][0]['_embedded']['front_image']['_embedded']['creator']['_links']['relation']['templated']",
   "$['_embedded']['items'][0]['start_point']['lat']",
   "$['_embedded']['items'][0]['start_point']['lng']",
   "$['_embedded']['items'][0]['start_point']['alt']",
   "$['_embedded']['items'][0]['mid_point']['lat']",
   "$['_embedded']['items'][0]['mid_point']['lng']",
   "$['_embedded']['items'][0]['mid_point']['alt']",
   "$['_embedded']['items'][0]['end_point']['lat']",
   "$['_embedded']['items'][0]['end_point']['lng']",
   "$['_embedded']['items'][0]['end_point']['alt']",
   "$['_links']['self']",
   "$['_links']['next']",
   "$['_links']['self']['href']",
   "$['_links']['next']['href']",
   "$['page']['size']",
   "$['page']['totalElements']",
   "$['page']['totalPages']",
   "$['page']['number']"
]

guhu

Irgendwas ist da aber unterschiedlich.

Wenn ich das so habe:
multi(jsonPath("\$..items[*]"), concat(property('.id'), '_id'), property('.id'))
dann liefert mir jsonmod eine Liste mit Readings.
Wenn ich die einschränke wie folgt:
multi(jsonPath("\$..items[?(\@._embedded.creator.username=='671427342383')]"), concat(property('.id'), '_id'), property('.id'))
Bekomme ich nichts geliefert.
Allerdings hatte ich den jsonpath wiederum getestet mit  https://jsonpath.herokuapp.com/
Da bekomme ich das gewünschte Ergebnis.

FHEM 5.9 auf Synology DS918+ (in Docker), HM-CFG-USB2 mit hmlan, HM-CC-RT-DN, HM-SEC-SC-2, nanoCUL,a-culfw,deCONZ,Brennenstuhl-Steckdosen,-FB
Module:ENIGMA2,SONOS,FRITZBOX,FB_CALLLIST,WDT_TIMER,VCONTROL300,WITHINGS

yersinia

Du könntest die Escape-Sequenz noch tauschen:
multi(jsonPath('$..items[?(@._embedded.creator.username=="671427342383")]'), concat(property('.id'), '_id'), property('.id'))
Steht was im log?
viele Grüße, yersinia
----
FHEM 6.3 (SVN) on RPi 4B with RasPi OS Bullseye (perl 5.32.1) | FTUI
nanoCUL->2x868(1x ser2net)@tsculfw, 1x433@Sduino | MQTT2 | Tasmota | ESPEasy
VCCU->14xSEC-SCo, 7xCC-RT-DN, 5xLC-Bl1PBU-FM, 3xTC-IT-WM-W-EU, 1xPB-2-WM55, 1xLC-Sw1PBU-FM, 1xES-PMSw1-Pl

guhu

Gibt keinen Unterschied. Im Log steht nichts drin. Einfach nur keine Readings da.
FHEM 5.9 auf Synology DS918+ (in Docker), HM-CFG-USB2 mit hmlan, HM-CC-RT-DN, HM-SEC-SC-2, nanoCUL,a-culfw,deCONZ,Brennenstuhl-Steckdosen,-FB
Module:ENIGMA2,SONOS,FRITZBOX,FB_CALLLIST,WDT_TIMER,VCONTROL300,WITHINGS

guhu

PS: auch die normalisierte Form, die bei Jayway ein Ergebnis liefert, liefert nicht im Modul:
multi(jsonPath("\$['_embedded']['items'][\?(\@._embedded.creator.username=='671427342383')]"), concat(property('.id'), '_id'), property('.id'))
FHEM 5.9 auf Synology DS918+ (in Docker), HM-CFG-USB2 mit hmlan, HM-CC-RT-DN, HM-SEC-SC-2, nanoCUL,a-culfw,deCONZ,Brennenstuhl-Steckdosen,-FB
Module:ENIGMA2,SONOS,FRITZBOX,FB_CALLLIST,WDT_TIMER,VCONTROL300,WITHINGS

yersinia

Zitat von: guhu am 25 September 2020, 17:32:08
PS: auch die normalisierte Form, die bei Jayway ein Ergebnis liefert, liefert nicht im Modul:
Goessner ist der tab, nach dem du mMn schauen musst.

Normalisiert wäre mMn aber:
multi(jsonPath("\$['_embedded']['items'][\?(\@['_embedded']['creator']['username']=='671427342383')]"), concat(property('.id'), '_id'), property('.id'))
viele Grüße, yersinia
----
FHEM 6.3 (SVN) on RPi 4B with RasPi OS Bullseye (perl 5.32.1) | FTUI
nanoCUL->2x868(1x ser2net)@tsculfw, 1x433@Sduino | MQTT2 | Tasmota | ESPEasy
VCCU->14xSEC-SCo, 7xCC-RT-DN, 5xLC-Bl1PBU-FM, 3xTC-IT-WM-W-EU, 1xPB-2-WM55, 1xLC-Sw1PBU-FM, 1xES-PMSw1-Pl

guhu

Danke. Auch die Form bringt kein Ergebnis, der Tab Goessner hingegen bringt das erwartete Ergebnis.
Gibt es da einer bessere Möglichkeit des Debuggings? Das Ergebnis des Moduls scheint ja von dem der Webseite abzuweichen.
FHEM 5.9 auf Synology DS918+ (in Docker), HM-CFG-USB2 mit hmlan, HM-CC-RT-DN, HM-SEC-SC-2, nanoCUL,a-culfw,deCONZ,Brennenstuhl-Steckdosen,-FB
Module:ENIGMA2,SONOS,FRITZBOX,FB_CALLLIST,WDT_TIMER,VCONTROL300,WITHINGS

herrmannj

die unterschiedlichen Implementierungen liefern im Normalfall gleiche Ergebnisse. Wenn da Unterschiede sind, dann sind das idR corner-case oder Fälle wo die Eingaben (mehr oder weniger) falsch sind und unterschiedlich "streng" bewertet werden.

Ich sehe hier offen gestanden nicht genau durch wie der JSON jetzt genau aussieht und was genau das gewünschte Ergebnis ist.

Vermutung:
'id' ist keine property von 'items' sondern tiefer in der Struktur. Dann muss man das auch entsprechend tiefer angeben.

Bei 'multi' muss der erste Parameter auf ein Array auflösen. Sollte hier gegeben sein (items). Die beiden properties für den Reading Namen und den Wert müssten dann (vom array ausgehend) mit dem kompletten Pfad angegeben werden.

Für den Reading Namen könntest Du alternativ verwenden 'sprintf('User_%s', count())'. Dann würden die Reading Namen durchnummeriert User_0, User_1 ...

Wenn Du gar nicht weiterkommst kannst Du mir ein komplettes JSON zukommen lassen und bitte beschreiben welche Daten genau Du extrahieren möchtest.

vg
Joerg

guhu

Danke Euch. Ein Beispiel-JSON hatte ich oben angegeben:

{"_embedded":{"items":[{"type":"highlight_point","name":"Schöne alte Villa bei Laufenbacherhof","sport":"touringbicycle","routable":true,"distance":0,"categories":[],"flagged":false,"_links":{"self":{"href":"https://api.komoot.de/v007/highlights/2663360"},"seasonality":{"href":"https://api.komoot.de/v007/highlights/2663360/seasonality"},"tips":{"href":"https://api.komoot.de/v007/highlights/2663360/tips/"},"images":{"href":"https://api.komoot.de/v007/highlights/2663360/images/"},"recommenders":{"href":"https://api.komoot.de/v007/highlights/2663360/recommenders/"},"creator":{"href":"https://api.komoot.de/v007/users/671427342383/profile_embedded"},"tours":{"href":"https://api.komoot.de/v007/smart_tours/for_highlight/2663360/"},"bookmark":{"href":"https://api.komoot.de/v007/highlights/2663360/bookmark/{username}","templated":true},"recommendation":{"href":"https://api.komoot.de/v007/highlights/2663360/recommendation/{username}","templated":true},"seo_regions":{"href":"https://api.komoot.de/v007/highlights/2663360/seo_regions/"},"content":{"href":"https://api.komoot.de/v007/highlights/2663360/content"},"front_image":{"href":"https://api.komoot.de/v007/highlights/2663360/images/22784449"}},"_embedded":{"creator":{"username":"671427342383","avatar":{"src":"https://d2exd72xrrp1s7.cloudfront.net/www/9r/9rajr54tp9xcypi4cjjrmip92noomzgf-u671427342383-full/165156e958c?width={width}&height={height}&crop={crop}","templated":true,"type":"image/*"},"status":"public","_links":{"self":{"href":"https://api.komoot.de/v007/users/671427342383/profile_embedded"},"relation":{"href":"https://api.komoot.de/v007/users/{username}/relations/671427342383","templated":true}},"display_name":"Guido"},"front_image":{"id":22784449,"src":"https://d2exd72xrrp1s7.cloudfront.net/www/000/1k4/17/17eczvaokwqib7szcnpe8ohjf3iifdlt2-uhi22784449/0?width={width}&height={height}&crop={crop}","rating":{"up":0,"down":0},"templated":true,"client_hash":"990bd8638f81295fdd60c1fa87d1dceff00537e4b60f62ef614bd2905a20ab8d","type":"image/*","_links":{"self":{"href":"https://api.komoot.de/v007/highlights/2663360/images/22784449"},"creator":{"href":"https://api.komoot.de/v007/users/671427342383/profile_embedded"},"highlight":{"href":"https://api.komoot.de/v007/highlights/2663360"},"rating":{"href":"https://api.komoot.de/v007/highlights/2663360/images/22784449/rating/{username}","templated":true}},"_embedded":{"creator":{"username":"671427342383","avatar":{"src":"https://d2exd72xrrp1s7.cloudfront.net/www/9r/9rajr54tp9xcypi4cjjrmip92noomzgf-u671427342383-full/165156e958c?width={width}&height={height}&crop={crop}","templated":true,"type":"image/*"},"status":"public","_links":{"self":{"href":"https://api.komoot.de/v007/users/671427342383/profile_embedded"},"relation":{"href":"https://api.komoot.de/v007/users/{username}/relations/671427342383","templated":true}},"display_name":"Guido"}}}},"id":2663360,"created_at":"2020-09-22T08:53:14.351Z","changed_at":"2020-09-22T08:53:14.363Z","start_point":{"lat":50.433113,"lng":6.85859,"alt":314},"mid_point":{"lat":50.433113,"lng":6.85859,"alt":314},"end_point":{"lat":50.433113,"lng":6.85859,"alt":314},"elevation_up":0,"elevation_down":0,"poor_quality":true}]},"_links":{"self":{"href":"https://api.komoot.de/v007/users/671427342383/highlights/?sports=&saved=false&recommended=true&_embedded=bookmark&name=&hl=de&page=0&limit=1"},"next":{"href":"https://api.komoot.de/v007/users/671427342383/highlights/?sports=&saved=false&recommended=true&_embedded=bookmark&name=&hl=de&page=1&limit=1"}},"page":{"size":1,"totalElements":516,"totalPages":516,"number":0}}

FHEM 5.9 auf Synology DS918+ (in Docker), HM-CFG-USB2 mit hmlan, HM-CC-RT-DN, HM-SEC-SC-2, nanoCUL,a-culfw,deCONZ,Brennenstuhl-Steckdosen,-FB
Module:ENIGMA2,SONOS,FRITZBOX,FB_CALLLIST,WDT_TIMER,VCONTROL300,WITHINGS

amenomade

In deinem JSON gibt es nur ein einziges "items". Warum machst Du denn eine Suche mit user und nicht einfach [ 0 ] ?
Pi 3B, Alexa, CUL868+Selbstbau 1/2λ-Dipol-Antenne, USB Optolink / Vitotronic, Debmatic und HM / HmIP Komponenten, Rademacher Duofern Jalousien, Fritz!Dect Thermostaten, Proteus

herrmannj

Ursache war eine Inkonsistenz beim Syntax - der Filter hat die Angaben mit Leerzeichen getrennt erwartet. Ich habe einen Fix eingespielt, ab morgen im update.

Funltioniert jetzt, mit und ohne Leereichen zwischen Operand und Operator:
multi(jsonPath("\$['_embedded']['items'][\?(\@['_embedded']['creator']['username']=='671427342383')]"), concat(property('.id'), '_id'), property('.id'));

Den Sinn der Abfrage habe ich noch nicht verstanden. So wird ein Reading mit Name und Wert == ID erzeugt ("123_id" = "123"). Falls das nicht der Intention entspricht musst Du das entsprechend im "multi()" anpassen.

vg
Joerg

guhu

Super, danke. Im Beispiel ist zum Test nur ein Eintrag, die Liste ist natürlich länger. Mit dem Reading habe ich mich noch gar nicht im Detail beschäftigt, das kommt jetzt!
Ich hoffe, ich bekomme das so hin.

PS: die Leerzeichen hatte ich entfernt, weil bei einem Parser die wiederum Probleme brachten.
FHEM 5.9 auf Synology DS918+ (in Docker), HM-CFG-USB2 mit hmlan, HM-CC-RT-DN, HM-SEC-SC-2, nanoCUL,a-culfw,deCONZ,Brennenstuhl-Steckdosen,-FB
Module:ENIGMA2,SONOS,FRITZBOX,FB_CALLLIST,WDT_TIMER,VCONTROL300,WITHINGS

guhu

noch eine Meldung, nachdem in in der bestehenden Version Leerzeichen eingefügt habe:
[komootv4] error: JsonPath filter '@['_embedded']['creator']['username']' must start with @. or $. at ./FHEM/98_JsonMod.pm line 1630.

Die Syntax sollte doch auch ohne "." in Ordnung sein, oder?
FHEM 5.9 auf Synology DS918+ (in Docker), HM-CFG-USB2 mit hmlan, HM-CC-RT-DN, HM-SEC-SC-2, nanoCUL,a-culfw,deCONZ,Brennenstuhl-Steckdosen,-FB
Module:ENIGMA2,SONOS,FRITZBOX,FB_CALLLIST,WDT_TIMER,VCONTROL300,WITHINGS

herrmannj

ja, kannst Du bitte ein list zeigen? Danke

guhu

.. ich hab's jetzt schon geändert, hatte Deine oben zitierte Form vom Readinglist genommen. Das fängt ja mit "$[" an und nicht mit "$." und ist damit konsistent mit der gezeigten Fehlermeldung.

Übrigens vielen Dank für das Modul noch einmal, ist für Json m. E. wesentlich besser geeignet als httpmod.
FHEM 5.9 auf Synology DS918+ (in Docker), HM-CFG-USB2 mit hmlan, HM-CC-RT-DN, HM-SEC-SC-2, nanoCUL,a-culfw,deCONZ,Brennenstuhl-Steckdosen,-FB
Module:ENIGMA2,SONOS,FRITZBOX,FB_CALLLIST,WDT_TIMER,VCONTROL300,WITHINGS

guhu

.. noch ein Problem in diesem Zusammenhang:

ich benöige noch Werte aus einer anderen JSON-Struktur, passend zu den Readings id. Das wollte ich wie folgt lösen:
in einem neuen Device gehe ich über eine Schleife und setze die ids jeweils als Secrets. Dann gibt es aber offenbar ein timing-Problem. Die Meldung ist:
2020.09.28 14:20:40.011 3: set komoot_h reread : request already pending
2020.09.28 14:20:40.011 1: 184


Das Device selber mit einem einzelnen Eintrag funktioniert wie gewünscht.

Hier die Devices:

Internals:
   API_LAST_RES 1601295640.22239
   API__LAST_MSG 200
   CFGFN     
   DEF        https://api.komoot.de/v007/highlights/[id]/recommenders/?page=0&limit=1
   FUUID      5f6f6c6c-f33f-dad7-4012-ef3e0d10c464c754
   NAME       komoot_h
   NEXT       2020-09-28 15:00:00
   NOTIFYDEV  global
   NR         8458
   NTFY_ORDER 50-komootv5
   SECRETS    id
   SOURCE     https://api.komoot.de/v007/highlights/XXXXXXX/recommenders/?page=0&limit=1 (200)
   STATE      ???
   SVN        22651 2020-08-23 11:25:52 UTC
   TYPE       JsonMod
   CONFIG:
     IN_REQUEST 0
     SOURCE     https://api.komoot.de/v007/highlights/[id]/recommenders/?page=0&limit=1
     SECRET:
   READINGS:
     2020-09-28 14:20:40   rating          184
Attributes:
   readingList single(jsonPath("\$..rating.recommendations"),"rating","N/A")
   room       IT


und Internals:
   CFGFN     
   DEF        ([6:00]) ({
my $rat;
my $rating;
my $id;
$rat="";
$id="";
my $hash=$defs{"komoot_hl"};
my $readings = $hash->{READINGS};
Log 1, %{$readings};
foreach my $key ( sort keys %{$readings}) {
    Log 1, "$key";
fhem("set komoot_h secret ".$key);
fhem("set komoot_h reread");
$rating=ReadingsVal("komoot_h","rating",0);
Log 1, "$rating";
$id.=$key.",";
$rat.=$rating.",";
    }
fhem("set komoot.refresh_hl id ".$id);
fhem("set komoot.refresh_hl rating ".$rating);
}
)
   FUUID      5f6f717e-f33f-dad7-6537-7ddb7d7f6ff2c0c2
   MODEL      FHEM
   NAME       komoot.refresh_hl
   NOTIFYDEV  global
   NR         8991
   NTFY_ORDER 50-komoot.refresh_hl
   STATE      cmd_1
   TYPE       DOIF
   VERSION    22834 2020-09-23 17:50:00
   READINGS:
     2020-09-28 14:20:40   cmd             1
     2020-09-28 14:20:40   cmd_event       set_cmd_1
     2020-09-28 14:20:40   cmd_nr          1
     2020-09-28 14:20:40   id              HASH(0x5601b9f1a9a8)
     2020-09-28 14:20:15   mode            enabled
     2020-09-28 14:20:40   rating          HASH(0x5601c3c45880)
     2020-09-28 14:20:40   state           cmd_1
     2020-09-28 14:20:15   timer_01_c01    29.09.2020 06:00:00
   Regex:
     accu:
   attr:
     cmdState:
     waitdel:
   condition:
     0          ::DOIF_time_once($hash,0,$wday)
   days:
   do:
     0:
       0          { my $rat; my $rating; my $id; $rat=""; $id=""; my $hash=$defs{"komoot_hl"}; my $readings = $hash->{READINGS}; Log 1, %{$readings}; foreach my $key ( sort keys %{$readings}) {     Log 1, "$key"; fhem("set komoot_h secret ".$key); fhem("set komoot_h reread"); $rating=ReadingsVal("komoot_h","rating",0); Log 1, "$rating"; $id.=$key.","; $rat.=$rating.",";     } fhem("set komoot.refresh_hl id ".$id); fhem("set komoot.refresh_hl rating ".$rating); }
     1:
   helper:
     DEVFILTER  ^global$
     NOTIFYDEV  global
     globalinit 1
     last_timer 1
     sleeptimer -1
     DOIF_eventa:
       cmd_nr: 1
       cmd: 1
       cmd_event: set_cmd_1
       cmd_1
     DOIF_eventas:
       cmd_nr: 1
       cmd: 1
       cmd_event: set_cmd_1
       state: cmd_1
   intervalfunc:
   localtime:
     0          1601352000
   realtime:
     0          06:00:00
   time:
     0          6:00
   timeCond:
     0          0
   timer:
     0          0
   timers:
     0           0
   triggertime:
     1601352000:
       localtime  1601352000
       hash:
   uiState:
   uiTable:
Attributes:
   room       IT
   userReadings id {}, rating {}
   verbose    5
FHEM 5.9 auf Synology DS918+ (in Docker), HM-CFG-USB2 mit hmlan, HM-CC-RT-DN, HM-SEC-SC-2, nanoCUL,a-culfw,deCONZ,Brennenstuhl-Steckdosen,-FB
Module:ENIGMA2,SONOS,FRITZBOX,FB_CALLLIST,WDT_TIMER,VCONTROL300,WITHINGS

guhu

Hallo,
Ihr wolltet ja die Fehler des Moduls gemeldet bekommen. Ist das obige ein Fehler des Moduls?
FHEM 5.9 auf Synology DS918+ (in Docker), HM-CFG-USB2 mit hmlan, HM-CC-RT-DN, HM-SEC-SC-2, nanoCUL,a-culfw,deCONZ,Brennenstuhl-Steckdosen,-FB
Module:ENIGMA2,SONOS,FRITZBOX,FB_CALLLIST,WDT_TIMER,VCONTROL300,WITHINGS

amenomade

#25
Zitat von: guhu am 07 Oktober 2020, 12:55:42
Hallo,
Ihr wolltet ja die Fehler des Moduls gemeldet bekommen. Ist das obige ein Fehler des Moduls?

Eher in deiner Logik: Du machst ein fhem("set komoot_h reread"); in einer Schleife ohne darauf zu warten, dass das vorherige fhem("set komoot_h reread"); fertig ist. Fertig heisst hier, dass JsonMod nicht mehr "busy" ist und die Readings aktualisiert hat.

EDIT: wobei Du eigentlich nur ein Reading (im Moment?) im JsonMod hast. Trotzdem finde ich dieses Konstrukt dubiös.
Pi 3B, Alexa, CUL868+Selbstbau 1/2λ-Dipol-Antenne, USB Optolink / Vitotronic, Debmatic und HM / HmIP Komponenten, Rademacher Duofern Jalousien, Fritz!Dect Thermostaten, Proteus

guhu

Zitat von: amenomade am 07 Oktober 2020, 20:51:41
Eher in deiner Logik: Du machst ein fhem("set komoot_h reread"); in einer Schleife ohne darauf zu warten, dass das vorherige fhem("set komoot_h reread"); fertig ist. Fertig heisst hier, dass JsonMod nicht mehr "busy" ist und die Readings aktualisiert hat.

EDIT: wobei Du eigentlich nur ein Reading (im Moment?) im JsonMod hast. Trotzdem finde ich dieses Konstrukt dubiös.
Ok, danke! Werde das Warten mal einbauen. Hatte das mit sleepprobiert, das hat aber nichts genutzt.
Natürlich wäre es besser, den Wert in der vorherigen JSON-Struktur mitzugeben, aber da habe ich ja keinen Einfluss drauf.
FHEM 5.9 auf Synology DS918+ (in Docker), HM-CFG-USB2 mit hmlan, HM-CC-RT-DN, HM-SEC-SC-2, nanoCUL,a-culfw,deCONZ,Brennenstuhl-Steckdosen,-FB
Module:ENIGMA2,SONOS,FRITZBOX,FB_CALLLIST,WDT_TIMER,VCONTROL300,WITHINGS

topa_LE

Hallo,
Kurze Frage: wo speichert er den API Key in welcher Datei auf dem FHEM System?

Hintergrund ist der: Hole mir von https://api.bitpanda.com/v1/fiatwallets
per API Key meine Daten.

per set befehl secrets setze ich den API Key, klappt wunderbar, nur wenn ich das System neu starte verliert er den API Key. muss dann immer wieder neu eingeben.

bei einer anderen Plattform bleiben die Keys erhalten, nur bei Bitpanda nicht. Nun würde ich gerne den API manuell in die Datei eintragen, damit mir das ständie Neusetzen erspart bleibt.

herrmannj

gespeichert wird im keyfile. Entweder ist der explizit gesetzt oder kommt aus AttrVal("global", "keyFileName", "uniqueID");

Liegt unter /FHEM/FhemUtils/

Das secret wir dort aber nicht im Klartext sondern verschleiert gespeichert - von Hand ist daher nicht möglich. Mir fällt aber auch kein vernünftiger Grund ein warum das "bei einer anderen Plattform" gehen soll, bei Bitpanda jedoch nicht.

btw, bitte mach einen extra thread für so was auf, sonst werden da nur Sammelthreads draus

topa_LE

Zitat von: herrmannj am 03 August 2021, 20:00:54
Mir fällt aber auch kein vernünftiger Grund ein warum das "bei einer anderen Plattform" gehen soll, bei Bitpanda jedoch nicht.
mir auch nicht, danke trotzdem.