Repository navigation
Conversation
|
InverterAbstract.h now got additional attributes to consistently provide parameters for HM[ST] | MIT. |
|
|
||
| uint8_t InverterAbstract::getMaxRetransmitCount() const | ||
| { | ||
| return MAX_DEFAULT_RETRANSMIT_COUNT; |
There was a problem hiding this comment.
| return MAX_DEFAULT_RETRANSMIT_COUNT; | |
| return 5; |
|
|
||
| uint8_t MIT_8CH::getMaxRetransmitCount() const | ||
| { | ||
| return MAX_MIT_RETRANSMIT_COUNT; |
There was a problem hiding this comment.
| return MAX_MIT_RETRANSMIT_COUNT; | |
| return 20; |
| #define MAX_DEFAULT_RETRANSMIT_COUNT 5 // Used to send the retransmit package | ||
| #define MAX_MIT_RETRANSMIT_COUNT 20 // Used to send the retransmit package to MIT inverters |
There was a problem hiding this comment.
no longer needed when values are substituted in InverterAbstract.cpp and MIT_8CH.cpp
| * 70: value matches PAC — possibly apparent power (S in VA) | ||
| */ | ||
| #include "MIT_8CH.h" | ||
| #include "commands/CommandAbstract.h" |
There was a problem hiding this comment.
Can be removed when MAX_MIT_RETRANSMIT_COUNT is substitited.
| * Copyright (C) 2022-2026 Thomas Basler and others | ||
| */ | ||
| #include "InverterAbstract.h" | ||
| #include "commands/CommandAbstract.h" |
There was a problem hiding this comment.
Can be removed when MAX_DEFAULT_RETRANSMIT_COUNT is substituted
|
@ms49434, I kind of like the #defines as these have all parameters nicely together and it is consistent with how everything is organised in the master branch. Also, to get access to the parameters you need an instance of those classes while you can literally grep in the code for those #defines (so have them while nothing is running) and at any point of the program's execution without any overhead. To have them or not to have them, that to decide is a matter of upstream. The whole purpose of this branch is to render the MIT work by @Geoffn-Hub easier for upstream to adopt. Any extra changes of mine (or yours :-) ) would be detrimental to that cause, I fear. That is - unless if you are upstream. Since I do not have immediate access to a functional OpenDTU (only the ones my neighbour failed to solder properly) or an MIT-8T - do you already have a success story? |
|
My OpenDTU is running perfectly with a stripped version of this PR (RF capture code removed). I wanted to ensure that the modifications are 100% backward compatible with my existing inverters, mainly HMS-2000-4T. I own a MIT-5000-8T as well but haven't fired it up yet. Now that the code is looking more mature, I'll give it a try in the next days. |
|
It would be lovely if you could confirm that the RF capture code is now no longer of any harm for older models. |
The full PR is running stable as well with capture mode enabled. No packet loss and no performance issues. |
|
Tested PR #3161 on OpenDTU-OnBattery with an HMS-2000-4T, serial prefix 0x1164, using an ESP32-S3 and CMT2300A. Current radio statistics:
Before applying the PR, polling could stall for much longer and partial receptions occurred. With the PR, requests now complete reliably within approximately six seconds. There are still many fragment retransmission requests, but every request currently completes successfully and the CMT queue remains small. |
|
Thank you for the report. The many requests are in line with what other installations have reported. I have no immediate suggestions and for the foreseeable future lacks some combination of opportunity, equipment and skills to chase this up myself. |
|
If you Need some Support Tell me so i can try to do my best. |
Update after field testingI have updated the Validate fragment lengths before calculating checksumsCommit Without these checks, subtracting the checksum length from a malformed short fragment could underflow and make the checksum code read outside the received data. This is the integration-branch version of #3163. Avoid advancing beyond an empty command queueCommit For an empty Behaviour for queues containing one or more commands remains unchanged. This is the integration-branch version of #3164. Reject oversized CMT2300A packets instead of truncating themCommit A packet larger than the supported RF packet size is still removed from the radio FIFO, but it is discarded instead of being passed to the parser as an apparently valid truncated packet. Select the MIT retransmission channel before receivingCommit An actual fragment request is identified by both its command byte and its exact packet length. The observed channel pattern is:
The channel is selected before receive mode is started. Logging therefore cannot delay the short response. Invalid fragment numbers and channels outside the supported range are rejected. Before every ordinary transmission, the radio is returned to the inverter's base channel. A previous MIT receive offset therefore cannot affect the following MIT or HMS command. Accept the SystemConfig response returned by the tested MITCommit The tested inverter repeatedly returned a complete, CRC-valid, one-fragment response containing 16 bytes. Requiring 38 bytes rejected that valid response every time. The normal 16-byte validity requirement is therefore retained. Field-test resultThe latest continuous recording produced:
MIT communication still requires several fragment retransmissions and therefore occupies the shared CMT radio for considerably longer than HMS communication. However, no interruption of an active HMS transaction, starvation, or HMS terminal failure was observed. Capture mode remained disabled during these tests. The read-only polling path is well tested; MIT power-limit and other control commands have not yet been field-tested. A clean
|
|
Hm. Cannot tell, really. Capture mode is off, but that does not explain the two frequencies. The trace only re-requests fragments belonging to two frequency classes. The repeated requests are the real remaining inefficiency—but lowering MAX_MIT_RETRANSMIT_COUNT would merely cause earlier failures. From what I understood, the frequency printed after RX is the channel on which the CMT2300A was listening. It is not an independent measurement of the inverter's transmitted frequency, which may be slightly off and received nonetheless. That would require an SDR recording to follow up and I am a bit too distracted with too many other things to for me to pursue this any time soon, I am afraid. My perception was like yours: It works. And it even works when other inverters are communicating next to it. My access to the devices is only irregular, I am afraid. And I still need to order the SDR. :-/ |
|
Data point from an HMS-700-2T-NA (serial prefix 0x1146, rev A02) running your PR ported onto Pulling fragment IDs out of the RF dumps, the received sets in each initial burst are strict Across 185 single-fragment re-requests the DTU never once asked for #3, #6, #9 or #12 — those So the modulo-3 structure behind Separately, because the received size was compared against the buffer size rather than a minimum response One more, possibly worth a separate report: with only ~1 fragment in 3 captured, |
|
I'm current testing your PR with 2 HMS-2000-4T (identical HW and software releases). Without this additional PR #3101, I had to manually set the frequency after every ESP reboot (frequency / PALevel not correctly set after a reboot) otherwise nothing is received on my setup. |
|
Hello, had another weekend with a 5000 MIT. Had investigated its failure to "show green" with the original DTU. Afterwards, I found that my two also present HMS 1600-T were did not both show but only one. It seems like the original DTU somehow triggered a change of the radio frequency of the inverters. On top, I had difficulties to connect to the local Wifi when I entered a (now) wrong password. This was all difficult for me to investigate. The here presented changes with the network selection in particular have helped me to bring the system up again. Will dissect them into smaller PRs over time, just anybody curious ... go for it :-) |
|
@smoe yesterday i have build your Tree: https://github.com/smoe/OpenDTU/tree/supporting_5000_MIT_8T to test it with my HMS-2000-4T (RF Capture Mode) but the Result is no Communication. Only the Original Pull #2962 works in my case Any Ideas ? |
|
I’ve been using this branch for my MIT5000 for several months. Today, I updated to the latest commits, and it’s still working. I’ll continue testing it. |
|
I just saw that this branch now has some conflicts against the current master. This is not meant to be the case but I cannot immediately test this myself. Will fix this as soon as I am back at the OpenDTU to at least check that it does not brick your OpenDTU :-/ |
|
I made a small change. |
Those inverters did not comprise a 5000 MIT, right? |
|
2x HMS800, 1x HMT2250, but i run them wirth the same radio Module FW as a MIT is running with. |
I get ERR_ADDRESS_UNREACHABLE and no updates in mqtt. |
Each successful inverter edit reloads the list and removes its old table. Destroy the associated Sortable instance before that removal and when the view unmounts, so repeated recovery-setting saves do not retain detached tables and document listeners. Keep the instance outside Vue reactivity, reject stale list responses and pending DOM callbacks, and ignore order saves while no instance exists. Include the rebuilt webapp bundle so firmware receives the lifecycle fix. Validation: frozen Yarn install, full yarn lint, production build with type checking, and seven source-based lifecycle regressions. The old code fails those cases; the fix passes repeated saves, navigation during requests and callbacks, overlapping refreshes, and saving without a table. Related report: tbnobody#3161 (comment)
Iterating getClients() directly races with AsyncTCP removing disconnected WebSocket clients. Use the pinned ESPAsyncWebServer textAll() API, which holds the client-list lock while queuing the shared console chunk. Stop appending a queue-full warning to an already queued shared buffer. Queued payloads now remain immutable. The existing library policy keeps slow-client queues bounded and drops excess chunks without blocking other clients; chunk sizes and flush intervals remain unchanged. Validation: C++ lint and source-based host tests under ASan/UBSan, including 20,000 concurrent connect/remove cycles and broadcasts, a stalled client beside a healthy client, and shared-buffer and flush-threshold checks. This addresses a possible device-side failure path raised while assessing: tbnobody#3161 (comment)
|
The MQTT updates do not happen while the radio is busy. There is a chance that the three changes above have fixed that. If your time and mental energy allows, please update once again and give it another try. |
|
Thanks for the ping, @smoe. A short status from our side, so nobody waits on us:
One question for when we do test, from reading the branch at |
|
As promised in my last comment: our MIT-5000-8T has been running since 29 Oct, and 30 Oct was the first full day. Some field data. Note that this is not the current branch: we run v26.9.28 plus only the MIT parts of this PR as of 1. Start-up needs all four inputs. With one string on one port and the other three empty, the MIT stayed completely dark (no LED, no reply on the radio). With two ports populated, it answered, but logged 207/221 (MPPT-A/-D undervoltage), the LED flashed red and it fed in 0 W in full sun. As soon as all four ports had a module, the undervoltage events ended and it started feeding in about three minutes later. This matches what Hoymiles support reportedly told users in the photovoltaikforum, and the manual's installation step "each DC input connects to a minimum of one PV module". It may save someone a support ticket. 2. YieldTotal and YieldDay drop to 0 after the evening restart. At dusk the event log shows "Inverter start" (15:57:41 UTC), then two time calibrations and 223 "Grid: Connection attempt failed". From 16:01:33 UTC on, the inverter reports 3. Radio. Hourly increments of the DTU's radio stats during daylight (06:00–15:00 UTC):
So every request to the MIT eventually succeeds, but it needs about 5.6 retransmit requests on average (the MIT limit in this build is 20). The HMT's poll rate drops from about 12.5/min (29 Oct, before the MIT was added to the DTU) to about 3.4/min with the MIT answering. Its data stays fresh enough for us (data age ≤ 21 s), so no problem in practice. Energy check against an independent AC meter on the inverter circuit: 5.90 kWh metered vs 5.82 kWh from the two inverters' yield. Happy to help with investigations. We now have an HMT-2000-4T and a MIT-5000-8T on the same DTU, in daily operation, with an independent AC meter on their circuit and the radio statistics logged every 10 s. So we can compare both inverter types side by side under the same conditions. If you want something checked (a test build, a timeout or retransmit setting, a specific command or log), tell me what you need. Once the remaining two strings are on the roof in the next few days, I can also run the current branch against the numbers above as a baseline. |
|
Wow, I've been running https://github.com/smoe/OpenDTU/tree/b22cdb1f95f64994951e0ed8c0de30cfbec88ba0 for just half an hour, and this is the first time that "reception successful" is increasing faster than "fragment reassembly requests". "Fragment reassembly requests" only increases during the initial phase; after that, there are almost none. Hopefully, this release won't crash my ESP again over the course of the day. Edit: |
|
I hope this will be added to the official OpenDTU release including the work of @xX-nichtlachen-Xx |
The CMT2300A receive loop previously used an either/or structure: when a packet interrupt fired, it drained the hardware FIFO but did no processing; when no interrupt was pending, it processed only one buffered packet. This caused FIFO overflows with MIT inverters that send 6 response fragments in rapid succession — the 64-byte hardware FIFO can hold ~2 packets, and the old code couldn't drain fast enough. Changes: - Remove either/or: drain FIFO then process all buffered packets in the same loop() iteration - Process entire software buffer (while loop) instead of one packet - Fix available() to check only PKT_OK flag instead of OR'ing PREAM_OK|SYNC_OK|CRC_OK|PKT_OK, which could trigger reads before a packet was fully received
Start CMT reception during initialization and hop across the configured country's legal channels while capture mode is enabled. Log received frames before DTU and inverter filtering, expose capture controls through /api/dtu/capture, and document usage.
Detect serial prefix 0x1520 and decode the inverter's four RF-level MPPT channels and three-phase measurements. Keep the longer command timeouts and retransmit allowance scoped to MIT through inverter overrides. Select the transmit and fragment retransmit channels, reject oversized CMT payloads, and allow a 48-byte SystemConfig buffer while retaining upstream's 16-byte minimum response validation. Co-authored-by: Steffen Moeller <moeller@debian.org>
Expose asynchronous nearby-network scans and allow selection of an SSID in network setup. Coordinate scan completion, cancellation, and timeouts, and restore the station mode afterwards. Cancel scans before reconnecting or applying changed network configuration.
Include packet bytes, channel and signal strength when the receiver rejects another DTU address, an unknown inverter, or a bad checksum. Preserve filtering, channel selection and retry policy.
Fixed-frequency reception can miss replies that rotate between channels, and an unreachable inverter may still be operating on another frequency. Add RF-module-aware reception and bounded recovery probes to learn that frequency and attempt to move the inverter to the configured DTU frequency. Adapted from xX-nichtlachen-Xx/OpenDTU, branch New_CMT2300A_Radio: https://github.com/xX-nichtlachen-Xx/OpenDTU/tree/New_CMT2300A_Radio Reviewed source revision: xX-nichtlachen-Xx@a5c2703 - Classify RF module firmware and track each inverter's working frequency and receive-channel sequence. Follow rotating replies while keeping known legacy module A on one channel, and expose module line/frequency in the devinfo API. - Probe legal regional channels in bounded batches. Learn channel-change profiles from replies and retain the learned transmit frequency when queuing a corrected request. Distinguish corrected requests from true duplicates. - Restrict active receive retuning to the transaction's inverter and expected response command, filter unrelated response commands, and avoid retuning while another packet is pending. Clear learned link state on country or target-frequency changes. Preserve the current branch's MIT recovery policy: model defaults and manual fragment timeout/retry overrides, per-transaction settings snapshots, initial command waits, and retry limits. Keep the fragment-number-based MIT channel fallback until rotation has been observed, including when hopping is disabled. Retain FIFO draining, oversized-payload rejection, early transaction completion, passive RF capture, and restoration of radio configuration. Two conservative differences from the source branch remain pending RF capture: recently heard traffic suppresses link recovery without changing the UI's statistics-based reachability; a probe treats the inverter as using the configured target only when its transmit frequency matches that target exactly. Exclude the source branch's board profiles and machine-specific serial ports. Refresh the embedded webapp from this branch's existing sources so a firmware build includes the implemented MIT recovery controls, WiFi scanner, and three-phase display instead of the stale checked-in bundle. Validation: - All four CI targets build: generic_esp32, generic_esp32s3, generic_esp32s3_usb, and generic. - Frozen web dependencies, production build, type-check, oxlint, ESLint, Prettier checks, and C++ lint pass. - Actual-source ASan/UBSan host tests cover regional scans, RF parsing, corrected retries, transaction ownership, pending-packet guards, MIT settings snapshots/timeouts/retry limits, channel fallback, and link resets. - Application and factory images embed the matching webapp and branch/revision. RF behavior still requires hardware validation with HackRF captures and DTU logs; these builds and host tests do not establish on-air timing correctness. Co-authored-by: xX-nichtlachen-Xx <nichtlachen@yahoo.de>
Each successful inverter edit reloads the list and removes its old table. Destroy the associated Sortable instance before that removal and when the view unmounts, so repeated recovery-setting saves do not retain detached tables and document listeners. Keep the instance outside Vue reactivity, reject stale list responses and pending DOM callbacks, and ignore order saves while no instance exists. Include the rebuilt webapp bundle so firmware receives the lifecycle fix. Validation: frozen Yarn install, full yarn lint, production build with type checking, and seven source-based lifecycle regressions. The old code fails those cases; the fix passes repeated saves, navigation during requests and callbacks, overlapping refreshes, and saving without a table. Related report: tbnobody#3161 (comment)
Upstream now provides the protected WebSocket broadcast API introduced by our earlier console fix. Preserve the remaining single-broadcast behavior: when one client has a full queue, sending a copy of the original chunk plus a warning would repeat every log line for clients that received it already. Broadcast each immutable shared chunk once and retain the library's bounded queue/drop policy. Chunk size, flush timing and client lifetime protection remain unchanged. This keeps our existing behavior after the upstream rebase. Reconciles upstream aaa1f0c with the original 18da2cf console fix.
The imported hopping guards assumed available() included preamble and sync activity. Our driver deliberately reports only complete packets there, so a hop could retune and flush a frame still arriving at the radio. Add a separate reception-busy query for preamble, sync, CRC and packet flags, and use it to guard ring-follow retunes and hopping. Keep available() strict for FIFO draining. Expire a hold after 60 ms even if incomplete flags remain latched, while continuing to preserve completed packets for the normal drain. MIT recovery settings, transaction snapshots and retry budgets are unchanged. Validation: C++ lint and source-based radio regressions under ASan/UBSan for early reception flags, completed-packet draining, stale-hold expiry and transaction ownership, plus the MIT channel/retransmit/settings regression matrix. The early-flag cases demonstrate the previous premature retune. Corrects integration of the response-channel hopping from: https://github.com/xX-nichtlachen-Xx/OpenDTU/tree/New_CMT2300A_Radio Imported fork revision: a5c2703
Rebuild the MIT integration's checked-in application bundle from its final sources on origin/master 9ea7f06 (v26.11.11). Firmware builds now include upstream hostname guidance and error translations together with the existing MIT recovery controls, phase measurements, WiFi picker and lifecycle fixes. Only the application bundle changes. Preserve compressed files whose uncompressed content is unchanged to avoid compression-only churn. Validation: frozen Yarn dependencies, yarn lint, Vue type-check, production Vite build and Prettier checks pass without changing frontend sources.
b22cdb1 to
10deac1
Compare
|
HMS-2000-4T serial 1420a is working with this PR, only a very small amount of partials (<5%) at -35 dBm. edit I am seeing occasional spikes of partials, not sure how best to capture whatever debug information as its intermittent. Currently at 15% partial and saw some 60s+ data ages. |


As described on #2962.