Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Phase switching does not work correctly #380

Open
stu75 opened this issue Sep 1, 2024 · 22 comments
Open

Phase switching does not work correctly #380

stu75 opened this issue Sep 1, 2024 · 22 comments
Labels

Comments

@stu75
Copy link

stu75 commented Sep 1, 2024

Describe the bug
Since I replaced my KEBA P30 Dienstwagen wallbox, the phase switch is always activated as soon as I set enableUser to true or currentUser to a different value. In addition, the following warning is logged in the log every second:

Invalid value for 1p3p switch: 0 (type number)
or
Invalid value for 1p3p switch: 1 (type number)

I have activated the dipswitch 1.3 (1.2 is off). In the KEBA webfrontend the phase switching Option is on, with UDP. The IOBroker Adapter is configured in passiv mode with 5 second refresh intervall. The options "phases switching uses x2..." and "contactor is NO" are enabled. This configuration worked since 3 months with my old Wallbox whith old Firmware, but the software-modules where inconsistent and so Keba replaced it with a new one.

The new wallbox should just do this what the adapter transmits, but the adapter (or the wallbox?) set automatically the x2phaseSwitch to 1 if I change the currentUser value. So if I have selected 1 phase charging with 10A and change the current to 8A, the Adapter are changing the value x2phaseSwitch from 0 to 1 (3 phase charging), but should remain at 0 (1 phase charging).

To Reproduce
Steps to reproduce the behavior:

  1. Vehicle ist connect and RFID authentication ist valid
  2. set currentUser to 10000 mA
  3. set enableUser to true
  4. wallbox starts the charging process with 3 phases
  5. after approx 5 minutes (cooldown) set x2phaseSwitch to 0
  6. wallbox changing 1 phase
  7. the state remains at 0
  8. change currentUser to 8000 mA
  9. wallbox changing to 3 phases with 8A -> why does it switch to 3 phases??

Expected behavior
At step 9 the wallbox sould charge with 1 phasee and 8A.

Screenshots & Logfiles
Attached is the screenshot of the log. Regardless of whether the value of x2switch is 0 or 1, it is constantly logged that the value is invalid.
Screenshot 2024-09-01 154410

After restarting the keContact adapter, only null values ​​are visible in the configuration of 1p3pSwitchIsNO.
Screenshot 2024-09-01 155222

Versions:

  • Adapter version: 2.2.0
  • JS-Controller version: 6.0.11
  • Node version: 5.2.1
  • Operating system: Ubuntu 20.04.3 LTS (GNU/Linux 5.15.136-1-pve x86_64)
@stu75 stu75 changed the title Phaseswitchin Phase switching did not work correctly Sep 1, 2024
@mcm1957 mcm1957 closed this as completed Sep 1, 2024
@mcm1957 mcm1957 added the invalid label Sep 1, 2024
@stu75
Copy link
Author

stu75 commented Sep 1, 2024

I'm sorry, but I sent it too early. I have now completed the description. Can you reopen the ticket?

@mcm1957 mcm1957 reopened this Sep 1, 2024
@stu75 stu75 changed the title Phase switching did not work correctly Phase switching does not work correctly Sep 1, 2024
@Sneak-L8
Copy link
Collaborator

First step: please check if log contains a message "Using min time between phase switching of" (severity info). If yes, X2 switch is recognized for switching. But I guess message is missing and X2swithc is not recognized correctly. Then, please go to settings and disable X" switch. Save, Enter again and re-activate switch. Save.

@stu75
Copy link
Author

stu75 commented Sep 11, 2024

You are right, there is no message in the log like "using min time....". I now turned off the X2-Switch and done save+close and activate the checkbox with save+close. The adapter was restating after save+clos, but there is nomessage "using min time...". But if i turn off the X2Switch, the "Invalid value for 1p3p" does not appear.

This is the checkbox i changed:
image

@Sneak-L8
Copy link
Collaborator

I think you currently have to set up at least stateRegard or stateSurplus to make it work.
Can you please check?

@stu75
Copy link
Author

stu75 commented Sep 11, 2024

Ok, I wrote my Energymeter object into stateRegard and now I have following behavior:

  • Log shows Using min time between phase switching of: 305 and config.1p3pSwitchIsNO: true, 1p = 0, 3p = 1, off = 0
  • no Invalid value for 1p3p switch appears
  • but when I change the userCurrent, the adapter set x2phaseSwitch to 1

@Sneak-L8
Copy link
Collaborator

can you provide a debug log of the last step you described?

@stu75
Copy link
Author

stu75 commented Sep 12, 2024

Here the debug log. Value of currentUser was 6000.

2024-09-12 19:59:57.639 - debug: kecontact.0 (136485) History ID received: 00
2024-09-12 19:59:58.066 - debug: kecontact.0 (136485) Available surplus: 33.4

First I set X2 to 0

2024-09-12 20:00:38.599 - debug: kecontact.0 (136485) Sent "x2 0" to 172.16.2.4:7090
2024-09-12 20:00:38.601 - debug: kecontact.0 (136485) UDP datagram from 172.16.2.4:7090: "TCH-OK :done
"
2024-09-12 20:00:38.602 - debug: kecontact.0 (136485) Received TCH-OK :done

Then I changed the currentUser to 7000

2024-09-12 20:01:11.997 - debug: kecontact.0 (136485) Sent "curr 7000" to 172.16.2.4:7090
2024-09-12 20:01:12.001 - debug: kecontact.0 (136485) UDP datagram from 172.16.2.4:7090: "TCH-ERR:X2 : not allowed now
"

And now we got that X2 is not allowed (because it was during the cooldown)

2024-09-12 20:01:12.002 - error: kecontact.0 (136485) Error received from wallbox: TCH-ERR:X2 : not allowed now
2024-09-12 20:01:57.037 - debug: kecontact.0 (136485) Sent "report 2" to 172.16.2.4:7090
2024-09-12 20:01:57.039 - debug: kecontact.0 (136485) UDP datagram from 172.16.2.4:7090: "{

Is this a bug in the Keba api?

@stu75
Copy link
Author

stu75 commented Sep 12, 2024

This is a try after the X2 cooldown

2024-09-12 20:11:57.646 - debug: kecontact.0 (136485) History ID received: 00
2024-09-12 20:12:30.506 - info: influxdb.0 (190) No Data
2024-09-12 20:12:37.139 - debug: kecontact.0 (136485) Sent "curr 8000" to 172.16.2.4:7090
2024-09-12 20:12:37.140 - debug: kecontact.0 (136485) UDP datagram from 172.16.2.4:7090: "TCH-OK :done
"
2024-09-12 20:12:37.142 - debug: kecontact.0 (136485) Received TCH-OK :done
2024-09-12 20:13:09.835 - debug: kecontact.0 (136485) Sent "curr 9000" to 172.16.2.4:7090
2024-09-12 20:13:09.837 - debug: kecontact.0 (136485) UDP datagram from 172.16.2.4:7090: "TCH-OK :done
"
2024-09-12 20:13:09.838 - debug: kecontact.0 (136485) Received TCH-OK :done
2024-09-12 20:13:11.809 - info: admin.0 (167) <== Disconnect system.user.admin from ::ffff:172.16.1.2 admin
2024-09-12 20:13:13.606 - info: admin.0 (167) ==> Connected system.user.admin from ::ffff:172.16.1.2
2024-09-12 20:13:57.042 - debug: kecontact.0 (136485) Sent "report 2" to 172.16.2.4:7090
2024-09-12 20:13:57.045 - debug: kecontact.0 (136485) UDP datagram from 172.16.2.4:7090: "{
"ID": "2",
"State": 1,
"Error1": 0,
"Error2": 0,
"Plug": 3,
"AuthON": 1,
"Authreq": 1,
"Enable sys": 0,
"Enable user": 1,
"Max curr": 0,
"Max curr %": 1000,
"Curr HW": 16000,
"Curr user": 9000,
"Curr FS": 0,
"Tmo FS": 0,
"Curr timer": 16000,
"Tmo CT": 0,
"Setenergy": 0,
"Output": 1,
"Input": 0,
"X2 phaseSwitch source": 4,
"X2 phaseSwitch": 1,
"Serial": "xxxx",
"Sec": 1241245
}
"

@Sneak-L8
Copy link
Collaborator

If I understand you right, with setting up regard state almost everything works fine? You're "only" wondering why Keba denies "curr" command? But switching 1p and 3p works? Then, perhaps this is an error or Keba not only denies switching phases but also chinging current while cooldown.

@stu75
Copy link
Author

stu75 commented Sep 13, 2024

Yes, since the State Regard object is set, the "Invalid value for 1p3p switch" warning is no longer reported. But step 8 in the error description still causes the problem in step 9. This means that changing the currentUser value results in the X2 switch being activated. But X2 shouldn't change when I change the charging current.

In the second debug log you can see at 2024-09-12 20:13:57.045 that the X2 switch automatically changed to 1 after changing the charging current.

I configured the new wallbox in exactly the same way as my old one, but the old wallbox had a broken firmware with an older version on it, so I replaced it.

Maybe the old firmware required a slightly different configuration. Here is my current one:
image
image

@Sneak-L8
Copy link
Collaborator

Ok, when I see it right, no other log entries occurs while setting current to 8000 and 9000. No messages ("UDP datagram from 172.16.2.4:7090") come in? And with "report 2" x2 switch has changed to 1?
Then I would advice to contact Keba with a log of all entries from current to the answer of report 2.
If your new Keba is configured exactly like the old one and you have the same settings in kecontact adapter, the only difference is your wallbox (and its firmware)....

@stu75
Copy link
Author

stu75 commented Sep 13, 2024

OK, thank you very much for your time. I just sent the commands individually using a UDP tool called “Packet Sender”. If I change the charging current with "curr nnnn", then the wallbox automatically sets X2 to 1. This means that this problem is due to the wallbox and not the adapter.

If I find out why the wallbox is behaving so strangely, I'll let you know

@stu75
Copy link
Author

stu75 commented Sep 14, 2024

So, after some research and a few tests, I suspect that the problem could also affect other users, but I also found a solution for it.

First of all, my insight:

  • the udp command "curr nnnn" forces the switching of X2 to 1
  • the udp command "currtime nnnn 1" changing the current without changing X2 😎

What I noticed while browsing the Keba documents

  • In the last Releasenotes document KeContactP30x_releasnotes_sw_1.18_en.pdf I found following change in Version 1.17
    5.2.8 Phase Switching via UDP enabled
    For a direct initiation of the phase switching feature by an external energy management
    system, the KeContact P30 functionality has been enhanced to decide on itself if it should
    charge with 1-phase or 3-phases based on the UDP control method
    .
    Up to now, the KeContact P30 forwarded information to the external phase switch S10,
    which reacted upon the command by the inverter.

    However, it is unclear to me on what basis the wallbox decides between 1 or 3 phases.
  • Additinaly I found the folowing note in the kecontactp30udp_pgen.pdf manual
    3.3.2 UDP command: curr
    The command curr can be used to control the target charging current at any time. This command directly changes the value in the "Curr user" field in report 2. All changes made by curr are permanent until the device is rebooted. The only option to remove a curr setting without a restart is to overwrite it with a currtime command. When the currtime setting is copied from "Curr timer" to "Curr user" the value from a previous curr is overwritten and thus is resettable by unplugging (see section command: currtime). In general, it is not recommended to use the curr command, since the current can be easily controlled via the non-permanent currtime. If the charging current of the charging station needs to be lowered permanently, a reconfiguration of the DIP switch settings is recommended (see “installation manual”)

    Ok, it is recommended to use the "currtime" command, but it is not clear why the wallbox sets X2 to 1 after this command.

But now the big question: When I have to use the currtime command, how can I trigger this command with this adapter? The UDP command uses 2 parameters (mA and seconds). But when I change the currentTimer object I get the following error message:
Unsupported state change: kecontact.0.currentTimer

@Sneak-L8
Copy link
Collaborator

Thanks for that investigation. The easiest way would probably to ask Keba about their logic for self-adjusting X2 switch.
I see, that instead of using "curr " there was code "currtime 1" commented out. But I don't remember why I changed this or I only used currtime as a test....
Let's see what Keba will anser and how to react then (changing to currtime, new option to select curr or currtime)...

@Sneak-L8
Copy link
Collaborator

currtime is not yet supported for update. But this is not much effort to enable.
I currently changed my notebook and IDE is not yet fully installed. so it will still take some time...

@stu75
Copy link
Author

stu75 commented Sep 14, 2024

Ok. let's see what solution we have earlier :)

My temporary workaround ist to use a UDP out Node in Node-RED and send the currtime cmd directly to the wallbox. It is not clean, but it works.

@Sneak-L8
Copy link
Collaborator

I just upload a new version to git. X2 should now work without regard or surplus state. Also currtime should now work (also set timeoutforcurr state).

@stu75
Copy link
Author

stu75 commented Sep 15, 2024

Oh, that's fine!
Is there a simple way to install this fix before the adapter is released?
Do you know, when the adapter version will be released approx in IOBroker?

@Sneak-L8
Copy link
Collaborator

Yes, it's easy. Activate expert mode by klicking the symbol look like a masked head. Then on the adapter tab there's a git symbol (like a cat). With this, you can install special version. Klick on the github tab and select kecontact and install. Now, you're using the latest github version.
I also have to update some other issues, so new version will take about 1 months, I guess.

@stu75
Copy link
Author

stu75 commented Sep 17, 2024

So, now I installed the Git adapter and tested it again in passive mode. Changing the charging current via currentTime now works, but only if you also set timeoutCurrentTimer to >=1. After the value changed to 0 after restarting the adapter, I first looked for an error, which wasn't there :-) It would be great if the default value is 1 instead 0. A intial time of 0 makes no sense. In the manual you will find the following:
currtime 0 0: This command nullifies a previously issued currtime as long as the timer is still running

But something is strange in this version: If the UDP value of "Curr Timer" or "Curr User" changes, the data in the adapter is not updated. The refresh interval is set to 5 seconds.

@stu75
Copy link
Author

stu75 commented Sep 19, 2024

Hm, I can not reproduce the "curr" refreshing problem yet. So I think it was an other issue.

@Sneak-L8
Copy link
Collaborator

Thanks for your feedback. I introduced a default value for curr timeout. But I think it is only relevant for new instances. But it will help new users. It's on git.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants