torbennehmer / hacs-e3dc

Homeassistant E3DC Integration
GNU Affero General Public License v3.0
53 stars 8 forks source link

Wallbox support (configuration, switches and sensors) #47

Open neuromancer3142 opened 10 months ago

neuromancer3142 commented 10 months ago

Checklist

Is your feature request related to a problem? Please describe.

I would like to be able to configure my S10E Pro / Wallbox in order to be able to change the charging priorities wrt.:

Describe the solution you'd like

When charging an electric vehicle I would like to be able to remotely change via RSCP the charging behaviour of my E3DC S10E Pro system, i.e. to

Screenshot of E3DC UI with those options is included in the screenshots.

The iOS "AutarkieManager" app (see one screenshot below) offers these 3 options in its RSCP extension pack. So I can remotely switch on/off those charging options. This would enable me to remote start/stop charging my car with PV energy and also enable automations to start/stop the charging based on SOC state and weather forecast.

Describe alternatives you've considered

None

Additional context

No response

Diagnostics dump

IMG_7501 IMG_7500 IMG_7493

AgentP38 commented 9 months ago

I´m also interested

neuromancer3142 commented 9 months ago

@torbennehmer : I just updated to v3.3.3 and I can now download the diagnostic dump. So @bug#46 is now confirmed closed. Are you still interested in the diagnostic dump in order to work on the enhancement feature?

torbennehmer commented 9 months ago

Please wait for the moment. I'd like to scan the API listing of E3DC, I would suspect that we need some more data provided by the system, that's currently not logged for me to make an implementation plan. Would you be capable of running custom python scripts against pye3dc as an alternative, in that case we could directly play around a bit how your unit reacts to various commands?

neuromancer3142 commented 9 months ago

Please wait for the moment. I'd like to scan the API listing of E3DC, I would suspect that we need some more data provided by the system, that's currently not logged for me to make an implementation plan. Would you be capable of running custom python scripts against pye3dc as an alternative, in that case we could directly play around a bit how your unit reacts to various commands?

If you give me some direction on how to do it: Would be more than happy to do that. Do you mean this script: https://github.com/fsantini/python-e3dc ?

In the meanwhile I installed pip via HomeBrew and the python-e3dc library. I could run the following sample script and get an output: start

from e3dc import E3DC

TCP_IP = '192.168.1.57'
USERNAME = 'test@test.com'
PASS = 'MySecurePassword'
KEY = 'abc123'
CONFIG = {} 
# CONFIG = {"powermeters": [{"index": 6}]}

print("local connection")
e3dc = E3DC(E3DC.CONNECT_LOCAL, username=USERNAME, password=PASS, ipAddress = TCP_IP, key = KEY, configuration = CONFIG)
# The following connections are performed through the RSCP interface
print(e3dc.poll())
print(e3dc.get_pvi_data())

stop

So please let me know what commands I should run in order to help you with the implementation.

torbennehmer commented 9 months ago

That is actually not trivial to answer, the E3DC API is not really easy to read, and putting request objects together is possibly non-trivial. Let me ponder this for a week or two.

neuromancer3142 commented 9 months ago

That is actually not trivial to answer, the E3DC API is not really easy to read, and putting request objects together is possibly non-trivial. Let me ponder this for a week or two.

If it helps, we can also execute some of the commands in an interactive session. Sometimes trial and error is quickest way to progress. Waiting for your input.

bullitt186 commented 8 months ago

There is an open but apparently abandoned PR in 'python_e3dc' which implements basic wallbox features. I guess without this PR we won't see WB support in 'hacs-e3dc'. I tested the abandoned PR, the features still work fine with my Multiconnect II, so I asked there what it takes to finish the PR and hope to finish the started work.

neuromancer3142 commented 7 months ago

@bullitt186 : Any success re. the abandoned PR for the wallbox features?

bullitt186 commented 7 months ago

Not really; I tested the PR with the most recent version of python_e3dc and it works fine. mstv suggested some improvements but these shouldn't be blocking. I don't find much time these days to include his suggestions as work and private life is busy, but adding these suggestions in a new PR together with the work of mdhom would probably be the way to go in order to move forward.

neuromancer3142 commented 7 months ago

@bullitt186 : Thanks for your response. Would love to help, but I am not a SW coder myself. Otherwise, I would gladly contribute. Just let me know if I can support any other way. IT skills are just sufficient to google my way through home assistant configuration issues and yaml configuration ;-).

neuromancer3142 commented 6 months ago

Not really; I tested the PR with the most recent version of python_e3dc and it works fine. mstv suggested some improvements but these shouldn't be blocking. I don't find much time these days to include his suggestions as work and private life is busy, but adding these suggestions in a new PR together with the work of mdhom would probably be the way to go in order to move forward.

Do you see any hope that this might be tackled by you in the coming months? If not I would need to look for alternative solutions. Thanks for letting me know.

Wolfgang-03 commented 3 months ago

I am also very interested in support for the wallboxes. I have an "E3DC S10 E Pro" with storage and 2 "E3DC Wallboxes Easy Connect". Is there any progress on this? I am also happy to help with development and have sufficient experience in software development. Please let me know if there is anything I can do.

bullitt186 commented 3 months ago

I got stuck last year, since the underlying python-e3dc hadn't wallbox integration supported yet. The corresponding PR 59 seems to be abandoned. But only 2 days ago, a new PR within python-e3dc was openend by user mstv with the goal to add WB functionality: https://github.com/fsantini/python-e3dc/pull/116

So maybe we will have WB functionality in python-e3dc...

T1ppes commented 2 months ago

It has been merged today

bullitt186 commented 2 months ago

I am happy to contribute to the implementation of the wallbox-features in hacs-e3dc but frankly speaking, i am not a professional programmer, so it would take me a while and probably some re-work by @torbennehmer or other experts.

Before digging in, here are my thoughts how the implementation should be handeled.

  1. During Setup, check if theres a Powermeter PM_TYPE_WALLBOX in order to identify there's a WB installed. If not, nothing else happens. Open question: how to distinguish a WB with Schuko (MultiConnect I) from a WB without (MultiConnect II)

  2. Add sensors for all attributes of get_wallbox_data()

  3. Implement the following setters: switch: set_battery_to_car_mode() service: set_wallbox_max_charge_current() service: toggle_wallbox_phases() switch: set_wallbox_schuko() switch: set_wallbox_sunmode() service: toggle_wallbox_charging()

While for the set_...calls a switch is obvious, for the toggles, a switch may be oversimplified and lead to confusion / ambiguity what is meant with the on state. (or if we read back actual values and set the switch based on those, it may also be confusing, that the switch state is changed without user interaction) Thus i think using services is the more transparent way to handle those. For convenience, a Button entity to trigger these services could be added.

What are your thoughts: Would you also go that route as I am suggesting? Is somebody else (more experienced) willing to pick up the work?

neuromancer3142 commented 2 months ago

Hi bullitt186,

I am not able to comment on the programming approach as I lack the experience to do so. So I can only comment on useability - see below.

3. Implement the following setters:
   switch: set_battery_to_car_mode()
   service: set_wallbox_max_charge_current()
   service: toggle_wallbox_phases()
   switch: set_wallbox_schuko()
   switch: set_wallbox_sunmode()
   service: toggle_wallbox_charging()

While for the set_...calls a switch is obvious, for the toggles, a switch may be oversimplified and lead to confusion / ambiguity what is meant with the on state. (or if we read back actual values and set the switch based on those, it may also be confusing, that the switch state is changed without user interaction) Thus i think using services is the more transparent way to handle those. For convenience, a Button entity to trigger these services could be added.

What are your thoughts: Would you also go that route as I am suggesting? Is somebody else (more experienced) willing to pick up the work?

Your proposal seems logical for me. One additional feature I would add is the "Bis SOC" value that is shown in the screenshots above (dont know the variables for that). I often have my wallbox in the following configuration:

What this configuration does is to use any incoming PV energy and directly put it into my car. It also discharges my battery to help charging the car, until the SOC is emptied until 50%. At that point it only continues using incoming PV energy. If that is not sufficient anymore, the charging will stop.

I rarely change the charging phases in the meanwhile, as doing so also necessitates physically changing the charging cable at my car. By simply changing the 4 variables mentioned above I manage to remotely start / stop the loading of my car and manage the content of my battery at home. E.g. I will empty the battery before I leave the house in the morning by lowering the SOC value to 3% so that my battery at home can recharge during the day while I am away. In the evening I will empty some of my battery again into my car.

Happy to help with the testing and trouble shooting if needed.

bullitt186 commented 1 week ago

I implemented WB integration in https://github.com/torbennehmer/hacs-e3dc/pull/153. Feel free to test and add suggestions.

bullitt186 commented 1 week ago

Your proposal seems logical for me. One additional feature I would add is the "Bis SOC" value

With the wallbox features implemented in the PR, it should be easy to implement this as an automation in home assistant (trigger = SoC; action = turn sun mode on)

what i have in mind doing is that per default it only charges in sun mode but when i trigger an automation by "Alexa: Auto jetzt laden an", it charges fully once (or until disconnected) and then falls back to sun charging. THis may be handy if i need a fully charged car in the morning.

torbennehmer commented 22 hours ago

@bullitt186 I've merged the PR so that we can test this. Could you please update the README.md (in another PR), I totally forgot this on the existing one, go over it and update it at your discretion, the minimum would be describing the new service at the bottom of the file. It'd be great if we had this for the stable release.

torbennehmer commented 22 hours ago

https://github.com/torbennehmer/hacs-e3dc/releases/tag/v3.8.0-beta.1 out of the door

bullitt186 commented 13 hours ago

@bullitt186 I've merged the PR so that we can test this. Could you please update the README.md (in another PR), I totally forgot this on the existing one, go over it and update it at your discretion, the minimum would be describing the new service at the bottom of the file. It'd be great if we had this for the stable release.

For sure! @Thomansky's feedback regarding multiple wallboxes triggered me to add support for multiple wallboxes rightaway. See https://github.com/torbennehmer/hacs-e3dc/pull/155. So ideally, we get this integrated fast and can state in the README.md rightaway that multiple wallboxes are supported :-)