Bonjour,
En complément du tuto je souhaite archiver des consommations et je rencontre un problème avec ce flow :
[{"id":"bbada7d3.cf7c18","type":"cronplus","z":"5f869aea.270dd4","name":"","outputField":"payload","timeZone":"","persistDynamic":false,"commandResponseMsgOutput":"output1","outputs":1,"options":[{"name":"mai","topic":"mai","payloadType":"default","payload":"","expressionType":"cron","expression":"0 58 23 31 MAY * 2021","location":"","offset":"0","solarType":"all","solarEvents":"sunrise,sunset"}],"x":280,"y":940,"wires":[["87ff8218.d8fc5"]]},{"id":"87ff8218.d8fc5","type":"switch","z":"5f869aea.270dd4","name":"period select","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"mai","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":450,"y":940,"wires":[["d4497780.3b8e68"]]},{"id":"bcfbea13.5758c8","type":"debug","z":"5f869aea.270dd4","name":"Conso elec 21_05","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1410,"y":880,"wires":[]},{"id":"3b97fdda.cb0f22","type":"influxdb out","z":"5f869aea.270dd4","influxdb":"468eb0a8.3cc35","name":"Influxdb Conso elec mai","measurement":"conso_elec_hist","precision":"","retentionPolicy":"","database":"database","precisionV18FluxV20":"ms","retentionPolicyV18Flux":"","org":"organisation","bucket":"bucket","x":1430,"y":940,"wires":[]},{"id":"6a6f2f3f.94be2","type":"function","z":"5f869aea.270dd4","name":"transforme en nombre + format pour influx","func":"var conso_elec_hist= parseFloat(msg.payload);\nmsg.payload = [];\nfields = {\"value\":conso_elec_hist};\ntags = {\"entity\":\"conso_elec_mai\"};\nmsg.payload = [fields,tags];\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1120,"y":880,"wires":[["bcfbea13.5758c8","3b97fdda.cb0f22"]]},{"id":"d4497780.3b8e68","type":"change","z":"5f869aea.270dd4","name":"","rules":[{"t":"set","p":"conso_elec_hist_mai","pt":"flow","to":"conso_elec_hist_month","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":640,"y":880,"wires":[["372ee317.fed44c"]]},{"id":"a574698e.667128","type":"inject","z":"5f869aea.270dd4","name":"Manual init","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":420,"y":860,"wires":[["d4497780.3b8e68"]]},{"id":"cb859e86.3f94d","type":"debug","z":"5f869aea.270dd4","name":"TEST","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1010,"y":980,"wires":[]},{"id":"372ee317.fed44c","type":"function","z":"5f869aea.270dd4","name":"","func":"var conso_elec_mai = flow.get(\"conso_elec_hist_mai\");\nmsg.payload = [conso_elec_mai];\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":860,"y":880,"wires":[["6a6f2f3f.94be2","cb859e86.3f94d"]]},{"id":"468eb0a8.3cc35","type":"influxdb","hostname":"a0d7b954-influxdb","port":"8086","protocol":"http","database":"nodereddb","name":"influx db addon","usetls":false,"tls":"","influxdbVersion":"1.x","url":"http://localhost:8086","rejectUnauthorized":true}]
le format du nombre est correct à la sortie du nœud « fontion » :
13/05/2021, 20:11:21node: TEST
msg.payload : array[1]
array[1]
0: array[2]
0: object
value: 61256
1: object
entity: "conso_elec_month"
mais il ne l’est plus à la sortie du nœud « Transforme en nombre + format pour Influx »
13/05/2021, 20:11:21node: Conso elec 21_05
msg : Object
object
_msgid: "82f910ca.fb035"
payload: array[2]
0: object
value: NaN
1: object
entity: "conso_elec_mai"
topic: ""
Je ne trouve pas l’erreur ?