custom-components / zaptec

zaptec charger custom component for home assistant
MIT License
64 stars 20 forks source link

multiple chargers in different locations lead to various issues #61

Closed dbarrosop closed 10 months ago

dbarrosop commented 11 months ago

Hello, let me start by saying the result of the big refactor work feels amazing, awesome job there. I am having a minor issue though and I suspect this is due to having multiple chargers in different locations.

The first issue is that one of the chargers has a max. current of 16 and the other one of 25 and my "available currrent" is limited to 16. I suspect the component chose the minimum of the two.

The other problem is that according to the docs:

ℹ️ NOTE! The "Available current" is the official way to control the charge current. However, it will affect all chargers connected to the installation.

But as mentioned, before, they are in different locations so this doesn't really apply here. I could be charging in both locations at the same time both at max. current.

What do you think about this problem? I suspect this isn't going to be a very rare problem, having a charger home and another one at the summer/winter cabin is probably quite common.

Thanks again for the amazing work.

Regards.

sveinse commented 11 months ago

The first issue is that one of the chargers has a max. current of 16 and the other one of 25 and my "available currrent" is limited to 16. I suspect the component chose the minimum of the two.

The "available current" max value is read from the attribute "max current" in the installation object. So is then the data from Zaptec portal inconsistent?

But as mentioned, before, they are in different locations so this doesn't really apply here. I could be charging in both locations at the same time both at max. current.

I'm really curious to how this has been organized in Zaptec portal. Zaptec divides every charger into "Installation" and "Circuits" and I'm curious how this is in this case. Under each of the zaptec devices there is a "Download diagnostics". Any chance you might upload it here?

dbarrosop commented 11 months ago

The "available current" max value is read from the attribute "max current" in the installation object. So is then the data from Zaptec portal inconsistent?

Not sure about the installation (how can I check it?) but at least the circuit show the correct values:

Screenshot 2023-11-19 at 08 37 53 Screenshot 2023-11-19 at 08 38 10 Screenshot 2023-11-19 at 08 42 41 Screenshot 2023-11-19 at 08 42 09

Don't you think the cause might be this?

ℹ️ NOTE! The "Available current" is the official way to control the charge current. However, it will affect all chargers connected to the installation.

it might make sense to pick the minimum of the two if this "available current" is a global one.

Under each of the zaptec devices there is a "Download diagnostics"

Happy to share but I am afraid I couldn't find it, where exactly is that?

Thanks for taking the time and the excellent work.

sveinse commented 11 months ago

Good. You should have one or two installation devices as well in HA. These circuits are connected through the installation device. How does this look like for you?

sveinse commented 11 months ago

@dbarrosop You're almost there. On the page you posted for the circuit, you can navigate to the installation device by following the circled link, see below. The download diagnostics button is available on any of the zaptec devices. They will all provide the information I was requesting.

image

dbarrosop commented 11 months ago

Oh, silly me was looking in zaptec's portal...

I tried downloading it but all I am getting is a file with:

500 Internal Server Error
Server got itself in trouble

Happens with both circuits.

sveinse commented 11 months ago

Which version of zaptec do you run? Did you update to the latest (master)? The version can be read in HACS -> Integrations -> Zaptec EV Charger. The version is printed in the top left corner of the page.

dbarrosop commented 11 months ago

I am running v0.7.0 (latest beta version).

Did you update to the latest (master)?

No, but I can do it if there are unreleased fixes.

dbarrosop commented 11 months ago

Ok, I changed to master and I could download the diagnostics now:

zaptec-31b86ab6cc612b8223a37cfff753ce35-Charge circuit-a7395c2e9dd67e835f6e7e2eb31fabf7.json.txt zaptec-31b86ab6cc612b8223a37cfff753ce35-Charge circuit-aa2086e87e63550d6a1c88d8d62cfbca.json.txt

sveinse commented 11 months ago

@dbarrosop I have looked into your setup. The data fetched from Zapted Portal seems to suggest that both have set their AvailableCurrent to 16A. I see that the chargers have MaxCurrent of 25A and 16A respectively. I recommend you to check the available current in the Zaptec Portal, because both seems to be limited to 16A there.

Or you can increase the value yourself in HA: You have two zaptec installation devices in your home assistant. This means you have two entities number.<installation>_available_current. Both is currently at 16A, but one of them should be able to be adjusted up to 25A.

I was curious if there might be a bug in the zaptec integration that wrongfully sets the available current to a lower value when loading up, but after reviewing it I can't see anything that might cause this. The entity number.<installation>_available_current fetches the maxium value it may be from <installation>_max_current which seems to be right for your setup.

If you see any unexpected changes to "Available Current" please reach out.

dbarrosop commented 11 months ago

Where is it in the zaptec portal?

The things that are strange:

  1. I can set up to 20 with no problem in the tibber (and I can confirm the change as I can see how the power consumption goes up). Actually, the tibber app shows that I can go up to 25 but I see no difference in power consumption going from 20 to 25.
  2. I could also set up to 20 with no problem using this component prior to the upgrade (making service calls).

Also, I can see this in the "states":

number.XXXXXXXXXX_available_current 16.0

min: 0
max: 16
step: 1
mode: auto
unit_of_measurement: A
device_class: current
icon: mdi:waves
friendly_name: XXXXXX

number.XXXXXX_charger_max_current 20.0

min: 0
max: 16
step: 1
mode: auto
unit_of_measurement: A
device_class: current
icon: mdi:current-ac
friendly_name: XXXXX

charger_max_current is 20.0 but the max attribute is 16.0. I tried changing the states and max attributes for both numbers to 16.0 but they are reverted automatically after a few seconds.

sveinse commented 11 months ago
dbarrosop commented 11 months ago

Thanks! It was set to 11 (all three) and if I try to change it to a large number it says:

Value must be between 0 and 25

I set all three to 25 and this is what the various "numbers" say in HA now:

number.xxxxx_available_current state set to 25
attributes:
min: 0
max: 16
step: 1
mode: auto
unit_of_measurement: A
device_class: current
icon: mdi:waves

number.xxxxx_max_current state set to 20.0
attributes:

min: 0
max: 16
step: 1
mode: auto
unit_of_measurement: A
device_class: current
icon: mdi:current-ac

So looks like there is something forcing the max value to 16.

sveinse commented 11 months ago

@dbarrosop According to the data you provided me you have two installations, not just one. This means you should have two number.xxxx_available_current entities. The same applies in Zaptec Portal. There should be two installations to chose from, one with 16A and one with 25A max current

dbarrosop commented 11 months ago

There should be two installations to chose from, one with 16A and one with 25A max current

that is the problem, that I do have 2 but both are limited to 16 in HA but are not in the zaptec portal:

number.xxxxx_available_current state set to 25 (set to 25 via zaptec portal)
attributes:
min: 0
max: 16
step: 1
mode: auto
unit_of_measurement: A
device_class: current
icon: mdi:waves

number.xxxxx_max_current state set to 20.0 (I set this state in the developer tools to 20.0 but didn't change anything, still capped at 16)
attributes:

min: 0
max: 16
step: 1
mode: auto
unit_of_measurement: A
device_class: current
icon: mdi:current-ac

and

number.yyyyyy_available_current state set to 16.0
attributes:
min: 0
max: 16
step: 1
mode: auto
unit_of_measurement: A
device_class: current
icon: mdi:waves

number.yyyyyy_max_current state set to 4.0
attributes:
min: 0
max: 16
step: 1
mode: auto
unit_of_measurement: A
device_class: current
icon: mdi:current-ac

There are also two sensors for sensor.charge_circuit_max_current and both show the correct max current, for instance, for the one that should support 25:

sensor.charge_circuit_max_current state set to 25
attributes:

unit_of_measurement: A
device_class: current
icon: mdi:current-ac
friendly_name: Charge circuit Max current

But still, available current for that device is capped at 16.

dbarrosop commented 11 months ago

As another datapoint, calling the service:

service: zaptec.limit_current
data:
  installation_id: xxxxxx
  available_current: 25

works fine and it updates number.xxxxx_available_current correctly but the slider is still capped to 16.

sveinse commented 11 months ago

Good. I suspected that there are some issues here, and now we've confirmed that installation xxxx and yyyy exists but with wrong values on one of them. I'll start hunting in the code.

sveinse commented 11 months ago

@dbarrosop I don't have two installations in my Zaptec setup, so its really hard for me to debug this issue. Are you able and willing to install the zaptec-dev integration? I can instrument that version and provide debug output. You will have to run it and post the logs. We will probably need to do this a few times. If it's ok, i'll notify you when I have a version ready.

dbarrosop commented 11 months ago

Yeah, that should be fine. Depending on what's on the logs I may feel more comfortable sharing via email or some other more private means.

And if there is anything else I can do to help let me know. I have no experience developing for HA but I have written plenty of python in my past.

sveinse commented 11 months ago

@dbarrosop I agree. I will publish the findings / improvements for the zaptec integration here, but we can keep the detail for your specific installation between us. Do you use facebook or linkedin? You can look me up by name and send med a DM and I'll send you my email.

dbarrosop commented 11 months ago

Don't have facebook but sent a connection request on LinkedIn! Thx!

sveinse commented 10 months ago

The latest release in "master" contains a promising fix to the issue you have been observing. I believe it was due to data leakage from one charger to the other that created the problems for you which is now fixed. Please test this version and report back if it fixes the problem.

dbarrosop commented 10 months ago

I can confirm 0.7.1 fixes this issue. Awesome work :)