Ensuite, avec mon code Node-Red, j’ai réussi à envoyer les données. si quelqu’un préfère également travailler avec Node-Red ?
[{"id":"f4ae01a1588d5de6","type":"comment","z":"d3da2382172b33d2","name":"Send rest API Solar production to bdpv.fr","info":"","x":170,"y":950,"wires":[]}
,{"id":"53481a046637a11f","type":"inject","z":"d3da2382172b33d2","name":"at 03:30","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"30 03 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":90,"y":990,"wires":[["9aa5ea233fc121de"]]},{"id":"f709440999874121","type":"http request","z":"d3da2382172b33d2","name":"","method":"use","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":620,"y":990,"wires":[["dff6fbdb3bc848ee"]]},{"id":"b51cede108599b79","type":"function","z":"d3da2382172b33d2","name":"http POST values","func":"var solaryield = msg.solar * 100;\nvar apikey = \"apiKey=xxxxx&\";\nvar feed_id = \"util=xxxxx&\";\nvar source = \"source=homeassistant&\";\nvar typeReleve =\"typeReleve=onduleur&\";\nvar index =\"index=\"+solaryield;\n// url: \"https://www.bdpv.fr/webservice/majProd/expeditionProd_v3.php?util=xxx&apiKey=xxx&source=homeassistant&typeReleve=onduleur&index=123) }}\" \n\nvar data = {};\nmsg.method = \"POST\";\nmsg.headers = { \"X-ApiKey\": apikey };\nmsg.payload = JSON.stringify(data);\nmsg.url = \"https://www.bdpv.fr/webservice/majProd/expeditionProd_v3.php\" + \"?\" + feed_id + apikey + source + typeReleve + index;\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":420,"y":990,"wires":[["f709440999874121"]]},{"id":"dff6fbdb3bc848ee","type":"debug","z":"d3da2382172b33d2","name":"REST","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":770,"y":990,"wires":[]},{"id":"9aa5ea233fc121de","type":"api-current-state","z":"d3da2382172b33d2","name":"Solar yield","server":"1e5734de.b5addb","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.solar_energy_yield","state_type":"num","blockInputOverrides":false,"outputProperties":[{"property":"solar","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":240,"y":990,"wires":[["b51cede108599b79"]]},{"id":"467d275d.a68208","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30,"areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true,"info":"y|yes|true|on|home|open"},{"id":"1e5734de.b5addb","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30,"areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]