Easee EV charger integration

I got an Easee EV charger, and there is an API available. I found this python script that works, and there is a API documentation https://api.easee.cloud/index.html

Currently I only need basic functionality:
get a token
get a switch in openhab that
starts the charging: /api/chargers/[CHARGERID ex. EH123456]/commands/start_charging
stops the charging: /api/chargers/[CHARGERID ex. EH123456]/commands/stop_charging

Is there some one that can give me some guidance how to make this in Openhab? I have no experience of working with API in Openhab

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":"+46[PHONENO]","password":"[PASSWORD]"}).json()

def get_data_request(self):
    return requests.get(
        'https://api.easee.cloud/api/chargers/[CHARGERID ex. EH123456]/state',headers=self.headers).json()

my_charger = connect()
resp = my_charger.get_data_request()

print(resp[‘latestPulse’] + " ", end=’’)
print(str(round(resp[‘inCurrentT3’],1)) + "A ", end=’’)
print(str(round(resp[‘inCurrentT4’],1)) + "A ", end=’’)
print(str(round(resp[‘inCurrentT5’],1)) + "A ", end=’’)
print(str(round(resp[‘sessionEnergy’],3)) + "kWh ", end=’’)
print(str(round(resp[‘totalPower’],3)) + “kWh”)

1 Like

Hello Patrik.

Have you worked on this project? I was thinking of buying Easse ev and was hoping ti use it on OH.

/David

Yes - I made a python script that connects to my Kia Niro EV and request the current charging level, thereafter it checks the electrical prices per hour and optimize when the chargin shall start and finally turn Easee on and off when the charging shall be made. Unfortunately do not have sufficient skills to make a good integration to openhab, so I communicate to the python script via MQTT from openhan

1 Like

Sounds great. I ordered an Easee instalation and I hopefully get my ID4 in februari. I was thinking I would try to make a bindning but your solution sound like a good start.

Still no binding for the Easee Home Wallbox, but maybe it helps some others who want to integrate the Easee Home Wallbox into OpenHAB and like to charge their car with the help of some solar panels :wink:
I wrote a small article how I did this with a combination of a few items and a rule - described in German, but the sources may be helpful anyway :slight_smile:
In case of interest: click

A binding for that would be great!

Any updates?