Ohme Charger integrations may now be possible!
Initial Release V0.1 29-01-2021
*UPDATE 10/02/2021: Sadly Ohme has not seen this as an option and have asked me not to share it. Therefore (for now) the file downloads have been disabled. I’m leaving this post up as more of a proof that it is possible. I’ll keep tweaking it & hopefully the situation will change in future.
The work took inspiration from a similar exercise carried out by members of the “Myenergy” system forum: here
In their case the company has not explicitly condoned it, nor have they requested it to stop.
I would hope Ohme take a similar view, such that “you are on your own as long as you don’t affect Ohme’s product, systems or bug them for answers to how the API works / explanations.”
If Ohme are reading this & disagree, please let me know on: [email protected] and I’ll remove it. (But at least consider giving us some form of useful data access in the future for integrations to displays, solar etc…)
///////////////How / What Does it Do?///////////////
This software came about as a means to interrogate the Ohme charger for additional data not currently shown via the app (such as Power & Current data.)
By monitoring incoming & outgoing traffic from the app it was possible to mimic these commands and save the resulting data for use in other systems (such as JSON, .CSV or .TXT)
It basically uses cURL so can in theory be used on pretty much any other language that has the cURL function.
As of this initial release the following has currently been achieved:
Data in (from API):
Charger Status: (Unplugged, Plugged in (Waiting), Charging, Finished)
Stats: Voltage, Charge Current, Power (KW) and so on.
Relaying of battery level % and or estimated mileage (only on vehicles with API support – Tested on Tesla)
Note: It will not magically tell you battery levels for any vehicle it doesn’t already show on the app (such as MG ZS).
Other: Numerous other data points which may or may not be of use.
As of V0.1 There is also a version using JQUERY to format data in pretty JSON if needed.
Charge History: Same info as history screen on app, output as .txt/.csv/JSON
Note: This still requires work as the data is a bit of a mash of numerous useless fields & the request needs to be formatted with Unix time.
It currently defaults to the converting the current time to Unix time
For any other date, a timecode can be sent manually by just inputting a 10 digit Unix date code (code generator)
It will then return history data which will need further formatting to be of use.
As of V0.1 There is also a version using JQUERY to format data in pretty JSON if needed.
Experimental Data Out (to API*):
Start Max Charge
Pause Max Charge
Resume Max Charge
Investigations ongoing into live current level changes to work with external data for solar matching (not able to set this yet)
*Note: I personally have these working with only minor issues. Due to certain risks involved in allowing people to blindly start & stop charges these features do come with additional risk & do require further testing.
Although I have yet to be able to start a charge without it being plugged in, please be aware this may be possible & take suitable precautions.
Also be aware if you use these modes: do not rely on your timed charge being carried out without unplugging from the car afterwards to reset the Ohme.
Finally: Sending instructions direct to the charger is done via cellular, this will invariably have a cost to Ohme so access may be disabled.
(although this is no different to flicking the charger on & off via the app, so additional cost is debateable.)
//////////////HOW TO USE//////////////
OHME Live Data (Ohme.Bat / OhmeJQ.Bat)
1: These series of Windows Batch files that are designed to be run on most windows PC’s with no additional libraries or files required (except for JQuery Output).
Inside the .Zip file you should have a few .bat files & folders “Logs”, “Data” “History” etc
2: Extract this to a directory on your PC (default assumed is C:\Ohme)
Note where you have saved the folder, you will need this later.
3: Open the folder, edit Ohme.Bat (right click, edit) which would normally open it in Notepad.
4: You will see the following: (without the comments here) – Edit data to suit your details, especially important is the directory installed.
(edits should be made after the = sign).
Don’t change anything else below that part unless you know what you are doing:
::::::::Enter Specific Credentials below:::::::
set AuthAPI= * The Ohme Google Auth API Key s
set CDP=C:\Ohme\ The directory you saved the Ohme folder to
set OFILE=OhmeDat.txt Output filename (.txt or .cdv etc)
set [email protected] Your Ohme Login email address
set Password=Password Your Ohme login password
set ftp=true ftp your data set to true or false
set FTPIP=18.104.22.168 IP to FTP data to
set FTPUSRPW=Username:Password FTP Username:Password
set Custom1=false Run a custom command afterwards
the custom command to run
*Note: API key is the specific key Ohme uses with Google Firebase Auth to authenticate over https: (which may overtime change.)
How you acquire this is up to you however it has been documented by the MyEnergy Github by using the Charles Proxy method if it changes.
If Ohme have an issue with me shipping this with it then they can let me know.
5: Once complete, save then close out of notepad.
6: Run the file by double clicking, the command prompt will open, login, get an Auth token & run through a series of steps before outputting data to a file (named whatever you called it above)
7: It will then automatically keep refreshing every 60 seconds (and every 30 loops/mins will refresh authentication with Google) to keep the connection live.
Be aware it will overwrite the same file each time. (If there is a call for it, then this can be changed)
If you have set FTP=true then it will also upload the file to your server on each loop.
8: That’s it – Unless you use the “custom” line & tell it to do something else after!
History Log (Charge History.bat / Charge HistoryJQ.bat)
History log is exactly the same however it only runs once and then closes.
You will again need to edit the file with your specific details (after the = sign).
rem – ::::::::Enter Specific Credentials below:::::::
set [email protected]
set FromNow=true History start to now (true / false)
set FromTS=1611933620 Specific date and time (Unix 10 Code)
Remeber it defaults to the time now. You need to manually input a 10 digit Unix date code for further back (get time code from https://www.epochconverter.com/)
Known issues: Mine only pulls the last 6 charges from whatever date supplied. Still working on why this is & working on a fix.
Also the default output file is difficult to work with. It can be converted to CSV via uploading file to https://json-csv.com/ as a quick fix.
I have found the JQUERY Batch to be easier to machine read but less useful for logging – pick you poison!
//////////////HOW THE CODE WORKS//////////////
Those familiar will be able to follow but briefly:
1) API.ohme.io will not respond to http request without authorisation (although if you type this into a browser you do get a portal so maybe an API is coming)
Authorisation is done via Google Firebase http in 3 steps:
A, firebase is called with the Ohme API key & a response is received
B, your Ohme logins are sent to Firebase & if correct a access token is received back
C, Token is sent back to google to prove login is working.
Note: Tokens expire every 60mins and can be refreshed with the a refresh token (see: Refresh Token routine)
(You probably don’t need steps A & C but the app does & it makes debugging easier for me)
The results of these logins are stored in the logs folder if they fail.
2) Somewhere in the Ohme API backend this token is linked to your specific charger.
3) Using this authorisation token, the Ohme API is sent a http request for your charger.
4) The charger information is returned in the http body and saved into the Ohme folder.
5) If FTP is selected the batch file also uploads this file to a server.
6) The batch file then waits 60 seconds before looping back to step 3.
7) Every 30 loops (30mins) the refresh routine (step D) is called to refresh authorisation and keep running.
8) If the file output is 0KB (which suggests authorisation has failed) it will go back to step 1 and try again. (if it keeps doing this then your login is wrong or Ohme have changed something, see logs.)
8) Loop runs indefinitely until closed.
9) What you do with the data after is up to you (I recommend DakBoard.com as a nice display)
//////////////KNOWN ISSUES / NOTES / TODO//////////////
I’ve only tested by logging into the app via email & password, if you use Facebook / apple / Google to login I suspect this may not work!
The refresh loop is set to 60 seconds for a reason. The data from the API is fairly static & very slow for data like voltage/power which can be >5mins between updates from the Sim Card)
I can’t do anything about this.
There is no point forcing refresh any quicker other than risk Ohme denying access for us all by abusing it.
I’ve only tested on Tesla & MG ZS EV (as that is all I have unless someone wants to buy me another car!)
As the batch loops continuously alongside the app it can sometimes cause conflict issues with vehicles that connect via API (such as Tesla) – not particular damaging ones but;
On a few occasions it has caused the iPhone app to not display the charge graph correctly without a refresh.
I’ve not noticed this with Android but neither have I spent much time testing.
You can’t change cars which require a login (such as Tesla) at the same time the file is running, so I don’t recommend running this for those that have 2 EV’s on one charger.
This is likely due to authorisation mis-match by having 2 sources trying to prod the same data. Might be fixable, might not be.
I have the app on 2 iPhone & and an android along with this and it seems to not mind.
If you do get an issue, closing the batch file, signing out & in of the app has resolved it every time for me. (Potentially waiting up to 60mins for the batch file Auth. to expire)
The code is rough (I know that) & early dev, there will be bugs/issues found. It all could do with pushing into Powershell to make variables easier to pull from JSON. In all honesty I started from cmd line as a trial not expecting it to work!
I’m a full time electrician with a new baby, not a programmer!
Owing to this, tweaks will be made on my terms/time not yours. I will help where I can but don’t be disappointed if you are waiting a while.
Everyone else is welcome to improve / port it, just make sure credit is given where due & let me know what interesting projects come about.
As i’ve mentioned before, don’t take the P!ss with Ohme’s API, we pay them nothing (yet) for their servers & sim card connectivity.
Pummelling their API with requests will no doubt be taken with a very dim view and kill this off.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED.
Although any damage caused by the use of this software is remote, the user assumes any and all risk of damage to vehicles, chargers or any other item by running the program.
None of this work is supported by Ohme. They may ask for this information to be removed at any time (which I am happy to do so if asked.)
They can also potentially block access to the API using this method or worse potentially disable the chargers of users using it.
Security- The data can/may/will include your car details, charger ID, Charge times, VIN number, mileage, status, GPS location of charger etc…
Yes that’s right, the Ohme charger has GPS and knows exactly where it is.
As you can imagine sending your log to anyone basically tells them: what car you have, where it’s parked while charging & potentially information allowing them easier access to the car.
(I doubt the Tesla API where Ohme get this info is that stupid but who knows!) other manufacturers may give even more, I don’t know.
Basically don’t send your resultant data to ME or send/store it anywhere someone else can easily read it (especially if uploading via FTP – make sure appropriate security is in place or that data redaction is done first!)
Version V0.1 29-01-21:
V0.1 – Added JQUERY Batch files for “Pretty” JSON outputs.
V0.0 – Initial Release 26-01-21