Easee EV charging station

Hey folks
I just purchased an EV car charging box from Easee (Norwegian made).
I use it with Tibber which can turn it on and off so there must be an API for this but I can’t find it.

I want to be able to read the sensor values and well as control the charging on/off on the box and therefore I am looking for anyone which might have any insights into this.

Edit:

If anyone want to help test the initial version it is released

10 Likes

Maybe
Https://api.easee.cloud

But I would had prefer local access

They answered this over at their site for roadmaps/feature requests:

"We are currently working on the Cloud API to extend it’s documentation so that it is easy for everyone who wants to start using it. The reason for using a cloud api is mainly because of security, there are many local secure methods as well but it introduces complexity we would like to avoid having to take into account at the moment.

We promised an API and we do have one, we cannot promise at this point in time an API which is local. What we can say at this point is that we would like to implement a system that can work offline but at the same time play nicely with the rest of the home. We are closely following the development of the CHIP standard and as it matures we are hoping to implement that as The integration point into the smart home market and other possible solutions."

Upvote over at https://easee.upvoty.com/

Yes, a local api is what I really want.

2 Likes

Hi folks,

Just got an Easee charger myself, and is eager to get it connected to HA. Anybody working with this? If so, I would be happy to contribute both with coding and testing. I did some basic testing with some code I found on a Tesla forum with a simple python script, and I got connected and were able to pull data from the charger. The API seems well documented as commented above, although only cloud based and not local.

I noticed there is a start here:


but there hasn’t been any activity since november 2019 and it doesn’t appear to be completed.

Cheers.

Just in case someone is interested, here’s the basic python code I found (credit to Olalid/TeslaClubSweden)

import requests, json, time
from pprint import pprint

class connect:
    def __init__(self,
                 access_token=None,
                 ):

        if (access_token is None):
            access_token_resp = self.get_access_token()
            access_token = access_token_resp["accessToken"]
        self.headers = {"Authorization": "Bearer {}".format(access_token)}

    def get_access_token(self):
        return requests.post("https://api.easee.cloud/api/accounts/token", json={"grantType":"password","username":"+46xxxxxxxx","password":"xxxxxxxx"}).json()

    def get_state(self):
        return requests.get(
            'https://api.easee.cloud/api/chargers/EH<serial>/state',headers=self.headers).json()

    def get_sites(self):
        return requests.get(
            'https://api.easee.cloud/api/sites',headers=self.headers).json()

    def get_site_info(self):
        return requests.get(
            'https://api.easee.cloud/api/sites/<site-id>?detailed=true',headers=self.headers).json()

    def set_current(self, current):
        return requests.post("https://api.easee.cloud/api/sites/<site-id>/circuits/<circuit-id>/settings", headers=self.headers, json={"dynamicCircuitCurrentP1":current, "dynamicCircuitCurrentP2":current, "dynamicCircuitCurrentP3":current}).json()

    def pause(self):
        return requests.post("https://api.easee.cloud/api/chargers/EH<serial>/commands/pause_charging", headers=self.headers).json()

    def resume(self):
        return requests.post("https://api.easee.cloud/api/chargers/EH<serial>/commands/resume_charging", headers=self.headers).json()

my_charger = connect()
resp = my_charger.get_sites()
pprint(resp)
resp = my_charger.get_site_info()
pprint(resp)
resp = my_charger.set_current(10)
pprint(resp)
resp = my_charger.pause()
pprint(resp)
resp = my_charger.resume()
pprint(resp)

resp = my_charger.get_state()
pprint(resp)

Replace the <> values with real ones, and the script retrieves all data necessary. SiteID and CircuitID are easily found by running one of the first commands.

I can create a component and integration but right now I don’t have much time.i will probably start with it in a week or so

1 Like

Hi Niklas,

Sounds good. I did some experimenting and made some code, the API seems quite good although it is only available through cloud so far. It seems responsive and fast at least. Had a look at the Keba integration and I believe it should be a fairly ok task to make something similar. Perhaps I will be trying a bit myself, but I haven’t made anything like this from scratch before, just messing around with modifications and adjustments until now. Happy to join you on the development if you decide to move ahead.

Great to hear. I maintain some stuff for HA already so we can def work together if you kmow python already.
Ill set up a skeleton as custom component tomorrow which later can be made into a component to HA. Iy is way faster that way.

Can you all post what control and what sensors you want from this component?

I had a look at KEBA, so at least this I guess (* added by me based on API)

Binary Sensors:
Online state,
plug state,
Charging state
failsafe mode state (think this is a feature made if lost contact with charger, perhaps not possible?)

Lock:
Authorization (like with the RFID card).

Sensors:
current set by the user,
target energy/SOC set by the user,
charging power,
charged energy of the current session
charged energy of the total energy charged.
*voltage
*currentFirmware
*availableFirmware
*cableLocked
*smartCharging

Services:
authorize,
deauthorize,
set energy target,
set the maximum allowed current and manually update the states.
*start
*stop
*resume
*pause
*override_schedule

I haven’t tested everything, but I read out a lot of values. Personally I’m a “the more the marrier” guy, so I don’t mind adding most of what is available in the API and rather let the user decide which one should be added to his or her HA. Especially sensors, since they are not too complicated. When it comes to functionality it may be more tricky and can be looked at in a step 2 if neccessary (add/get/delete basic_plan for instance).

Seems Easee organizes everything in Sites consisting of Circuits consisting of Chargers, so I believe a wise choise would be to build classes around this? They are also planning something called Equalizers which is supposed to be their own Tibber Pulse for reading and loadbalancing with power meter in the house (AMS).

I started with an integration today towards cloud. It works ok. I’m no Easee expert so you might have to help me with how to get all that data from theirs docs here: https://api.easee.cloud/index.html

I’ll post an update when I have something checked in

Another thing that I understood now is that my operator of the box is Tibber but I am the owner if it which I think means I don’t have all controls, at least not in the GUI.

@tormagj if you want and have time I would like to chat on discord at some point and we can share knowledge.

I have 90% ready custom sensor but have very limited knowledge about what I can do with the charger. I have solar panels so I just plug in my car and that’s it.

Hi Niklas, sounds great! I was out all day yesterday and also today, but discord sounds like a plan! I’m also fairly new to the Easee charger, in fact it’s laying on my desk for testing right now and not installed yet (will be installed shortly though). But I read through and did some testing of the API and believe I get most of the stuff, although there definitely are some things that we should test in practice to be sure.

I have a sensor up and running
Currently it is 1 sensor with information as atrributes.
Would be good to discuss if we really need that many sensors as you suggested.
I was thinking more in the line of one sensor per charger with state being one of
STATUS = {
1: “STANDBY”,
2: “PAUSED”,
3: “CHARGING”,
4: “READY_TO_CHARGE”,
5: “UNKNOWN”,
6: “CAR_CONNECTED”,
}
which is taken from the API’s state object

If anyone want to help test the initial version it is released as 0.5 in https://github.com/fondberg/easee/releases/tag/v0.5.0

I’ve setup the component and so far it looks good. I like your approach with having just one sensor and putting the other data as attributes. I think it is cleaner. I’m somehow confused since I see both approaches on different integrations and I don’t know enough about the pros and cons there, but I’ve done it like your approach when creating some custom Appdaemon-based components stuff myself.

Where did you find the definitions of the state, phaseMode et.c? I also saw in the API that it is returning specific integers, but I couldn’t find the definitions (1=standby and so on).

I’ll study the code a bit more and do some reading on the charger too. I had a feeling that it would be wise to include “Site” and “Circuits” in one way or another. I’m not sure, but I had an impression that they link certain functionality to the site or circuit and not to the specific charger (current settings for instance). Maybe there are workarounds though, I’ll do some digging.

I am thinking if breaking out some sensors like consumption and add some services.
The integers for state and config I got from a js plugin from honey and verified myself

One thing you can help me with is how to have the charger I stopped state and only charge when starting it.

Regarding sites, what is the use case here? For personal use it seems not that useful.

What are circuits?

Perhaps you’re right about sites, maybe not too useful for personal use. And it is always possible to get the ID for site and circuits when you’ve got hold of the charger if it becomes necessary to pull data from there.

It looks to me that a circuit is the actual/physical circuit or fuse or circuit breaker in your switchboard. “-F21” 32A for instance. Looks like they are scaling their model approximately like this: a site (say a parking lot) which may have several independent circuits (fuses). A circuit can have one or several chargers, and if you have more than one the Easee system will handle load sharing between the chargers on same fuse. I believe it is also possible to have load sharing between circuits/fuses to avoid overloading the main fuse.

I already read my power meter and get actual power/current/voltage updated every 2s or so. So I intend to limit the charger if other loads are demanding a lot of power. Another scheme could be to setup some automation to charge when the price is low (although this is supposedly possible with Easee without anything more added), only when solar panels are providing enough power or whatever comes to mind.