Hi,
I'm using node red for a while now as rule engine for my home automation system. Now I've stumbled over a problem, I cannot solve by myself. Every idea how to solve is highly welcome
The problem is hard to explain, because I'm not a native English speaker, but I try to...
I try to get information about my heating system with a Rest-API call and want to use the received information (as object) in a flow. This works so far but...
When requesting e.g. "outside temperature" from my heating system the received msg-object looks like this (shortened):
{
"_msgid": "b4d8608.3e462a",
"payload": {
"properties": {
"value": {
"value": 8.2,
"type": "number"
},
"status": {
"value": "connected",
"type": "string"
},
"unit": {
"value": "celsius",
"type": "string"
}
},
"path": "properties.value.value"
},
"statusCode": 200
}
So the value of msg.payload.path tells me where to find the value I want to extract. In this example it is at msg.payload.properties.vale.value
Another example when asking the REST-API e.g. for the "outside temperature" is:
{
"_msgid": "5f35fd23.ced484",
"payload": {
"properties": {
"active": {
"value": true,
"type": "boolean"
},
"demand": {
"value": "unknown",
"type": "string"
},
"temperature": {
"value": 22,
"type": "number"
}
},
"path": "properties.temperature.value"
},
"statusCode": 200
}
Here the value of msg.payload.path tells me that the value I want to extract is at msg.payload.properties.temperature.value
Is it possible, maybe with a change node and JSONata, to first get the value of msg.path and use this value as path to the value I want to extract??? How???
I played a bit with JSONata but with our success
Regards,
Michael