/SonnenChargeHq-Adapter

Integrates Sonnen Batterie 9.53 with ChargeHQ

Primary LanguageC#

Sonnen Batterie - ChargeHq Integration

This integration allows smart charging of your EV with Sonnen Solar Batterie and ChargeHq.

There are implementations in both Golang and .NET core with dockerfiles for both.

Also note, this integration assumes that Sonnen API v2 is used.

Setup

.NET

If running as .Net7 service update the appsettings.json with your relevant urls and keys and compile to your target platform:

  "Sonnen": {
    "BaseUrl": "http://localhost"
  },
  "ChargeHq": {
    "BaseUrl": "https://api.chargehq.net",
    "ApiKey": "YourApiKey",
    "RefreshMs":"120000" //optional- defaults to 2 mins
  }

GO

Create a .env file in the goService folder with the following settings:

 SONNEN__BASEURL=http://localhost
 CHARGEHQ__APIKEY=your_api_key
 CHARGEHQ__REFRESHMS=120000 (optional)

Getting your Sonnen local address

image

  • Use this as your BaseUrl in the Sonnen configuration setting.

Getting your ChargeHq API key

  • Log into https://app.chargehq.net/.
  • Click settings
  • Select "My Equipment" -> Solar battery equipment.
  • Select the "Push Api" item.
  • Copy your API key into the ChargeHq ApiKey setting.

More details can be found here. https://chargehq.net/kb/push-api.

Docker

If you want to run a docker container, then, you can use the publish.sh scripts to create a linux build/docker images.

Exporting the docker image

To export the docker image, execute the export.sh script to add a tar archive in the ./service/dist directory. I use this to run the container on my Synolgy NAS.

Environment Settings

If using docker, add the following docker environment Variables for your configuration:

SONNEN__BASEURL=http://your_local_sonnen_address
CHARGEHQ__APIKEY=Your_Api_Key