Commit Graph

468 Commits

Author SHA1 Message Date
Bernhard Kirchen
4e36c8c9ea
Feature: battery interface: use HW serial 0 on ESP32-C3 or S3 (#933)
this allows to use two VE.Direct interfaces, as there is no conflict
regarding HW serial port 2 after making the battery interfaces use
serial port 0 on devices with USB CDC. on those chips HW serial 0 is
free to be used since serial messages are written through the USB
interface directly.
2024-04-29 20:43:35 +02:00
SW-Nico
b9ad1e3054 VE.Direct: process more values and refactor variable names
* process "IL", "AR" and "MON"
* discard "BMV" and (unsolicited) History Data
* simplify isDataValid()
* veMpptStruct, veStruct: new, verbose variable names, including units,
  and replace floats (save values with original integer precision)
* comment on rollover situation in isDataValid()
2024-04-07 17:13:07 +02:00
Bernhard Kirchen
3934906001
Merge pull request #836 from helgeerbe/merge-v24.3.31
Merges v24.3.31 from upstream
2024-04-03 20:08:09 +02:00
Bernhard Kirchen
6b8c93d2e6 polish VE.Direct HEX support
* show charge controller temperature in live view
* send hex requests right after decoding a frame. this seems to have the
  best chance of getting an answer to all requests.
* deem 0xFFFFFFFF value of network total DC power as invalid indicator.
  neither network state, nor network info, nor network mode seem to
  indicate that the charge controller is part of a VE.Smart network. for
  that reason, we revert to always querying the network total DC power
  value, but testing it for max(uin32_t) value, which seems to indicate
  that the charge controller is not part of a VE.Smart network.
* improve (verbose) logging, e.g., use _logId, and print names of
  response codes and known registers, always print error messages,
  add additional tests to prevent overly verbose messages.
* move hex protocol definitions to VeDirectData.h header
  and use enum classes
* define register addresses in enum class
* move values retrieved through hex protocol into main MPPT data struct
* do not send HEX requests if the serial interface cannot send data
* detect whether smart battery sense temperature is available
* web app: make all VE.Direct sub-cards iterable. this makes addind more
  values much simpler and saves a bunch of code in the web app.
* make VeDirectFrameHandler state a type-safe enum class
* unindent MPPT controller loop()
* whitespace cleanup
2024-04-03 16:33:15 +02:00
SW-Nico
aadd7303ac Feature: add support for VE.Direct hex messages 2024-04-03 16:33:15 +02:00
helgeerbe
ff44267e73 Merge remote-tracking branch 'tbnobody/OpenDTU/master' into merge-v24.3.31 2024-04-03 11:53:03 +02:00
Bernhard Kirchen
8c6e925ca4 VE.Direct: make state machine timeout robust against overflow 2024-04-02 21:05:59 +02:00
Bernhard Kirchen
92a7f27919 VE.Direct: use float rather than double
double precision floating point numbers are not needed to handle
VE.Direct values. handling double is implemented in software and hence
*much* more resource intensive.
2024-04-02 21:05:59 +02:00
Bernhard Kirchen
b299b9dc6c VE.Direct: simplify access to data
hand out const& to the data structs. this is possible now that this
struct is "stable", i.e., not reset regularly.
2024-04-02 21:05:59 +02:00
Bernhard Kirchen
ad125ea804 Fix: properly handle fragmented VE.Direct messages
queue every text event until the frame was checked by it checksum. then
process the data directly into the buffer struct. do not clear the
buffer struct, so it will always include the most recent value of a
particular data point.
2024-04-02 21:05:59 +02:00
Bernhard Kirchen
187f197e32 Feature: add unique prefix to VE.Direct messages 2024-04-02 21:05:59 +02:00
Thomas Basler
1888054627 Fix: Re-Request grid profile parameters if received data are invalid / to short
Fixes #1874
2024-03-31 12:42:00 +02:00
Bernhard Kirchen
06f39f8396 Merge remote-tracking branch 'tbnobody/master' into development 2024-03-23 22:58:21 +01:00
Thomas Basler
3125f16d99 Fix: Previously check for HwPartNumber 124097 was implemented wrong
Fix: #1846
2024-03-21 20:00:34 +01:00
helgeerbe
5259fc172a Merge remote-tracking branch 'tbnobody/OpenDTU/master' into v24.3.15 2024-03-20 09:42:35 +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
Thomas Basler
77b38dff2b Fix: Updated source comments to also match hex numbers 2024-03-15 20:14:29 +01:00
Thomas Basler
f995287a6e Feature: Add support for HERF inverters 2024-03-06 21:57:18 +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
Thomas Basler
021d9b5f44 Feature: Added description for alarm id 152
Fixes: #1798
2024-03-01 19:31:47 +01:00
Thomas Basler
9b7df71da0 webapp: Fix typo
Fixes #1780
2024-02-25 11:23:49 +01:00
helgeerbe
c72ae561c7 Merge remote-tracking branch 'tbnobody/OpenDTU/master' into development 2024-02-19 16:03:56 +01:00
Thomas Basler
bfc604db88 Added HMS-300 to DevInfoParser
Fix #1758
2024-02-16 18:15:50 +01:00
Thomas Basler
dfe82ff17e Added HMT-2000 to DevInfoParser
Fix #1752
2024-02-15 22:11:50 +01:00
Thomas Basler
c24a4ea41d Added second HMS-450 to DevInfoParser
Fix #1744
2024-02-13 16:42:08 +01:00
Bernhard Kirchen
7c84621ea9
update VE.Direct product IDsfixes typos and errors, and adds previously unknown PIDs.closes #641.
* update VE.Direct product IDs

fixes typos and errors, and adds previously unknown PIDs.

closes #641.
2024-02-09 19:50:36 +01:00
Thomas Basler
3cf8fea8e0 Fix: Guru Meditation (StoreProhibited) when saving DTU settings
Fixed #1725
2024-02-06 21:47:06 +01:00
Thomas Basler
e81a280b87 Fix: Calculate the AC current for 3 phase inverters correctly 2024-01-30 22:29:25 +01:00
Thomas Basler
abb37242e8 Rename internal variables and methods 2024-01-30 22:29:25 +01:00
Thomas Basler
1b637f0870 BREAKING CHANGE: Web API Endpoint /api/livedata/status and /api/prometheus/metrics
Yield total and Yield day where moved from the AC section to the INV section
2024-01-30 22:29:25 +01:00
Thomas Basler
e1564780d6 BREAKING CHANGE: Web API Endpoint /api/livedata/status and /api/prometheus/metrics
Power DC was moved from the AC section to the INV section
2024-01-30 22:29:25 +01:00
Thomas Basler
f0b5542c2d BREAKING CHANGE: Web API Endpoint /api/livedata/status and /api/prometheus/metrics
Efficiency was moved from the AC section to the INV section
2024-01-30 22:29:25 +01:00
helgeerbe
ebacc2f25f Merge remote-tracking branch 'tbnobody/OpenDTU/master' into development 2024-01-25 23:36:32 +01:00
Thomas Basler
e66060e769 Move the conversation from time_t to String into DevInfoParser 2024-01-20 01:09:42 +01:00
Thomas Basler
149444decb Fix: Gridprofile dump contained the whole buffer instead of the actual length
As a result, a lot of zeros where placed at the end of the dump
2024-01-18 21:21:40 +01:00
helgeerbe
63205f88be Merge remote-tracking branch 'tbnobody/OpenDTU/master' into development 2024-01-16 17:39:45 +01:00
Thomas Basler
9093f9de79 Change default target frequency for US and BR 2024-01-14 17:09:53 +01:00
Thomas Basler
a1f2c93cf6 Added const keywords 2024-01-14 16:37:43 +01:00
Thomas Basler
c20caf8097 Feature: Support HMS/HMT inverters in different countries with different frequency bands
Thanks to @Fribur, @homeautomation2022 and @stefan123t
2024-01-14 16:37:34 +01:00
Thomas Basler
188c4688ab Distinct between Band and Country
This allows different frequencies (Startup/Default etc.) for the same band configuration.
2024-01-14 00:06:35 +01:00
Thomas Basler
6b44694a12 Added frequency and command definitions for the 900 MHz band (North America) 2024-01-13 15:29:17 +01:00
Thomas Basler
16cd1a90d5 Move HOY_BOOT_FREQ from define to function 2024-01-13 14:48:23 +01:00
Thomas Basler
58f0121c11 Create separate definition for the 860MHz band of the CMT2300A
This is required to support different countries in the future. The defines where moved to function to change the values dynamically
2024-01-13 14:48:23 +01:00
Thomas Basler
2c92750100 webapp: Remove hard coded min/max frequencies for CMT module 2024-01-13 12:51:20 +01:00
Thomas Basler
ee78698e37 Migrate all frequency calculations to Hz
Previously the code contains calculations  using a mixture  of kHz and Hz.

Thanks to @Fribur
2024-01-13 12:51:20 +01:00
Thomas Basler
ce2109ab1b Rename define CMT_BASE_CH_OFFSET860 to CMT_BASE_CH_OFFSET 2024-01-13 11:40:30 +01:00
Bernhard Kirchen
3c8b8d4427
use frozen::string and frozen::map where reasonable (#593)
this change utilizes some of the features from library "frozen", which
was included upstream for the grid profile parser. to improve code
maintainability, a couple of std::maps mapping strings to values or the
other way around were introduced in OpenDTU-OnBattery-specific code at
the expense of some flash and computing overhead.

library "frozen" offers constexpr versions of map and string, which
saves initialization code and offers slightly faster lookups. this
brings the binary size down by ~25kB and should provide a small
performance improvement at runtime.
2024-01-04 23:28:34 +01:00
helgeerbe
f89f9da67a Merge remote-tracking branch 'tbnobody/OpenDTU/master' into development 2023-12-29 10:54:41 +01:00
helgeerbe
6ab706c87d clean up merge conflicts 2023-12-27 13:16:37 +01:00