Pass one value in terms of another

Hello,

i get 2 value "Débit" and "Ventilateur entrant" from a xml file to a HomeAssistant Sensor

I need to send value "Ventilateur entrant" only when "Débit" is 170.

I guess i should use a function but i don't understand how make it.

here is my flow :

[{"id":"1a16149fa7d435cc","type":"inject","z":"f2a8135109ef702c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"600","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":290,"y":320,"wires":[["2850b01c39dd23b8"]]},{"id":"2850b01c39dd23b8","type":"http request","z":"f2a8135109ef702c","name":"VMC Maico WS320 detail.cgx","method":"GET","ret":"txt","paytoqs":"ignore","url":"http://192.168.10.210/details.cgx","tls":"","persist":false,"proxy":"","authType":"basic","senderr":false,"headers":[],"x":510,"y":320,"wires":[["92c0e26ce770d256"]]},{"id":"92c0e26ce770d256","type":"xml","z":"f2a8135109ef702c","name":"","property":"payload","attr":"","chr":"","x":730,"y":320,"wires":[["10dfb307b28507d9","cde0bf7ddcd73a89"]]},{"id":"10dfb307b28507d9","type":"change","z":"f2a8135109ef702c","name":"Débit","rules":[{"t":"set","p":"payload","pt":"msg","to":"$$.payload.form.text[id[0] = \"VolumenstromZu\"].value.$split($,\" \")[0]","tot":"jsonata"},{"t":"set","p":"topic","pt":"msg","to":"Débit","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":490,"y":460,"wires":[[]]},{"id":"cde0bf7ddcd73a89","type":"change","z":"f2a8135109ef702c","name":"Ventilateur entrant","rules":[{"t":"set","p":"payload","pt":"msg","to":"$$.payload.form.text[id[0] = \"DrehzahlZu\"].value.$split($,\" \")[0]","tot":"jsonata"},{"t":"set","p":"topic","pt":"msg","to":"Entrant","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":490,"y":500,"wires":[[]]},{"id":"a5c3867e0a6974f5","type":"ha-entity","z":"f2a8135109ef702c","name":"VentilateurEntrantVMC","server":"72357ae2.ec78e4","version":2,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"VentilateurEntrantVMC"},{"property":"device_class","value":""},{"property":"icon","value":""},{"property":"unit_of_measurement","value":""},{"property":"state_class","value":""},{"property":"last_reset","value":""}],"state":"payload","stateType":"msg","attributes":[],"resend":true,"outputLocation":"payload","outputLocationType":"none","inputOverride":"allow","outputOnStateChange":false,"outputPayload":"","outputPayloadType":"str","x":760,"y":480,"wires":[[]]},{"id":"72357ae2.ec78e4","type":"server","name":"Home Assistant","version":4,"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"}]

Can anybody help me ?
Thank you :slight_smile:

No need for function just set your "Débit" to msg.debit and "Ventilateur entrant" to msg.payload, in the same change node. Then use a switch node to check if msg.Débit is 170.

Thank you for advice but i don't understand how to make this. Can you send me a sample ? i will adapt it after.

Sorry i am very new to node-red.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.