Hi.
I am looking for correct way to parse ‘data’ values (need to be nested object) to be able to future parrametrize it.
I tried formatting it as json first - not working.
After couple iterations I got idea of using template node between.
I even managed to produce valid output (or at least I think so)
But in call service node values are doubled.
I am lost.
Call service node except from me something like:
{
"message":"The garage door has been open for 10 minutes.",
"title":"Your Garage Door Friend",
"data":{
"transparency":"25%",
"color":"red"
}
}
This is my current state
[
{
"id": "93f8b217c8d567c2",
"type": "api-call-service",
"z": "446c2f2ccb426807",
"name": "",
"server": "f7ab3ad286dad1b2",
"version": 5,
"debugenabled": true,
"domain": "notify",
"service": "telewizor_poddasze",
"areaId": [],
"deviceId": [],
"entityId": [],
"data": "payload",
"dataType": "jsonata",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [
{
"property": "out",
"propertyType": "msg",
"value": "",
"valueType": "data"
}
],
"queue": "none",
"x": 650,
"y": 320,
"wires": [
[
"d9425cc6e65722d7"
]
]
},
{
"id": "b762a57da83e912f",
"type": "inject",
"z": "446c2f2ccb426807",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
},
{
"p": "data.notification.title",
"v": "Tytuł",
"vt": "str"
},
{
"p": "data.notification.message",
"v": "wiadomosc",
"vt": "str"
},
{
"p": "data.notification.addata",
"v": "[{\"dataname\":\"color\",\"datavalue\":\"red\"}]",
"vt": "json"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 260,
"y": 440,
"wires": [
[
"d6bac9da2963fd29"
]
]
},
{
"id": "d9425cc6e65722d7",
"type": "debug",
"z": "446c2f2ccb426807",
"name": "debug 1",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 740,
"y": 520,
"wires": []
},
{
"id": "d6bac9da2963fd29",
"type": "template",
"z": "446c2f2ccb426807",
"name": "",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "{\n \"message\":\"{{data.notification.message}}\",\n \"title\":\"{{data.notification.title}}\",\n \"data\":{\n {{#data.notification.addata}}\n \"{{dataname}}\":\"{{datavalue}}\"\n {{/data.notification.addata}}\n }\n}",
"output": "json",
"x": 460,
"y": 440,
"wires": [
[
"d9425cc6e65722d7",
"93f8b217c8d567c2"
]
]
},
{
"id": "f7ab3ad286dad1b2",
"type": "server",
"name": "Home Assistant",
"version": 5,
"addon": false,
"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": ": ",
"statusYear": "hidden",
"statusMonth": "short",
"statusDay": "numeric",
"statusHourCycle": "default",
"statusTimeFormat": "h:m",
"enableGlobalContextStore": false
}
]