cathiele / homeassistant-goecharger

Home Assistant custom_component for controlling the go-eCharger EV-Charger
MIT License
91 stars 29 forks source link

Possible use multiple goecharger? #28

Closed atze09 closed 3 years ago

atze09 commented 3 years ago

Hello, is it possible use multiple goecharger? I have 2 goechargers and wanted to control both of them in home assistant. How can i do that?

cathiele commented 3 years ago

At the moment this is not possible. i will look into it

mkunter commented 3 years ago

Hi, I also wondered why only one of my 2 go-e Chargers was added with your integration. Would be very nice to have multiple chargers controlled soon!

tsetzekorn commented 3 years ago

That would be really great. I am also owning two echargers and really looking forward to this. ;-)

alexfisch79 commented 3 years ago

That would be great! :-)

michis0806 commented 3 years ago

Same here. Two chargers in place ;)

cryptedx commented 3 years ago

Same :-)

cathiele commented 3 years ago

First version of the setup Flow for multiple chargers, but still not working...

Screenshot from 2021-05-06 21-50-49

cathiele commented 3 years ago

In PR #35 i added support for multiple chargers. Maybe someone with more than one charger could check the branch "multi-charger" (or PR #35)

goecharger:
  chargers:
    - name: charger1
      host: host-or-ip
    - name: charger2
      host: second.charger.ip

or via "Add Integration" Config Flow

still WIP but tests with "real" two chargers would be great (i just have one). The entity_ids for the chargers are named based on the name-Attribute. So if the currently configured charger will be named with the serial-number of the charger the entity_ids will be stable.

Known bugs:

tsetzekorn commented 3 years ago

I deleted my goecharger configuration, deleted the goecharger folder in custom_components, afterwards copied the one from the multi-charger branch and did a restart. Then I added the following configuration (just trying to have my first charger connected again):

goecharger:
  chargers:
    - name: "serial_no"
      host: 192.168.2.6

During configuration validation I get the following error: Component error: goecharger - No module named 'custom_components.goecharger.const'

What am I doing wrong?

cathiele commented 3 years ago

sorry, i forgot to commit one file. please pull again. thanks for testing!

tsetzekorn commented 3 years ago

That error was solved now. After restart I see the following error with the above mentioned entry in configuration.yaml :

Logger: homeassistant.setup
Source: custom_components/goecharger/__init__.py:99
Integration: go-eCharger (documentation, issues)
First occurred: 22:30:41 (1 occurrences)
Last logged: 22:30:41

Error during setup of component goecharger
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 248, in _async_setup_component
    result = await task
  File "/config/custom_components/goecharger/__init__.py", line 99, in async_setup
    host = config[DOMAIN][CONF_HOST]
KeyError: 'host'
tsetzekorn commented 3 years ago

I was able to solve that error by locally changing line 99 in __init__.py to:

host = config[DOMAIN].get(CONF_HOST, False)

I added also my second charger and both seem to be connected now. :) I will further test and give you a feedback.

cathiele commented 3 years ago

I was able to solve that error by locally changing line 99 in __init__.py to:

host = config[DOMAIN].get(CONF_HOST, False)

I added also my second charger and both seem to be connected now. :) I will further test and give you a feedback.

ups, you are right! fixed it like you did it. thank you! (i missed this one because my charger is still configured the old way without the chargers: line)

tsetzekorn commented 3 years ago

So I have added my two chargers like this (where name represents the serial number):

goecharger:
  chargers:
    - name: 111111
      host: 192.168.2.6
    - name: 222222
      host: 192.168.2.91

The first one was named exactly like when I did it the old way. So no issue with my existing dashboards.

The attributes of both chargers seem to be correct and not linked to each other. I can switch both of them separately. I also see no error messages in the logs. So I am fine with the multi-charger solution. Is there anything else I should test?

I was not using automations so far with the echarger services, but how does the integration work here? How to select the right charger? A dropdown would be nice when calling a service:

Screenshot 2021-05-13 112916

The config flow does not work at all for me, in light mode I only see three empty input fields with no labels. But you already mentioned you are still working on that, so I guess you will fix this separately.

Screenshot 2021-05-13 112450

cathiele commented 3 years ago

@tsetzekorn Thank you for testing!

I now added texts to the config-flow dialog

the usage of the services is documented in "Entwickerwerkzeuge" => "Dienste"

image

i think i will merge it like it is in the master branch and will fix the missing pieces later.

tsetzekorn commented 3 years ago

Great! Thanks a lot for implementing this!