-
Notifications
You must be signed in to change notification settings - Fork 107
SolarEdge Speichersteuerung mit Battery Index #2269
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
SolarEdge Speichersteuerung mit Battery Index #2269
Conversation
|
Ich habe jetzt den last_mode ausgebaut und durch Auslesen der Register ersetzt. @LKuemmel oder @benderl : |
|
Ich lese nun den ControlMode vorher aus und schreibe ihn dann wieder zurück. Den Wert für battery_index übernehme ich mit 1, solange er noch nicht umgesetzt ist. Den Wert für soc_reserve übernehme ich mit 10, solange er noch nicht umgesetzt ist.
|
|
Ich habe versucht die Änderungen im master einzupflegen und die Konflikte zu beheben. |
|
Es gibt noch einen Sonderfall, der ggf. zu Problemen führen könnte: |
last_mode wieder eingebaut, Problem damit behoben. |
|
Du musst dein Branch auch hochziehen, weil zwischenzeitlich Commits gemacht wurden an gleicher Stelle, deshalb rennt dein PR auch in Konflikte. Damit musst du die bereits gemachten Änderungen aus #2317 nicht mehr mitziehen. |
Kannst Du mir verraten, wie ich das machen kann ohne Probleme zu verursachen? |
Such mal nach "Resolve Merge conflicts Github" da müsste es sicher ne Menge Anleitungen und Videos zu geben, ich nutze Visual Studio Code. |
LKuemmel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probier mal mit der Ergänzuung folgender Methoden in der common/modbus.py Strings zu lesen:
def __read_string(self, func: Callable, address: int, length: int = 1, byteorder: Endian = Endian.Big,
wordorder: Endian = Endian.Big, **kwargs) -> str:
response = self.__read_registers(func,
address,
[ModbusDataType.INT_16]*length,
byteorder,
wordorder,
**kwargs)
string = ""
for word in response:
string += struct.pack(">h", word).decode("utf-8")
return string
def read_input_string(self, address: int, length: int = 1, byteorder: Endian = Endian.Big,
wordorder: Endian = Endian.Big, **kwargs) -> str:
return self.__read_string(self._delegate.read_input_registers,
address,
length,
byteorder,
wordorder,
**kwargs)
def read_holding_string(self, address: int, length: int = 1, byteorder: Endian = Endian.Big,
wordorder: Endian = Endian.Big, **kwargs) -> str:
return self.__read_registers(self._delegate.read_holding_registers,
address,
length,
byteorder,
wordorder,
**kwargs)Für #2236 habe ich auch das Review gemacht. Wenn er rebased wurde, merge ich ihn und dann kannst Du auch einen Rebase machen und die Änderungen in Deinen PR holen.
| def get_imported_exported(self, power: float) -> Tuple[float, float]: | ||
| return self.sim_counter.sim_count(power) | ||
| try: | ||
| PowerLimitMode = data.data.bat_all_data.data.config.power_limit_mode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| PowerLimitMode = data.data.bat_all_data.data.config.power_limit_mode | |
| power_limit_mode = data.data.bat_all_data.data.config.power_limit_mode |
Bitte auf die Python naming convention achten. CamelCase zeigt einen Klassen-Namen an.
| def _encode_value(self, value: Union[int, float], data_type: ModbusDataType) -> list: | ||
| builder = pymodbus.payload.BinaryPayloadBuilder( | ||
| byteorder=pymodbus.constants.Endian.Big, | ||
| wordorder=pymodbus.constants.Endian.Little | ||
| ) | ||
| encode_methods = { | ||
| ModbusDataType.UINT_32: builder.add_32bit_uint, | ||
| ModbusDataType.INT_32: builder.add_32bit_int, | ||
| ModbusDataType.UINT_16: builder.add_16bit_uint, | ||
| ModbusDataType.INT_16: builder.add_16bit_int, | ||
| ModbusDataType.FLOAT_32: builder.add_32bit_float, | ||
| } | ||
| if data_type in encode_methods: | ||
| if data_type == ModbusDataType.FLOAT_32: | ||
| encode_methods[data_type](float(value)) | ||
| else: | ||
| encode_methods[data_type](int(value)) | ||
| else: | ||
| raise ValueError(f"Unsupported data type: {data_type}") | ||
| return builder.to_registers() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hast Du probiert, ob die Werte auch ohne vorheriges Encodieren geschrieben werden? Eigentlich macht pymodbus das.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hast Du probiert, ob die Werte auch ohne vorheriges Encodieren geschrieben werden? Eigentlich macht pymodbus das.
Ich habe das aus der SMA Speichersteuerung abgekupfert, ich brauche bei SolarEdge aber wordorder Endian.Little, das konnte ich nur an der Stelle einbauen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, das stimmt. Kannst Du den Code bitte in die common/mdobus.py verschieben? Der ist ja nicht SolarEdge-spezifisch und kann auch von anderen Modulen genutzt werden.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ich habe ja die wordorder Little fest hinterlegt, die müsste man dann vermutlich besser per übergebenem Parameter einrichten oder nur für die Kombination eine eigene def (byteorder Big, wordorder Little) anlegen?
Das übersteigt meine Copy&Paste Fähigkeiten, ich könnte nochmal im Forum fragen, ob jemand helfen kann.
|
Hallo @LKuemmel , mir ist bei einem Austausch mit openwb noch ein neuer Weg eingefallen, die soc_reserve dynamisch zu ermitteln.
Welche der Lösungen soll ich umsetzen? VG |
|
Option 2 halte ich auch für zu aufwendig.
|
Die Speichersteuerung darf bei SoC = Reserve noch nicht beendet werden, da sonst bei 2 Speichern die Steuerung immer an- und ausgeschaltet wird, habe es nochmal korrigiert und den Grund kommentiert. Ich habe es mal eingebaut, wie ich mir das denke: self.min_soc habe ich aktuell Initial nur zum Test auf 100 bzw. 35 festgelegt, später soll es auf 8 definiert werden. Nach ein Neustart geht es also einmalig max. um 4% bzw. 9% ungewollte Entladung, bis der Wert einmal gelernt wurde. Passt das so oder sollen wir die Config Option nehmen? |
|
Das kann so rein. Wenn die automatische Erkennung sich nicht als praktikabel erweist, kann ja immer noch die Konfig-Option eingebaut werden. |
* Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update power_limit sign
|
Hallo @LKuemmel , nach den Hinweisen von seaspotter ist die Übergabe der konstanten Entladeleistung an den Speicher zwingend nötig. Ich habe die Steuerung durch den Modus "Maximaler Eigenverbrauch" bei der SolarEdge Speichersteuerung über die "Maximale Entladeleistung" genutzt. Bitte gib mir Bescheid, wenn dies nochmal geändert werden soll. VG |
|
Hallo @cr0i, |
* bidi draft * typos * fixes * fixes * fixes * flake8 * pytest * fix pytest * rename * rename pro mode * fixes * workaround max current * fix zero point control mode * max_discharge_power * calc max discharge power * Exception * fix extend meter check (#2518) * fix phases scheduled charging combined with time charging (#2521) * add path (#2520) * create empty thread errors log (#2524) * loose limits for hardware check (#2525) * loose limits for hardware check * fix * fixes * set zeor point to evu counter * fix * fix max bidi current * flake8 * Only display time charging plans if time charging is activated (#2523) * Build Web Theme: Koala * use queue and listener for logging (#2528) * use queue and listener for logging * flake8 * log top (#2529) * fix merge update_config * disable screen timeout (#2535) * SolarEdge Speichersteuerung mit Battery Index (#2269) * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update bat.py * Update power_limit sign * fix SDM120 (#2536) * throttled state (#2541) * Fix SoC slider displayed for standard fahrzeug (#2540) * Build Web Theme: Koala * GoodWe second battery; fix no attribute error (#2539) * add second battery and update config * fix no attribute error * fix register adresses * GoodWe second battery - fix index detection (#2546) * add second battery and update config * fix no attribute error * fix register adresses * detect battery index * Wiki SolarEdge Speichersteuerung (#2537) * Wiki SolarEdge Speichersteuerung * Change Default SoC-Reserve * Change Default min_soc (#2543) * Fix - New Vehicle soc slider visible when SoC module present (Vehicle Cards) (#2542) * Build Web Theme: Koala * remove unused assignment of response headers (#2544) * Update requirements.txt - rise version of pycarwings3 to 0.7.14 (#2545) * Create __init__.py * Add files via upload * Add files via upload includes newest Base URL to Nissan API: https://gdcportalgw.its-mo.com/api_v230317_NE/gdc/ * Add files via upload copied 1:1 from OpenWB V1.9 * Add files via upload included module "fetch-soc" is derived from former soc.py in OpenWB V1.9 * Update soc.py * Update soc.py * Update soc.py * Update soc.py * Update responses.py * Update packages/modules/vehicles/leaf/soc.py Co-authored-by: LKuemmel <76958050+LKuemmel@users.noreply.github.com> * Update soc.py Ich habe Anzahl der Wartezyklen noch von 3 auf 9 erhöht, also insgesamt 3 Minuten Wartezeit. Bis dahin müsste der Nissan Server den Leaf in jedem Fall erreicht haben. Falls nicht, kehrt requestSoc() nach drei Minuten ohne Update des SoC auf dem Server zurück und das anschließende readSoc holt sich dann halt nur den alten SoC vom Server. In der Zeit haben die Funktionen von pycarwings2 und responses auch genug Zeit für Einträge ins Logging für eine evtl. notwendige Fehleranalyse. * Update __init__.py empty line at end of file removed accoring to warning from test run on Jul 15. * Update __init__.py * Update __init__.py * Update __init__.py empty line removed at end of file * Update pycarwings2.py At import instruction wildcard * replaced by the names of the classes to be imported * Update pycarwings2.py trailing spaces removed * Update __init__.py Empty line at end of file removed * Update soc.py missing whitespace after "," added * Update __init__.py * Delete packages/modules/vehicles/leaf/__init__.py still a LF inside, that I can't delete. So I will replace __init__.py by a really empty file to get flake 8 quiet * Add files via upload * Update requirements.txt pycarwings2 added to load this library (for the SOC module of Nissan Leaf) during start * Update packages/modules/vehicles/leaf/soc.py Co-authored-by: LKuemmel <76958050+LKuemmel@users.noreply.github.com> * Delete packages/modules/vehicles/leaf/pycarwings2.py File deleted at this position as requested * Delete packages/modules/vehicles/leaf/responses.py File deleted at this position as requested * Delete packages/modules/vehicles/leaf/soc.py soc.py using pycarwings2 removed * Add files via upload api.py using pycarwings3 uploaded. api_wo_CarState.py using pycarwings3 uploaded. test_fetch_soc.py using fetch_soc within api_wo_CarState uploaded. test_fetch_soc.py is able to run standalone, i.e. without OpenWB overhead. It prints the whole logging of interaction with the Nissan server on console and finishes with the SoC of the Nissan Leaf. Enter your user ID and password before running. This package is using https://github.com/ev-freaks/pycarwings3 from @remuslazar * Add files via upload * Add files via upload * Add files via upload * Add files via upload replace requirements.txt with a version that includes pycarwings3. * Update api.py Definition/Import für Klasse CarState ergänzt. * Update api.py Name of parameter "vnum" within fetch_soc() changed to "charge_point". * Update api.py chargepoint * Update config.py variable "region" added. variable "name" changed to "Nissan Leaf/NV200 -05.2019 (experimental)". * Update soc.py variable "region" added parameter "calc_while_charging" added and preset to False * Update api.py variable "region" added * Update config.py Variable "region" added in line 5. * Update api.py * Update api.py Parameter range added * Update api.py Import-Pfad zur config.py korrigiert * Update api.py fetching time stamp added * Update soc.py "charge_point" renamed to "vehicle" (missunderstanding) * Update api.py "chargepoint" renamed to "vehicle" "LP" renamed to "vehicle" * Delete packages/modules/vehicles/leaf/api_wo_CarState.py needed for test purpose only * Delete packages/modules/vehicles/leaf/test_fetch_soc.py needed for test purpose only * Update soc.py trailing whitespaces removed * Update api.py according to flake8: trailing whitespace removed. import of LeafSoc und LeafConfiguration removed (not used). comment shortened. blank line added * Update api.py whitespaces removed * Update soc.py calc_while_charging removed * Update soc.py variable "vehicle" renamed to "charge_point" * Update soc.py trailing whitespaces removed * Mock pycarwings3 for pytest * Update requirements.txt - rise version of pycarwings3 to 0.7.14 The vehicle module for fetching the SoC of NISSAN Leaf is using the library pycarwings3. NISSAN has changed the URL of its API as well as the method of encryption from Blowfish to AES. Details see remuslazar/homeassistant-carwings#100 New API is at URL https://gdcportalgw.its-mo.com/api_v250205_NE/gdc/ Many thanks to @remuslazar and @zwartevogel who already updated pycarwings3 to version 0.7.14, see ev-freaks/pycarwings3#14 and remuslazar/homeassistant-carwings#101 With this PR the changed pycarwings3 library will be introduced into openWB2 V2.1.8 Alpha.1 &.2 by rising the version No of pycarwings3 from 0.7.13 to 0.7.14 in requirements.txt. --------- Co-authored-by: LKuemmel <76958050+LKuemmel@users.noreply.github.com> * fix manual soc: manual_soc=0% (#2548) * fix manual soc: manual_soc=0% * flake8 * get counter state (#2549) * Widen the main layout area and display 3 cards on screen > 1400px (#2547) * pytest * Build Web Theme: Koala * Revert "Widen the main layout area and display 3 cards on screen > 1400px (#2…" (#2550) This reverts commit 2819727. * Build Web Theme: Koala * fix power limit init (#2555) * new SoC module Cupra (#2553) * add cupra connect soc * add docu * fix manual soc (#2560) * reset fault state at init for tariffs, backup clouds and vehicles (#2562) * fix template id must be int not str (#2566) * fix template id must be int not str * flake8 * adjust factors of phase values (#2564) * fix Meter_Power Nonetype (#2563) * evu kit: clean up code (#2559) * evu kit: clean up code * flake8 * component-wise error handling (#2557) * info-box for new features (#2515) * info-box for new features * flake8 * fix component-wise error handling (#2568) * fix merge * add max dis/charge power * test charge_template * integration test bidi charging * draft * bidi in scheduled charging * fixes * fixes * fix test * unused code --------- Co-authored-by: ndrsnhs <156670705+ndrsnhs@users.noreply.github.com> Co-authored-by: BrettS <168732306+Brett-S-OWB@users.noreply.github.com> Co-authored-by: LKuemmel <LKuemmel@users.noreply.github.com> Co-authored-by: cr0i <christoph@rischke.net> Co-authored-by: vuffiraa72 <u.mersewsky+github@gmail.com> Co-authored-by: mekrapp <158028484+mekrapp@users.noreply.github.com>
Umsetzung der Speichersteuerung von SolarEdge.
Für die Umsetzung des Battery Index aus #2236 wurde hier bereits der Battery Index für die Unterstützung von 2 Batterien als feste Variable eingefügt.
Nach Umsetzung des PR#2236 muss diese nur entfernt werden, damit ist die Unterstützung hierfür bereits gewährleistet.
Noch offen:
Erst ab Firmware Version 4.20.36 werden TimeOfUse Profile unterstützt.
Die Firmware kann als String aus dem WR ausgelesen werden.
Beim Beenden des Remote Modus muss bei kleinerer Version auf Maximaler Eigenverbrauch (1), statt TimeOfUse(2) zurückgestellt werden.
Um fremde Steuerungen durch z.B. SolarEdge ONE nicht zu beeinflussen, erfolgt im Modus "Immer" gar keine Steuerung.
Sonst wird beim Reboot der openWB der Remote Modus beendet, falls er durch Abstürze oder fehlerhafte Steuerungen aktiv sein sollte.
Dies ist wichtig, da sonst keine Zwangsladung bei Unterschreitung des Mindest-SoC gegen Tiefentladung mehr läuft.