Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions charger/phoenix-ev-eth.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,24 @@ func init() {

// NewPhoenixEVEthFromConfig creates a PhoenixEVEth charger from generic config
func NewPhoenixEVEthFromConfig(ctx context.Context, other map[string]any) (api.Charger, error) {
cc := modbus.TcpSettings{
ID: 255,
cc := struct {
modbus.TcpSettings `mapstructure:",squash"`
MilliCurrentSupported bool
}{
TcpSettings: modbus.TcpSettings{
ID: 255,
},
}

if err := util.DecodeOther(other, &cc); err != nil {
return nil, err
}

return NewPhoenixEVEth(ctx, cc.URI, cc.ID)
return NewPhoenixEVEth(ctx, cc.URI, cc.ID, cc.MilliCurrentSupported)
}

// NewPhoenixEVEth creates a PhoenixEVEth charger
func NewPhoenixEVEth(ctx context.Context, uri string, slaveID uint8) (api.Charger, error) {
func NewPhoenixEVEth(ctx context.Context, uri string, slaveID uint8, milliCurrentSupported bool) (api.Charger, error) {
conn, err := modbus.NewConnection(ctx, uri, "", "", 0, modbus.Tcp, slaveID)
if err != nil {
return nil, err
Expand Down Expand Up @@ -110,7 +115,12 @@ func NewPhoenixEVEth(ctx context.Context, uri string, slaveID uint8) (api.Charge
}

// check presence of extended Wallbe firmware
if b, err := wb.conn.ReadHoldingRegisters(phxRegMaxCurrent, 1); err == nil && encoding.Uint16(b) >= 60 {
if !milliCurrentSupported {
b, err := wb.conn.ReadHoldingRegisters(phxRegMaxCurrent, 1)
milliCurrentSupported = err == nil && encoding.Uint16(b) >= 60
}

if milliCurrentSupported {
wb.isWallbe = true
implement.May(wb, implement.ChargerEx(wb.maxCurrentMillis))
}
Expand Down
13 changes: 13 additions & 0 deletions templates/definition/charger/phoenix-ev-eth.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,19 @@ params:
- name: modbus
choice: ["tcpip"]
id: 255
- name: millicurrentsupported
type: bool
default: false
advanced: true
description:
de: mA-Regelung unterstützt
en: mA regulation supported
help:
de: Erzwingt die mA-Regelung der erweiterten Wallbe-Firmware, falls die automatische Erkennung fehlschlägt.
en: Forces mA regulation of the extended Wallbe firmware in case autodetection fails.
render: |
type: phoenix-ev-eth
{{- include "modbus" . }}
{{- if eq .millicurrentsupported "true" }}
millicurrentsupported: true
{{- end }}
Loading