Indeed the original xiaomi data (msg.payload.data) is a string. Inxiaomi-mqtt
the data is converted to JSON so you can directly access the temperature using msg.payload.data.temperature
.
How are you capturing xiaomi sensor_ht?
Edit:
You need to convert the string data
to JSON:
msg.payload.data = JSON.parse(msg.payload.data);
Example:
[{"id":"aa5504d2.b38fb8","type":"inject","z":"d0877ed4.9e0cc","name":"","topic":"","payload":"{ \t\"cmd\": \"report\", \t\"model\": \"sensor_ht\", \t\"sid\": \"158 d0001f4ecc4\",\t\"short_id\": 1154, \t\"data\": \"{\\\"temperature\\\":\\\"1639\\\"}\" }","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":4440,"wires":[["ba0be5c0.106318"]]},{"id":"3ee06a5d.510976","type":"debug","z":"d0877ed4.9e0cc","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":710,"y":4440,"wires":[]},{"id":"ba0be5c0.106318","type":"json","z":"d0877ed4.9e0cc","name":"","property":"payload","action":"obj","pretty":false,"x":230,"y":4440,"wires":[["db0dfe00.76b3"]]},{"id":"db0dfe00.76b3","type":"function","z":"d0877ed4.9e0cc","name":"convert data","func":"msg.payload.data = JSON.parse(msg.payload.data);\n\nreturn msg;","outputs":1,"noerr":0,"x":370,"y":4440,"wires":[["8cd21ab0.3d2048"]]},{"id":"8cd21ab0.3d2048","type":"change","z":"d0877ed4.9e0cc","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.data.temperature","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":540,"y":4440,"wires":[["3ee06a5d.510976"]]}]
… and you have to device the temperature by 100 to get 16.39