# Pass one value in terms of another

**URL:** https://discourse.nodered.org/t/pass-one-value-in-terms-of-another/66818
**Category:** General
**Created:** [23 August 2022 14:57 UTC](https://discourse.nodered.org/t/pass-one-value-in-terms-of-another/66818 "2022-08-23T14:57:41Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Coroebus](https://avatars.discourse-cdn.com/v4/letter/c/57b2e6/32.png) [@Coroebus](https://discourse.nodered.org/u/Coroebus)
#### Post date: [23 August 2022 14:57 UTC](https://discourse.nodered.org/t/pass-one-value-in-terms-of-another/66818/1 "2022-08-23T14:57:41Z")

</div>

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 :

```auto
[{"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 🙂

---

<div class="post-metadata">

### Author: ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)
#### Post date: [23 August 2022 15:12 UTC](https://discourse.nodered.org/t/pass-one-value-in-terms-of-another/66818/2 "2022-08-23T15:12:28Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Coroebus](https://avatars.discourse-cdn.com/v4/letter/c/57b2e6/32.png) [@Coroebus](https://discourse.nodered.org/u/Coroebus)
#### Post date: [24 August 2022 07:53 UTC](https://discourse.nodered.org/t/pass-one-value-in-terms-of-another/66818/3 "2022-08-24T07:53:35Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [23 October 2022 07:53 UTC](https://discourse.nodered.org/t/pass-one-value-in-terms-of-another/66818/4 "2022-10-23T07:53:43Z")

</div>

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