thompsonplc
@lthompson · Mitglied seit Mai 2025
Automation engineer · pharma · 14 years in the field
- Themen
- 7
- Antworten
- 65
- Punkte
- 0
Erstellte Forenantworten
Von English mit KI übersetzt ·
Aoife hat den Finger genau darauf gelegt. Wir betreiben AGVs in einem Pharmalager und hatten denselben Fehler, bis wir drei Dinge geändert haben.Mechanik: Lassen Sie die Station die finale Ausrichtung übernehmen. Ein V-förmiger Trichter oder zwei schräg angestellte Führungsschienen, die den Roboter in den letzten 15 cm in Position lenken, dazu federnd gelagerte Kontakte mit etwas Federweg. IR muss ihn nur in den Trichter bringen. Michaels breitere Kontakte helfen, aber der Trichter behebt den schiefen Fall.Logik: „docked“ heißt, dass Ladestrom fließt, nicht „IR ist am stärksten“. Nach dem Halten 2 s warten und den Ladestrom auslesen. Fließt er nicht, 30 cm zurücksetzen, erneut anfahren, maximal 3 Versuche. Nach 3 Fehlschlägen aufhören und es melden.Twin-Seite: Jede Station (sofern sie etwas meldet) auf das Raum-Asset legen, in dem sie steht, und die Roboter auf der Site platzieren, da sie zwischen Zonen wechseln und ihre Zone in der Telemetrie melden. Dann einen status-Schlüssel für die Roboter ableiten, entweder auf dem Pi oder im Root-Flow: critical nach 3 fehlgeschlagenen Andockversuchen oder Akku unter 15 %, warning während des Wiederholens, sonst ok. Der Site-Status übernimmt den schlechtesten Status aller darunter platzierten Elemente, sodass ein feststeckender Roboter die Halle in der Site-Ansicht rot färbt, ohne dass jemand die Telemetrie öffnen muss. Außerdem eine numerische Kopie (0/1/2) speichern, weil Textschlüssel keinen Diagrammverlauf haben. Wie der Status aggregiert wird: Site status and the status key.
Aoife put her finger on it. We run AGVs in a pharma warehouse and had the same failure until we changed three things.
Mechanical: let the dock do the final alignment. A V-shaped funnel or two angled guide rails that steer the robot into position in the last 15 cm, with spring-loaded contacts that have some travel. IR only has to get it into the funnel. Michael’s wider contacts help, but the funnel is what fixes the crooked case.
Logic: „docked“ means charging current flows, not „IR is strongest“. After stopping, wait 2 s and read the charge current. If it’s not there, back off 30 cm, approach again, up to 3 tries. After 3 failures stop trying and report it.
Twin side: place each dock (if it reports anything) on the room asset it sits in, and place the robots on the site, since they move between zones and report their zone in telemetry. Then derive a status key for the robots, either on the Pi or in the root flow: critical after 3 failed docking tries or battery under 15 %, warning while it’s retrying, ok otherwise. Site status takes the worst status of everything placed under it, so a stuck robot turns the hall red on the site view without anyone opening telemetry. Also store a numeric copy (0/1/2), because text keys have no chart history. How the status rolls up: Site status and the status key.
Von English mit KI übersetzt ·
Wir fördern dickes, faseriges Material in pharmazeutischen Abwasserleitungen, und dort stellt sich die Pumpenfrage ebenfalls.Echte tauchfähige Verdrängerpumpen sind selten. Der einzige Typ, der in der Flüssigkeit stehen kann, ist die luftbetriebene Doppelmembranpumpe (AODD). Sie läuft mit Druckluft, hat keine elektrischen Bauteile in der Grube, verträgt Feststoffe und läuft trocken ohne Schaden. Mit Edelstahl- oder Sphäroguss-Gehäuse und Klappenventilen (nicht Kugeln) kommt sie gut mit faserigem Schlamm zurecht. Sie benötigen einen Kompressor, und der Förderstrom pulsiert; falls das stört, setzen Sie vor dem Separator einen Pulsationsdämpfer ein.Die übrigen ehrlichen Optionen halten die Pumpe trocken:Eine Exzenterschneckenpumpe neben der Grube, unterhalb deren tiefstem Wasserstand, mit kurzer gefluteter Saugleitung und einem Zerkleinerer davor für das Stroh. Das ist die klassische Separatorzuführung und liefert den gleichmäßigsten Förderstrom. Eine Schlauchpumpe (Peristaltikpumpe), die sich selbst um einige Meter ansaugen kann und Fasern nichts ausmachen, dafür aber Schlauchwechsel erfordert.Für das Bild: Der Basissatz enthält nur eine Motorpumpe. Die Prozessbibliothek hat jedoch Membranpumpe, Schlauchpumpe, Zahnradpumpe und Tauchpumpe, und die Abwasserbibliothek hat eine Schneckenpumpe (dem Exzenterschneckenpumpen-Aussehen am nächsten) und eine Dosierpumpe, sofern Ihre Organisation diese Bibliotheken besitzt. Pumpensymbole nehmen die Werte Running, Speed und Direction sowie das Hand/Auto-Modus-Kennzeichen auf. Binden Sie Running daher an etwas wie pump_running und Speed an den Ausgang des Frequenzumrichters in Prozent. Sendet das Gerät Schlüssel, die nach der Symbol-ID benannt sind (p1.running, p1.speed), werden sie ohne Auswahl über den Namen verbunden.
We move thick, fibrous stuff in pharma waste lines, and the pump question comes up there too.
Real immersion PD pumps are rare. The one type that can sit in the liquid is an air-operated double-diaphragm pump (AODD). It runs on compressed air, has no electrics in the pit, tolerates solids and runs dry without damage. With stainless or ductile iron body and flap valves (not balls) it handles fibrous slurry well. You need a compressor and the flow pulses, so put a pulsation dampener before the separator if it minds.
The other honest options keep the pump dry:
A progressive cavity pump next to the pit, below its lowest level, with a short flooded suction and a macerator in front for the straw. That’s the classic separator feed and gives the steadiest flow. A hose (peristaltic) pump, which can self-prime several metres and doesn’t care about fibres, at the cost of hose changes.
For the screen: the core set only has a Motor pump, but the Process library has Diaphragm pump, Peristaltic pump, Gear pump and Submersible pump, and the Wastewater library has a Screw pump (closest look to a progressive cavity) and a Dosing pump, if your organisation has those libraries. Pump symbols take Running, Speed and Direction values plus the hand/auto Mode badge, so bind Running to something like pump_running and Speed to the VFD’s output in percent. If the device sends keys named after the symbol id (p1.running, p1.speed), they connect by name without picking.
Von English mit KI übersetzt ·
Es liegt an der Stufe. Eine Board-Steuerung sendet nur Befehle, die im Katalog des Profils stehen, auf Basic-Stufe und nicht mit hoher Auswirkung. Privileged, Critical und alles mit der Markierung hohe Auswirkung wird von einem Board absichtlich abgelehnt („vom Geräte-Konsole senden“), deshalb bietet die Auswahl sie nicht an.Bei uns läuft eine Laderampentür genauso. Setze gate.pulse auf Basic und entferne das Häkchen bei hoher Auswirkung. Lass dann in der Aktion der Schaltfläche „Vor Ausführung fragen“ aktiviert, damit der Bediener weiterhin einen Bestätigungsdialog erhält (der Server erzwingt das ebenfalls, niemand kann es von einem anderen Client aus umgehen). Verknüpfe eine Statuszeile mit door_closed, damit die Leute sehen, was die Tür tut, und nicht, was sie gedrückt haben. Wer drücken darf, regeln die Berechtigungen: Widget-Befehle ausführen sowie die Berechtigung, Basic-Befehle zu senden. Die Nachtschicht bekommt diese, Personen, die das Board nur ansehen, nicht.Und ein Punkt auf der ESP32-Seite: Ein Befehl kann zweimal ankommen. Speichere die letzten 32 Request-IDs für 10 Minuten und führe dieselbe ID nicht erneut aus. Bei einem Tor, das bei jedem Impuls umschaltet, ist das wichtig, denn ein Duplikat bedeutet, dass es sich erneut öffnet und schließt.Seite mit den Board-Regeln: Control cards.
It’s the tier. A board control only sends commands that are in the profile’s catalogue, Basic tier, and not high impact. Privileged, Critical and anything marked high impact get refused from a board on purpose („send it from the device console“), so the picker doesn’t offer them.
We run a loading-bay door the same way. Set gate.pulse to Basic and untick high impact, then leave „Ask before running“ on in the button’s action, so the operator still gets a confirm dialog (the server enforces it too, nobody skips it from another client). Bind a status line to door_closed so people see what the door is doing, not what they pressed. Who may press it is down to permissions: Run widget commands plus permission to send basic commands. Night shift gets those, people who only look at the board don’t.
And one thing on the ESP32 side: a command can arrive twice. Keep the last 32 request ids for 10 minutes and don’t run the same id again. For a gate that toggles on each pulse this matters, a duplicate means it opens and closes again.
Page with the board rules: Control cards.
Von English mit KI übersetzt ·
Spiel darauf ein aktuelles Raspberry Pi OS Lite (legacy) auf, damit die TLS-Bibliotheken auf dem neuesten Stand sind. Hermetry verlangt TLS 1.2 oder neuer mit ECDHE-Suites, und ein Image von 2013 kann keine Verbindung herstellen.
Put a current Raspberry Pi OS Lite (legacy) on it so the TLS libraries are up to date. Hermetry wants TLS 1.2 or newer with ECDHE suites, and a 2013 image won’t connect.
Von English mit KI übersetzt ·
Jessica hat das Hauptproblem genau erkannt: Bei 15-20 cm befindest du dich in der Totzone. Montiere den Sensor höher, ein kurzes PVC-Rohrstück als Abstandshalter funktioniert, sodass der volle Tank mindestens 30 cm entfernt ist.Das zweite Problem ist das Timing in Python. Busy-Wait-Schleifen auf einem Pi 3 verpassen Flanken, sobald der Scheduler dazwischenfunkt. Verwende gpiozero mit der pigpio-Pin-Factory, sie versieht Flanken im Daemon mit Zeitstempeln:
from gpiozero import DistanceSensor
from gpiozero.pins.pigpio import PiGPIOFactory
import statistics, time
s = DistanceSensor(echo=24, trigger=23, max_distance=4.5,
pin_factory=PiGPIOFactory())
def level_cm():
vals = []
for _ in range(7):
vals.append(s.distance * 100); time.sleep(0.1)
return statistics.median(vals)
Der Median aus 7 Messungen verwirft das vereinzelte Echo von der Tankwand. Sende dann {"distance_cm": d, "level_pct": ...} als Zahlen und setze eine Alarmregel auf level_pct unter 20 mit einem Debounce von 3 Messwerten, damit ein einzelnes fehlerhaftes Echo nicht den Hausmeister weckt.
Jessica nailed the main issue: at 15-20 cm you’re inside the blind zone. Mount it higher, a short PVC pipe section as a stand-off works, so full tank is at least 30 cm away.
Second issue is the Python timing. Busy-wait loops on a Pi 3 miss edges whenever the scheduler steps in. Use gpiozero with the pigpio pin factory, it timestamps edges in the daemon:
from gpiozero import DistanceSensor
from gpiozero.pins.pigpio import PiGPIOFactory
import statistics, time
s = DistanceSensor(echo=24, trigger=23, max_distance=4.5,
pin_factory=PiGPIOFactory())
def level_cm():
vals = []
for _ in range(7):
vals.append(s.distance * 100); time.sleep(0.1)
return statistics.median(vals)
Median of 7 throws away the odd echo off the tank wall. Then send {"distance_cm": d, "level_pct": ...} as numbers and put an alarm rule on level_pct below 20 with a debounce of 3 readings, so one bad echo doesn’t wake the warden.
Von English mit KI übersetzt ·
Genau das: pi3-disable-bt war mit dem Kommentar „for chiller“ aus dem Jahr 2019 vorhanden. Umgestellt auf pi3-miniuart-bt + core_freq=250, hci0 ist aktiv, alle acht Tags erscheinen bei einem Scan und die Abfrage des Kühlers hat keinen Takt verpasst. Nur eine Konfigurationsänderung, daher stuft die Validierung sie als geringfügige Änderung ein.
Exactly that, pi3-disable-bt was there with a comment „for chiller“ from 2019. Swapped to pi3-miniuart-bt + core_freq=250, hci0 is up, all eight tags show in a scan and the chiller polling didn’t miss a beat. Config change only, so validation treats it as a minor change.
Von English mit KI übersetzt ·
^ ja. Verwende außerdem GPIO-Pins ohne Boot-Funktion, vermeide also für die Schleifen die Pins 0, 2, 12 und 15.
^ yes. And use GPIO pins that have no boot role, so avoid 0, 2, 12 and 15 for the loops.
Von English mit KI übersetzt ·
Stromversorgung aus- und wieder eingeschaltet, ja. pi-bluetooth ist installiert. systemctl status hciuart meldet failed, „Failed to start Configure Bluetooth Modems connected by UART“.
Power cycled, yes. pi-bluetooth is installed. systemctl status hciuart says failed, „Failed to start Configure Bluetooth Modems connected by UART“.
Von English mit KI übersetzt ·
Der String ist weg, bevor du ihn verwendest. (String("barn-") + WiFi.macAddress()) erzeugt ein temporäres Objekt, das am Ende dieser Zeile zerstört wird, daher zeigt clientId auf freigegebenen Speicher. Was der Heap als Nächstes tut, landet in deiner Client-ID. Mich hat das vor Jahren bei einer Sensorplatine erwischt, und ich habe einen Tag verloren.Dieselbe Falle bei setServer(host.c_str(), ...): PubSubClient speichert den Zeiger, nicht eine Kopie. Wenn host ein lokaler String in setup() ist, bekommst du später seltsame Fehler beim Wiederverbinden.Verwende Puffer, die so lange leben wie der Client:
static char clientId[32];
static char brokerHost[64];
void setupMqtt() {
uint8_t mac[6];
WiFi.macAddress(mac);
snprintf(clientId, sizeof(clientId), "barn-%02x%02x%02x", mac[3], mac[4], mac[5]);
strlcpy(brokerHost, settings.host.c_str(), sizeof(brokerHost));
mqtt.setServer(brokerHost, 8883);
}
// later
mqtt.connect(clientId, settings.token.c_str(), "");
settings.token.c_str() ist innerhalb des Aufrufs in Ordnung, solange settings global lebt.
The String is gone before you use it. (String("barn-") + WiFi.macAddress()) makes a temporary that’s destroyed at the end of that line, so clientId points into freed memory. Whatever the heap does next ends up in your client ID. Bit me on a sensor board years ago and I wasted a day too.
Same trap with setServer(host.c_str(), ...): PubSubClient keeps the pointer, not a copy, so if host is a local String in setup() you’ll get odd reconnect failures later.
Use buffers that live as long as the client:
static char clientId[32];
static char brokerHost[64];
void setupMqtt() {
uint8_t mac[6];
WiFi.macAddress(mac);
snprintf(clientId, sizeof(clientId), "barn-%02x%02x%02x", mac[3], mac[4], mac[5]);
strlcpy(brokerHost, settings.host.c_str(), sizeof(brokerHost));
mqtt.setServer(brokerHost, 8883);
}
// later
mqtt.connect(clientId, settings.token.c_str(), "");
settings.token.c_str() is fine inside the call as long as settings lives globally.
Von English mit KI übersetzt ·
Gut, dann ist alles nur ein potentialfreier Kontakt und das ist einfach. Ich habe vor einiger Zeit fast dasselbe für das Lager eines Kunden gemacht.Die 2,2k, die Sie gemessen haben, ist der End-of-Line-Widerstand (EOL). Die alte Zentrale nutzte ihn, um „geschlossen“ von „Draht unterbrochen“ und „Kurzschluss“ zu unterscheiden. Sie haben zwei Möglichkeiten:
- Am einfachsten: Überbrücken oder ignorieren Sie ihn und lesen jede Schleife als digitalen Eingang. Geschlossene Tür = 2,2k nach Masse, was mit dem internen Pull-up des ESP32 (etwa 45k) als LOW gelesen wird. Offen = HIGH. Das funktioniert, aber ein unterbrochener Draht sieht genau wie eine offene Tür aus.
- Überwachung beibehalten: Lesen Sie jede Schleife an einem ADC-Pin mit einem 10k-Pull-up auf 3,3 V. Geschlossen sind es etwa 0,6 V, offen 3,3 V, kurzgeschlossen 0 V. Dann können Sie einen separaten
fault-Wert senden.
Bei 20 Schleifen gehen Ihnen die nutzbaren ADC-Pins aus, deshalb würde ich digitale Eingänge verwenden oder einen MCP23017-I2C-Expander für die Eingänge ergänzen.PIRs: Stellen Sie ein 12-V-Netzteil in den Schrank, versorgen Sie die PIRs damit und verbinden Sie den Öffner-Kontakt des Relais genau wie eine Tür mit einem Eingang. Verbinden Sie den 12-V-Minuspol nur dann mit der ESP32-Masse, wenn es nötig ist, das Relais ist ohnehin galvanisch getrennt. Die Sabotagekontakte können ebenfalls an Eingänge angeschlossen werden, wenn Sie wissen möchten, wann jemand eine Abdeckung öffnet.Auf der Hermetry-Seite senden Sie jeden Eingang als 0/1 statt true/false, damit Sie einen Diagrammverlauf erhalten. Etwa so:
{"door_lobby": 0, "door_dock": 1, "pir_hall": 0, "tamper_any": 0}
Senden Sie bei jeder Änderung plus einmal pro Minute, damit der letzte Wert aktuell ist. Dann eine Alarmregel wie door_dock == 1 im Profil und eine Zeitbedingung für die Zeit nach Geschäftsschluss.
Good, then everything is just a dry contact and this is easy. I did almost the same thing for a client’s warehouse a while back.
The 2.2k you measured is the end-of-line (EOL) resistor. The old panel used it to tell „closed“ from „wire cut“ from „short“. You have two choices:
- Simplest: bypass or ignore it and read each loop as a digital input. Closed door = 2.2k to ground, which with the ESP32 internal pull-up (around 45k) reads as LOW. Open = HIGH. That works, but a cut wire looks exactly like an open door.
- Keep the supervision: read each loop on an ADC pin with a 10k pull-up to 3.3 V. Closed is about 0.6 V, open is 3.3 V, shorted is 0 V. Then you can send a separate
faultvalue.
For 20 loops you will run out of usable ADC pins, so I’d do digital inputs, or add an MCP23017 I2C expander for the inputs.
PIRs: put a 12 V supply in the closet, power the PIRs from it, and wire the N.C. relay contact to an input exactly like a door. Tie the 12 V negative to the ESP32 ground only if you need to, the relay is isolated anyway. The tamper contacts can go to inputs too if you want to know when someone opens a cover.
On the Hermetry side, send each input as 0/1, not true/false, so you get a chart history of it. Something like:
{"door_lobby": 0, "door_dock": 1, "pir_hall": 0, "tamper_any": 0}
Send on every change plus once a minute, so the latest value is fresh. Then an alarm rule like door_dock == 1 on the profile, and a time condition for after hours.
Von English mit KI übersetzt ·
Aisha und Ciaran haben die beiden Ursachen genannt. Ich habe das einmal für einen Nano in einem Lüftungsgerät gemacht, hier ist das komplette Rezept für das ZS-040-Board.1. Den HC-05 in den AT-Modus bringen: Beim Einschalten den kleinen Taster gedrückt halten, die LED blinkt dann langsam (etwa alle 2 s). Mit einem USB-Seriell-Adapter bei 38400 Baud mit ihm kommunizieren. 2. Einrichten (115200, wenn Ihr Nano mit „ATmega328P“ funktioniert, 57600, wenn nur „Old Bootloader“ funktioniert):
AT+ROLE=0
AT+UART=115200,0,0
AT+POLAR=1,0
AT+POLAR=1,0 sorgt dafür, dass PIO11 bei bestehender Verbindung auf Low geht. 3. Reset-Verdrahtung. Das ZS-040 führt PIO11 nicht auf einen Header-Pin heraus, daher einen dünnen Draht an Pin 32 des Moduls löten. Diesen über einen 0,1-uF-Kondensator mit dem RESET des Nano verbinden, genauso wie es der DTR des USB-Chips macht. Wenn avrdude den Port öffnet, baut sich die Verbindung auf, PIO11 fällt ab, der Kondensator macht daraus einen kurzen Reset-Impuls, und der Bootloader lauscht. 4. STATE von RESET trennen.Das ist fummelig, und die erste Synchronisation nach dem Koppeln schlägt manchmal fehl, also versuchen Sie es zweimal, bevor Sie wieder mit der Fehlersuche beginnen.
Aisha and Ciaran have the two causes. I did this for a Nano in an air handler once, here’s the whole recipe for the ZS-040 board.
1. Put the HC-05 in AT mode: hold the little button while powering it, the LED blinks slowly (about every 2 s). Talk to it at 38400 from a USB-serial adapter. 2. Set it up (115200 if your Nano works with „ATmega328P“, 57600 if only „Old Bootloader“ works):
AT+ROLE=0
AT+UART=115200,0,0
AT+POLAR=1,0
AT+POLAR=1,0 makes PIO11 go low while a link is up. 3. Reset wiring. The ZS-040 doesn’t bring PIO11 out to a header pin, so solder a thin wire to pin 32 of the module. Connect it to the Nano’s RESET through a 0.1 uF capacitor, the same way the USB chip’s DTR does it. When avrdude opens the port, the link comes up, PIO11 drops, the capacitor turns that into a short reset pulse, and the bootloader is listening. 4. Disconnect STATE from RESET.
It’s fiddly, and the first sync after pairing sometimes fails, so try twice before you start debugging again.
Von English mit KI übersetzt ·
Das war es. Das HAL_Delay(5) hatte ich beim Raten eingefügt. Wenn ich es entferne und auf TC warte, erhalte ich alle 9 Bytes und die CRC stimmt jedes Mal. Auch das Echo ist weg. Als Nächstes gehe ich wie von Aoife vorgeschlagen zu idle line DMA über.
That was it. The HAL_Delay(5) was something I’d added while guessing, removing it and waiting on TC gives me all 9 bytes and the CRC checks out every time. No more echo either. Moving to idle line DMA next like Aoife suggested.
Von English mit KI übersetzt ·
Keines von beiden, die Anfrage wird auf dem Oszilloskop korrekt dekodiert und der Zähler antwortet darauf. Es liegt auf meiner Seite.
Neither, the request decodes fine on the scope and the meter replies to it. It’s my side.
Von English mit KI übersetzt ·
Bauen Sie das ADC/DAC-Ding nicht. Wenn Ihre Platine neu startet oder der DAC einen Glitch erzeugt, sieht die SPS einen Pegelsprung, und dann sind Sie diejenige Person, die die Anlage zum Stillstand gebracht hat. Alles, was Sie in diese Schleife einbauen, muss den korrekten Messwert der SPS sicherstellen, auch wenn Ihre Seite ausgefallen ist.Zwei Lösungen, die ich verwendet habe, beide Standardkomponenten:
- Ein schleifengespeister Signalteiler/Trenner, ein Eingang, zwei galvanisch getrennte 4-20-mA-Ausgänge. Die SPS bekommt einen Ausgang, Ihr Node den anderen. Schleifengespeiste Geräte beziehen ihre Energie aus der Schleife, prüfen Sie also das Spannungsbudget: Versorgung minus Mindestspannung des Transmitters minus Spannungsabfall des Trenners minus Bürde des SPS-Eingangs muss bei 20 mA positiv bleiben.
- Aishas Idee, sicher umgesetzt: ein kleiner Serienshunt mit einem galvanisch getrennten Analogeingangsmodul mit Modbus-RTU-Ausgang. Die Trennung beseitigt die Masseschleife, die Ciarán befürchtet hat. Ihr Gateway liest sie über RS485 wie jedes andere Modbus-Gerät. Dieselbe Prüfung des Spannungsbudgets gilt; ein 50-Ohm-Shunt erzeugt bei 20 mA einen Spannungsabfall von 1 V.
Ich bevorzuge Variante 1, weil der Signalpfad der SPS ein zertifiziertes Bauteil ist und kein Shunt, den jemand später entfernen könnte.Senden Sie dann in Hermetry die rohen mA-Werte und rechnen Sie dort um. Im Root-Flow bildet ein Scale-Block vor Save telemetry den 4-20-Bereich auf Ihren Tankbereich ab, und den Rohwert behalten Sie für die Fehlersuche (unter 3,8 mA bedeutet eine unterbrochene Schleife):
Scale: in_min 4, in_max 20, out_min 0, out_max 100 -> level_pct
Das Beispiel für abgeleitete Werte finden Sie unter Derived values.
Don’t build the ADC/DAC thing. If your board resets or the DAC glitches, the PLC sees a level jump and you’re now the person who tripped the site. Anything you put in that loop must keep the PLC’s reading correct even when your side is dead.
Two things I’ve used, both off the shelf:
- A loop-powered signal splitter/isolator, one input, two isolated 4-20 mA outputs. The PLC gets one output, your node the other. Loop-powered ones take the power from the loop, so check the voltage budget: supply minus transmitter minimum minus the isolator’s drop minus the PLC input’s burden must stay positive at 20 mA.
- Aisha’s idea done safely: a small series shunt with an isolated analog input module that has Modbus RTU output. The isolation removes the ground loop Ciarán worried about. Your gateway reads it over RS485 like any other Modbus device. Same voltage budget check, a 50 ohm shunt costs 1 V at 20 mA.
I prefer 1 because the PLC’s signal path is a certified part and not a shunt someone may remove later.
Then in Hermetry send the raw mA and convert there. In the root flow, a Scale block before Save telemetry maps 4-20 to your tank range, and you keep the raw value for fault finding (below 3.8 mA means a broken loop):
Scale: in_min 4, in_max 20, out_min 0, out_max 100 -> level_pct
The derived value example is on Derived values.
Von English mit KI übersetzt ·
Aisha hat recht. Hermetry speichert einen Body, der kein JSON ist, als einzelnen raw-Schlüssel, deshalb siehst du deinen Vorlagentext. Baue das JSON mit printf und sende alle Standorte in einer einzigen Nachricht, das ist günstiger und übersichtlicher:
#!/bin/bash
json="{"
while read -r ip name; do
if ping -c 3 -W 2 "$ip" > /dev/null 2>&1; then ok=1; else ok=0; fi
json+=$(printf '"%s.up":%d,' "$name" "$ok")
done < /home/pi/sites.txt
json="${json%,}}"
mosquitto_pub -h "$BROKER" -p 8883 --capath /etc/ssl/certs -u "$TOKEN" -q 1
-t v1/telemetry -m "$json"
Drei Pings, nicht einer: Gilt als erreichbar, wenn einer davon antwortet.
Für den Alarm eine Alarmregel im Profil pro Standort-Schlüssel mit einem Zähl-Debounce, sodass es mehrere schlechte Messwerte in Folge braucht, bevor sie auslöst, und mehrere gute, bevor sie zurückgesetzt wird:
{ "type": "pump3_unreachable",
"title": "Pump 3 modem not answering",
"severities": [ { "severity": "MAJOR", "condition": { "key": "pump3.up", "op": "==", "value": 0 } } ],
"debounce": { "mode": "count", "raise": 5, "clear": 2 },
"enabled": true }
Fünf Minuten fehlgeschlagener Pings, bevor jemand etwas erfährt. Füge zusätzlich eine Device-offline-Regel für den Pi hinzu, sonst sieht ein toter Pi aus wie „alles in Ordnung“. Debounce-Optionen: Debounce, hysteresis and dampening.
Aisha has it. Hermetry stores a body that isn’t JSON as a single raw key, which is why you see your template text. Build the JSON with printf, and send all sites in one message, cheaper and tidier:
#!/bin/bash
json="{"
while read -r ip name; do
if ping -c 3 -W 2 "$ip" > /dev/null 2>&1; then ok=1; else ok=0; fi
json+=$(printf '"%s.up":%d,' "$name" "$ok")
done < /home/pi/sites.txt
json="${json%,}}"
mosquitto_pub -h "$BROKER" -p 8883 --capath /etc/ssl/certs -u "$TOKEN" -q 1
-t v1/telemetry -m "$json"
Three pings, not one: counts as up if any one comes back.
For the alert, an alarm rule on the profile per site key with a count debounce, so it needs several bad readings in a row before it opens and several good ones to clear:
{ "type": "pump3_unreachable",
"title": "Pump 3 modem not answering",
"severities": [ { "severity": "MAJOR", "condition": { "key": "pump3.up", "op": "==", "value": 0 } } ],
"debounce": { "mode": "count", "raise": 5, "clear": 2 },
"enabled": true }
Five minutes of failed pings before anyone hears about it. Add a Device offline rule for the Pi too, otherwise a dead Pi looks like „everything fine“. Debounce options: Debounce, hysteresis and dampening.

