@aerograf Yes, this is good and I can also use the control-device node to use it. But I was specifically looking for sensors.
I creates a “Test Sensor” which has temperature and humidity. But no matter what I send in, it is not getting processed by the put-device-state node:
[{"id":"9c242d75faa4c99d","type":"inject","z":"f6f2187d.f17ca8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":700,"wires":[["72fad3b5e82dcbd4"]]},{"id":"72fad3b5e82dcbd4","type":"register-device","z":"f6f2187d.f17ca8","name":"Test Sensor","server":"3bd64653f454c56c","device_id":"5db53c3e-2fe4-11ee-be56-0242ac120002","device_name":"Test Sensor","category":"temperatureAndHumiditySensor","capabilities":"{\"toggleNum\":\"1\",\"values\":[\"temperature\",\"humidity\"]}","manufacturer":"NodeRed","model":"C5","firmware_version":"1.0.0","service_address":"192.168.1.109","tags":"{\"temperature_unit\":\"c\"}","state":"{}","x":310,"y":700,"wires":[[]]},{"id":"92f6db876e6b6dcc","type":"inject","z":"f6f2187d.f17ca8","name":"Temperature test","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"temperature\":{\"temperature\":22}}","payloadType":"json","x":540,"y":700,"wires":[["2e34f9b99ae92df5"]]},{"id":"3225afd7247705df","type":"debug","z":"f6f2187d.f17ca8","name":"debug 3","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":920,"y":700,"wires":[]},{"id":"2e34f9b99ae92df5","type":"put-device-state","z":"f6f2187d.f17ca8","name":"Fixed temp","server":"3bd64653f454c56c","category":"temperatureAndHumiditySensor","device":"f1b018d1-591f-4af7-ba9c-c551fef052ae","state":"{\"temperature\":{\"temperature\":20}}","number":"5db53c3e-2fe4-11ee-be56-0242ac120002","x":730,"y":700,"wires":[["3225afd7247705df"]]},{"id":"165de480f690ca3c","type":"inject","z":"f6f2187d.f17ca8","name":"Humidity test","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"humidity\":{\"humidity\":35}}","payloadType":"json","x":530,"y":760,"wires":[["2e34f9b99ae92df5"]]},{"id":"d4267dd7deea0e7e","type":"inject","z":"f6f2187d.f17ca8","name":"Both test","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"humidity\":{\"humidity\":45},\"temperature\":{\"temperature\":13}}","payloadType":"json","x":520,"y":800,"wires":[["2e34f9b99ae92df5"]]},{"id":"3bd64653f454c56c","type":"api-server","name":"iHost","ip":" 192.168.1.109","token":"c63f92a1-ba08-4084-88bf-2a39a77e68f4"}]
If you check my code, I tried the same approach as you. I send the payload.payload
par of when I can read from the event-state node. But in this case no matter if I send {"temperature":{"temperature":22}}
or {"humidity":{"humidity":35}}
or {"humidity":{"humidity":45},"temperature":{"temperature":13}}
the device is not updated on the iHost.