Dr-Gigavolt / dbus-aggregate-batteries

Virtual service to merge multiple serial batteries
MIT License
66 stars 11 forks source link

Invalid calculations for alarms #28

Closed jdeus closed 1 year ago

jdeus commented 1 year ago

When calculating the safest values, max() is systematically used. However, when calculating the HighVoltage_alarm, the HighChargeCurrent_alarm, or the HighTemperature_alarm for example, min() should be used. https://github.com/Dr-Gigavolt/dbus-aggregate-batteries/blob/main/aggregatebatteries.py#L417

Dr-Gigavolt commented 1 year ago

Why? OK is 0, Warning is 1 and Alarm is 2. If min used, result wäre OK even if one instance sends 1 or 2.