This gives me a JSON with the following structure:
{
“chartTotal”: {
“totalkWh”: “15.409,8”,
“totalkgCO2”: “12.828,659”,
“totalTime”: 27103395,
“totalSessions”: 570
},
“chart”: [
{
“date”: “09-11-2019”,
“sessions”: 16,
“kwh”: 75.31
},
{
“date”: “09-12-2019”,
“sessions”: 46,
“kwh”: 687.9099999999999
},
{
“date”: “09-01-2020”,
“sessions”: 41,
“kwh”: 1091.5
}
]
}
I’ll see if I can update the flow with this logic myself. The Shell Recharge node is pretty complicated but I’m getting there.
I’ve already made some adjustments and I want this flow to trigger each 15 mins by itself and just post it’s payload to the MQTT topic:
The function behind the “info” request makes sure that the “to” date is filled with the current timestamp. The response part is being split up in “assets” and “energy”, publishing the payloads to their respective topics:
@siumba i did some code for the endpoint https://account.shellrecharge.com/user/SOMEGUID/… already but i found it unreliable (not sure what the issue is, it needs some work). it’s in the subflow you have already but it’s deactivated. call with…
I’m also trying to figure out why the “energy” call doesn’t work consistently, but I didn’t find a solution yet. Is there an easy way to be able to debug your subflow template? If I copy all nodes into a new flow I’m not sure how to trigger it yet, that way I could set up some debugging. I also saw that your call for “energy” differs a little from “info” regarding the specific “change nodes”, where you check the token again, where you don’t do that in “info”.
When the “energy” path errors out I can call the “info” path and most of the time it works, sometimes it needs a second call on “energy” but it does work in the end.
This would be exactly what I’m looking for. Although I’d skip MQTT and directly update a sensor through the websocket integration. Should be able to get that sorted myself when you get the flow working.
i tend to wire a debug node after the node i’m interested in debugging inside the subflow then triggering it from an outside flow with an info/enegry/token/start inject node. the whole sub flow’s not really sorted for managing unexpected responses from shell and that needs tightening up (node-red’s not particularly good for collaborating, though, is it?!)
the only consistent thing i’ve found is that getting anything out of account.shellrecharge.com will be inconsistent and unreliable. i think it will have something to do with JSESSIONID-- if you examine the http exchange using something like charles it seems to change all the time.
No very well. The offset works of the individual session data, but it still ouputs a max of 50 sessions. So there’s no way to add up the energy numbers. The ‘energy’ action doesn’t generate any debug output for me.
there’ll be some nodered magic that could combine all the energy use information into one array/data structure… happy to have a look if you send it over
I appreciate the offer, but it seems like a fragile solution that’s very dependent of what they’re doing on their side. I’m thinking of just using an induction based meter with clamps
Looking forward to this @35e
It would be nice to have a (HACS) plugin available for NewMotion chargers.
Even if it would be to read the current status, and stop/start charging in the beginning.
This opens up many opportunities.