Garo chargebox without custom components

I set up this integration purely with the rest and curl a long time back and thought i would share it with you.
Texts are in Swedish, i hope you figure it out anyway.

You find the same info plus the images for lovelace www folder on the github page as well:
endor-force/home-assistant-garo-chargebox: Details for setting up Garo Chargebox in Homeassistant (github.com)

It is using the following parts:

  • Command line switch to control availability on/off for the chargebox… if you don’t trust your neighbours then you can schedule or automate the availability of charging from the box.
  • Rest sensor to collect the data from the box as attributes (one call to collect all stats)
  • Template sensors to calculate and make the collected data representable and enumerate statuses.
  • Lovelace cards with dynamic image that changes color based on status.
  • Utility sensors that collect and calculate stats for usage per month and day…

Note: for chargebox with software version earlier than v1.3.1 you need to format the urls like this instead, (i recommend to update the firmware): (thanks @StarkJohan)

http://192.168.xxx.yyy:2222/rest/chargebox/mode
http://192.168.xxx.yyy:2222/rest/chargebox/status

Please follow the instructions and download package at github :slight_smile:

1 Like

Since v.1.3.1 the location of the API has changed.

Instead of “http://:2222/rest/chargebox/status” it is now “http://:8080/servlet/rest/chargebox/status”

1 Like

Thanks @StarkJohan, I have updated the instructions and the Github page to reflect settings for v.1.3.1 and info for older versions.

Updated my chargebox firmware and settings and can confirm that it works :slight_smile:

I’m doing a pretty basic addition to your example to add support for multiple load balanced chargers. Will post it all once it is finished. A couple of notes on multiple chargers though:
Unfortunately there’s currently no HA-native way of getting all the data without making at least one API call per charger.
Temperature is unfortunately only available for the main charger for some reason.

Also, the “INITIALIZATION” mode makes the LED green, not red as your code suggests. At least that is the case on my chargers. Perhaps this is firmware dependent?

I think the translation of ‘CONTACTOR_FAULT’ should be Kontaktor fel.
What do you think of that?

Yes, you are correct, it is Kontaktorfel in the garo web interface. I have updated on github.

Works great! Is there a way to set the current limit?

Edit: I checked the config and there is no function for setting the current limit. I added a sensor for displaying the current configured current limit. I have also found the POST header and data needed to change the limit but since my coding skills are quite limited I haven’t figured out how to implement this yet. Current limit is a scheduled function but can be set for the whole day as well. My box supports 6-16A charge limit at 1A increments.

Atleast I can post some findings :slight_smile:

HTTP POST http://x.y.z.b:8080/servlet/rest/chargebox/currentlimit

json data:
{
‘chargeLimit’: set limit here,
‘schemaId’: 1,
‘start’: ‘00:00:00’,
‘stop’:‘24:00:00’,
‘weekday’: 8
}

I added som magic that solved my need for being able to set the charge limit. There are problably better or cleaner ways to do this but with limited coding experience this is what I came up with.

I added this to pkg_garo_chargebox.yaml

### For setting charge limit
input_number:
  charge_limit_set:
    name: charge_limit_set
    min: 6
    max: 16
    step: 1
    unit_of_measurement: A
shell_command:
  laddbox_set_charge_limit: '/usr/bin/curl --header "Content-Type: application/json" --request POST --data "{\"reducedIntervalsEnabled\":true,\"reducedCurrentIntervals\":[{\"schemaId\":1,\"start\":\"00:00:00\",\"stop\":\"00:00:00\",\"weekday\":8,\"chargeLimit\":{{ states("input_number.charge_limit_set") | int }}}]}" http://your.ip.here.x:8080/servlet/rest/chargebox/currentlimit/'

### Templates to convert units and set separate sensors from attributes.
template:
    - sensor:
        - unique_id: 'laddbox_currentlimit'
          name: 'Laddbegränsning'
          icon: mdi:flash-circle
          unit_of_measurement: 'A'
          state_class: measurement
          state: >
            {% set state = state_attr('sensor.laddbox', 'currentLimit') | round(0) %}
            {% if state >= 0 %}
            {{state}}
            {% else %}
            0
            {% endif %}

Then I added an automation to execute the shell_command when the input_number changed.

- id: '1632384423797'
  alias: Set charge limit
  description: ''
  trigger:
  - platform: state
    entity_id: input_number.charge_limit_set
  condition: []
  action:
  - service: shell_command.laddbox_set_charge_limit
  mode: single

This is fantastic, great job.

My box isnt up and running yet but I’m going to install the GNM3D-RS485 energy-meter. And as I understand the wallbox read values from this. Is it possible to get them into HA as well?

Hi!
I am not familiar with the Garo energy meter but based on the specs it looks like it is having modbus interface over RS485 rather than a wifi or network interface like the wallbox. It will probably require you to connect some more hardware/interface to extract data from the meter.
Modbus - Home Assistant (home-assistant.io)

I assume you’re installing the GNM3D meter to be used for load balancing hardwired to the master GLB. In this case you can access the a couple of the values from the meter. Specifically the values presented in the Garo webGUI.

This is how I access it:

platform: rest
scan_interval: 29
resource: http://<glb>:8080/servlet/rest/chargebox/meterinfo/CENTRAL100
name: Meter100
value_template: "{{ value_json.accEnergy }}"
json_attributes:
  - accEnergy
  - phase1Current
  - phase2Current
  - phase3Current
  - readTime
3 Likes

Thanks man, that’s awesome

As a total HA noob…
Can this snippet just be added to config.yaml and i should be able to get the values from my load balancing meter?
I have the GNM3D in my main fuse box.
I have mainly used Domoticz for the past years and just now looking into HA.

Vad jag förstår så är inte detta energimätaren för lastbalansering, utan den energimätaren som sitter internt i Garo boxen. Hur man kommer åt lastbalanseringen har jag inte lyckats klura ut.
Hasse

As mentioned “central100” is not the correct adress.

This is how I access the external meter:


sensor:
  - platform: rest
    name: Lastbalanserare
    resource: http://<glb>:8080/servlet/rest/chargebox/meterinfo/EXTERNAL
    json_attributes:
        - phase1Current
        - phase2Current
        - phase3Current
        - phase1InstPower
        - phase2InstPower
        - phase3InstPower
        - apparentPower
    value_template: '{{ value_json.apparentPower }}'

The bad news is that the value for “phasesXInstpower” reports as 0 as long as they are below 1
and as 1 between 1-2 and so on.
The same issue with “apperentPower”.
“phaseXcurrent” I’ll get the correct value x 10. → 151 = 15,1A

This is how I solved phaseXcurrent part.

template:
    - sensor:
        - unique_id: 'lastbalanserare_phase1Current'
          name: 'Aktuell Ström Fas 1'
          icon: mdi:flash-circle
          unit_of_measurement: 'A'
          state_class: measurement
          state: >
            {% set state = state_attr('sensor.lastbalanserare', 'phase1Current')/10 | round(1) %}
            {% if state >= 0 %}
            {{state}}
            {% else %}
            0
            {% endif %}

The values I get from “phaseXInstPower” is more or less useless to me, so I ended up doing the math
P =U*I.
I now this isn’t 100% correct but closer than what I get out of the box.

        - unique_id: 'lastbalanserare_phase1InstPower'
          name: 'Aktuell förbrukning fas 1'
          icon: mdi:resistor
          unit_of_measurement: 'kW'
          state_class: measurement
          state: >
            {% set state = state_attr('sensor.lastbalanserare', 'phase1Current')*230/10000 | round(1) %}
            {% if state >= 0 %}
            {{state}}
            {% else %}
            0
            {% endif %}

I did this in a new yaml-file and included it in configuration.yaml.

Well. In my setup the “correct” adress to get the load balancing meter data is in fact as I stated above:

http://<glb>:8080/servlet/rest/chargebox/meterinfo/CENTRAL100

I’m on software 1.3.1 BUT my setup consists of two GLB (1 master, 1 slave) and a LBM. I can assure you that the data collected on this url is the same data as can be read on the LBM itself. Example output below. I get no response on “:8080/servlet/rest/chargebox/meterinfo/EXTERNAL” with my setup.

{"success":0,"accEnergy":22963400,"phase1Current":41,"phase2Current":23,"phase3Current":12,"phase1InstPower":0,"phase2InstPower":0,"phase3InstPower":0,"readTime":1636722791615,"gridNetType":"UNKNOWN","meterSerial":"348030U","type":341,"apparentPower":0}
1 Like

Lots of great information and a working solution, just what I was seeking.

But a somewhat none HA related question, do anyone know how I get the GARO to stay on a private network with no internet access?

I do not see any reason for the box to connect to internet, I just want to keep it local. But when I switch it to a local network with no internet access it goes back to access point mod after some 10 minutes like it say in dialog when I do the change. Anyone figured out how it detect this, and how to trick it to say connected?

I’ve done according to specificaions on github, yet I get an error in HA stating:
Integration error: garo_chargebox - Integration ‘garo_chargebox’ not found.
Any ideas? Also - any input on what to change/add to get data from a dual charger?

Hey there,

Can you elaborate more on where you get the error, is it from lovelace or some other integration that is throwing the error?

Verify that the packages section is in the correct place, in homeassistant, similar to this

Also check the logs if you get any error related to the rest sensor.

For dual charges i would assume you would get some more or different output from the chargebox which might cause the error or require you to set up the “mother” sensor in a bit different way.

When i look at my output file i can see two sub sections in the structure, maincharger and twincharger
http://[chargebox_ip]:8080/servlet/rest/chargebox/status

I have updated the yaml package file on github to enable you to extend for twinCharger.

For double port box/twinCharger:
First add the attribute twinCharger in the mother sensor, then copy the mainCharger unique template sensors and set them up to extract values from twinCharger too :).

pkg_garo_chargebox.yamll