Konnect+ Andersen EV integration

Anyone aware of an integration for this - I can’t find one?

2 Likes

I don’t believe there is one… yet.

I started to look into what it would take to programmatically control the Andersen EV charger, so that I could try and build a python based library that could subsequently be leveraged by a Home Assistant integration.

I’ve managed to write the basics, including:

  • Authentication
  • Listing devices connected to the account
  • User lock enable/disable

One challenge I have though, don’t ask, is that I don’t yet have access to an EV to test properly. One thing I would love is to determine how to extract the “state” of the device (e.g. charging vs not). If someone has some time (and skills) to help, i’d love them to share. Here’s what I need…

  • Clone my repo: GitHub - IanDBird/konnect
  • Install requests and warrant via pip
  • Navigate to the src folder in the repo, and type the following (changing the username and password to match your account):
from client import KonnectClient
client = KonnectClient('Username@Email', 'Password')
client.authenticate_user()

devices = client.getDevices()

After that, it should print out the status of the devices it finds. If that works, capture a log while your EV is charging and share here.

1 Like

Hi there, I’m happy to run logs etc, but you will have to let me have step by step instructions…

Regards,

Craig.

Thanks. I was able to have a friend test it remotely and show that while i’m able to control the user lock correctly, it’s not able to detect the current state of the charger (e.g. idle, charging, etc). This will probably be hard for me to remotely debug the issue, and instead require to actually have an EV to plug in. Given a few factors personally, this may not happen before the end of the year.

I may continue an initial Home Assistant integration which purely exposes the user lock as a binary switch. At the very least, this would allow people to set up automations controlling when their EV can charge.

For anyone having issues installing the warrant package from the src code have a look at:

https://pycryptodome.readthedocs.io/en/latest/src/installation.html

You need a C++ compiler installed on your system.

@iandbird you integration looks dependent on Andersen AWS services remaining operational but given the recent news that seems unlikely, would you have any ideas about how to utilise the OCPP support the Andersen in theory has?

I’ve got your code working on my Anderson

output
Out[50]: 
{'duration': 41525,
 'chargeCostTotal': 10.09582027869997,
 'chargeEnergyTotal': 72.25438700000012,
 'gridCostTotal': 11.161436408100004,
 'gridEnergyTotal': 78.54892399999996,
 'solarEnergyTotal': 0,
 'solarCostTotal': 0,
 'surplusUsedCostTotal': 0,
 'surplusUsedEnergyTotal': 0}

How do you know/discovery what commands are possible and what queries are possible with the Graph QL API?

Some info on the speakev forum about Andersen going into administration. Sounds like OCPP support was never added and some discussion about the cloud services being taken over by another company. Nothing decided yet - worst case is a dumb charger or retro-fitting a high voltage smart switch inside it.

Andersen has been acquired by Evios and according to the announcement on the web page, the app will still continue to function as now. Hopefully the new owners will make enhancements in due course, but they say they will be taking orders soon.

@iandbird - yes please!

That would be very much appreciated! Ultimately that would allow us to use calendars and schedule helpers etc. to control the times that the charger is enabled/disabled.

A lock and/or a couple of services that enable disable the charger would literally be all anyone needs within HA.

If you’d like to get some raw data from an A2 while a car is charging, I’d be happy to help - though it would have to be on an evening GMT.

I used this but I admit my Python is shocking so I’ve no clue if what I did to access the device is correct - what if I needed to access another by a more specific name?

from client import KonnectClient
client = KonnectClient('Username@Email', 'Password')
client.authenticate_user()

devices = client.getDevices()

dev = devices[0] # Is that how to do this?!
dev.disable()

I was able to disable and enable the charger with the above…though admittedly, the first time I tried, it didn’t work but I assume there was a token timeout as I’d tried it about 30 minutes after I’d initially run client.authenticate_user()

Some graphQL commands for you - will share charging status soon

{
  "operationName": "runAEVCommand",
  "variables": {
    "deviceId": "my_device_id",
    "functionName": "userLock"
  },
  "query": "mutation runAEVCommand($deviceId: ID!, $functionName: String!, $params: String) {\n  runAEVCommand(deviceId: $deviceId, functionName: $functionName, params: $params) {\n    return_value\n    __typename\n  }\n}"
}

{
  "operationName": "getDeviceCalculatedChargeLogs",
  "variables": {
    "id": "my_device_id",
    "offset": 0,
    "limit": 1,
    "minEnergy": 0.5
  },
  "query": "query getDeviceCalculatedChargeLogs($id: ID!, $limit: Int, $offset: Int, $minEnergy: Float, $dateFrom: Date) {\n  getDevice(id: $id) {\n    id\n    deviceCalculatedChargeLogs(\n      limit: $limit\n      offset: $offset\n      minEnergy: $minEnergy\n      dateFrom: $dateFrom\n    ) {\n      chargeCostTotal\n      chargeEnergyTotal\n      deviceId\n      duration\n      gridCostTotal\n      gridEnergyTotal\n      particleFwVersion\n      solarEnergyTotal\n      solarCostTotal\n      startDateTimeLocal\n      surplusUsedCostTotal\n      surplusUsedEnergyTotal\n      uuid\n      __typename\n    }\n    __typename\n  }\n}"
}


{
  "operationName": "getDevice",
  "variables": {
    "id": "my_device_id"
  },
  "query": "query getDevice($id: ID!) {\n  getDevice(id: $id) {\n    id\n    name\n    last_ip_address\n    deviceStatus {\n      id\n      sysFwVersion\n      sysSchEnabled\n      sysSch0\n      sysSch1\n      sysSch2\n      sysSch3\n      sysSch4\n      cfgCTConfig\n      scheduleSlotsArray {\n        startHour\n        startMinute\n        endHour\n        endMinute\n        enabled\n        dayMap {\n          monday\n          tuesday\n          wednesday\n          thursday\n          friday\n          saturday\n          sunday\n          __typename\n        }\n        __typename\n      }\n      __typename\n    }\n    deviceInfo {\n      id\n      currency\n      enableThreePhaseMultiplier\n      friendlyName\n      locationLongitude\n      locationLatitude\n      schedule0Name\n      schedule1Name\n      schedule2Name\n      schedule3Name\n      schedule4Name\n      address\n      addressPlace\n      addressDistrict\n      addressPostcode\n      addressCountry\n      solarOverrideStart\n      notifyRcmErrorEnabled\n      notifyWeeklyReportEnabled\n      notifyDeviceOfflineEnabled\n      purpose\n      solarChargeAlways\n      timeZoneRegion\n      userLock\n      __typename\n    }\n    __typename\n  }\n}"
}


{
  "operationName": "getCalculatedPowerLogsBinned",
  "variables": {
    "id": "my_device_id",
    "dateFrom": "2022-12-11T00:00:00.000Z",
    "dateTo": "2022-12-15T23:59:59.999Z",
    "binnedMinutes": 60,
    "groupBy": "MINUTE"
  },
  "query": "query getCalculatedPowerLogsBinned($id: ID!, $dateFrom: Date, $dateTo: Date, $binnedMinutes: Int, $limit: Int, $offset: Int, $groupBy: LogsGroupedBy) {\n  getDevice(id: $id) {\n    id\n    deviceCalculatedPowerLogsBinned(\n      dateFrom: $dateFrom\n      dateTo: $dateTo\n      binnedMinutes: $binnedMinutes\n      groupBy: $groupBy\n      limit: $limit\n      offset: $offset\n    )\n    __typename\n  }\n}"
}


{
  "operationName": "setSchedules",
  "variables": {
    "deviceId": "my_device_id",
    "scheduleSlots": {
      "sch0": {
        "startHour": 20,
        "startMinute": 30,
        "endHour": 8,
        "endMinute": 30,
        "enabled": true,
        "dayMap": {
          "monday": true,
          "tuesday": true,
          "wednesday": true,
          "thursday": true,
          "friday": true,
          "saturday": true,
          "sunday": true
        }
      }
    }
  },
  "query": "mutation setSchedules($deviceId: ID!, $scheduleSlots: ScheduleSlotsInput!) {\n  setSchedules(deviceId: $deviceId, scheduleSlots: $scheduleSlots) {\n    id\n    name\n    last_app\n    connected\n    return_value\n    __typename\n  }\n}"
}

Just wondered if you guys had made any progress - keen to get this working :slight_smile:

Not from my side but there is an alternative connection library at GitHub - strobejb/andersen-ev: Python package to enable control of the Andersen A2 EV charger which may be a good starting point for someone to build an integration. The library has been pushed to pypi as well.
Sorry not much help…