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

Fix SBSE 4.0 battery (dis)charge power #7

Merged
merged 2 commits into from
Aug 11, 2024

Conversation

tanuva
Copy link

@tanuva tanuva commented Aug 10, 2024

There was a mismatch between the profile name in the device profile and the sensor name given in ennexosSensors: BatDsch.CurBatDsch.1 vs BatDsch.CurBatDsch. I think applying both commits in this PR moves it in the right direction since it matches the pattern I see for BatChrg.CurBatCha.

However, I'm not entirely sure this is correct. See these sensor definitions (including this PR):

Sensor("BatChrg.CurBatCha", Identifier.battery_power_charge_total, factor=1, unit="W"),
Sensor("BatChrg.CurBatChaArr.1", Identifier.battery_power_charge_total, factor=1, unit="W"),

Sensor("BatDsch.CurBatDsch", Identifier.battery_power_discharge_total, factor=1, unit="W"),
Sensor("BatDsch.CurBatDschArr.1", Identifier.battery_power_discharge_total, factor=1, unit="W"),

Each pair of sensors now shares the same identifier. That was already the case for CurBatCha and is now also the case for CurBatDsch - and leads to the uglier Arr.1 values overriding the overall charge/discharge power sensors if I'm not mistaken.

This feels like we might need a number of additional identifiers for elements of the battery array - or drop reporting them... 🤔


Just for the record, I tested with an SBSE 4.0 running firmware 03.08.11.R.

The profile name with `.1` included does not appear in the
ennexosSensors list and is therefore never picked up.
@tanuva tanuva changed the title Fix SBSE 4.0 battery discharge power Fix SBSE 4.0 battery (dis)charge power Aug 10, 2024
@tanuva
Copy link
Author

tanuva commented Aug 10, 2024

Btw, I'd be perfectly fine with German as well if that's easier for you, I just stick to English to avoid needlessly excluding folks.

@littleyoda
Copy link
Owner

<german, damit es schneller geht>
Ich dachte eigentlich, dass ich eine Abfrage bzgl. doppelten Identifier hätte. Muss ich die Tage nochmal prüfen.

Unterscheiden sich bei dir BatDsch.CurBatDsch und BatChrg.CurBatChaArr.1?
[Diese Sensorabkürzungen von SMA verursachen irgendwie Kopfschmerzen bei mir]
Da an den SBSE ja nur ein Akku angeschlossen werden kann, sollten die Messwerte gleich sein.

Aber trotzdem es für die Zukunft korrigieren.

Sensor("BatChrg.CurBatCha", Identifier.battery_power_charge_total, factor=1, unit="W"),
Sensor("BatDsch.CurBatDsch", Identifier.battery_power_discharge_a, factor=1, unit="W"),

Both refer to the total amount, so that each should be assigned to the "total" sensor.
discharge_a is wrong and should be replaced by Identifier.battery_discharge_total,

Sensor("BatChrg.CurBatChaArr.1", Identifier.battery_power_charge_total, factor=1, unit="W"),
Sensor("BatDsch.CurBatDschArr.1", Identifier.battery_discharge_total, factor=1, unit="W"),

These two refer to the first battery, so "_a" should be used.
Identifier.battery_power_charge_a and Identifier.battery_power_discharge_a

Agree to the following?

Sensor("BatChrg.CurBatCha",           Identifier.battery_power_charge_total, factor=1, unit="W"),
Sensor("BatDsch.CurBatDsch",         Identifier.battery_discharge_total, factor=1, unit="W"),

Sensor("BatChrg.CurBatChaArr.1",   Identifier.battery_power_charge_a, factor=1, unit="W"),
Sensor("BatDsch.CurBatDschArr.1", Identifier.battery_power_discharge_a, factor=1, unit="W"),

* `CurBatChaArr.1` is a subcomponent of the overall value in
`CurBatCha`, thus it should have the `_a` identifier.
* Swap the `_a` and `_total_` identifiers for `CurBatDsch` and
`CurBatDschArr.1`, reflecting the subcomponent hierarchy as well.

In both cases, the `Arr.1` value is slightly different from the total
value for me, but it is not obvious why and how. I just have one
battery, so in my world they should be the same. Therefore I'd stick
to the hierarchical setup. If needed both can be made available in Home
Assistant.
@tanuva tanuva force-pushed the sbse4-battery-power branch from 2f26e55 to fa31597 Compare August 10, 2024 17:53
@tanuva
Copy link
Author

tanuva commented Aug 10, 2024

Unterscheiden sich bei dir BatDsch.CurBatDsch und BatChrg.CurBatChaArr.1?
Da an den SBSE ja nur ein Akku angeschlossen werden kann, sollten die Messwerte gleich sein.

Intuitiv hätte ich gesagt "natürlich sind die gleich" - aber nein. Ich hatte hier grade schwankend ein bisschen Ladung und ein bisschen Entladung (zweistelliger Bereich). Beim Laden ist der Wert von CurBatCha ein paar Watt größer (als CurBatChaArr.1) und beim Entladen der Wert von CurBatDschArr.1. Was auch immer das jetzt wieder für einen Grund hat. Mit Dokumentation für die Werte ist SMA ja nicht direkt großzügig...

[Diese Sensorabkürzungen von SMA verursachen irgendwie Kopfschmerzen bei mir]

Same here, same here...

I updated the code with your proposal. Of course the _a variant is the identifier to use. (I keep reading that part as the unit Ampère instead of "option a"...)

@littleyoda littleyoda merged commit 72db232 into littleyoda:master Aug 11, 2024
@tanuva tanuva deleted the sbse4-battery-power branch August 11, 2024 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants