Les deux change node:
[{"id":"ea6ed23.108073","type":"change","z":"f5b50430.ea48b8","name":"","rules":[{"t":"set","p":"state_orig","pt":"msg","to":"data.state","tot":"msg"},{"t":"set","p":"attri_orig","pt":"msg","to":"data.attributes","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":360,"y":1340,"wires":[["9425b139.44c5e"]]},{"id":"2b3c4ef4.1a6432","type":"change","z":"f5b50430.ea48b8","name":"Remplace Tempé","rules":[{"t":"set","p":"attri_orig.temperature","pt":"msg","to":"$number(payload)\t","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":910,"y":1340,"wires":[["e682eeff.1dc6f"]]}]
Et le contenu de la fonction:
var host = "IP_HA:8123";
var token = "Mon super token";
msg.payload = {
"state": msg.state_orig,
"attributes" : msg.attri_orig
}
msg.url = host + "/api/states/weather.ailleurs";
msg.method = "POST";
msg.headers = {
'Authorization': 'Bearer ' + token,
'content-type': 'application/json'
} ;
return msg;
PS: Et d’accord avec oncleben31 pour mettre dans un nouveau sujet. Je laisse un @responsables faire la scission…