Closed MT76 closed 3 months ago
You can try to set MQTT_SOCKET_TIMEOUT
to a short time, eg 15 sec.
Add this in setup.h
#define MQTT_SOCKET_TIMEOUT 15
actually, it should already be at 15 sec from the default library file. So it's weird it times-out at 30sec. Is your wifi rssi correct? (between -60 and -30)?
Yes, fluctuates a bit, but usually it's @ -35dBm. Flaky Wifi was the first suspect, but the issue persisted even after yanking my 2 AP's off the ceiling and running a cable from my router into the boiler room and setting up a single AP there. And then i saw it disconnect at the same moment each time, so i pretty much ruled out Wifi issues. For what it's worth, i also migrated my HAOS to a new system to rule out hardware issues on the broker side. I even set up a MQTT LXC on a completely different server to rule out problems with my HAOS install. But got exceeded timeouts in all situations.
Still think it started after the first OTA update. Maybe reflashing factory firmware back on the M5Stick and then ESPAltherma again will fix this. But, priorities. Sleep > Learn Arduino > flash. =) I'll report back here.
Flashed factory with partition scheme No OTA and then ESPAltherma again. But unfortunately that didn't fix it, still lots of disconnects.
Well, i think i have found the problem and if so, it's a severe case of PEBKAC...
I was looking for a way to calculate COP and i came across https://github.com/raomin/ESPAltherma#calculating-cop.
But I'm using def/Altherma(EPRA D ETV16-ETB16-ETVZ16 D series 14-16kW).h
for my heatpump and it didn't have a definition for Voltage (N-phase)
. So as an experiment i added a definition for Voltage from another definition file. And i did get readings. But they didn't make sense so i decided not to use them in HA, but i forgot to take it out of my definition file. Today i was going through the file again and saw the voltage register still there so i deleted it. Uploaded OTA to my M5Stick and lo and behold; it is running for 3 hours now, without 1 disconnect.
So sorry for wasting your time raomin, i'll just crawl back under my rock and feel stupid. =)
No problem @MT76, glad you fixed it. Still wondering why it caused a disconnect.... maybe a reboot...?
Running ESPAltherma on a M5StickC, connected to Mosquitto in HAOS. I'm seeing lots of short disconnects. Mosquitto log says it's due to time out:
Seemingly random, but look at the timestamp seconds: Coincides with
setup.h
's FREQUENCY setting of 30000. The connection is usually re-established immediately, but Althermasensors is shown as Unavailable for a second, obviously resulting in gaps in the corresponding graphs.Mosquitto's
log_type all
shows something interesting:Last three lines of successful PUBLISH:
Last three lines when a disconnect happens:
See? It's missing the last /log publish that is supposed to come after /ATTR publish. And this is the case with all disconnects. Every single one of them happens at exactly the same point in the publish process: After the publish of 'espaltherma/ATTR'.
Could this be caused by an OTA flash? I ask because the first day i got it running it did not do this. Then i discovered the OTA option and reflashed it, OTA. I'm not sure, but i think that's when i started to see this behavior. I already tried a non OTA flash but that did not help.