[vz-users] Daten auf MQTT Topics verteilen

Christian Wulff christianwulff at gmx.de
Tue Oct 2 10:07:30 CEST 2018


Hallo Frank,

 

das wäre wirklich sehr lieb, wenn du mir dabei nochmal helfen könntest.

Ich hab mich ne ganze Weile damit beschäftigt, aber leider noch keine gut funktionierende Lösung gefunden.

 

Hier ist eine Testsequenz mit Testdaten, die aus dem /vzpush rauskommen:

 

[{"id":"58b4a1f0.38211","type":"debug","z":"aac14499.e7214","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":510,"y":1240,"wires":[]},{"id":"2d338874.d09c9","type":"change","z":"aac14499.e7214","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"(\t  $uuidMap := {\t    'xxxxxxxx-0000-xxxx-xxxx-xxxxxxxxxxxx': 'Haus/Strom/Haus',\t    'xxxxxxxx-1111-xxxx-xxxx-xxxxxxxxxxxx': 'Haus/Strom/WärmepumpeHaupttarif',\t    'xxxxxxxx-2222-xxxx-xxxx-xxxxxxxxxxxx': 'Haus/Strom/WärmepumpeNebentarif',\t    'xxxxxxxx-3333-xxxx-xxxx-xxxxxxxxxxxx': 'Haus/Temperatur/T01Aussen',\t    'xxxxxxxx-4444-xxxx-xxxx-xxxxxxxxxxxx': 'Haus/Temperatur/T02Fortluft',\t    'xxxxxxxx-5555-xxxx-xxxx-xxxxxxxxxxxx': 'Haus/Heizung/T03Warmwasserspeicher',\t    'xxxxxxxx-6666-xxxx-xxxx-xxxxxxxxxxxx': 'Haus/Heizung/T04WarmwasserVorlauf',\t    'xxxxxxxx-7777-xxxx-xxxx-xxxxxxxxxxxx': 'Haus/Temperatur/T05Bad',\t    'xxxxxxxx-8888-xxxx-xxxx-xxxxxxxxxxxx': 'Haus/Temperatur/T06LeniRauchmelder',\t    'xxxxxxxx-9999-xxxx-xxxx-xxxxxxxxxxxx': 'Haus/Temperatur/T07SchlafenWand',\t    'xxxxxxxx-aaaa-xxxx-xxxx-xxxxxxxxxxxx': 'Haus/Temperatur/T08SchlafenRauchmelder',\t    'xxxxxxxx-bbbb-xxxx-xxxx-xxxxxxxxxxxx': 'Haus/Temperatur/T12LeniTür'\t  };\t\t  payload.data.{\t    $lookup($uuidMap, uuid): tuples[0]\t  }\t)\t","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":320,"y":1240,"wires":[["58b4a1f0.38211"]]},{"id":"a13bb1ff.e694e","type":"debug","z":"aac14499.e7214","name":"","active":false,"tosidebar":true,"console":false,"complete":"payload","x":310,"y":1080,"wires":[]},{"id":"2b063ddf.a29fb2","type":"inject","z":"aac14499.e7214","name":"from /vzpush","topic":"","payload":"{\"_msgid\":\"91a80fdc.ad383\",\"payload\":{\"data\":[{\"uuid\":\"xxxxxxxx-0000-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380292008,20.187]]},{\"uuid\":\"xxxxxxxx-1111-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380292818,19.75]]},{\"uuid\":\"xxxxxxxx-2222-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380279628,20.562]]},{\"uuid\":\"xxxxxxxx-3333-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380286108,21.125]]},{\"uuid\":\"xxxxxxxx-4444-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380288744,19.437]]},{\"uuid\":\"xxxxxxxx-5555-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380282058,46.937]]},{\"uuid\":\"xxxxxxxx-6666-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380280438,19.625]]},{\"uuid\":\"xxxxxxxx-7777-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380278798,20.437]]},{\"uuid\":\"xxxxxxxx-8888-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380283678,19.625]]},{\"uuid\":\"xxxxxxxx-9999-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380289573,12.125]]},{\"uuid\":\"xxxxxxxx-aaaa-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380277983,21.562]]},{\"uuid\":\"xxxxxxxx-bbbb-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380290388,20.187]]},{\"uuid\":\"xxxxxxxx-cccc-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380286917,20.687]]},{\"uuid\":\"xxxxxxxx-dddd-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380282868,39.5]]},{\"uuid\":\"xxxxxxxx-eeee-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380287728,31.125]]},{\"uuid\":\"xxxxxxxx-ffff-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380281248,30.875]]},{\"uuid\":\"xxxxxxxx-gggg-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380285298,20.687]]},{\"uuid\":\"xxxxxxxx-hhhh-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380291198,21.187]]}]},\"req\":{\"_readableState\":{\"objectMode\":false,\"highWaterMark\":16384,\"buffer\":{\"head\":null,\"tail\":null,\"length\":0},\"length\":0,\"pipes\":null,\"pipesCount\":0,\"flowing\":true,\"ended\":true,\"endEmitted\":true,\"reading\":false,\"sync\":false,\"needReadable\":false,\"emittedReadable\":false,\"readableListening\":false,\"resumeScheduled\":false,\"destroyed\":false,\"defaultEncoding\":\"utf8\",\"awaitDrain\":0,\"readingMore\":false,\"decoder\":null,\"encoding\":null},\"readable\":false,\"domain\":null,\"_events\":{},\"_eventsCount\":0,\"socket\":\"[internal]\",\"connection\":\"[internal]\",\"httpVersionMajor\":1,\"httpVersionMinor\":1,\"httpVersion\":\"1.1\",\"complete\":true,\"headers\":{\"host\":\"127.0.0.1:1880\",\"content-type\":\"application/json\",\"accept\":\"application/json\",\"user-agent\":\"vzlogger/0.6.0 (libcurl/7.38.0 OpenSSL/1.0.1t zlib/1.2.8 libidn/1.29 libssh2/1.4.3 librtmp/2.3)\",\"content-length\":\"1805\",\"expect\":\"100-continue\"},\"rawHeaders\":[\"Host\",\"127.0.0.1:1880\",\"Content-type\",\"application/json\",\"Accept\",\"application/json\",\"User-Agent\",\"vzlogger/0.6.0 (libcurl/7.38.0 OpenSSL/1.0.1t zlib/1.2.8 libidn/1.29 libssh2/1.4.3 librtmp/2.3)\",\"Content-Length\",\"1805\",\"Expect\",\"100-continue\"],\"trailers\":{},\"rawTrailers\":[],\"upgrade\":false,\"url\":\"/vzpush\",\"method\":\"POST\",\"statusCode\":null,\"statusMessage\":null,\"client\":\"[internal]\",\"_consuming\":true,\"_dumped\":false,\"baseUrl\":\"\",\"originalUrl\":\"/vzpush\",\"_parsedUrl\":{\"protocol\":null,\"slashes\":null,\"auth\":null,\"host\":null,\"port\":null,\"hostname\":null,\"hash\":null,\"search\":null,\"query\":null,\"pathname\":\"/vzpush\",\"path\":\"/vzpush\",\"href\":\"/vzpush\",\"_raw\":\"/vzpush\"},\"params\":{},\"query\":{},\"res\":\"[internal]\",\"body\":{\"data\":[{\"uuid\":\"xxxxxxxx-0000-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380292008,20.187]]},{\"uuid\":\"xxxxxxxx-1111-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380292818,19.75]]},{\"uuid\":\"xxxxxxxx-2222-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380279628,20.562]]},{\"uuid\":\"xxxxxxxx-3333-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380286108,21.125]]},{\"uuid\":\"xxxxxxxx-4444-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380288744,19.437]]},{\"uuid\":\"xxxxxxxx-5555-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380282058,46.937]]},{\"uuid\":\"xxxxxxxx-6666-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380280438,19.625]]},{\"uuid\":\"xxxxxxxx-7777-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380278798,20.437]]},{\"uuid\":\"xxxxxxxx-8888-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380283678,19.625]]},{\"uuid\":\"xxxxxxxx-9999-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380289573,12.125]]},{\"uuid\":\"xxxxxxxx-aaaa-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380277983,21.562]]},{\"uuid\":\"xxxxxxxx-bbbb-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380290388,20.187]]},{\"uuid\":\"xxxxxxxx-cccc-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380286917,20.687]]},{\"uuid\":\"xxxxxxxx-dddd-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380282868,39.5]]},{\"uuid\":\"xxxxxxxx-eeee-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380287728,31.125]]},{\"uuid\":\"xxxxxxxx-ffff-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380281248,30.875]]},{\"uuid\":\"xxxxxxxx-gggg-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380285298,20.687]]},{\"uuid\":\"xxxxxxxx-hhhh-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380291198,21.187]]}]},\"_body\":true,\"_passport\":{\"instance\":{\"_key\":\"passport\",\"_strategies\":{\"session\":{\"name\":\"session\"},\"bearer\":{\"name\":\"bearer\",\"_realm\":\"Users\"},\"oauth2-client-password\":{\"name\":\"oauth2-client-password\"},\"anon\":{\"name\":\"anon\"}},\"_serializers\":[],\"_deserializers\":[],\"_infoTransformers\":[],\"_framework\":{},\"_userProperty\":\"user\",\"_sm\":{\"_key\":\"passport\"},\"strategies\":{}}},\"route\":{\"path\":\"/vzpush\",\"stack\":[{\"name\":\"cookieParser\",\"keys\":[],\"regexp\":{\"fast_star\":false,\"fast_slash\":false},\"method\":\"post\"},{\"name\":\"httpMiddleware\",\"keys\":[],\"regexp\":{\"fast_star\":false,\"fast_slash\":false},\"method\":\"post\"},{\"name\":\"corsHandler\",\"keys\":[],\"regexp\":{\"fast_star\":false,\"fast_slash\":false},\"method\":\"post\"},{\"name\":\"metricsHandler\",\"keys\":[],\"regexp\":{\"fast_star\":false,\"fast_slash\":false},\"method\":\"post\"},{\"name\":\"jsonParser\",\"keys\":[],\"regexp\":{\"fast_star\":false,\"fast_slash\":false},\"method\":\"post\"},{\"name\":\"urlencodedParser\",\"keys\":[],\"regexp\":{\"fast_star\":false,\"fast_slash\":false},\"method\":\"post\"},{\"name\":\"multipartParser\",\"keys\":[],\"regexp\":{\"fast_star\":false,\"fast_slash\":false},\"method\":\"post\"},{\"name\":\"rawBodyParser\",\"keys\":[],\"regexp\":{\"fast_star\":false,\"fast_slash\":false},\"method\":\"post\"},{\"name\":\"<anonymous>\",\"keys\":[],\"regexp\":{\"fast_star\":false,\"fast_slash\":false},\"method\":\"post\"},{\"name\":\"<anonymous>\",\"keys\":[],\"regexp\":{\"fast_star\":false,\"fast_slash\":false},\"method\":\"post\"}],\"methods\":{\"post\":true}},\"cookies\":{},\"signedCookies\":{}},\"res\":{\"_res\":\"[internal]\"}}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":1080,"wires":[["a13bb1ff.e694e","2d338874.d09c9"]]},{"id":"d9cc42a5.c5641","type":"inject","z":"aac14499.e7214","name":"from /vzpush","topic":"","payload":"{\"_msgid\":\"91a80fdc.ad383\",\"payload\":{\"data\":[{\"uuid\":\"xxxxxxxx-0000-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380292008,20.187]]},{\"uuid\":\"xxxxxxxx-1111-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380292818,19.75]]},{\"uuid\":\"xxxxxxxx-2222-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380279628,20.562]]},{\"uuid\":\"xxxxxxxx-3333-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380286108,21.125]]},{\"uuid\":\"xxxxxxxx-4444-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380288744,19.437]]},{\"uuid\":\"xxxxxxxx-5555-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380282058,46.937]]},{\"uuid\":\"xxxxxxxx-6666-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380280438,19.625]]},{\"uuid\":\"xxxxxxxx-7777-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380278798,20.437]]},{\"uuid\":\"xxxxxxxx-8888-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380283678,19.625]]},{\"uuid\":\"xxxxxxxx-9999-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380289573,12.125]]},{\"uuid\":\"xxxxxxxx-aaaa-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380277983,21.562]]},{\"uuid\":\"xxxxxxxx-bbbb-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380290388,20.187]]},{\"uuid\":\"xxxxxxxx-cccc-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380286917,20.687]]},{\"uuid\":\"xxxxxxxx-dddd-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380282868,39.5]]},{\"uuid\":\"xxxxxxxx-eeee-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380287728,31.125]]},{\"uuid\":\"xxxxxxxx-ffff-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380281248,30.875]]},{\"uuid\":\"xxxxxxxx-gggg-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380285298,20.687]]},{\"uuid\":\"xxxxxxxx-hhhh-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380291198,21.187]]}]},\"req\":{\"_readableState\":{\"objectMode\":false,\"highWaterMark\":16384,\"buffer\":{\"head\":null,\"tail\":null,\"length\":0},\"length\":0,\"pipes\":null,\"pipesCount\":0,\"flowing\":true,\"ended\":true,\"endEmitted\":true,\"reading\":false,\"sync\":false,\"needReadable\":false,\"emittedReadable\":false,\"readableListening\":false,\"resumeScheduled\":false,\"destroyed\":false,\"defaultEncoding\":\"utf8\",\"awaitDrain\":0,\"readingMore\":false,\"decoder\":null,\"encoding\":null},\"readable\":false,\"domain\":null,\"_events\":{},\"_eventsCount\":0,\"socket\":\"[internal]\",\"connection\":\"[internal]\",\"httpVersionMajor\":1,\"httpVersionMinor\":1,\"httpVersion\":\"1.1\",\"complete\":true,\"headers\":{\"host\":\"127.0.0.1:1880\",\"content-type\":\"application/json\",\"accept\":\"application/json\",\"user-agent\":\"vzlogger/0.6.0 (libcurl/7.38.0 OpenSSL/1.0.1t zlib/1.2.8 libidn/1.29 libssh2/1.4.3 librtmp/2.3)\",\"content-length\":\"1805\",\"expect\":\"100-continue\"},\"rawHeaders\":[\"Host\",\"127.0.0.1:1880\",\"Content-type\",\"application/json\",\"Accept\",\"application/json\",\"User-Agent\",\"vzlogger/0.6.0 (libcurl/7.38.0 OpenSSL/1.0.1t zlib/1.2.8 libidn/1.29 libssh2/1.4.3 librtmp/2.3)\",\"Content-Length\",\"1805\",\"Expect\",\"100-continue\"],\"trailers\":{},\"rawTrailers\":[],\"upgrade\":false,\"url\":\"/vzpush\",\"method\":\"POST\",\"statusCode\":null,\"statusMessage\":null,\"client\":\"[internal]\",\"_consuming\":true,\"_dumped\":false,\"baseUrl\":\"\",\"originalUrl\":\"/vzpush\",\"_parsedUrl\":{\"protocol\":null,\"slashes\":null,\"auth\":null,\"host\":null,\"port\":null,\"hostname\":null,\"hash\":null,\"search\":null,\"query\":null,\"pathname\":\"/vzpush\",\"path\":\"/vzpush\",\"href\":\"/vzpush\",\"_raw\":\"/vzpush\"},\"params\":{},\"query\":{},\"res\":\"[internal]\",\"body\":{\"data\":[{\"uuid\":\"xxxxxxxx-0000-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380292008,20.187]]},{\"uuid\":\"xxxxxxxx-1111-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380292818,19.75]]},{\"uuid\":\"xxxxxxxx-2222-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380279628,20.562]]},{\"uuid\":\"xxxxxxxx-3333-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380286108,21.125]]},{\"uuid\":\"xxxxxxxx-4444-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380288744,19.437]]},{\"uuid\":\"xxxxxxxx-5555-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380282058,46.937]]},{\"uuid\":\"xxxxxxxx-6666-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380280438,19.625]]},{\"uuid\":\"xxxxxxxx-7777-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380278798,20.437]]},{\"uuid\":\"xxxxxxxx-8888-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380283678,19.625]]},{\"uuid\":\"xxxxxxxx-9999-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380289573,12.125]]},{\"uuid\":\"xxxxxxxx-aaaa-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380277983,21.562]]},{\"uuid\":\"xxxxxxxx-bbbb-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380290388,20.187]]},{\"uuid\":\"xxxxxxxx-cccc-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380286917,20.687]]},{\"uuid\":\"xxxxxxxx-dddd-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380282868,39.5]]},{\"uuid\":\"xxxxxxxx-eeee-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380287728,31.125]]},{\"uuid\":\"xxxxxxxx-ffff-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380281248,30.875]]},{\"uuid\":\"xxxxxxxx-gggg-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380285298,20.687]]},{\"uuid\":\"xxxxxxxx-hhhh-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380291198,21.187]]}]},\"_body\":true,\"_passport\":{\"instance\":{\"_key\":\"passport\",\"_strategies\":{\"session\":{\"name\":\"session\"},\"bearer\":{\"name\":\"bearer\",\"_realm\":\"Users\"},\"oauth2-client-password\":{\"name\":\"oauth2-client-password\"},\"anon\":{\"name\":\"anon\"}},\"_serializers\":[],\"_deserializers\":[],\"_infoTransformers\":[],\"_framework\":{},\"_userProperty\":\"user\",\"_sm\":{\"_key\":\"passport\"},\"strategies\":{}}},\"route\":{\"path\":\"/vzpush\",\"stack\":[{\"name\":\"cookieParser\",\"keys\":[],\"regexp\":{\"fast_star\":false,\"fast_slash\":false},\"method\":\"post\"},{\"name\":\"httpMiddleware\",\"keys\":[],\"regexp\":{\"fast_star\":false,\"fast_slash\":false},\"method\":\"post\"},{\"name\":\"corsHandler\",\"keys\":[],\"regexp\":{\"fast_star\":false,\"fast_slash\":false},\"method\":\"post\"},{\"name\":\"metricsHandler\",\"keys\":[],\"regexp\":{\"fast_star\":false,\"fast_slash\":false},\"method\":\"post\"},{\"name\":\"jsonParser\",\"keys\":[],\"regexp\":{\"fast_star\":false,\"fast_slash\":false},\"method\":\"post\"},{\"name\":\"urlencodedParser\",\"keys\":[],\"regexp\":{\"fast_star\":false,\"fast_slash\":false},\"method\":\"post\"},{\"name\":\"multipartParser\",\"keys\":[],\"regexp\":{\"fast_star\":false,\"fast_slash\":false},\"method\":\"post\"},{\"name\":\"rawBodyParser\",\"keys\":[],\"regexp\":{\"fast_star\":false,\"fast_slash\":false},\"method\":\"post\"},{\"name\":\"<anonymous>\",\"keys\":[],\"regexp\":{\"fast_star\":false,\"fast_slash\":false},\"method\":\"post\"},{\"name\":\"<anonymous>\",\"keys\":[],\"regexp\":{\"fast_star\":false,\"fast_slash\":false},\"method\":\"post\"}],\"methods\":{\"post\":true}},\"cookies\":{},\"signedCookies\":{}},\"res\":{\"_res\":\"[internal]\"}}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":1120,"wires":[["2d338874.d09c9","f36a2088.552a6"]]},{"id":"3b1859e2.775fbe","type":"inject","z":"aac14499.e7214","name":"from /vzpush","topic":"","payload":"{\"_msgid\":\"91a80fdc.ad383\",\"payload\":{\"data\":[{\"uuid\":\"xxxxxxxx-0000-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380292008,20.187]]},{\"uuid\":\"xxxxxxxx-1111-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380292818,19.75]]},{\"uuid\":\"xxxxxxxx-2222-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380279628,20.562]]},{\"uuid\":\"xxxxxxxx-3333-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380286108,21.125]]},{\"uuid\":\"xxxxxxxx-4444-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380288744,19.437]]},{\"uuid\":\"xxxxxxxx-5555-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380282058,46.937]]},{\"uuid\":\"xxxxxxxx-6666-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380280438,19.625]]},{\"uuid\":\"xxxxxxxx-7777-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380278798,20.437]]},{\"uuid\":\"xxxxxxxx-8888-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380283678,19.625]]},{\"uuid\":\"xxxxxxxx-9999-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380289573,12.125]]},{\"uuid\":\"xxxxxxxx-aaaa-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380277983,21.562]]},{\"uuid\":\"xxxxxxxx-bbbb-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380290388,20.187]]},{\"uuid\":\"xxxxxxxx-cccc-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380286917,20.687]]},{\"uuid\":\"xxxxxxxx-dddd-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380282868,39.5]]},{\"uuid\":\"xxxxxxxx-eeee-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380287728,31.125]]},{\"uuid\":\"xxxxxxxx-ffff-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380281248,30.875]]},{\"uuid\":\"xxxxxxxx-gggg-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380285298,20.687]]},{\"uuid\":\"xxxxxxxx-hhhh-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380291198,21.187]]}]},\"req\":{\"_readableState\":{\"objectMode\":false,\"highWaterMark\":16384,\"buffer\":{\"head\":null,\"tail\":null,\"length\":0},\"length\":0,\"pipes\":null,\"pipesCount\":0,\"flowing\":true,\"ended\":true,\"endEmitted\":true,\"reading\":false,\"sync\":false,\"needReadable\":false,\"emittedReadable\":false,\"readableListening\":false,\"resumeScheduled\":false,\"destroyed\":false,\"defaultEncoding\":\"utf8\",\"awaitDrain\":0,\"readingMore\":false,\"decoder\":null,\"encoding\":null},\"readable\":false,\"domain\":null,\"_events\":{},\"_eventsCount\":0,\"socket\":\"[internal]\",\"connection\":\"[internal]\",\"httpVersionMajor\":1,\"httpVersionMinor\":1,\"httpVersion\":\"1.1\",\"complete\":true,\"headers\":{\"host\":\"127.0.0.1:1880\",\"content-type\":\"application/json\",\"accept\":\"application/json\",\"user-agent\":\"vzlogger/0.6.0 (libcurl/7.38.0 OpenSSL/1.0.1t zlib/1.2.8 libidn/1.29 libssh2/1.4.3 librtmp/2.3)\",\"content-length\":\"1805\",\"expect\":\"100-continue\"},\"rawHeaders\":[\"Host\",\"127.0.0.1:1880\",\"Content-type\",\"application/json\",\"Accept\",\"application/json\",\"User-Agent\",\"vzlogger/0.6.0 (libcurl/7.38.0 OpenSSL/1.0.1t zlib/1.2.8 libidn/1.29 libssh2/1.4.3 librtmp/2.3)\",\"Content-Length\",\"1805\",\"Expect\",\"100-continue\"],\"trailers\":{},\"rawTrailers\":[],\"upgrade\":false,\"url\":\"/vzpush\",\"method\":\"POST\",\"statusCode\":null,\"statusMessage\":null,\"client\":\"[internal]\",\"_consuming\":true,\"_dumped\":false,\"baseUrl\":\"\",\"originalUrl\":\"/vzpush\",\"_parsedUrl\":{\"protocol\":null,\"slashes\":null,\"auth\":null,\"host\":null,\"port\":null,\"hostname\":null,\"hash\":null,\"search\":null,\"query\":null,\"pathname\":\"/vzpush\",\"path\":\"/vzpush\",\"href\":\"/vzpush\",\"_raw\":\"/vzpush\"},\"params\":{},\"query\":{},\"res\":\"[internal]\",\"body\":{\"data\":[{\"uuid\":\"xxxxxxxx-0000-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380292008,20.187]]},{\"uuid\":\"xxxxxxxx-1111-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380292818,19.75]]},{\"uuid\":\"xxxxxxxx-2222-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380279628,20.562]]},{\"uuid\":\"xxxxxxxx-3333-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380286108,21.125]]},{\"uuid\":\"xxxxxxxx-4444-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380288744,19.437]]},{\"uuid\":\"xxxxxxxx-5555-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380282058,46.937]]},{\"uuid\":\"xxxxxxxx-6666-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380280438,19.625]]},{\"uuid\":\"xxxxxxxx-7777-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380278798,20.437]]},{\"uuid\":\"xxxxxxxx-8888-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380283678,19.625]]},{\"uuid\":\"xxxxxxxx-9999-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380289573,12.125]]},{\"uuid\":\"xxxxxxxx-aaaa-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380277983,21.562]]},{\"uuid\":\"xxxxxxxx-bbbb-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380290388,20.187]]},{\"uuid\":\"xxxxxxxx-cccc-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380286917,20.687]]},{\"uuid\":\"xxxxxxxx-dddd-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380282868,39.5]]},{\"uuid\":\"xxxxxxxx-eeee-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380287728,31.125]]},{\"uuid\":\"xxxxxxxx-ffff-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380281248,30.875]]},{\"uuid\":\"xxxxxxxx-gggg-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380285298,20.687]]},{\"uuid\":\"xxxxxxxx-hhhh-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380291198,21.187]]}]},\"_body\":true,\"_passport\":{\"instance\":{\"_key\":\"passport\",\"_strategies\":{\"session\":{\"name\":\"session\"},\"bearer\":{\"name\":\"bearer\",\"_realm\":\"Users\"},\"oauth2-client-password\":{\"name\":\"oauth2-client-password\"},\"anon\":{\"name\":\"anon\"}},\"_serializers\":[],\"_deserializers\":[],\"_infoTransformers\":[],\"_framework\":{},\"_userProperty\":\"user\",\"_sm\":{\"_key\":\"passport\"},\"strategies\":{}}},\"route\":{\"path\":\"/vzpush\",\"stack\":[{\"name\":\"cookieParser\",\"keys\":[],\"regexp\":{\"fast_star\":false,\"fast_slash\":false},\"method\":\"post\"},{\"name\":\"httpMiddleware\",\"keys\":[],\"regexp\":{\"fast_star\":false,\"fast_slash\":false},\"method\":\"post\"},{\"name\":\"corsHandler\",\"keys\":[],\"regexp\":{\"fast_star\":false,\"fast_slash\":false},\"method\":\"post\"},{\"name\":\"metricsHandler\",\"keys\":[],\"regexp\":{\"fast_star\":false,\"fast_slash\":false},\"method\":\"post\"},{\"name\":\"jsonParser\",\"keys\":[],\"regexp\":{\"fast_star\":false,\"fast_slash\":false},\"method\":\"post\"},{\"name\":\"urlencodedParser\",\"keys\":[],\"regexp\":{\"fast_star\":false,\"fast_slash\":false},\"method\":\"post\"},{\"name\":\"multipartParser\",\"keys\":[],\"regexp\":{\"fast_star\":false,\"fast_slash\":false},\"method\":\"post\"},{\"name\":\"rawBodyParser\",\"keys\":[],\"regexp\":{\"fast_star\":false,\"fast_slash\":false},\"method\":\"post\"},{\"name\":\"<anonymous>\",\"keys\":[],\"regexp\":{\"fast_star\":false,\"fast_slash\":false},\"method\":\"post\"},{\"name\":\"<anonymous>\",\"keys\":[],\"regexp\":{\"fast_star\":false,\"fast_slash\":false},\"method\":\"post\"}],\"methods\":{\"post\":true}},\"cookies\":{},\"signedCookies\":{}},\"res\":{\"_res\":\"[internal]\"}}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":1160,"wires":[["2d338874.d09c9","9c257f3b.8a2458"]]},{"id":"7f272f2.f6c83d","type":"inject","z":"aac14499.e7214","name":"from /vzpush","topic":"","payload":"{\"_msgid\":\"91a80fdc.ad383\",\"payload\":{\"data\":[{\"uuid\":\"xxxxxxxx-0000-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380292008,20.187]]},{\"uuid\":\"xxxxxxxx-1111-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380292818,19.75]]},{\"uuid\":\"xxxxxxxx-2222-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380279628,20.562]]},{\"uuid\":\"xxxxxxxx-3333-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380286108,21.125]]},{\"uuid\":\"xxxxxxxx-4444-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380288744,19.437]]},{\"uuid\":\"xxxxxxxx-5555-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380282058,46.937]]},{\"uuid\":\"xxxxxxxx-6666-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380280438,19.625]]},{\"uuid\":\"xxxxxxxx-7777-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380278798,20.437]]},{\"uuid\":\"xxxxxxxx-8888-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380283678,19.625]]},{\"uuid\":\"xxxxxxxx-9999-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380289573,12.125]]},{\"uuid\":\"xxxxxxxx-aaaa-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380277983,21.562]]},{\"uuid\":\"xxxxxxxx-bbbb-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380290388,20.187]]},{\"uuid\":\"xxxxxxxx-cccc-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380286917,20.687]]},{\"uuid\":\"xxxxxxxx-dddd-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380282868,39.5]]},{\"uuid\":\"xxxxxxxx-eeee-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380287728,31.125]]},{\"uuid\":\"xxxxxxxx-ffff-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380281248,30.875]]},{\"uuid\":\"xxxxxxxx-gggg-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380285298,20.687]]},{\"uuid\":\"xxxxxxxx-hhhh-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380291198,21.187]]}]},\"req\":{\"_readableState\":{\"objectMode\":false,\"highWaterMark\":16384,\"buffer\":{\"head\":null,\"tail\":null,\"length\":0},\"length\":0,\"pipes\":null,\"pipesCount\":0,\"flowing\":true,\"ended\":true,\"endEmitted\":true,\"reading\":false,\"sync\":false,\"needReadable\":false,\"emittedReadable\":false,\"readableListening\":false,\"resumeScheduled\":false,\"destroyed\":false,\"defaultEncoding\":\"utf8\",\"awaitDrain\":0,\"readingMore\":false,\"decoder\":null,\"encoding\":null},\"readable\":false,\"domain\":null,\"_events\":{},\"_eventsCount\":0,\"socket\":\"[internal]\",\"connection\":\"[internal]\",\"httpVersionMajor\":1,\"httpVersionMinor\":1,\"httpVersion\":\"1.1\",\"complete\":true,\"headers\":{\"host\":\"127.0.0.1:1880\",\"content-type\":\"application/json\",\"accept\":\"application/json\",\"user-agent\":\"vzlogger/0.6.0 (libcurl/7.38.0 OpenSSL/1.0.1t zlib/1.2.8 libidn/1.29 libssh2/1.4.3 librtmp/2.3)\",\"content-length\":\"1805\",\"expect\":\"100-continue\"},\"rawHeaders\":[\"Host\",\"127.0.0.1:1880\",\"Content-type\",\"application/json\",\"Accept\",\"application/json\",\"User-Agent\",\"vzlogger/0.6.0 (libcurl/7.38.0 OpenSSL/1.0.1t zlib/1.2.8 libidn/1.29 libssh2/1.4.3 librtmp/2.3)\",\"Content-Length\",\"1805\",\"Expect\",\"100-continue\"],\"trailers\":{},\"rawTrailers\":[],\"upgrade\":false,\"url\":\"/vzpush\",\"method\":\"POST\",\"statusCode\":null,\"statusMessage\":null,\"client\":\"[internal]\",\"_consuming\":true,\"_dumped\":false,\"baseUrl\":\"\",\"originalUrl\":\"/vzpush\",\"_parsedUrl\":{\"protocol\":null,\"slashes\":null,\"auth\":null,\"host\":null,\"port\":null,\"hostname\":null,\"hash\":null,\"search\":null,\"query\":null,\"pathname\":\"/vzpush\",\"path\":\"/vzpush\",\"href\":\"/vzpush\",\"_raw\":\"/vzpush\"},\"params\":{},\"query\":{},\"res\":\"[internal]\",\"body\":{\"data\":[{\"uuid\":\"xxxxxxxx-0000-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380292008,20.187]]},{\"uuid\":\"xxxxxxxx-1111-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380292818,19.75]]},{\"uuid\":\"xxxxxxxx-2222-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380279628,20.562]]},{\"uuid\":\"xxxxxxxx-3333-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380286108,21.125]]},{\"uuid\":\"xxxxxxxx-4444-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380288744,19.437]]},{\"uuid\":\"xxxxxxxx-5555-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380282058,46.937]]},{\"uuid\":\"xxxxxxxx-6666-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380280438,19.625]]},{\"uuid\":\"xxxxxxxx-7777-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380278798,20.437]]},{\"uuid\":\"xxxxxxxx-8888-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380283678,19.625]]},{\"uuid\":\"xxxxxxxx-9999-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380289573,12.125]]},{\"uuid\":\"xxxxxxxx-aaaa-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380277983,21.562]]},{\"uuid\":\"xxxxxxxx-bbbb-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380290388,20.187]]},{\"uuid\":\"xxxxxxxx-cccc-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380286917,20.687]]},{\"uuid\":\"xxxxxxxx-dddd-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380282868,39.5]]},{\"uuid\":\"xxxxxxxx-eeee-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380287728,31.125]]},{\"uuid\":\"xxxxxxxx-ffff-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380281248,30.875]]},{\"uuid\":\"xxxxxxxx-gggg-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380285298,20.687]]},{\"uuid\":\"xxxxxxxx-hhhh-xxxx-xxxx-xxxxxxxxxxxx\",\"tuples\":[[1538380291198,21.187]]}]},\"_body\":true,\"_passport\":{\"instance\":{\"_key\":\"passport\",\"_strategies\":{\"session\":{\"name\":\"session\"},\"bearer\":{\"name\":\"bearer\",\"_realm\":\"Users\"},\"oauth2-client-password\":{\"name\":\"oauth2-client-password\"},\"anon\":{\"name\":\"anon\"}},\"_serializers\":[],\"_deserializers\":[],\"_infoTransformers\":[],\"_framework\":{},\"_userProperty\":\"user\",\"_sm\":{\"_key\":\"passport\"},\"strategies\":{}}},\"route\":{\"path\":\"/vzpush\",\"stack\":[{\"name\":\"cookieParser\",\"keys\":[],\"regexp\":{\"fast_star\":false,\"fast_slash\":false},\"method\":\"post\"},{\"name\":\"httpMiddleware\",\"keys\":[],\"regexp\":{\"fast_star\":false,\"fast_slash\":false},\"method\":\"post\"},{\"name\":\"corsHandler\",\"keys\":[],\"regexp\":{\"fast_star\":false,\"fast_slash\":false},\"method\":\"post\"},{\"name\":\"metricsHandler\",\"keys\":[],\"regexp\":{\"fast_star\":false,\"fast_slash\":false},\"method\":\"post\"},{\"name\":\"jsonParser\",\"keys\":[],\"regexp\":{\"fast_star\":false,\"fast_slash\":false},\"method\":\"post\"},{\"name\":\"urlencodedParser\",\"keys\":[],\"regexp\":{\"fast_star\":false,\"fast_slash\":false},\"method\":\"post\"},{\"name\":\"multipartParser\",\"keys\":[],\"regexp\":{\"fast_star\":false,\"fast_slash\":false},\"method\":\"post\"},{\"name\":\"rawBodyParser\",\"keys\":[],\"regexp\":{\"fast_star\":false,\"fast_slash\":false},\"method\":\"post\"},{\"name\":\"<anonymous>\",\"keys\":[],\"regexp\":{\"fast_star\":false,\"fast_slash\":false},\"method\":\"post\"},{\"name\":\"<anonymous>\",\"keys\":[],\"regexp\":{\"fast_star\":false,\"fast_slash\":false},\"method\":\"post\"}],\"methods\":{\"post\":true}},\"cookies\":{},\"signedCookies\":{}},\"res\":{\"_res\":\"[internal]\"}}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":1200,"wires":[["2d338874.d09c9","5d5546f5.439248"]]},{"id":"f36a2088.552a6","type":"debug","z":"aac14499.e7214","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":310,"y":1120,"wires":[]},{"id":"9c257f3b.8a2458","type":"debug","z":"aac14499.e7214","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":310,"y":1160,"wires":[]},{"id":"5d5546f5.439248","type":"debug","z":"aac14499.e7214","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":310,"y":1200,"wires":[]}]

 

 

Dazu folgende zwei Problemstellungen:

 

1. Wie krieg ich das so aufgeteilt, dass dabei für jedes Topic eine eigene Message mit folgendem Format erzeugt wird:

{"topic":"Haus/Heizung/T18HausRücklauf","payload":21.062,"_msgid":"c6a81ec4.8f35f"}   ?

(ich brauche nur “topic” und “payload”, die _msgid brauche ich nicht)

 

2. Wie fange ich UUIDs ab, die nicht in der uuidMap stehen?

Momentan kommt dann immer folgende Fehlermeldung bei raus:

"Invalid JSONata expression: Key in object structure must evaluate to a string; got: undefined"

 

Liebe Grüße,

Chris

 

 

Von: Frank Richter [mailto:frank.richter83 at gmail.com] 
Gesendet: Dienstag, 2. Oktober 2018 02:08
An: volkszaehler.org - users
Betreff: Re: [vz-users] Daten auf MQTT Topics verteilen

 

Hi Christian,

 

wenn du noch Hilfe brauchst, schick mal deinen Flow, damit ich eine Basis zum Rumprobieren habe. Vielleicht komme ich diese Woche dazu.

 

Grüße

Frank

 

Am Di., 25. Sep. 2018 um 20:22 Uhr schrieb Christian Wulff <christianwulff at gmx.de>:

Moin Frank,

 

Ich steck tief im Schlamm L

Daran verzweifle ich leider, ich kann kein bisschen JavaScript.

Ich habe forEach() gesucht, gefunden und mehrere Seiten darüber durchgelesen, aber wenn man keine einzige Zeile JavaScript schreiben kann, dann ist das wie Kiswahili und Chinesisch. Kann ich auch beides nicht.

Könntest du mir dabei vielleicht weiter helfen?

 

Danke und liebe Grüße,

Chris

 

 

 

 

Von: Frank Richter [mailto:frank.richter83 at gmail.com] 
Gesendet: Dienstag, 25. September 2018 01:57
An: volkszaehler.org - users
Betreff: Re: [vz-users] Daten auf MQTT Topics verteilen

 

Hi,

 

ok, kapiert. Das data-Array kannst du mit forEach() auseinander nehmen. Beim return musst du dann wieder ein Array aus Message-Objekten übergeben (siehe https://nodered.org/docs/writing-functions#multiple-messages).

Den Rest dazwischen musst du selbst basteln ;-)

 

Grüße

Frank

 

Christian Wulff <christianwulff at gmx.de> schrieb am Mo., 24. Sep. 2018, 23:52:

Da hab ich mich wohl falsch ausgedrückt. Pro UUID ist immer nur ein timestamp und ein Wert drin.

Ich hatte weiter unten drei Beispiele eingefügt.

Hier nochmal:

{

    "data": [

        {

            "uuid": "xxxxxxxx-1111-xxxx-xxxx-xxxxxxxxxxxx",

            "tuples": [

                [

                    1537815350021,

                    13875.6

                ]

            ]

        }

    ]

}

Der läuft einwandfrei durch, weil es nur ein Kanal ist.

 

Beim nächsten sind zwei UUIDs drin, davon kriege ich nur die erste erwischt:

{

    "data": [

        {

            "uuid": "xxxxxxxx-2222-xxxx-xxxx-xxxxxxxxxxxx",

            "tuples": [

                [

                    1537815406656,

                    12309.5

                ]

            ]

        },

        {

            "uuid": "xxxxxxxx-3333-xxxx-xxxx-xxxxxxxxxxxx",

            "tuples": [

                [

                    1537815405848,

                    13683.8

                ]

            ]

        }

    ]

}

 

Und hier bei den Temperaturen kommt gleich ein ganzer Haufen zusammen, von dem ich auch nur den ersten rauskriege mit meinem Code ohne Schleife:

{

    "data": [

        {

            "uuid": "xxxxxxxx-6666-xxxx-xxxx-xxxxxxxxxxxx",

            "tuples": [

                [

                    1537815433104,

                    21.562

                ]

            ]

        },

        {

            "uuid": "xxxxxxxx-7777-xxxx-xxxxx-xxxxxxxxxxxx",

            "tuples": [

                [

                    1537815433972,

                    20.937

                ]

            ]

        },

        {

            "uuid": " xxxxxxxx-8888-xxxx-xxxxx-xxxxxxxxxxxx ",

            "tuples": [

                [

                    1537815420583,

                    21.75

                ]

            ]

        },

        {

            "uuid": " xxxxxxxx-9999-xxxx-xxxxx-xxxxxxxxxxxx ",

            "tuples": [

                [

                    1537815427434,

                    22.187

                ]

            ]

        },

        {

            "uuid": " xxxxxxxx-0000-xxxx-xxxxx-xxxxxxxxxxxx ",

            "tuples": [

                [

     ...

 

 

 

 

Von: Frank Richter [mailto:frank.richter83 at gmail.com] 
Gesendet: Montag, 24. September 2018 23:27
An: volkszaehler.org - users
Betreff: Re: [vz-users] Daten auf MQTT Topics verteilen

 

Für welchen Zählertyp liefert Push denn überhaupt mehr als 1 Tupel?

 

Grüße

Frank

 

Christian Wulff <christianwulff at gmx.de> schrieb am Mo., 24. Sep. 2018, 23:19:

Moin,

 

also wenn ich behilflich sein kann beim Testen, dann immer gerne.

Das Problem ist nur, dass ich kein JavaScript kann, von MQTT keine Ahnung habe, von Linux sicher keine Ahnung habe, usw.

Dennoch habe ich hier einiges zum Laufen bekommen mit Eurer Hilfe und Hilfe von Foren, wenn ich denn mal Zeit habe.

Und von der Zeit habe ich leider auch nicht so viel. Deswegen dauert es meistens eine Weile.

 

Ich hatte es ja zuerst ohne JSON node. Da hab ich gar nichts hinbekommen. Fehlermeldung: "SyntaxError: Unexpected token o in JSON at position 1"

Dann habe ich den JSON node eingefügt und schon ging es fast. Fehlermeldung: "TypeError: Cannot read property '0' of undefined"

Ich habe mit meinem Displayprojekt ja schon JSONs mit der ArduinoJSON Library geparst.

Zu der Library gibt’s einen JSON Assistent: https://arduinojson.org/v5/assistant/

Da habe ich die JSONs vom Push Server und vom VZLOGGER reingehauen und habe dann erkannt, dass es beim VZLogger ein kleines bisschen anders aufgebaut ist.

 

Anstatt:

var myUuid = myJsonObj.data.uuid;

var myTimestamp = myJsonObj.data.tuples[0][0];

var myValue = myJsonObj.data.tuples[0][1];

 

habe ich dann:

var myUuid = myJsonObj.data[0].uuid;

var myTimestamp = myJsonObj.data[0].tuples[0][0];

var myValue = myJsonObj.data[0].tuples[0][1];

In den Funktion node geschrieben. Und schon läuft es ohne Fehler durch.

 

Wenn ich das jetzt richtig durchblicke, wird so allerdings immer nur der erste Tuple des JSONs eingelesen, alle anderen nicht.

Die anderen würden wohl mit

var myUuid = myJsonObj.data[1].uuid;

var myTimestamp = myJsonObj.data[1].tuples[0][0];

var myValue = myJsonObj.data[1].tuples[0][1];

usw. eingelesen werden.

 

Jetzt müsste man irgendwie eine Schleife programmieren, die immer alle Tuples aus einem JSON ausgibt.

Aber da hab ich leider wieder keinen Plan wie das geht L

 

Ich wollte ja auch nur meine drei Stromzähler über den VZLOGGER an MQTT pushen. Die Stromzählerwerte kommen einzeln raus, daher funktioniert das jetzt provisorisch bei mir.

Schöner wäre es natürlich wenn ich alle Werte aus den JSON rauskriegen würde, und nicht nur den ersten Wert.

 

Liebe Grüße,

Chris

 

 

 

Von: Frank Richter [mailto:frank.richter83 at gmail.com] 
Gesendet: Montag, 24. September 2018 21:30
An: volkszaehler.org - users
Betreff: Re: [vz-users] Daten auf MQTT Topics verteilen

 

Hi Christian,

 

der Vorschlag von Matthias macht durchaus Sinn, das wäre der direkte Weg. Ich hab allerdings noch keine eigene Erfahrung mit MQTT via vzlogger, deswegen kann ich da nicht helfen. Aber Matthias freut sich sicher über Tester :-)

Den vzlogger kannst du wahrscheinlich auch auf dem alten Image neu compilieren. Aber irgendwann musst du halt auch mal upgraden, wenn du neue Features willst.

 

Ansonsten: lass den JSON-Node weg, das ist kontraproduktiv. Der Function Node erwartet ein Objekt, keinen String.

 

Grüße

Frank

 

Am 24.09.2018 9:07 nachm. schrieb "Christian Wulff" <christianwulff at gmx.de>:

Hallo Matthias,

 

ich habe mir deine verlinkte Seite mal angesehen.

Verstanden habe ich davon aber nix, oder nur minimal rudimentär.

Weitergebracht hat mich das jetzt leider nicht.

Da die Posts vom August diesen Jahren kommen, vermute ich dass es mir auch nichts hilft.

Meine VZ Installation ist aus ~Oktober 2016.

 

@Frank:

 

Ich habe jetzt mal testweise in Node-RED hinter den [post] /vzpush node einen json node drangehängt.

Nun wird schon mal aus dem JavaScript Object ein JSON String (ich vermute das hilft)

Dann habe ich einen Funktionsknoten mit dem gleichen Code dahintergehängt, der bei dem VZ Push Server funktioniert:

 

var uuidMap = {

                'xxxxxxxx-1111-xxxx-xxxx-xxxxxxxxxxxx':{topic:'Haus/Strom/Haus'},

                ' xxxxxxxx-2222-xxxx-xxxx-xxxxxxxxxxxx ':{topic:'Haus/Strom/WärmepumpeHaupttarif'},

                ' xxxxxxxx-3333-xxxx-xxxx-xxxxxxxxxxxx ':{topic:'Haus/Strom/WärmepumpeNebentarif'},

' xxxxxxxx-4444-xxxx-xxxx-xxxxxxxxxxxx ':{topic:'Haus/Temperatur/T01Aussen'},

                }; 

 

// Parse JSON

var myJsonObj = [];

var myJsonObj = JSON.parse(msg.payload);

 

// Get UUID, timestamp and value

var myUuid = myJsonObj.data.uuid;

var myTimestamp = myJsonObj.data.tuples[0][0];

var myValue = myJsonObj.data.tuples[0][1];

 

if (uuidMap[myUuid] !== undefined) {

  // Create output payload

  var myOutput = {};

  myOutput.topic = uuidMap[myUuid]['topic'];

  myOutput.payload = myValue;

  return myOutput;

}

 

Dann bekomme ich allerdings die Fehlermeldung:

"TypeError: Cannot read property '0' of undefined"

Und nun verlassen sie mich, ich finde nicht heraus wo der Fehler liegt.

Kann da jemand weiterhelfen?

 

Danke und liebe Grüße,

Chris

 

P.S.: Die JSON Strings sehen z.B. so aus:

{

    "data": [

        {

            "uuid": "xxxxxxxx-1111-xxxx-xxxx-xxxxxxxxxxxx",

            "tuples": [

                [

                    1537815350021,

                    13875.6

                ]

            ]

        }

    ]

}

 

Oder so:

{

    "data": [

        {

            "uuid": "xxxxxxxx-2222-xxxx-xxxx-xxxxxxxxxxxx",

            "tuples": [

                [

                    1537815406656,

                    12309.5

                ]

            ]

        },

        {

            "uuid": "xxxxxxxx-3333-xxxx-xxxx-xxxxxxxxxxxx",

            "tuples": [

                [

                    1537815405848,

                    13683.8

                ]

            ]

        }

    ]

}

Oder auch so:

{

    "data": [

        {

            "uuid": "xxxxxxxx-6666-xxxx-xxxx-xxxxxxxxxxxx",

            "tuples": [

                [

                    1537815433104,

                    21.562

                ]

            ]

        },

        {

            "uuid": "xxxxxxxx-7777-xxxx-xxxxx-xxxxxxxxxxxx",

            "tuples": [

                [

                    1537815433972,

                    20.937

                ]

            ]

        },

        {

            "uuid": " xxxxxxxx-8888-xxxx-xxxxx-xxxxxxxxxxxx ",

            "tuples": [

                [

                    1537815420583,

                    21.75

                ]

            ]

        },

        {

            "uuid": " xxxxxxxx-9999-xxxx-xxxxx-xxxxxxxxxxxx ",

            "tuples": [

                [

                    1537815427434,

                    22.187

                ]

            ]

        },

        {

            "uuid": " xxxxxxxx-0000-xxxx-xxxxx-xxxxxxxxxxxx ",

            "tuples": [

                [

     ...

 

Von: Matthias Behr [mailto:mbehr at mcbehr.de] 
Gesendet: Sonntag, 23. September 2018 22:41


An: volkszaehler.org - users
Betreff: Re: [vz-users] Daten auf MQTT Topics verteilen

 

Hallo,

 

schon mal https://github.com/volkszaehler/vzlogger/pull/357 angeschaut?

 

Gruß

Matthias

 

Am 23.09.2018 um 21:47 schrieb Frank Richter <frank.richter83 at gmail.com>:

 

Hi Christian,

 

was gibt's da groß zu "entschlüsseln", das ist doch auch nur JSON? Geht im Prinzip genauso wie bei den Websockets-Messages vom Push-Server.

 

Gruß

Frank

 

Christian Wulff <christianwulff at gmx.de> schrieb am So., 23. Sep. 2018 20:11:

Hallo Frank,

 

also so?:

 

  "push": [

    {

      "url": "http://127.0.0.1:5582 <http://127.0.0.1:5582/> "},

    { "url": "http://127.0.0.1:1880/vzpush"

    }

  ],

 

Das scheint zu funktionieren.

Auf jeden Fall kommt dann msg: Objects im debug Fenster von Node-RED raus.

Im debug Fenster habe ich diese Objects mal aufgeklappt und durchgesehen, und tatsächlich einen Zählerstand eines Stromzählers gefunden *happy*

 

Jetzt müssen diese Objects „nur“ noch entschlüsselt und auf den MQTT Broker gepublished werden.

Das sieht mir jetzt aber sehr komplex aus.

Hat da jemand ein Beispiel, wie man das hinkriegt? Da blicke ich so erstmal gar nicht durch L

 

Liebe Grüße,

Chris

 

Von: Frank Richter [mailto:frank.richter83 at gmail.com] 
Gesendet: Samstag, 22. September 2018 18:47
An: volkszaehler.org <http://volkszaehler.org/>  - users
Betreff: Re: [vz-users] Daten auf MQTT Topics verteilen

 

Hi Christian,

 

"push": [] ist doch ein Array, sollte also auch mit mehreren Zielen klarkommen.

 

Grüße

Frank

 

Christian Wulff <christianwulff at gmx.de> schrieb am Sa., 22. Sep. 2018, 17:00:

Hallo Frank,

 

ich möchte also zusätzlich zu den Werten, die über den Push Server an MQTT gesendet werden, auch noch die Zählerstände vom vzlogger direkt an Node-RED pushen.

Dazu steht im Wiki, dass man folgende Zeilen in /ect/vzlogger.conf editieren soll:

"push": [

  {

    "url": "http://127.0.0.1:1880/vzpush"

  }

],

 

 

Nun habe ich in meiner /ect/vzlogger.conf allerdings schon drin stehen:

  "push": [

    {

      "url": "http://127.0.0.1:5582 <http://127.0.0.1:5582/> "

    }

  ],

 

Was ist denn richtig?

Beides geht ja vermutlich nicht?!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://demo.volkszaehler.org/pipermail/volkszaehler-users/attachments/20181002/49eadcf0/attachment-0001.html>


More information about the volkszaehler-users mailing list