# Issue with sending temperature to homekit node

**URL:** <https://discourse.nodered.org/t/issue-with-sending-temperature-to-homekit-node/34645>\
**Category:** General\
**Created:** [21 October 2020 18:10 UTC](https://discourse.nodered.org/t/issue-with-sending-temperature-to-homekit-node/34645 "2020-10-21T18:10:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sapster77](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sapster77/32/14335_2.png) [@sapster77](https://discourse.nodered.org/u/sapster77)\
**Post date:** [21 October 2020 18:10 UTC](https://discourse.nodered.org/t/issue-with-sending-temperature-to-homekit-node/34645/1 "2020-10-21T18:10:03Z")

</div>

Hi all,

Can't figure this out...🙂  
I am trying to send a temperature from a zigbee2mqtt node to a HomeKit node using a change, but it gives me an error:

```auto
[{"id":"f4763e3d.c019b8","type":"zigbee2mqtt-in","z":"ecabaa55.339ab8","name":"Soveværelse Temp.","server":"abca54b8.bf83a8","friendly_name":"0x00158d000208dcc9","device_id":"0x00158d000208dcc9","state":"temperature","outputAtStartup":true,"x":110,"y":1900,"wires":[["81c72799.78011","ac5adc35.77057","f98d5b2.a4831a8"]]},{"id":"f98d5b2.a4831a8","type":"change","z":"ecabaa55.339ab8","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"CurrentTemperature\":{{payload}}}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":420,"y":1860,"wires":[["4f53bc1d.399d7c","eaee04be.664ae8"]]},{"id":"4f53bc1d.399d7c","type":"homekit-service","z":"ecabaa55.339ab8","isParent":true,"bridge":"8b72c53e.f04088","accessoryCategory":"SENSOR","parentService":"","name":"Soveværelse temp.","serviceName":"TemperatureSensor","topic":"","filter":false,"manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","cameraConfigVideoProcessor":"ffmpeg","cameraConfigSource":"","cameraConfigStillImageSource":"","cameraConfigMaxStreams":2,"cameraConfigMaxWidth":1280,"cameraConfigMaxHeight":720,"cameraConfigMaxFPS":10,"cameraConfigMaxBitrate":300,"cameraConfigVideoCodec":"libx264","cameraConfigAudioCodec":"libfdk_aac","cameraConfigAudio":false,"cameraConfigPacketSize":1316,"cameraConfigVerticalFlip":false,"cameraConfigHorizontalFlip":false,"cameraConfigMapVideo":"0:0","cameraConfigMapAudio":"0:1","cameraConfigVideoFilter":"scale=1280:720","cameraConfigAdditionalCommandLine":"-tune zerolatency","cameraConfigDebug":false,"cameraConfigSnapshotOutput":"disabled","characteristicProperties":"{}","x":650,"y":1860,"wires":[[],[]]},{"id":"abca54b8.bf83a8","type":"zigbee2mqtt-server","z":"","name":"","host":"localhost","mqtt_port":"1883","mqtt_username":"xxx","mqtt_password":"xxx","base_topic":"zigbee2mqtt"},{"id":"8b72c53e.f04088","type":"homekit-bridge","z":"","bridgeName":"States","pinCode":"xxx-xx-xxx","port":"","allowInsecureRequest":false,"manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","customMdnsConfig":false,"mdnsMulticast":true,"mdnsInterface":"","mdnsPort":"","mdnsIp":"","mdnsTtl":"","mdnsLoopback":true,"mdnsReuseAddr":true,"allowMessagePassthrough":true}]

```

I get "Invalid 'to' JSON property" in the debug window. If I exchange the {"CurrentTemperature":{{payload}}} with an actual temperature - let's say {"CurrentTemperature":22} - it works fine.  
I realize that this probably is something simple I am missing, but I will be very grateful for any help:-)  
Cheers,  
Peter

---

<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:** [21 October 2020 18:59 UTC](https://discourse.nodered.org/t/issue-with-sending-temperature-to-homekit-node/34645/2 "2020-10-21T18:59:48Z")

</div>

You can not use mustache in a json, in the change node. use JSONata instead

```auto
[{"id":"b8c635da.ed89a8","type":"change","z":"4ed02988.12fff8","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"CurrentTemperature\": payload}","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":300,"wires":[[]]}]

```

---

<div class="post-metadata">

**Author:** ![sapster77](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sapster77/32/14335_2.png) [@sapster77](https://discourse.nodered.org/u/sapster77)\
**Post date:** [21 October 2020 20:05 UTC](https://discourse.nodered.org/t/issue-with-sending-temperature-to-homekit-node/34645/3 "2020-10-21T20:05:37Z")

</div>

Worked perfectly. Thank you!

---

<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:** [4 November 2020 20:05 UTC](https://discourse.nodered.org/t/issue-with-sending-temperature-to-homekit-node/34645/4 "2020-11-04T20:05:37Z")

</div>

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