Hello Henry,
You wrote:
Most of the time this goes ok, but sometimes there is an error in the communication.
The error message tells you that the "Key not authorized: Token is expired" .
I would recommend to renew the token, however I do not know what BlueLinky requires.
Sending it to Domoticz doesn't look very useful, unless you want a notification.
I would say, use the message as a trigger to renew the token.
And I want the part between braces sent to a Domoticz device.
I think you mean the part between the curly brackets:
Code: Select all
{"error":"Key not authorized: Token is expired"}
This is JSON and the only thing we have to do is to extract that JSON part from the string.
Currently it is not possible to add a screenshot.
See flow below:
Code: Select all
[
{
"id": "bd198a1a36d1f4b5",
"type": "inject",
"z": "660311734f481f3a",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "ManagedBluelinkyError: @EuropeVehicle.fullStatus: [401] Unauthorized on [GET] https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fprd.eu-ccapi.kia.com%3A8080%2Fapi%2Fv2%2Fspa%2Fvehicles%2Fd717d170-e9b2-4000-9144-4cc82bff4ad1/location - {\"error\":\"Key not authorized: Token is expired\"}",
"payloadType": "str",
"x": 790,
"y": 140,
"wires": [
[
"b588b09dfa693a99"
]
]
},
{
"id": "b588b09dfa693a99",
"type": "string",
"z": "660311734f481f3a",
"name": "",
"methods": [
{
"name": "between",
"params": [
{
"type": "str",
"value": "{"
},
{
"type": "str",
"value": "}"
}
]
},
{
"name": "ensureLeft",
"params": [
{
"type": "str",
"value": "{"
}
]
},
{
"name": "append",
"params": [
{
"type": "str",
"value": "}"
}
]
}
],
"prop": "payload",
"propout": "payload",
"object": "msg",
"objectout": "msg",
"x": 950,
"y": 140,
"wires": [
[
"8cc844613b9c3c7e"
]
]
},
{
"id": "38344109b7bc037d",
"type": "debug",
"z": "660311734f481f3a",
"name": "debug 304",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 1290,
"y": 140,
"wires": []
},
{
"id": "8cc844613b9c3c7e",
"type": "json",
"z": "660311734f481f3a",
"name": "",
"property": "payload",
"action": "",
"pretty": false,
"x": 1110,
"y": 140,
"wires": [
[
"38344109b7bc037d"
]
]
}
]
You have to add a contrib node with the Palette Manager (node-red-contrib-string)
Regards