dbus-mqtt-devices icon indicating copy to clipboard operation
dbus-mqtt-devices copied to clipboard

Add support for EVCharger

Open freakent opened this issue 11 months ago • 11 comments

Version

0.6.6 (current)

What version of VenusOS are you running on your GX device

3.21 (current release)

Does this issue occur during installation or at runtime ?

Other

Is there a Discussion thread for this issue? Please paste a link.

https://github.com/freakent/dbus-mqtt-devices/issues/32#issuecomment-1979792013

@dersch81

What is the issue you are actually experiencing?

Users are using the driver to add EV Chargers to their system using a customised service description. With each new release of the driver they have to manually add the service description to their services.yml file.

The service description currently in use needs refining before inclusion in the released version.

# https://github.com/victronenergy/venus/wiki/dbus#evcharger
evcharger:
  ProductId:
    default: 65535 # 0xFFFF
  CustomName:
    default: "MyCharger"
    persist: true
  Ac/Energy/Forward:
    description: "wh"
    format: "{:.2f}W"
  Ac/L1/Power:
    description: "W"
    format: "{} W"
  Ac/L2/Power:
    description: "w"
    format: "{} W"
  Ac/L3/Power:
    description: "w"
    format: "{} W"
  Ac/Power:
    description: "w"
    format: "{} W"
  AutoStart:
    description: "w"
    default: 0
#    persist: true
  ChargingTime:
    description: "in seconds"
    format: "{} s"
  Current:
    description: "A"
    default: 0
#    persist: true
  EnableDisplay:
    description: ""
  MaxCurrent:
    description: "A"
    default: 0
#    persist: true   #wird nicht gespeichert reset nach disconnect/reconnect
  Mode:
    description: ""
    default: 0
  Model:
    description: "w"
    default: "AC22NS"
  Position:
    persist: true
    default: 0
    min: 0
    max: 1
    description: "0=OUTPUT; 1=INPUT"
#  Connected:
#    description: "w"
  Role:
    description: "w"
  SetCurrent:
    description: "w"
#  StartStop:
#    description: "w"
#    persist: true
  Status:
    description: "w"
    default: 1

If this is not installation related, what does the status payload look like that you are publishing to the driver to register your device?

No response

Relevant log output

No response

freakent avatar Mar 06 '24 06:03 freakent

Things to do

  1. confirm the use of “persist: true” across all attributes
  • done: cross checked gx setup screen for evchargers
  1. use the correct descriptions from the Victron documentation
  • done
  1. confirm why some fields are commented out entirely (Connected, StartStop)
  • done: Connected is handled by the driver itself and should never be included in the yaml. StartStop is a setting so should be included
  1. create a script to test/verify the configuration is working
  • wip: i have a nodered flow that I will tidy up and share after release.

freakent avatar Mar 06 '24 07:03 freakent

With correct descriptions:

# https://github.com/victronenergy/venus/wiki/dbus#evcharger
evcharger:
  ProductId:
    default: 65535 # 0xFFFF
  CustomName:
    default: "MyCharger"
    persist: true
  Ac/Energy/Forward:
    description: "Ac Engergy Forward wh"
    format: "{:.2f}W"
  Ac/L1/Power:
    description: "L1 Power used (W)"
    format: "{} W"
  Ac/L2/Power:
    description: "L3 Power used (W)"
    format: "{} W"
  Ac/L3/Power:
    description: "L3 Power used (W)"
    format: "{} W"
  Ac/Power:
    description: "AC Power (W)"
    format: "{} W"
  AutoStart:
    description: "0=Charger autostart disabled,  1=Charger autostart enabled"
    default: 0
#    persist: true
  ChargingTime:
    description: "Total charging time (seconds)"
    format: "{} s"
  Current:
    description: "Charging current actual (A)"
    default: 0
#    persist: true
  EnableDisplay:
    description: "Control via display; 0=control disabled, 1=control enabled"
  MaxCurrent:
    description: "Max current (A)"
    default: 0
#    persist: true   #wird nicht gespeichert reset nach disconnect/reconnect
  Mode:
    description: "0=Manual, 1=Auto"
    default: 0
  Model:
    description: "Model, e.g. AC22E or AC22NS (for No Screen)"
    default: "AC22NS"
  Position:
    persist: true
    default: 0
    min: 0
    max: 1
    description: "0=OUTPUT; 1=INPUT"
  Connected:
    description: "Connected"
  Position: # 0=AC input 1;1=AC output;2=AC input 2
    persist: true
    default: 0
    min: 0
    max: 2
  Role:
    description: "Role"
  SetCurrent: # Set charge current (manual mode)
    description: "Charging current (A)"
  StartStop: # Start/stop charging (manual mode)
    description: "Start Stop"
  Status:
    description: "0=disconnected, 1=connected, 2=charging, 3=charged,4=waiting for sun, 5=waiting for RFID, 6=waiting for start, 7=low SOC, 8=ground test error, 9=welded contacts error, 10=CP input test error (shorted), 11=residual current detected, 12=undervoltage detected, 13=overvoltage detected, 14=overheating detected, 15-19=reserved, 20=charging limit"
    default: 1

Connected, Position, Role and StartStop had no supplied descriptons, which may suggest they should be treated as settings with persit=true.

freakent avatar Mar 07 '24 11:03 freakent

Settings - aka where to use persist=true

CustomName AutoStart ?? MaxCurrent ?? Mode Model Position Role

freakent avatar Mar 07 '24 12:03 freakent

@dersch81, Can you provide some code snippets of registration (publishing to device//Status) and the data values you send via MQTT from your EV charger?

freakent avatar Mar 07 '24 12:03 freakent

Sure, i have a quite big NodeRed Flow for this to read via MQTT the data from the Wallbox (i'm using two) in that way and registered two EVcharger. I can also control the charging mode via VRM, because i have mapped the mode ID's between VenusOS and OpenWB. But should work with any other "open" Wallbox, too.

I'm sure some improvement could be added to my way. But it works (mainly)

I've started not from zero: https://forum.openwb.de/viewtopic.php?t=6044 but i have tweaked something.

image

EVCharger Flow 1.json EVCharger Flow 2.json

In VRM they appear like this: image

Example of local Venus GUI: image

MQTT Explorer: Screenshot 2024-03-07 140542

Screenshot 2024-03-07 140701

dbus-spy: image

image

dersch81 avatar Mar 07 '24 13:03 dersch81

In your nodered flows, what does Gate do?

freakent avatar Mar 07 '24 14:03 freakent

In that flow the gate is just preventing to flood the register with zero values. It opens only in case of >0.

In general i'm using gates a lot to control main flows with subflows.

dersch81 avatar Mar 07 '24 14:03 dersch81

In that flow the gate is just preventing to flood the register with zero values. It opens only in case of >0.

In general i'm using gates a lot to control main flows with subflows.

I'm sorry my information about the gate was wrong. It is controlling the counting of charging time. When the current is >0 then it opens the gate and the timestamp payload is able to flow. If current is =0 then the gate is closed and time counting stopps. The next process is starting from time 0 again.

When i move one EVcharge to another AC side then you see much more information in vrm. In my case that is hidden because of the consolidation of two EV chargers

image

dersch81 avatar Mar 07 '24 20:03 dersch81

These are the attributes that need persist = true

Mode SetCurrent MaxCurrent Position AutoStart EnableDisplay CustomName

image

freakent avatar Mar 08 '24 14:03 freakent

persist = true just means to have the same state after restart, right?

dersch81 avatar Mar 08 '24 21:03 dersch81

Yes, which also affects the device specific setup screen on the GX device (as per my screenshots above). If the correct fields are not set as persist = true the setup screen will not work correctly. It might have been better to call this parameter "setting" instead of "persist" to more accurately affect what it does.

freakent avatar Mar 09 '24 06:03 freakent

Fixed in v0.8.0.

freakent avatar Apr 26 '24 13:04 freakent