Commit Graph

2496 Commits

Author SHA1 Message Date
Snoopy-HSS
f6680bd664 Feature: Support SMA HomeManager 2.0 as PowerMeter 2024-03-17 20:20:29 +01:00
Bernhard Kirchen
900326742c fix: prevent getTotalPower() reading intermediate results
the SDM power meter (among others) writes the power consumption of three
phases in multiple steps. this change helps to prevent getTotalPower()
reading intermediate values, e.g., reading a new value for phase 1 but
old values for phase 2 and 3 since phase 2 is currently read.

cache the values, and write them all at once, protected by a mutex,
later.

closes #732.
2024-03-17 16:54:48 +01:00
Bernhard Kirchen
13bc943dd5 Feature: Refactor/Simplify DPL settings
this changeset refactors the web application's DPL settings view. the
DPL settings can be complex, and they shall be presented in a way that
allows users to comprehend their meaning. irrelevant settings are now
hidden or displayed dynamically based on the influencing settings.

* group SoC thresholds into their own card

* hide battery SoC thresholds if battery disabled. if the user did not
  even enable the battery interface, battery SoC values will not be used
  for DPL decisions. in that case we completely hide the respective
  settings from the DPL admin view. this reduces the amount of settings
  for new users and especially users who don't even have a battery in
  their setup or have no BMS connected.

* group voltage thresholds and improve label texts

* fix load correction factor unit

* fix header (wording)

* group solar-passthrough settings in new card

* group inverter-related settings

* hide solar passthrough settings if VE.Direct is disabled. closes #662.

* completely disable form if any requirement is not met

* list available inverters by name and type. this makes it much more
  convenient to select the right inverter, especially since the order of
  the inverters in the web UI is decoupled from their position in the
  internal array, which was used to select them previously. care was
  taken that old configs select the same inverter after an update.
  when editing the DPL settings, the selects an inverter from the newly
  created drow-down list, and the respective old inverter is
  pre-selected.

* disable form if no inverter is configured (config alert)

* make inverter input selection dynamic. adjust selection to actual
  amount of channels for selected inverter. skip selection altogether if
  inverter has only one channel, or if it is solar powered.

* web app: wording adjustments

* group meta data into new property and exclude from submission. saves
  memory when evaluating the submitted settings.

* hide irrelevant settings if inverter is solar-powered

* move restart hour setting to inverter card. translate setting which
  disabled automatic restart.

* simplify "drain strategy" setting into an on/off toggle. care was
  taken that existing configs work the same after an upgrade. the
  respective drain strategy is translated into the new setting when
  reading the config. once the config is written, the new setting is
  persisted and the old is not part of the config any more.

* show more configuration hints, depending on actual configuration

* replace inputs by InputElement components where possible
2024-03-17 16:50:57 +01:00
Bernhard Kirchen
7d6b7252bf polish support for second VE.Direct MPPT charge controller
* fix compiler warning in SerialPortManager.cpp: function must not
  return void

* clean up and simplify implementation of usesHwPort2()
  * make const
  * overrides are final
  * default implementation returns false
  * implement in header, as the implementation is very simple

* rename PortManager to SerialPortManager. as "PortManager" is too
  generic, the static instance of the serial port manager is renamed to
  "SerialPortManager". the class is therefore renamed to
  SerialPortManagerClass, which is in line with other (static) classes
  withing OpenDTU(-OnBattery).

* implement separate data ages for MPPT charge controllers

* make sure MPPT data and live data time out

* do not use invalid data of MPPT controlers for calculations

* add :key binding to v-for iterating over MPPT instances
2024-03-17 16:50:15 +01:00
Arman Vartan
75541be248 Feature: Support for second Victron MPPT charge controller
this change adds support for a second Victron MPPT charge controller
using a second serial connection.

* Add device configuration for a second victron mppt
* Update VedirectView for second victron mppt
* Update MqttHandleVedirect for second victron mppt
* Update MqttHandleVedirectHass for second victron mppt
* Handle nonexisting victron controllers with optionals
* Add bool-function to Battery and inherited classes, if uart port 2 is
  being used
* Introduced a serial port manager. In order to prevent the battery and
  the Victron MPPT to use the same hw serial ports, this class keeps
  track of the used ports and their owners.
2024-03-17 16:50:15 +01:00
Bernhard Kirchen
21c19f4b7f fix: preserve SmartShunt energy values precision 2024-03-17 08:31:54 +01:00
Bernhard Kirchen
7ebd4f4632 clean up defaults.h
* remove duplicated #defines. this is most probably a merge error from
  2024-01-16, as evidenced by 63205f88b, which added these duplicates.

* sort values by upstream and downstream projects. add a comment which
  tells us in the future where OpenDTU-OnBattery-specific values start.
2024-03-16 14:31:07 +01:00
Thomas Basler
f66b4fa5f1 webapp: add app.js.gz 2024-03-15 22:03:54 +01:00
Thomas Basler
7c60c37f49 webapp: update dependencies 2024-03-15 20:16:59 +01:00
Thomas Basler
77b38dff2b Fix: Updated source comments to also match hex numbers 2024-03-15 20:14:29 +01:00
Thomas Basler
dc04a63f7c Upgrade ESP Async WebServer from 2.7.0 to 2.8.1 2024-03-15 20:04:42 +01:00
Thomas Basler
cab38d3c84 Upgrade olikraus/U8g2 from 2.35.10 to 2.35.14 2024-03-15 19:57:28 +01:00
Thomas Basler
3138e28cdf webapp: Remove not required cast to string 2024-03-15 19:54:29 +01:00
Thomas Basler
a0d0aec677 Fix: Correct detection of Hoymiles serial if it contains hex characters 2024-03-15 19:46:24 +01:00
Bernhard Kirchen
2efa1b35b0 live view: do not access undefined data
if the respective feature is disabled, there is no data. do not try to
access it.
2024-03-15 08:55:21 +01:00
Bernhard Kirchen
5c6b4a8f12 disable restarting solar-powered inverters
now that users can tell the DPL that their inverter is not powered by a
battery but powered by solar panels, we shall not restart inverters to
reset the daily yield value, if they are solar powered. these inverters
will reboot every night by themselves.
2024-03-14 21:37:47 +01:00
Bernhard Kirchen
8895791145 live data: exclude data if respective feature disabled 2024-03-14 21:37:47 +01:00
Thomas Basler
0b7258d50e Upgrade olikraus/U8g2 from 2.35.9 to 2.35.10 2024-03-14 20:12:24 +01:00
Bernhard Kirchen
cf27bd29d7 adjust (new) about texts to OpenDTU-OnBattery 2024-03-14 16:27:32 +01:00
Thomas Basler
33bf2117c6 Fix: Set all settings to default when deleting an inverters
Previously some old settings from previous inverters could have been shown in a new inverter
2024-03-13 18:47:28 +01:00
Bernhard Kirchen
56353e4f00 implement Battery::needsCharging()
currently this is only supported by the Pylontech battery provider, as
it reports a "charge battery immediately" alarm. this will also be
implemented by the JK BMS provider, and possibly also by the smart shunt
provider.

the method will be used to determine whether or not to start charging
the battery using the (Huawei) charger.
2024-03-13 17:07:05 +01:00
Thomas Basler
437f572c39 Fix: Don't throw exception if git_hash is not set 2024-03-12 22:11:19 +01:00
Thomas Basler
bd8d93bf92 Feature: Allow enabling and disabling of the version check
Fix #1787
2024-03-12 18:35:19 +01:00
Thomas Basler
9634c93a3c Fix: Show firmware update tooltip only if newer version available
Closes #1796
2024-03-12 17:27:43 +01:00
Thomas Basler
57a997baac webapp: update dependencies 2024-03-12 16:42:29 +01:00
Thomas Basler
103207cead Merge branch 'dev-herf' into dev 2024-03-12 16:34:08 +01:00
Thomas Basler
2526d3dad6 Remove deprecated extension recommendation 2024-03-12 16:33:55 +01:00
Bernhard Kirchen
784e369482 optimize DPL thresholds MQTT integration
* fix logic in HomeAssistent handler
* also publish voltage thresholds (not just SoC thresholds)
* do not publish irrelevant thresholds to MQTT. if the inverter is
  solar-powered, no thresholds are effectively in use by the DPL and it
  therefore makes no sense to publish them to the broker. similarly, if
  no battery interface is enabled or the SoC values are set to be
  ignored, the SoC thresholds are effectively not in use and will not be
  published to the broker.
* make HA auto-discovery expire. this makes auto-dicovered items
  disappear from Home Assistent if their value is no longer updated.
  changes to settings which cause other thresholds to be relevant will
  then be reflected in Home Assistent even if some thresholds are no
  longer maintaned in MQTT.
* force HA update when related settings change enabling VE.Direct shall
  trigger an update since solar passthrough thresholds become relevant.
  similarly, enabling the battery interface makes SoC thresholds become
  relevant. there are more settings in the power limiter that also
  influence the auto-discoverable items.
* break very long lines
2024-03-10 22:10:02 +01:00
LukasK13
fba5c02346 Feature: Set powerlimiter thresholds via MQTT
publish DPL thresholds to MQTT, add support for setting powerlimiter
thresholds via MQTT, and make these auto-discoverable for Home
Assistent.
2024-03-10 22:10:02 +01:00
Bernhard Kirchen
803b30ca11 fix: wrong unit in battery HomeAssistent exp_aft
the exp_aft value is in seconds.
2024-03-10 21:20:56 +01:00
Bernhard Kirchen
19859ed601
Merge pull request #733 from helgeerbe/dpl-make-shutdown-partially-optional
DPL: Explicit Support for solar-powered inverters
2024-03-10 17:25:30 +01:00
Bernhard Kirchen
c46980d6af fix: more memory for onBattery live data
the allocated memory to create the JSON with onBattery-specific totals
for the live view was too little to contain all values, which are sent
regularly.
2024-03-10 15:57:50 +01:00
Bernhard Kirchen
80edbec769 Feature: DPL: keep inverter running if solar powered
avoid shutting down the inverter at all if the calculated power limit
falls below the lower power limit or if the power meter value is
outdated. do this only if the inverter is setup to be solar powered.
2024-03-09 15:42:09 +01:00
Bernhard Kirchen
91f8f61e63 Feature: DPL: explicit support for solar powered inverters
by default and until this change, we assumed that the inverter
controlled by the DPL is powered by a battery. not all users have a
battery in their system. they still use the DPL to achieve net-zero
export. those users can now tell the DPL that their inverter is powered
by solar modules rather than a battery and the DPL will behave
accordingly.
2024-03-09 15:40:13 +01:00
Bernhard Kirchen
be15050aed DPL: refactor code determining battery charge cycle state 2024-03-09 15:40:13 +01:00
Bernhard Kirchen
c6f81806d6 DPL: make "IsInverterSolarPowered" configurable through web app 2024-03-09 15:40:13 +01:00
Bernhard Kirchen
b11b1dbcba DPL: define IsInverterSolarPowered config switch 2024-03-08 22:53:34 +01:00
Bernhard Kirchen
490a38f909
Merge pull request #726 from helgeerbe/development
Prepare Release 2024.03.07
2024-03-07 22:23:46 +01:00
Bernhard Kirchen
c42d68812c DPL limit scaling: prevent division by zero
this check was removed on error when moving the scaling code into its
own function.
2024-03-07 21:18:11 +01:00
Bernhard Kirchen
b0795a2131 DPL limit scaling: only for supported models 2024-03-07 21:18:09 +01:00
Bernhard Kirchen
64ad4bded1 fix: DPL: limit scaling sanity checks
do not scale limit if inverter is not producing, as DC channel power is
expected to be close to zero anyways.

do not scale limit if current inverter limit is small, such that
channels might produce very little power exactly because the limit is so
low.

move the calculation out of setNewPowerLimit and into a new function, so
that we can make use of return statements there.
2024-03-07 20:54:16 +01:00
Thomas Basler
f995287a6e Feature: Add support for HERF inverters 2024-03-06 21:57:18 +01:00
Bernhard Kirchen
50635ee2ce Feature: live view: update with respective frequency
the update frequency of Victron MPPT charger data, the battery Soc, the
huawei charger power, and the power meter differ from one another, and
differ in particular from the inverter update frequency.

the OnBattery-specific data is now handled in a new method, outside the
upstream code, which merely call the new function(s). the new function
will update the websocket independently from inverter updates. also, it
adds the respective data if it actually changed since it was last
updated through the websocket.

for the webapp to be able to recover in case of errors, all values are
also written to the websocket with a fixed interval of 10 seconds.
2024-03-05 11:31:44 +01:00
Bernhard Kirchen
e432f0eca3 make BateryStats::updateAvailable wrap-around-safe 2024-03-05 11:31:44 +01:00
Bernhard Kirchen
fe7e622e2d pull requests: use a meaningful branch when building
This change makes the build runner switch to a meaningful branch name, which will then appear as the "Firmware Branch" in the System Info of the web application. This helps users testing pull-request builds identify that they are actually using the changes from the respective pull request.
2024-03-05 11:26:38 +01:00
helgeerbe
78e70cc6c5
Merge pull request #708 from schlimmchen/dpl-manage-inverter-state
Fix: DPL: ensure inverter reaches requested state
2024-03-05 10:21:16 +01:00
Thomas Basler
10cd2e4201 webapp: update dependencies 2024-03-04 21:07:01 +01:00
Thomas Basler
b8c1168687 Fix: Exclude hardware part number 124097 from valid part numbers.
This triggers a  re-fetch of the hardware information. Especially 124097 seems to be a wrong read-out.
2024-03-03 16:35:34 +01:00
Bernhard Kirchen
8b6e57cda7 Fix: DPL: ensure inverter reaches requested state
we previously only called commitPowerLimit() if the desired limit
changed such that the change was bigger than the hysteresis. we found
that if the limit update was not received and the desired limit would
not change much, the limit of the inverter was wrong for a long time.

to mitigate this, we introduced re-sending the limit update every 60
seconds, regardless of what the limit reported by the inverter was at
that time.

if the power-up command was not received, we also would repeat it only
once every 60 seconds.

this leads to a new kind of staleness and the actual inverter state was
still not matching the desired state.

this new approach effectively adds an additional control loop at the
start of the DPL loop(). that new function compares the requested
inverter state to the actual reported state. it sends updates (limit
update or power on state) until the desired inverter state is reached,
or until a (hard-coded) timeout occurs.

this approach also allows us to send power-up, power-down, and limit
update commands independent from one another and in a particular order.

this should make sure that the inverter is in the desired state even if
conditions change slowly and commands were not received as expected.
2024-03-02 23:39:43 +01:00
Thomas Basler
3c2b35016a webapp: update dependencies 2024-03-01 19:36:18 +01:00