aisha.maker
@aisha_r58 · Mitglied seit Oktober 2025
Maker · home automation · Brisbane
- Themen
- 7
- Antworten
- 42
- Punkte
- 0
Erstellte Forenantworten
Von English mit KI übersetzt ·
Der Loopback-Test lohnt sich, in deinen Notizen aufgehoben zu werden. Hat mir zweimal geholfen.
The loopback test is worth keeping in your notes. Saved me twice.
Von English mit KI übersetzt ·
Ich dachte, SF12 ist einfach eine langsamere Version von SF7, also dasselbe, nur mit mehr Zeit?
I thought SF12 is just a slower version of SF7, same thing, more time?
Von English mit KI übersetzt ·
Dann also der Dongle-Weg. Antenne oben auf der Box, das integrierte WLAN ist aus, das Signal liegt jetzt bei -61 dBm bei geschlossener Tür. Seit Samstag gibt es im Log-Tab keine Keepalive-Abbrüche mehr, und das Lötkolben liegt in der Schublade. Zuerst musste ich den Treiber für meinen Dongle installieren, es war ein RTL8812AU, also prüfe vor dem Kauf, ob deiner unterstützt wird.
Dongle route it is. Antenna on top of the box, onboard Wi-Fi off, signal now -61 dBm with the door shut. No keepalive disconnects in the Log tab since Saturday, and I kept the soldering iron in the drawer. Had to install the driver for my dongle first, it was a RTL8812AU one, so check yours is supported before buying.
Von English mit KI übersetzt ·
Nach meiner Erfahrung sind die HLK-Module zu Hause problemlos einsetzbar, ich habe einige seit Jahren im Betrieb.
The HLK modules are fine at home in my experience, I have a few running for years.
Von English mit KI übersetzt ·
Ist die Masse des Pi irgendwo mit der 0-V-Seite der 24-V-Versorgung verbunden? Wenn ja, trennt der Optokoppler nichts.
Is the Pi’s ground tied to the 24 V supply’s 0 V somewhere? If so the opto isn’t isolating anything.
Von English mit KI übersetzt ·
Tyler hat in einem Satz recht, hier ist die längere Version. PubSubClient liest nur vom Socket und sendet Pings innerhalb von client.loop(). Das Standard-Keepalive beträgt 15 s. Sie schlafen 30 s, also wird kein Ping gesendet, der Broker trennt die Verbindung nach keepalive_timeout, und Status -3 bedeutet „connection lost“.
Blockieren Sie niemals in loop(), verwenden Sie stattdessen einen Timer:
unsigned long last = 0;
void setup() {
...
client.setKeepAlive(60);
client.setBufferSize(512);
}
void loop() {
if (!client.connected()) reconnect(); // with a back-off, not a tight loop
client.loop(); // every pass
if (millis() - last >= 30000) {
last = millis();
snprintf(buf, sizeof buf, "{"temperature":%.2f}", bme.readTemperature());
client.publish("v1/telemetry", buf);
}
}
Ein Keepalive zwischen 30 und 300 s wird laut Dokumentation empfohlen. Und tun Sie, was Niall gesagt hat, der Log-Tab nennt den Grund für jede Trennung.
Tyler’s right in one line, here’s the longer version. PubSubClient only reads from the socket and sends pings inside client.loop(). Its default keepalive is 15 s. You sleep 30 s, so no ping goes out, the broker drops you for keepalive_timeout, and state -3 is „connection lost“.
Never block in loop(), use a timer instead:
unsigned long last = 0;
void setup() {
...
client.setKeepAlive(60);
client.setBufferSize(512);
}
void loop() {
if (!client.connected()) reconnect(); // with a back-off, not a tight loop
client.loop(); // every pass
if (millis() - last >= 30000) {
last = millis();
snprintf(buf, sizeof buf, "{"temperature":%.2f}", bme.readTemperature());
client.publish("v1/telemetry", buf);
}
}
Keepalive between 30 and 300 s is what the docs recommend. And do what Niall said, the Log tab names the reason for every disconnect.
Von English mit KI übersetzt ·
Auf eine Messung alle 100 ms reduziert, und seitdem ist es zwei Tage am Stück verbunden. Michael, allein delay(1) hat die Abbrüche verringert, aber es brach trotzdem ab.
Down to one read every 100 ms and it has been connected for two days straight. Michael, delay(1) alone made it drop less, but it still dropped.
Von English mit KI übersetzt ·
Auf einem einfachen Broker schon. Du könntest Mosquitto auf einem Pi im Depot laufen lassen und die Schaltschränke zusätzlich dorthin publizieren lassen. Etwas unübersichtlich allerdings, zwei Ziele zum Senden.
On a plain broker it is. You could run Mosquitto on a Pi in the depot and have the cabinets publish there as well. Bit messy though, two places to send to.
Von English mit KI übersetzt ·
+1 zum Twin-Teil. Auch bei meinem Hausprojekt haben die Boards für andere Leute plötzlich Sinn ergeben, sobald die Geräte unter Räumen platziert waren.
+1 to the Twin bit. Even in my house project, once devices sat under rooms the boards suddenly made sense to other people.
Von English mit KI übersetzt ·
Der einzelne N-Kanal unten ist einfacher, das würde ich einfach so machen.
The single N-channel on the bottom is simpler, I’d just do that.
Von English mit KI übersetzt ·
Ein 802.3af-Splitter mit micro-USB-5-V-Ausgang funktioniert am 3B, ich betreibe einen in meinem Gewächshaus. Nimm einen mit 2,4 A Nennstrom, die 1-A-Modelle brechen unter Last zusammen, wenn RS-485-HAT und WLAN gleichzeitig ausgelastet sind.
An 802.3af splitter with a micro-USB 5 V output works on a 3B, I run one in my greenhouse. Get one rated 2.4 A, the 1 A ones brown out when the RS-485 HAT and Wi-Fi are both busy.
Von English mit KI übersetzt ·
Keine Topics pro Gerät nötig. Alle 300 veröffentlichen auf dasselbe v1/telemetry. Hermetry erkennt anhand der Zugangsdaten, mit denen sich das Gerät angemeldet hat, wer spricht, das Token ist also faktisch die Adresse. Gerät 17 kann nicht als 18 schreiben, weil es die Zugangsdaten von 18 nicht besitzt, und ein Gerät kann nur seine eigenen Downlink-Topics abonnieren (v1/attributes/set, v1/rpc/req/+ und so weiter), sieht also ebenfalls nie Nachrichten anderer Geräte. Keine ACL-Datei zu pflegen.Kevin hat recht, dass es Custom-Topics gibt, aber die sind für Firmware gedacht, die man nicht ändern kann: Das Profil behandelt dann jedes Topic außerhalb von v1/ als Telemetrie des jeweiligen Geräts. Die Grenzwerte dabei sind Topic-Tiefe 8, Länge 128 und 50 verschiedene Topics pro Gerät. Mit „Prefix keys with the topic“ wird aus grid/s12/temp ein Schlüssel wie grid.s12.temp. Da du neue Firmware schreibst, lass all das weg.Für die Standort-ID würde ich ein Attribut des Geräts verwenden statt eines Teils des Topics. Sie ändert sich nicht minütlich, gehört also nicht in die Telemetrie.Referenz mit der vollständigen Topic-Tabelle: MQTT topics and payload reference. Eine praktische Sache aus meiner eigenen Umstellung: Gib jeder Einheit ein eigenes Zugangsdatum. Zwei Geräte mit demselben Token werfen sich ständig gegenseitig raus.
No per-device topics needed. All 300 publish to the same v1/telemetry. Hermetry knows who’s talking from the credential the device logged in with, so the token is effectively the address. Unit 17 can’t write as unit 18 because it doesn’t have 18’s credential, and a device can only subscribe to its own downlink topics (v1/attributes/set, v1/rpc/req/+ and so on), so it never sees another device’s messages either. No ACL file to keep.
Kevin’s not wrong that Custom topics exist, but they’re for firmware you can’t change: the profile then takes any topic outside v1/ as telemetry of that device. Limits there are topic depth 8, length 128 and 50 distinct topics per device, and with „Prefix keys with the topic“ grid/s12/temp becomes a key like grid.s12.temp. Since you’re writing new firmware, skip all of that.
For the site id I’d make it an attribute of the device instead of part of the topic. It doesn’t change every minute so it doesn’t belong in telemetry.
Reference with the full topic table: MQTT topics and payload reference. One practical thing from when I moved my own stuff: give every unit its own credential. Two devices sharing one token keep kicking each other off.
Von English mit KI übersetzt ·
Damit das Pop-up erscheint, braucht der ESP32 einen DNS-Server, der jeden Namen mit 192.168.4.1 beantwortet. Das Telefon ruft eine bekannte Adresse auf, erhält stattdessen Ihre Seite und erkennt darin ein Portal.
The pop-up needs a DNS server on the ESP32 that answers every name with 192.168.4.1. The phone tries some known address, gets your page instead and decides it’s a portal.
Von English mit KI übersetzt ·
Erledigt. Den Hotspot habe ich mit nmcli hinzugefügt, wie tsmith geschrieben hat, Prioritäten 20/10. Am Samstag hat er sich etwa 40 s nach dem Booten mit dem Handy verbunden. Messwerte wurden in eine JSONL-Datei geschrieben, solange das Handy an den hinteren Beeten kein Signal hatte, und dann in Paketen zu je 50 hochgeladen, sobald es wieder Empfang gab. In der ersten Woche waren die Zeitstempel bei den ersten paar Messwerten um eine Stunde falsch, genau das NTP-Problem, daher habe ich eine DS3231 bestellt, so wie Michael. Bis sie da ist, prüft das Skript vor dem Stempeln NTPSynchronized.
Sorted. Added the hotspot with nmcli as tsmith wrote, priorities 20/10. Saturday it joined the phone within about 40 s of boot. Readings went into a JSONL file while the phone had no signal at the far beds, then went up in batches of 50 when it came back. First week the times were off by an hour on the first few readings, the NTP thing exactly, so I’ve ordered a DS3231 like Michael. Until it comes the script checks NTPSynchronized before stamping.
Von English mit KI übersetzt ·
Ich habe 20 MDBT42Q-Module bestellt, um die Platine zu überarbeiten, und zu Hause ein Pi-Gateway mit dem v1/gw-Format eingerichtet. Meine fünf Tags erschienen innerhalb einer Minute als Untergeordnete, benannt nach ihren MAC-Adressen. Der Punkt mit der doppelten Meldung ist real: Zwei Pis in meinem Haus meldeten denselben Tag, ich habe das mit einer Regel für die stärkste RSSI in den Gateways behoben.
Ordered 20 MDBT42Q modules to rework the board, and set up a Pi gateway at home with the v1/gw format. My five tags showed up as children named after their MAC addresses within a minute. The double-reporting point is real: two Pis in my house both reported the same tag, fixed it with a strongest-RSSI rule in the gateways.

