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

Sofar: Support for multiple, individual storage units #19240

Merged

Conversation

cschlipf
Copy link
Contributor

@cschlipf cschlipf commented Feb 27, 2025

Closes #19219

BREAKING CHANGE

Does no longer support one single meter entry for all storage units. Instead users need to configure separate meters with different storage units like this:

site:
  meters:
    battery:
      - storageunit-1
      - storageunit-2

meters:
  - name: storageunit-1
    type: template
    template: sofarsolar-g3
    usage: battery   
    modbus: tcpip
    id: 1
    host: 192.168.158.13 
    port: 502 
  - name: storageunit-2
    type: template
    template: sofarsolar-g3
    usage: battery   
    modbus: tcpip
    id: 1
    host: 192.168.158.13 
    port: 502 
    storageunit: 2

Advantage: We are back to an accuracy of 10W instead of 100W

@cschlipf cschlipf changed the title Sofar: Support for multiple storage units Sofar: Support for multiple, individual storage units Feb 27, 2025
@cschlipf
Copy link
Contributor Author

@ep4711

Hier der change zu individuellen Storage Units. Wäre Klasse, wenn Du das testen könntest, wenn es im nächsten Nightly nach dem Merge drin ist.

@andig andig added the devices Specific device support label Feb 27, 2025
@cschlipf
Copy link
Contributor Author

cschlipf commented Feb 28, 2025

@andig, @premultiply - um den Breaking Change zu vermieden könnte man den default der storageunit auf 0 setzen, was dann die Total Values nehmen würde. Siehe auch #19219 (comment) wo man das für den PV Eingang ähnlich handeln kann.

Was meint ihr?

Ich habe nur Bauchschmerzen, dass ich es nicht hinbekomme das lokal zu testen. Habe den decontainer am laufen aber nach dem erfolgreichen make install-ui läuft make install nicht durch:

vscode ➜ /workspaces/evcc (fix19219-sofar-support-multiple-storage-units) $ make install
go install tool
# runtime
/usr/local/go/src/runtime/map.go:877:6: mapiterinit redeclared in this block
        /usr/local/go/src/runtime/linkname_swiss.go:91:6: other declaration of mapiterinit
/usr/local/go/src/runtime/map.go:937:6: mapiternext redeclared in this block
        /usr/local/go/src/runtime/linkname_swiss.go:144:6: other declaration of mapiternext
/usr/local/go/src/runtime/map.go:1519:6: reflect_mapiterinit redeclared in this block
        /usr/local/go/src/runtime/linkname_swiss.go:123:6: other declaration of reflect_mapiterinit
/usr/local/go/src/runtime/map.go:1536:6: reflect_mapiternext redeclared in this block
        /usr/local/go/src/runtime/linkname_swiss.go:173:6: other declaration of reflect_mapiternext
/usr/local/go/src/runtime/map.go:1550:6: reflect_mapiterkey redeclared in this block
        /usr/local/go/src/runtime/linkname_swiss.go:191:6: other declaration of reflect_mapiterkey
/usr/local/go/src/runtime/map.go:1564:6: reflect_mapiterelem redeclared in this block
        /usr/local/go/src/runtime/linkname_swiss.go:209:6: other declaration of reflect_mapiterelem
/usr/local/go/src/runtime/map_fast32_swiss.go:18:6: mapaccess1_fast32 redeclared in this block
        /usr/local/go/src/runtime/map_fast32.go:13:6: other declaration of mapaccess1_fast32
/usr/local/go/src/runtime/map_fast32_swiss.go:29:6: mapaccess2_fast32 redeclared in this block
        /usr/local/go/src/runtime/map_fast32.go:62:6: other declaration of mapaccess2_fast32
/usr/local/go/src/runtime/map_fast32_swiss.go:41:6: mapassign_fast32 redeclared in this block
        /usr/local/go/src/runtime/map_fast32.go:113:6: other declaration of mapassign_fast32
/usr/local/go/src/runtime/map_fast32_swiss.go:52:6: mapassign_fast32ptr redeclared in this block
        /usr/local/go/src/runtime/map_fast32.go:212:6: other declaration of mapassign_fast32ptr
/usr/local/go/src/runtime/map_fast32_swiss.go:52:6: too many errors
make: *** [Makefile:40: install] Error 1

@andig
Copy link
Member

andig commented Feb 28, 2025

Es sollte der Defaultwert ziehen- kein böser BC.

@cschlipf
Copy link
Contributor Author

Es sollte der Defaultwert ziehen- kein böser BC.

Ja - hier nicht schlimm. Scheint aktuell ja nur einen Nutzer zu treffen. Bei der PV wäre das schlimmer und dachte falls man es dort machen will, könnte man es hier auch tun.

@@ -133,23 +139,47 @@ render: |
source: modbus
{{- include "modbus" . | indent 2 }}
register:
address: 0x0667 # Power_Bat_Total
{{- if eq .storageunit "1" }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mir fällt grad noch auf- hänge ich aber nicht dran- dass man auch einfach

base + (unit - 1) * 7

machen könnte ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Das wäre dann bei SQL eine SQL Injection ;-)

Aber "else if" scheint durchgelaufen zu sein.

@andig andig merged commit 598a105 into evcc-io:master Feb 28, 2025
6 checks passed
@ep4711
Copy link

ep4711 commented Feb 28, 2025

@ep4711

Hier der change zu individuellen Storage Units. Wäre Klasse, wenn Du das testen könntest, wenn es im nächsten Nightly nach dem Merge drin ist.

@cschlipf :
Ich habe die Installation auf eine Synology im Container Manager (docker). Ich habe mir das aktuell angebotene nightly geladen (zeigt v0.200.4 nightly) und die Konfiguration mit 2 Storage Units verwendet bekomme aber die Meldung

FATAL 2025/02/28 16:16:23 meter [sofar-battery-2] cannot create meter 'sofar-battery-2': cannot create meter type 'template': invalid key: storageunit

hab ich da nicht die nightly version, in den das Feature mit den 2 Units schon drin ist? wie kann ich auf die richtige version checken? - Sorry bin nicht so erfahren mit github...

@cschlipf
Copy link
Contributor Author

@ep4711 Das wurde erst heute morgen gemerged, wird also erst morgen im Nightly drin sein.

@ep4711
Copy link

ep4711 commented Mar 1, 2025

@ep4711 Das wurde erst heute morgen gemerged, wird also erst morgen im Nightly drin sein.

@cschlipf : guten morgen Carsten! Es funktioniert in nightly! Ihr seid echt klasse! Danke für deinen Einsatz!

IMG_0640
IMG_0639
👍

@cschlipf
Copy link
Contributor Author

cschlipf commented Mar 1, 2025

Vielen Dank für's testen

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

Successfully merging this pull request may close these issues.

Sofar: Support multiple, individual storage units
4 participants