smithops
@tsmith · Ocak 2026 tarihinde katıldı
Plant manager · automotive · 6 years in the field
- Konular
- 4
- Yanıtlar
- 35
- Puan
- 0
Oluşturulan forum yanıtları
Not at 140 m next to VFDs it isn’t.
Yapay zekâ tarafından English dilinden çevrildi ·
Kevin haklı, ve “preconfigured” bağlantısı, imager’ın ev WiFi’nizden oluşturduğu bağlantıdır. Hotspot’u ikinci bir NetworkManager bağlantısı olarak ekleyin ve ikisine de öncelik verin. Ben tam olarak bu yapıyla iki fabrika arasında bir Pi taşıyorum.
sudo nmcli con add type wifi ifname wlan0 con-name allotment
ssid "Aisha-phone" wifi-sec.key-mgmt wpa-psk wifi-sec.psk "********"
sudo nmcli con modify allotment connection.autoconnect yes connection.autoconnect-priority 10
sudo nmcli con modify preconfigured connection.autoconnect-priority 20
nmcli -f NAME,AUTOCONNECT,AUTOCONNECT-PRIORITY con show
İkisi de menzildeyse yüksek öncelikli olan kazanır, yani önce ev. Pi’yi açmadan önce hotspot’u açın; Pi önce açılırsa bir dakika bekleyin, NetworkManager yeniden tarar.Tamponlama için okumaları küçük bir SQLite tablosunda veya hatta bir JSONL dosyasında tutun ve bağlantı geri geldiğinde bunları kendi zaman damgalarıyla, toplu halde gönderin:
[{"ts": 1762668000000, "values": {"soil.bed3": 31.5, "air.temp": 12.1}},
{"ts": 1762668300000, "values": {"soil.bed3": 31.2, "air.temp": 12.6}}]
ts, UTC cinsinden milisaniyedir. Bir satırı yalnızca yayın onaylandıktan sonra silin (QoS 1, paho ile wait_for_publish() kullanarak PUBACK’i bekleyin).Pi ile ilgili bir tuzak: pilli bir saat yoktur. Allotment’ta açılır ve bir süre ağ alamazsa, NTP senkronize olana kadar saat yanlıştır; bu saatle damgalanan okumalar yanlış zamana düşer ya da atılır (10 dakikadan fazla ileri tarihliyse reddedilir). Okumaları yalnızca timedatectl show -p NTPSynchronized evet dediğinde damgalayın; aksi halde ts olmadan gönderin ve Hermetry’nin varış zamanını kullanmasına izin verin.
Kevin’s right, and the “preconfigured” connection is the one the imager created from your home WiFi. Add the hotspot as a second NetworkManager connection and give both a priority. I carry a Pi between two factories with exactly this.
sudo nmcli con add type wifi ifname wlan0 con-name allotment
ssid "Aisha-phone" wifi-sec.key-mgmt wpa-psk wifi-sec.psk "********"
sudo nmcli con modify allotment connection.autoconnect yes connection.autoconnect-priority 10
sudo nmcli con modify preconfigured connection.autoconnect-priority 20
nmcli -f NAME,AUTOCONNECT,AUTOCONNECT-PRIORITY con show
Higher priority wins when both are in range, so home first. Turn the hotspot on before you power the Pi; if it boots first, give it a minute, NetworkManager rescans.
For buffering: keep the readings in a small SQLite table or even a JSONL file, and when the connection comes back send them with their own time stamps, in batches:
[{"ts": 1762668000000, "values": {"soil.bed3": 31.5, "air.temp": 12.1}},
{"ts": 1762668300000, "values": {"soil.bed3": 31.2, "air.temp": 12.6}}]
ts is milliseconds UTC. Delete a row only after the publish is acknowledged (QoS 1, wait for the PUBACK in paho with wait_for_publish()).
One trap with a Pi: there’s no battery-backed clock. If it boots at the allotment and gets no network for a while, the clock is wrong until NTP syncs, and readings stamped with that clock end up at the wrong time or get dropped (more than 10 minutes in the future is refused). Only stamp readings after timedatectl show -p NTPSynchronized says yes, otherwise send them without ts and let Hermetry use the arrival time.
Yapay zekâ tarafından English dilinden çevrildi ·
Fabrikamızdaki hat aydınlatmaları için tam olarak bunu, süpervizör bilgisayarındaki küçük bir betikle yapıyoruz. Bir API anahtarıyla Commands API kullanılıyor.Anahtar kartınız zaten bir komut gönderiyor ve kartlar yalnızca cihaz profilinin Temel seviyedeki Commands kataloğunda bulunan komutları gönderebilir. Yani yöntem mevcut. Tam adını ve parametrelerini görmek için, oluşturacağınız anahtarla API’ye sorun: GET /tenant/<tenantId>/api/iot/devices/<deviceId>/rpc-commands o cihaza bir kontrolün gönderebileceği komutları listeler.API Keys altında anahtarı oluşturun: temel komutları gönderme ve komutları okuma iznini verin, masaüstünüzün adresini IP izin listesine ekleyin ve bir son kullanma tarihi seçin. Ardından:
#!/bin/sh
# ~/bin/office-lights (chmod 700)
KEY=$(cat ~/.config/hermetry/key)
curl -s -X POST "https://<your host>/tenant/<tenantId>/api/iot/devices/<deviceId>/rpc"
-H "Authorization: Bearer $KEY"
-H "Content-Type: application/json"
-d "{"method":"light.set","params":{"on":$1},"timeoutMs":10000}"
Zaman aşımı 30 saniye veya daha az olan çift yönlü bir komut bekler ve durumla birlikte 200 yanıtı verir; böylece terminalde SUCCESSFUL veya hatayı görürsünüz. office-lights true ve office-lights false komutlarını iki kısayola bağlayın, işiniz bitti. Bir API anahtarı yalnızca katalogdaki yöntemleri gönderebilir; bu da zaten burada istediğiniz şey.Dokümantasyon: Commands API.
We do exactly this for the line lights at our plant, from a little script on the supervisor’s PC. It’s the Commands API with an API key.
Your switch card already sends a command, and boards can only send commands that are in the device profile’s Commands catalogue at the Basic tier. So the method exists. To see its exact name and params, ask the API with the same key you’re about to create: GET /tenant/<tenantId>/api/iot/devices/<deviceId>/rpc-commands lists what a control may send to that device.
Create the key under API Keys: give it the permission to send basic commands and to read commands, put your desktop’s address in the IP allowlist, and pick an expiry. Then:
#!/bin/sh
# ~/bin/office-lights (chmod 700)
KEY=$(cat ~/.config/hermetry/key)
curl -s -X POST "https://<your host>/tenant/<tenantId>/api/iot/devices/<deviceId>/rpc"
-H "Authorization: Bearer $KEY"
-H "Content-Type: application/json"
-d "{"method":"light.set","params":{"on":$1},"timeoutMs":10000}"
A two-way command with a timeout of 30 seconds or less waits and answers 200 with the status, so you see SUCCESSFUL or the error in the terminal. Bind office-lights true and office-lights false to two shortcuts and you’re done. An API key can only send methods that are in the catalogue, which is what you want here anyway.
Docs: Commands API.
Yapay zekâ tarafından English dilinden çevrildi ·
Uygulanabilir. Ancak Pi ile router’ı küçük bir UPS’e bağlayın, aksi halde yük atma sırasında Pi’nin size hiçbir faydası olmaz.
Feasible. Put the Pi and the router on a small UPS though, otherwise the Pi buys you nothing during load shedding.
Yapay zekâ tarafından English dilinden çevrildi ·
Echo üzerindeki bölücü iyi. Depo doluyken sensör suya ne kadar uzaklıkta?
Divider on echo, good. How far is the sensor from the water when the tank is full?

