Maybe someone is able to help here.
I’m busy creating a Homey Script that serves to read all data from a Volt Time Source 2 EV charger and exposes all this data to later control the charger via other scripts - and to use it in advanced flow logic. I’m quite far already, but this is the problem I run into;
I’m using the data provided by Volt Time Cloud itself in the API docs - so I don’t expose any personal information;
Consider this response structure:
{
"data": {
"id": 596411,
"identity": "VTT_0001",
"connection_status": "offline",
"status": "Available",
"error": "NoError",
"error_info": null,
"created_at": "2023-11-01T09:17:10.000000Z",
"updated_at": "2023-11-02T14:15:11.000000Z",
"connectors": [
{
"id": 1655489,
"charger_id": 596411,
"connector_id": 1,
"status": "Available",
"error": "NoError",
"error_info": null,
"created_at": "2023-11-01T09:44:32.000000Z",
"updated_at": "2023-11-01T10:15:36.000000Z"
}
]
}
}
I’m able to directly read any direct child by (after storing it in the variable ‘body’) adressing it as:
await tag (‘status’ , body.data[0].status); - this returns me the status exactly.
However; this does not work for the nested ‘connectors’ . and this is where it gets specific and weird;
I do get the expected data in postman - including the connectors child data.
If I however log the exact data homey is using from the query - it summarizes the child with
[ [Object] ]
, so I get;
{
“data”: {
“id”: 596411,
“identity”: “VTT_0001”,
“connection_status”: “offline”,
“status”: “Available”,
“error”: “NoError”,
“error_info”: null,
“created_at”: “2023-11-01T09:17:10.000000Z”,
“updated_at”: “2023-11-02T14:15:11.000000Z”,
“connectors”: [ [Object] ]
}
}
Now - obviously - even when using the correct syntax - I don’t get any data from the connectors child. instead it gives me: TypeError: Cannot read properties of undefined (reading ‘connectors’).
I’m not so knowledgeable that I have a strategy to work around this particular problem. Can someone point me in the right direction ? breaking up in a flow with response cards and additional logic and is - unless I can help it - not the way to go. I want the script to be as independent as can be.
Thanks in advance,
Vince