Support for ChargeAmp's My Charge Space

Tryck på det gula plusset och lägg till chargeamps…

Tack Fredrik och ursäkta.
Jag gjorde fel och hittade inte i add-ons chargeamps, men efter din förklaring gick bra.
Stor Tack.
//Christian

Added to the default HACS repo in July :slight_smile: https://github.com/hacs/default/commit/b16dcbe436bbbbd888f1db93cbe2f983d4ff30b7

Hi, thank you for good work!

Can you please help me understand what kind of configuration is possible to limit the currents?
Can I:

  • Select which (or both) outlets to power?
  • Select (per outlet?) if I want to charge using 3-phase or 1-phase (and which phase)
  • Select (per outlet?) the max allowed current

Thank you
/Peter

Yes

No, ChargeAmp’s Api does not allow this.

Yes

Each outlet can be configured to act as a switch (or even a lamp where the dimming level is proportion of current).

1 Like

Perhaps we should start a campaign for ChargeAmps to open up their api for this. @jschlyter, @chris4, @Wolfie2016, @crusell, @mats.nethander, @marten.fallman, @Jockz0rz

Hi,
Unfortunately I have not had the time to look into it. But I support that we write to Chargeamp to open up their API locally without having to access their server.

1 Like

Has anyone looked at the traffic flowing between wallbox and charge amps servers?

If I’m to guess, it’s a simple loop on the wallbox wifi chip that once every 30s connects to the server and get it’s latest config. Since it’s a esp8266 chip it might even be non-ssl but I doubt it.

Thanks for att great integration with Charge Amps, I’ve a HALO Wallbox for my Volvo Plug-In Hybrid.

I’m relatively new to Home Assistant but I’ve installed the integration via HACS, got my API-key from Charge Amps support and configured configuration.yaml with my username, password and API-key.

But the integration doesn’t start since I recieve the following error:

Traceback (most recent call last):

File "/usr/src/homeassistant/homeassistant/setup.py", line 213, in _async_setup_component
    result = await task
  File "/config/custom_components/chargeamps/__init__.py", line 111, in async_setup
    for cp in await client.get_chargepoints():
  File "/usr/local/lib/python3.8/site-packages/chargeamps/external.py", line 81, in get_chargepoints
    response = await self._get(request_uri)
  File "/usr/local/lib/python3.8/site-packages/chargeamps/external.py", line 65, in _get
    await self._ensure_token()
  File "/usr/local/lib/python3.8/site-packages/chargeamps/external.py", line 46, in _ensure_token
    response = await self._session.post(
  File "/usr/local/lib/python3.8/site-packages/aiohttp/client.py", line 625, in _request
    resp.raise_for_status()
  File "/usr/local/lib/python3.8/site-packages/aiohttp/client_reqrep.py", line 1000, in raise_for_status
    raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 401, message='Unauthorized', url=URL('https://ca-externalapi.azurewebsites.net/api/v3/auth/login')

Seems like there some problem with authentication but I’ve double-checked my username and password and I can login using them to https://my.charge.space/

I cannot verify my API-key but I’ve copied once again from the mail I received from Charge Amps.

Or do I have to do anything else to make it work?

So do I :slight_smile:

Do you have any magical characters in the password (could be an issue with how yaml interprets your password).

Kul att du även har liknande uppsättning som jag har :slight_smile:

Självklart har jag specialtecken men även fast jag nu bytt lösenord till att bara innehålla bokstäver och siffror så får jag samma fel. Jag var rätt säker på att ditt tips skulle hjälpa!

Edit. Har även mejlat Charge Amps så de får verifiera att API-nyckeln jag fått är korrekt gentemot mitt konto.

Då vet jag tyvärr inte.

Kanske dra igång logger debug, https://www.home-assistant.io/integrations/logger

logger:
  default: debug

Men är osäker på hur @jschlyter har implementerat logging.

Som en extra grej, denna automatiseringen har jag från VOC (med notifikation när man laddar/slutar ladda)

- id: '1576334464454'
  alias: CAR Charging
  description: ''
  trigger:
  - entity_id: binary_sensor.car_battery_charging
    for: 00:00:05
    from: 'off'
    platform: state
    to: 'on'
  - entity_id: binary_sensor.car_battery_charging
    from: 'on'
    platform: state
    to: 'off'
  condition: []
  action:
  - data_template:
      message: "{% if is_state('binary_sensor.car_battery_charging', 'on') %}\n\
        \  CAR is currently charging, will finish at\n  {{- (now() | as_timestamp()\
        \ + (states('sensor.car_time_to_fully_charged')|int * 60)) | timestamp_custom(\"\
        \ %H:%M\", True) }}\n  {{- (-3600 + (states('sensor.car_time_to_fully_charged')|int*60))\
        \ | timestamp_custom(\" (%-H h %-M min).\", True) }}\n{%- else %}\n  CAR\
        \ finished charging, battery at {{states('sensor.car_battery_level')}}%\
        \ ({{ states('sensor.car_battery_range')}} km). \n{%- endif %}"
      title: Car charging time
    service: notify.pushover

Edit: här är ett blueprint https://gist.github.com/fredrike/ac758adad1360b74180194a0428a34dd

Man kan aktivera mer loggning för enbart integrationen via:

logger:
  logs:
    custom_components.chargeamps: debug

:+1:, tänkte att man kanske vill se output från aiohttp också.

Tack @fredrike och @jschlyter för era svar. Inväntar först svar från Charge Amps om min API-nyckel och sen testar jag loggningen.

Som jag anade visade sig felet ligga utanför vår kontroll. Charge Amps ändrade datumet när API-nyckeln blev aktiv så nu fungerar det :smiley:

1 Like

@fredrike, har du nån guide eller liknande på hur man kan presentera/visa de olika entiteterna på nåt snyggt och informativt sätt via korten på översiktssidan? Behöver lite inspiration och förslag då jag knappt vet vad alla entiteter egentligen är för nåt :wink:

Här är min dashboard:

ChargeAmps-dashboard
cards:
  - content: >
      {% if states("sensor.chargeamps_watt") |float > 0.0 %}  The car is
      currently charging via **{{ state_attr("sensor.chargeamps_watt",
      "active_phase") }}**  @ {{state_attr("switch.chargeamps", "max_current") |
      int }} Amp ({{ states("sensor.chargeamps_watt")|round(-2)|int }}W){% else
      %} The car is not charging. ChargeAmps is configured to charge from **{{
      state_attr("sensor.chargeamps_watt", "active_phase") or "-" }}** @
      {{state_attr("switch.chargeamps", "max_current") | int }} Amp. {% endif
      %} 
    type: markdown
  - entities:
      - entity: sensor.chargeamps
        icon: 'mdi:flash'
      - entity: sensor.chargeamps_watt
      - entity: binary_sensor.charge_amps_plugged
      - entity: binary_sensor.charge_amps_charging
    type: glance
  - type: grid
    columns: 2
    cards:
      - entity: light.chargeamps_current
        icon: 'mdi:car-electric'
        type: light
      - entity: switch.mjovik_1706001294_2
        hold_action:
          action: more-info
        show_icon: true
        show_name: true
        tap_action:
          action: toggle
        type: button
  - cards:
      - entity: light.chargeamps_downlight
        type: light
      - entity: light.chargeamps_dimmer
        type: light
    type: horizontal-stack
type: vertical-stack

Jag har dock skapat endel av sensorerna/switcharna med detta

charge_amps.yaml


sensor:
  - platform: template
    sensors:
      chargeamps_phase:
        unique_id:       chargeamps_phase
        friendly_name: "Charge Amps Phase"
        value_template: "{{ state_attr('sensor.chargeamps', 'installationPhase') }}"

binary_sensor:
  - platform: template
    sensors:
      charge_amps_plugged:
        unique_id:       charge_amps_plugged
        friendly_name: "Charge Amps plug"
        device_class: plug
        value_template: "{{ is_state_attr('sensor.chargeamps', 'Connector 0 state',
        'B2Connected') or is_state_attr('sensor.chargeamps', 'Connector 0 state', 'C2ConnectedCharging') }}"
      charge_amps_charging:
        unique_id:       charge_amps_charging
        friendly_name: "Charge Amps charge"
        device_class: battery_charging
        icon_template: mdi:car
        value_template: "{{ is_state_attr('sensor.chargeamps', 'Connector 0 state', 'C2ConnectedCharging') }}"

switch:
  - platform: template
    switches:
      chargeamps_socket:
        unique_id:       chargeamps_socket
        friendly_name: "Charge Amp's Socket"
        icon_template: mdi:car
        value_template: "{{  is_state_attr('sensor.chargeamps', 'Connector 1', 'On') }}"
        turn_off:
          service: chargeamps.change_settings
          data:
            entity_id: none.none
            setting: '{"connectors": [{},{"mode": "Off"}]}'
        turn_on:
          service: chargeamps.change_settings
          data:
            entity_id: none.none
            setting: '{"connectors": [{},{"mode": "On"}]}'

light:
  - platform: template
    lights:
      chargeamps_current:
        unique_id:       chargeamps_current
        friendly_name: "Charge Amp's Charger"
        icon_template: mdi:car
        value_template: "{{  is_state('switch.chargeamps', 'on') }}"
        level_template: "{{  ((state_attr('switch.chargeamps', 'max_current') | int) - 10) * 41.5 |int  }}"
        turn_off:
          service: chargeamps.disable
          data:
            chargepoint: 1706001294
            connector: 1
        turn_on:
          service: chargeamps.enable
          data:
            chargepoint: 1706001294
            connector: 1
        set_level: 
          service: chargeamps.set_max_current
          data_template:
            chargepoint: 1706001294
            connector: 1
            max_current: "{{ (brightness / 41.5 | round(0) + 10) | int | string }}"

1 Like

Nice!
I am just starting to configure this in my Homeassistnant now. I have also installed a load balancer from Charge Amps, and that provides sensor data of current load on each if my phases at home to the cloud, do you know if that data is also available via the API to fetch? Does not look to be documented in the integration so far at least.
Looks like this in my.charge.space when the load balancer is also available.

It should be possible to read the raw stream from the web if it’s not exposed trough API (I did something like that on my version on the plugin https://gist.github.com/fredrike/c9e99a3ae59a39d8df9c811456b8012f perhaps something like that could be implemented here too).

It would be really interesting to see the network communication from the load-balancer to the charger (the charger should have a local api but we have not cracked it yet).