Skip to content

Supporting 5000 MIT 8T - Rebase of #2962 on master and extras - #3161

Open
smoe wants to merge 17 commits into
tbnobody:masterfrom
smoe:supporting_5000_MIT_8T
Open

smoe wants to merge 17 commits into
tbnobody:masterfrom
smoe:supporting_5000_MIT_8T

Conversation

@smoe

@smoe smoe commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

As described on #2962.

@smoe

smoe commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

InverterAbstract.h now got additional attributes to consistently provide parameters for HM[ST] | MIT.


uint8_t InverterAbstract::getMaxRetransmitCount() const
{
return MAX_DEFAULT_RETRANSMIT_COUNT;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return MAX_DEFAULT_RETRANSMIT_COUNT;
return 5;


uint8_t MIT_8CH::getMaxRetransmitCount() const
{
return MAX_MIT_RETRANSMIT_COUNT;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return MAX_MIT_RETRANSMIT_COUNT;
return 20;

Comment on lines +11 to +12
#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

@ms49434 ms49434 Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be removed when MAX_DEFAULT_RETRANSMIT_COUNT is substituted

@smoe

smoe commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor Author

@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?

@ms49434

ms49434 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

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.

@smoe

smoe commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

It would be lovely if you could confirm that the RF capture code is now no longer of any harm for older models.

@ms49434

ms49434 commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

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.
I'm running a Fusion board which has an ESP32S3 chip.

@rudolfp1979

rudolfp1979 commented Aug 1, 2026 •

Copy link
Copy Markdown

Tested PR #3161 on OpenDTU-OnBattery with an HMS-2000-4T, serial prefix 0x1164, using an ESP32-S3 and CMT2300A.

Current radio statistics:

  • Sent requests: 62
  • Successful receptions: 62 (100%)
  • Nothing received: 0
  • Partially received: 0
  • Corrupted receptions: 0
  • Fragment retransmission requests: 650
  • RSSI: -22 dBm

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.

@smoe

smoe commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

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.

@rudolfp1979

Copy link
Copy Markdown

If you Need some Support Tell me so i can try to do my best.

@smoe

smoe commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

Update after field testing

I have updated the supporting_5000_MIT_8T branch from 5c1df91b to b7b2a724 with five additional commits prepared with help from Codex.

Validate fragment lengths before calculating checksums

Commit bfb74977 rejects RF fragments whose reported length is zero or exceeds the 32-byte RF payload buffer. It also checks that the final fragment of a multi-fragment response contains the two bytes required for its CRC16 checksum.

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 queue

Commit f602dd35 handles an empty command queue before the code calculates begin() + 1.

For an empty std::deque, begin() already equals end(). Advancing one position further is undefined behaviour. The new check is performed while the queue mutex is held.

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 them

Commit fc5cda74 preserves the payload size originally reported by the CMT2300A.

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 receiving

Commit a148048f selects the receive channel used by the MIT when a missing fragment is requested again.

An actual fragment request is identified by both its command byte and its exact packet length. The observed channel pattern is:

  • fragments 1, 4 and 7: inverter base frequency minus 250 kHz
  • fragments 2, 5 and 8: inverter base frequency
  • fragments 3, 6 and 9: inverter base frequency plus 250 kHz

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 MIT

Commit b7b2a724 removes the MIT-specific requirement for at least 38 reassembled SystemConfig bytes.

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 result

The latest continuous recording produced:

  • 28 of 28 successful MIT real-time-data requests
  • successful reception of retransmitted fragments from all three frequency classes
  • 95 of 95 successful commands from the first existing HMS inverter
  • 107 of 107 successful commands from the second existing HMS inverter

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 generic_esp32 build of b7b2a724 succeeds:

  • RAM usage: 23.9%
  • flash usage: 92.5%

@schwatter

schwatter commented Aug 21, 2026 •

Copy link
Copy Markdown
Screenshot 2026-08-21 192347

I've been running this build for two days now. This time I didn't change anything (like #define MAX_RETRANSMIT_COUNT)— just built and flashed it as is.

I'm getting a 100% success rate now. By the way, do you have access to your neighbor's MIT-5000 now?

The 20% "no capture" rate occurs during wakeup and sleep phases when OpenDTU receives no signal. It's the exact same behavior in Geoffn-Hub's source. Once the sun comes up and statistics reset, success goes back to 100%.

A quick question about frequency hopping: I thought it hops across three frequencies, but I'm only seeing two in my log. Am I missing something?

[19:30:25.793] D (176161121) webapi: Websocket: [/livedata][21] disconnect
[19:30:30.677] D (176164666) hoymiles: TX RealTimeRunData 868.00 MHz --> 15 A0 XX XX XX 80 12 56 76 80 0B 00 6A 88 8B 35 00 00 00 00 00 00 00 00 AC A7 83
[19:30:30.686] D (176164856) hoymiles: RX 868.00 MHz --> 95 A0 23 E1 9A 80 12 56 76 03 00 03 B9 63 09 2D 03 3B 00 1E 00 FE 00 04 9A BB DC | -60 dBm
[19:30:30.796] D (176165007) hoymiles: RX 868.00 MHz --> 95 A0 23 E1 9A 80 12 56 76 86 01 36 00 03 00 00 00 00 02 7A 00 02 00 00 66 07 76 | -60 dBm
[19:30:36.935] D (176170708) hoymiles: TX RequestFrame 868.00 MHz --> 15 A0 XX XX XX 80 12 56 76 81 DE
[19:30:39.043] D (176172738) hoymiles: TX RequestFrame 868.00 MHz --> 15 A0 XX XX XX 80 12 56 76 81 DE
[19:30:39.043] D (176172822) hoymiles: RX 867.75 MHz --> 95 A0 23 E1 9A 80 12 56 76 01 00 01 03 18 00 21 01 09 00 04 81 63 0B 84 03 3A BD | -60 dBm
[19:30:39.395] D (176174768) hoymiles: TX RequestFrame 868.00 MHz --> 15 A0 XX XX XX 80 12 56 76 82 DD
[19:30:39.503] D (176174920) hoymiles: RX 868.00 MHz --> 95 A0 23 E1 9A 80 12 56 76 02 00 18 00 CA 00 03 CC 64 09 6F 03 27 00 17 00 BD 4C | -60 dBm
[19:30:41.474] D (176176800) hoymiles: TX RequestFrame 868.00 MHz --> 15 A0 XX XX XX 80 12 56 76 84 DB
[19:30:43.539] D (176178831) hoymiles: TX RequestFrame 868.00 MHz --> 15 A0 XX XX XX 80 12 56 76 84 DB
[19:30:43.539] D (176178917) hoymiles: RX 867.75 MHz --> 95 A0 23 E1 9A 80 12 56 76 04 0B D2 08 E5 08 E3 08 EF 0F 62 0F 6C 0F 77 13 87 01 | -60 dBm
[19:30:45.537] D (176180862) hoymiles: TX RequestFrame 868.00 MHz --> 15 A0 XX XX XX 80 12 56 76 85 DA
[19:30:45.537] D (176180949) hoymiles: RX 868.00 MHz --> 95 A0 23 E1 9A 80 12 56 76 05 00 00 03 27 00 00 00 B3 00 0B 00 0C 00 0B 03 DB 99 | -60 dBm
[19:30:55.310] D (176190670) hoymiles: TX RealTimeRunData 868.00 MHz --> 15 A0 XX XX XX 80 12 56 76 80 0B 00 6A 88 8B 4F 00 00 00 00 00 00 00 00 CE BC 80
[19:30:55.493] D (176190898) hoymiles: RX 868.00 MHz --> 95 A0 23 E1 9A 80 12 56 76 03 00 03 B9 63 09 2D 03 45 00 1F 01 09 00 04 9A BB 55 | -60 dBm
[19:30:55.654] D (176191026) hoymiles: RX 868.00 MHz --> 95 A0 23 E1 9A 80 12 56 76 86 01 36 00 03 00 00 00 00 02 7A 00 02 00 00 B6 DE 7F | -60 dBm
[19:31:01.434] D (176196713) hoymiles: TX RequestFrame 868.00 MHz --> 15 A0 XX XX XX 80 12 56 76 81 DE
[19:31:03.722] D (176198744) hoymiles: TX RequestFrame 868.00 MHz --> 15 A0 XX XX XX 80 12 56 76 81 DE
[19:31:03.722] D (176198830) hoymiles: RX 867.75 MHz --> 95 A0 23 E1 9A 80 12 56 76 01 00 01 03 22 00 22 01 15 00 04 81 64 0B 85 03 42 E6 | -60 dBm
[19:31:07.652] D (176200775) hoymiles: TX RequestFrame 868.00 MHz --> 15 A0 XX XX XX 80 12 56 76 82 DD
[19:31:07.652] D (176200861) hoymiles: RX 868.00 MHz --> 95 A0 23 E1 9A 80 12 56 76 02 00 19 00 D0 00 03 CC 64 09 6F 03 31 00 18 00 C7 34 | -60 dBm
[19:31:07.674] D (176202805) hoymiles: TX RequestFrame 868.00 MHz --> 15 A0 XX XX XX 80 12 56 76 84 DB
[19:31:09.506] D (176204835) hoymiles: TX RequestFrame 868.00 MHz --> 15 A0 XX XX XX 80 12 56 76 84 DB
[19:31:09.506] D (176204921) hoymiles: RX 867.75 MHz --> 95 A0 23 E1 9A 80 12 56 76 04 0B D2 08 E8 08 E1 08 EE 0F 63 0F 6C 0F 76 13 8A 02 | -60 dBm
[19:31:11.541] D (176206865) hoymiles: TX RequestFrame 868.00 MHz --> 15 A0 XX XX XX 80 12 56 76 85 DA
[19:31:11.542] D (176206952) hoymiles: RX 868.00 MHz --> 95 A0 23 E1 9A 80 12 56 76 05 00 00 03 49 00 00 00 7A 00 0B 00 0C 00 0A 03 E8 0C | -60 dBm
[19:31:22.590] D (176216675) hoymiles: TX RealTimeRunData 868.00 MHz --> 15 A0 XX XX XX 80 12 56 76 80 0B 00 6A 88 8B 69 00 00 00 00 00 00 00 00 AF 0E 75
[19:31:22.590] D (176216866) hoymiles: RX 868.00 MHz --> 95 A0 23 E1 9A 80 12 56 76 03 00 03 B9 63 09 2D 03 3B 00 1F 01 01 00 04 9A BB 23 | -60 dBm
[19:31:22.603] D (176217015) hoymiles: RX 868.00 MHz --> 95 A0 23 E1 9A 80 12 56 76 86 01 36 00 03 00 00 00 00 02 7A 00 02 00 00 01 C7 D1 | -60 dBm
[19:31:27.409] D (176222718) hoymiles: TX RequestFrame 868.00 MHz --> 15 A0 XX XX XX 80 12 56 76 81 DE
[19:31:29.431] D (176224749) hoymiles: TX RequestFrame 868.00 MHz --> 15 A0 XX XX XX 80 12 56 76 81 DE
[19:31:29.431] D (176224835) hoymiles: RX 867.75 MHz --> 95 A0 23 E1 9A 80 12 56 76 01 00 01 03 0D 00 21 01 07 00 04 81 64 0B 85 03 38 A2 | -60 dBm
[19:31:31.467] D (176226779) hoymiles: TX RequestFrame 868.00 MHz --> 15 A0 XX XX XX 80 12 56 76 82 DD
[19:31:31.467] D (176226866) hoymiles: RX 868.00 MHz --> 95 A0 23 E1 9A 80 12 56 76 02 00 18 00 CA 00 03 CC 64 09 6F 03 31 00 17 00 C3 24 | -60 dBm
[19:31:33.628] D (176228810) hoymiles: TX RequestFrame 868.00 MHz --> 15 A0 XX XX XX 80 12 56 76 84 DB

@smoe

smoe commented Aug 21, 2026

Copy link
Copy Markdown
Contributor Author

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. :-/

@ryan5836600

Copy link
Copy Markdown
Contributor

Data point from an HMS-700-2T-NA (serial prefix 0x1146, rev A02) running your PR ported onto
OpenDTU-OnBattery — the three-channel fragment behaviour you model for the MIT-5000-8T appears
on this HMS too.

Pulling fragment IDs out of the RF dumps, the received sets in each initial burst are strict
arithmetic progressions with step 3:

AlarmData          got #3, #6, #9, #12
GridOnProFilePara  got #1, #4, #7, #10
RealTimeRunData    got #1 (of 3)

Across 185 single-fragment re-requests the DTU never once asked for #3, #6, #9 or #12 — those
always arrive. Not a link problem: RSSI −53 dBm, RX Fail: Receive Corrupt 0,
RX Fail: Receive Nothing 0. Single-fragment re-requests are answered ~30% of the time.

So the modulo-3 structure behind getMitHopOffsetForFragment() looks general, but the phase
doesn't match the fixed ((id - 1) % 3) - 1 formula on my unit — the captured residue class
differs between AlarmData (#3,6,9,12) and GridOnProFilePara (#1,4,7,10) in the same session.
So it can't just be ungated for 0x1146; it would need the phase learned per response rather
than derived from the fragment ID.

Separately, a813cc14 ("separate SystemConfig buffer and response sizes") fixed a real bug for
me on plain HMS. Before it I got, every poll:

ERROR in SystemConfigPara: Received fragment size: 16, min expected size: 48

because the received size was compared against the buffer size rather than a minimum response
size. Worth noting it isn't MIT-only.

One more, possibly worth a separate report: with only ~1 fragment in 3 captured,
MAX_DEFAULT_RETRANSMIT_COUNT (5) can't assemble an 11–12 fragment response, so AlarmData and
GridOnProFilePara never completed (0/6 over six poll cycles) and were re-queued every cycle
forever. Raising that budget let both complete on the first try.

@elmr91

elmr91 commented Sep 4, 2026 •

Copy link
Copy Markdown

I'm current testing your PR with 2 HMS-2000-4T (identical HW and software releases).
One of them is particularly picky about transmissions:
HMS-2000 1 (-61 dB) : ~100% success no retransmit, no receive nothing
HMS-2000 2 (-66 db) : 66% success, 33% receive nothing, ~0 retransmit

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.
It may be worth including this change for people wanting to test this PR.

@smoe

smoe commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor Author

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 :-)

@Starfoxfs

Copy link
Copy Markdown

@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

rf-proto.txt

Any Ideas ?

@schwatter

Copy link
Copy Markdown

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.

@smoe

smoe commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

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 :-/

@xX-nichtlachen-Xx

Copy link
Copy Markdown
Contributor

I made a small change.
But before and after, I had a 100% success rate and almost 0 re-requests for a three-inverter setup.

@smoe

smoe commented Oct 25, 2026

Copy link
Copy Markdown
Contributor Author

I made a small change. But before and after, I had a 100% success rate and almost 0 re-requests for a three-inverter setup.

Those inverters did not comprise a 5000 MIT, right?

@xX-nichtlachen-Xx

xX-nichtlachen-Xx commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

2x HMS800, 1x HMT2250, but i run them wirth the same radio Module FW as a MIT is running with.

@schwatter

schwatter commented Oct 25, 2026 •

Copy link
Copy Markdown

Hmm @smoe, I'm using your latest branch now for MIT5000. I set the fragment wait to 350ms and retries to 25. I get more errors with a fragment wait lower than 300ms. Over 400ms isn't good either. So with 350ms, I get 100% success. But the fragment retries are still as high as ever. Also, with a lot of testing, the web interface becomes unreachable. Maybe my ESP32 crashes then too. I won't touch it for now and will wait to see if it crashes again, but I think I'll downgrade the branch and build the previous version again.

Thank you very much for your feedback, in particular for your pointer on the UI becoming non-responsive. Can you trigger that in any way? Just repeated change of parameters? Or some particular function?

I get ERR_ADDRESS_UNREACHABLE and no updates in mqtt.
Maybe the limitation oft my esp32. At the moment i stay with it.
Otherwise a must print a bigger case.
So i will go back for the moment.

smoe added a commit to smoe/OpenDTU that referenced this pull request Oct 25, 2026
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)
smoe added a commit to smoe/OpenDTU that referenced this pull request Oct 25, 2026
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)
@smoe

smoe commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor Author

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.

@Araknus13

Copy link
Copy Markdown

Thanks for the ping, @smoe. A short status from our side, so nobody waits on us:

  • Our MIT-5000-8T is not installed yet. We will test this branch with it once it is on the roof.
  • Until then the DTU only talks to an HMT-2000-4T, and that one runs fine on the official v26.9.28 (on 25 Oct, 00:00–11:48 local time: 20,745 requests including the night, 5 retransmit requests, RSSI −24 dBm). So we keep it on the release for now.

One question for when we do test, from reading the branch at b22cdb1f: HMT_Abstract::sendChangeChannelRequest() and its HMS counterpart now go through CmtLinkRecovery instead of a single channel change request, and Hoymiles.cpp calls it whenever an inverter is not reachable. Our HMT is unreachable every night (no DC). Is the recovery probing meant to run in that case too? The commit message of ade1f675 says the probes are bounded; is that per night or per poll cycle?

@Araknus13

Copy link
Copy Markdown

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 02454057, without the radio rework. Inverter firmware V01.05.01 (build 10501), HW 08.67, RF 02.05.02, on one DTU together with an HMT-2000-4T.

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 YieldTotal = 0 and YieldDay = 0 while it is still reachable and has about 70 V on the inputs. Before that it was 3.57 kWh / 3567 Wh. On 29 Oct it also reported 0 when it shut down in the evening. The patch reads FLD_YT straight from bytes 8–11 of each port, so this comes from the payload. The capture in the MIT_8CH.cpp header shows YT=151.566kWh, so on that unit the value really is a lifetime counter. Does anyone see their MIT keep YieldTotal across a restart? Or does it only persist on units that have been registered with a Hoymiles DTU? Anyone feeding YieldTotal into an energy balance (Home Assistant energy dashboard, evcc, etc.) will lose the day's yield every evening otherwise. We now keep our own monotonic counter on the consumer side.

3. Radio. Hourly increments of the DTU's radio stats during daylight (06:00–15:00 UTC):

requests success retransmit requests partial
HMT-2000-4T 206/h 206/h 0 0
MIT-5000-8T 206/h 206/h ~1156/h 0

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.

@schwatter

schwatter commented Oct 31, 2026 •

Copy link
Copy Markdown

@smoe

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:
Ok, my esp32 just for testing is still fine and it was a good day.
MIT5000

@Starfoxfs

Copy link
Copy Markdown

I hope this will be added to the official OpenDTU release including the work of @xX-nichtlachen-Xx

Miraz and others added 17 commits November 12, 2026 18:18
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.
@smoe
smoe force-pushed the supporting_5000_MIT_8T branch from b22cdb1 to 10deac1 Compare November 12, 2026 17:31
@Gillingham

Gillingham commented Nov 17, 2026 •

Copy link
Copy Markdown

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.

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.