nikagl
(Nika Gerson Lohman)
October 29, 2022, 10:19pm
1
Anyone already create a binding for this?
If not, can someone post a “quick start” how to build a binding and access this API easily?
Regards,
Nika.
rlkoshak
(Rich Koshak)
October 31, 2022, 3:24pm
2
I’m unaware of such a binding yet. There’s a binding for the Go-eCharger and support for various car vendors (BMW, Tesla, etc.) but nothing that supports Shell that I can see.
nikagl
(Nika Gerson Lohman)
October 31, 2022, 5:34pm
3
Exactly, I couldn’t find anything either. Hence my other question: “If not, can someone post a “quick start” how to build a binding and access this API easily?”.
rlkoshak
(Rich Koshak)
October 31, 2022, 5:36pm
4
I posted a link to the docs for developing for OH. That’s your quick start guide.
1 Like
nikagl
(Nika Gerson Lohman)
November 2, 2022, 6:25pm
5
Thanks Rich, I missed that link.
Turns out the shell recharge API is less usable than I had hoped. It doesn’t work (even though I follow the steps in the doc) and may also be for B2B only. I have done some additional digging and it looks like there’s a Homey and HASS app for this. So still slightly hoping someone has experience in converting either the Homey or HASS app into something usable for OpenHAB?
Homey app
Homey community topic:
Homey app code which may be of use:
'use strict'
var htmlparser2 = require("htmlparser2")
//var formdata = require('form-data')
const http = require('http.min')
const cookie = require("cookie");
//const HS = require('./haversine')
//const { ManagerSettings } = require('homey');
//We store the active token in mem, it gets stale quick anyway
let auth_token = {
api_cookie: '',
set_date: new Date()
}
async function startSession(id, rfid, cred_username, cred_secure_password)
{
return SessionAction(id,'start', rfid, cred_username, cred_secure_password)
}
async function stopSession(id, cred_username, cred_secure_password)
{
This file has been truncated. show original
HASS topic:
I’d love an integration with the newmotion app to create sensor of my home charging of my EV car (VW ID4 but that doesnt matter) they seem to have the API available When i am logged in to the site i can see charging status with this url: ...
Reading time: 8 mins 🕑
Likes: 19 ❤
Node RED code:
[
{
"id": "9d5f683315a5a542",
"type": "subflow",
"name": "Shell Recharge",
"info": "## About this subflow\n\nThis subflow will control Shell Recharge or Newmotion car charging equipment.\n\n## Getting started\n\nDrag the Shell Recharge node into a flow.\n\nDouble-click on the new node.\n\nUsing the credentials used to login to the Shell Recharge website, enter the username and password into the respective fields.\n\nTo find suitable values for _Charger ID_ and _Card ID_, send a payload (using an inject node, for example) to **_Input_** containing:\n\n> msg.payload = {\"action\":\"setup\"}\n\nInspect the output (by connecting a debug node to the **_Debug_** output). Choose a suitable charger and RFID token card/keyfob- these match the details shown on the Shell Recharge website. The array index for _msg.payload.chargePoints_ and _msg.payload.chargeTokens_ should be entered in the configuration fields _Charger ID_ and _Card ID_ respectively.\n\n_Poll_ should be left unchecked initially (see below).\n\n_Automatically refresh token_ will keep a session active by refreshing the Shell Recharge API token every 24 hours.\n\n## Inputs\n\n> msg.payload = {\"action\":\"_ACTION_\"}\n\n...where _ACTION_ is:\n\n**start**\n\nStart a charging session using the configured charger and RFID card/token.\n\n**stop**\n\nStop the current charging session.\n\n**reset**\n\nReset the charging equipment.\n\n**info**\n\nThis gives similar output to **setup** above. The information may be returned from the cache; use **flush** first to update it if changes have been made on the Shell Recharge website.\n\nEnergy consumption data is also returned if there is an active Shell Recharge subscription _(beta)_. Additional payload parameters are _from_ and _to_ which should be set as a Unix Epoch time which will output for the period interval specified. Usually, 50 results are given per query; use _offset_ with _(number) n_ to select a batch of results from _n_ to _(n + 50)_.\n\n**poll** and **nopoll**\n\nContinually poll the charging equipment for status information: this gives details directly from Shell Recharge like _'Charging'_ and _'Occupied'_. \n\nSelect _Poll_ on the setup page to automatically poll after **start**, **stop** and **reset** actions.\n\nThe polling interval is every 5 minutes but only for 4 hours in total, at which point polling will be disabled automatically (in order to play fair with Shell Recharge's servers).\n\n**flush**\n\nDelete the current Shell Recharge API token, session and cache (which stores account details like chargers and token cards/keyfobs). This will force a fresh login attempt during the next interaction with Shell Recharge and get up-to-date account information. The token is expired internally after 24 hours.\n\n**token**\n\nManually request a new Shell Recharge API token. Expires internally after 24 hours. Set _msg.payload.quiet_ to _true_ to suppress the initial token flush debug message.\n\n**ready**\n\nTests whether a live API token is available: outputs _(boolean) true_ or _(boolean) false_.\n\n**refresh** and **norefresh**\n\nKeep a session active by refreshing the Shell Recharge API token every 24 hours after **start**, **stop** and **reset** actions.\n\n**vehicles**\n\nList the vehicles set up on the Shell Recharge account.\n\n**energy**\n\nSimilar to **info**, but uses another (less-reliable) Shell Recharge API to return energy consumption data.\n\n## Outputs\n\nThe **_Output_** payload is _(boolean) true_ if a charge is in progress after a **start** command (see above) and _(boolean) false_ when a charge has been stopped by **stop** (see above). This is also updated when polling is in progress. All other output is from **_Debug_** labelled with topics like _status_, _poll_, _response_, _token_, _ready_ and _error_.\n\n## Problems\n\nSometimes Shell Recharge just doesn't allow the system to log in... it's not clear why. The node will indicate if this is the case. The node will try 5 times before giving up.\n\n## Contact\n\nvia [Github](https://github.com/dgthomson/nodered-shellrecharge)",
"category": "",
"in": [
{
"x": 45,
"y": 50,
"wires": [
{
"id": "2813d1a7df38a439"
}
]
}
],
"out": [
{
This file has been truncated. show original
Regards,
Nika.
rlkoshak
(Rich Koshak)
November 2, 2022, 7:01pm
6
Ran into the same problem with the Honeywell Residio APIs. I could only get it to work randomly and I finally gave up.
Unfortunately your choices are:
extract and make a separate little Python script using that code (see the myriad X2mqtt projects, e.g. zigbee2mqtt)
rewrite it in Java
since the Homy code is written in JS, it might prove close enough to modify into openHAB rules using the JS Scripting add-on. It’ll probably need to be taken apart and restructured since OH rules are event driven. But that might be less of a lift than translating it to another programming language.
system
(system)
Closed
December 14, 2022, 11:01am
7
This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.