lynchlab
@aoife_l22 · Nisan 2025 tarihinde katıldı
Engineering student · university
- Konular
- 15
- Yanıtlar
- 79
- Puan
- 0
Oluşturulan forum yanıtları
Yapay zekâ tarafından English dilinden çevrildi ·
Sabitleme, alarmı bugün geri getirmek için işe yarıyor. Asıl çözüm iki satır. paho 2.x, ilk argüman olarak callback API sürümünü bekliyor, betiğiniz ise istemci kimliğini oraya geçiriyor, bu yüzden “chiller-pi” bir API sürümü olarak okunuyor. Constructor’ı ve on_connect imzasını değiştirin:
import paho.mqtt.client as mqtt
def on_connect(client, userdata, flags, reason_code, properties):
print("connected:", reason_code)
client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2, client_id="chiller-pi")
client.on_connect = on_connect
client.username_pw_set("<ACCESS_TOKEN>") # token as username, empty password
client.tls_set()
client.connect("<device host>", 8883, keepalive=60)
client.loop_start()
...
client.publish("v1/telemetry", json.dumps({"chiller_temp_c": t}), qos=1)
Bu arada protokolü MQTT 5’e geçirmeyin. Hermetry 3.1.1 kullanıyor ve return code 1 ile bir MQTT 5 CONNECT isteğini reddediyor. paho varsayılan olarak hâlâ 3.1.1 kullandığı için buna dokunmamak doğru.Teknisyenin başka callback’leri (on_disconnect, on_publish) varsa, bunların da 2.x’te imzası değişti; her biri için geçiş notlarını kontrol edin.
Pinning works to get the alarm back today. The proper fix is two lines. paho 2.x wants the callback API version as the first argument, and your script passes the client id there, so “chiller-pi” gets read as an API version. Change the constructor and the on_connect signature:
import paho.mqtt.client as mqtt
def on_connect(client, userdata, flags, reason_code, properties):
print("connected:", reason_code)
client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2, client_id="chiller-pi")
client.on_connect = on_connect
client.username_pw_set("<ACCESS_TOKEN>") # token as username, empty password
client.tls_set()
client.connect("<device host>", 8883, keepalive=60)
client.loop_start()
...
client.publish("v1/telemetry", json.dumps({"chiller_temp_c": t}), qos=1)
Don’t switch the protocol to MQTT 5 while you’re in there. Hermetry speaks 3.1.1 and refuses an MQTT 5 CONNECT with return code 1. paho still defaults to 3.1.1, so leaving it alone is right.
If the tech had other callbacks (on_disconnect, on_publish), they changed signature in 2.x as well, check the migration notes for each one.
Yapay zekâ tarafından English dilinden çevrildi ·
Wemos yeniden başlatıldığında çalışan toplam ne olacak? Temizlikçiler fişi çektiğinde elektrik kesintisi olur, bahse girerim.
What happens to the running total when the Wemos reboots? Power cuts when the cleaners unplug it, I’d bet.
Yapay zekâ tarafından English dilinden çevrildi ·
Ardından 2 register tek bir 32-bit float oluşturur. Yanıtınızı parçalara ayırıyorum:
01 slave address
03 function (read holding registers)
04 byte count, 4 bytes follow
43 66 99 9A data: register 0 = 0x4366, register 1 = 0x999A
3A 1E CRC
Dört veri baytını 0x4366999A olarak birleştirip IEEE 754 float olarak okursanız: işaret 0, üs 2^7 = 128 verir, mantis yaklaşık 1.8016 ve 128 x 1.8016 = 230.6. Demek ki Wilson’ın 0x4366 değeri float’ın ilk yarısıdır; bu yüzden bölme işlemi hiçbir zaman doğru sonuç vermez.Uno’da baytlar önce en anlamlı bayt gelerek ulaşır ama AVR little endian olduğundan, float’a kopyalamadan önce sıralarını ters çevirin:
uint8_t b[4] = { rx[6], rx[5], rx[4], rx[3] }; // 9A 99 66 43
float v;
memcpy(&v, b, 4);
Serial.print("{"l1.voltage":");
Serial.print(v, 1);
Serial.println("}");
Bazı ölçerler iki register’ı ters sırada gönderir (word swap). Gerilim yerine 1.2e-23 gibi bir değer alırsanız, rx[3..4] ile rx[5..6] değerlerini değiştirin. Ayrıca bir yanıta güvenmeden önce CRC’yi de kontrol edin.
Then the 2 registers are one 32-bit float. Splitting your reply:
01 slave address
03 function (read holding registers)
04 byte count, 4 bytes follow
43 66 99 9A data: register 0 = 0x4366, register 1 = 0x999A
3A 1E CRC
Put the four data bytes together as 0x4366999A and read them as an IEEE 754 float: sign 0, exponent gives 2^7 = 128, mantissa about 1.8016, and 128 x 1.8016 = 230.6. So Wilson’s 0x4366 is the first half of the float, which is why dividing never comes out right.
On the Uno the bytes arrive most significant first but the AVR is little endian, so reverse them before copying into a float:
uint8_t b[4] = { rx[6], rx[5], rx[4], rx[3] }; // 9A 99 66 43
float v;
memcpy(&v, b, 4);
Serial.print("{"l1.voltage":");
Serial.print(v, 1);
Serial.println("}");
Some meters send the two registers the other way round (word swapped). If you ever get something like 1.2e-23 instead of a voltage, swap rx[3..4] with rx[5..6]. Check the CRC before trusting a reply too.
Yapay zekâ tarafından English dilinden çevrildi ·
Sorun DE zamanlamasında. Ben de bir F103 ile kurduğum laboratuvar düzeneğinde tam olarak aynı şeyi yaşamıştım.HAL_UART_Transmit, son bayt veri kaydedicisine girdiğinde döner; shift kaydedicisinden çıktığında değil. Üstüne bir de 5 ms beklersiniz. 9600 baud’da bir bayt yaklaşık 1 ms sürer ve hızlı bir sayaç birkaç ms içinde yanıt vermeye başlar. DE yüksekken /RE de yüksek olur, yani alıcı kapalıdır ve yanıtın ilk baytları kaybolur. Ayrıca HAL_UART_Receive ancak bundan sonra çağrıldığı için, bu arada gelen veri ya kaybolur ya da veri kaydedicisinde yarım kalır.Yankı ise ters sıradan kaynaklanır: iletim sırasında alıcı zaten açıksa ve /RE bir an için düşük kalırsa, kendi isteğinizi geri okursunuz.İletim tamamlandı bayrağı (TC) kalktığı anda DE’yi bırakın ve hemen ardından alıcıyı açın:
__HAL_UART_CLEAR_FLAG(&huart2, UART_FLAG_TC);
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_SET);
HAL_UART_Transmit(&huart2, req, 8, 100);
while (!__HAL_UART_GET_FLAG(&huart2, UART_FLAG_TC)) {}
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_RESET);
__HAL_UART_FLUSH_DRREGISTER(&huart2);
HAL_UART_Receive(&huart2, rx, 9, 200);
Daha iyisi, idle hat kesmesiyle kesme veya DMA alımı kullanmaktır; bu durumda 3,5 karakterlik boşluk çerçeveyi sonlandırır ve uzunluğu önceden bilmenize gerek kalmaz. F103’te RS-485 için donanımsal bir DE pini yoktur; daha yeni ailelerde vardır ve bu da tüm bu uğraşı ortadan kaldırır.
It’s the timing around DE, I had the exact same thing on a lab rig with an F103.
HAL_UART_Transmit returns when the last byte has gone into the data register, not when it has left the shift register. Then you wait 5 ms on top. At 9600 one byte is about 1 ms, and a fast meter starts answering within a few ms. While DE is high, /RE is high too, so the receiver is off and the first bytes of the reply are gone. And because HAL_UART_Receive is only called after that, anything that came in meanwhile is lost or sits half in the data register.
The echo comes from the other order: if the receive is already armed while you transmit and /RE is low for a moment, you read back your own request.
Drop DE the moment the transmit complete flag (TC) is set, and arm the receive right after:
__HAL_UART_CLEAR_FLAG(&huart2, UART_FLAG_TC);
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_SET);
HAL_UART_Transmit(&huart2, req, 8, 100);
while (!__HAL_UART_GET_FLAG(&huart2, UART_FLAG_TC)) {}
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_RESET);
__HAL_UART_FLUSH_DRREGISTER(&huart2);
HAL_UART_Receive(&huart2, rx, 9, 200);
Better still, use interrupt or DMA receive with the idle line interrupt, then a 3.5 character gap ends the frame and you don’t need to know the length in advance. The F103 has no hardware DE pin for RS-485, newer families do, which saves all of this.
Yapay zekâ tarafından English dilinden çevrildi ·
Video ve sürüş için bir makara üzerinde 100 m Cat6, telemetri ve acil durdurma için ise 868 MHz noktadan noktaya LoRa kullandım. Temel dizüstü bilgisayar verileri Hermetry’ye iletiyor. Bir testte kabloyu bilerek çektim ve acil durdurma yine LoRa üzerinden çalıştı. Jüri gaz grafiğini beğendi.
Went with 100 m of Cat6 on a reel for video and driving, and 868 MHz point-to-point LoRa for telemetry and the e-stop. The base laptop forwards to Hermetry. Pulled the tether out in a test on purpose and the e-stop still worked over LoRa. Judges liked the gas chart.
Yapay zekâ tarafından English dilinden çevrildi ·
Kevin’e daha yakınsın. Bluetooth 4.0, Low Energy’yi tanıtan spesifikasyon sürümüdür; dolayısıyla “BLE” 4.0’ın ve ondan sonraki tüm sürümlerin bir parçasıdır. “Bluetooth 4.0” olarak etiketlenmiş bir cihaz klasik Bluetooth, BLE veya ikisini birden destekleyebilir. Pil ile çalışan sensörlerde pratikte neredeyse her zaman BLE’dir. İlk satıcıdan bunu yazılı olarak teyit etmesini iste.Asıl önemli soru ikincisi. Hermetry verileri MQTT, HTTPS veya LoRaWAN üzerinden alır, dolayısıyla iki sensör de doğrudan onunla iletişim kurmaz. Motorların yakınında sensörleri dinleyip her birini Hermetry’de bir alt cihaz olarak raporlayan bir gateway’e ihtiyacın olur (tek bir gateway girişi, her sensör kendi geçmişi ve alarmlarıyla ayrı bir cihaz olarak görünür). Bu yalnızca satıcı sensörün gönderdiği veriyi belgelediğinde işe yarar: reklam paketi formatı ya da okunacak BLE karakteristikleri. Veri yalnızca telefon uygulamalarına gidiyorsa ve formatı paylaşmıyorlarsa, sürüm ne olursa olsun Hermetry’ye ulaşmaz.Bu nedenle iki satıcıya da sorulacak soru: “Veri formatı, üçüncü taraf bir BLE gateway’in okuyabilmesi için belgelenmiş mi?”
Kevin is closer. Bluetooth 4.0 is the version of the spec that introduced Low Energy, so “BLE” is part of 4.0 and every version after it. A “Bluetooth 4.0” device can be classic Bluetooth, BLE, or both. For battery sensors it’s almost always BLE in practice. Ask the first vendor to confirm in writing.
The bigger question is your second one. Hermetry takes data over MQTT, HTTPS or LoRaWAN, so neither sensor talks to it directly. You’d need a gateway near the motors that listens to the sensors and reports each one as a child device in Hermetry (one gateway login, each sensor shows up as its own device with its own history and alarms). That only works if the vendor documents what the sensor sends: the advertising format, or the BLE characteristics to read. If the data only ever goes into their phone app and they won’t tell you the format, it’s not getting into Hermetry, whatever version it is.
So the question to send both vendors: “Is the data format documented so a third-party BLE gateway can read it?”
Yapay zekâ tarafından English dilinden çevrildi ·
Birinci sınıfta aynı şeyi yaşadım, sonradan sensör çalıştı ama şanslıydım. Tam kontrol listesi:Bağlantı: kırmızı 3V3’e (pin 1), siyah GND’ye (pin 6), sarı GPIO4’e (pin 7) ve sarıdan 3V3’e 4.7k direnç. /boot/firmware/config.txt dosyasına (eski imajlarda /boot/config.txt) dtoverlay=w1-gpio ekleyin ve yeniden başlatın. 28-xxxxxxxxxxxx klasörünü görmeniz gerekir.Ardından, sahip olduğunuz paho koduyla birlikte betik:
import glob, json, time
import paho.mqtt.client as mqtt
dev = glob.glob('/sys/bus/w1/devices/28-*/w1_slave')[0]
def read_c():
lines = open(dev).read().splitlines()
if not lines[0].endswith('YES'):
return None # CRC failed, skip this one
return int(lines[1].split('t=')[1]) / 1000.0
c = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2, client_id="basement-pi")
c.username_pw_set("YOUR_ACCESS_TOKEN") # token as username, no password
c.tls_set()
c.connect("YOUR_BROKER_HOST", 8883, keepalive=60)
c.loop_start()
while True:
t = read_c()
if t is not None:
c.publish("v1/telemetry", json.dumps({"temp_c": round(t, 2)}), qos=1)
time.sleep(60)
CPU okumalarının aynı grafikte karışmaması için temp_c gibi yeni bir anahtar adı kullanın. Broker adresi cihazın Connection details kartında yer alıyor.
Did the same thing in first year, the probe was fine afterwards but I was lucky. Full checklist:
Wiring: red to 3V3 (pin 1), black to GND (pin 6), yellow to GPIO4 (pin 7), and a 4.7k resistor from yellow to 3V3. Add dtoverlay=w1-gpio to /boot/firmware/config.txt (or /boot/config.txt on older images) and reboot. You should see a 28-xxxxxxxxxxxx folder.
Then the script, on the same paho code you have:
import glob, json, time
import paho.mqtt.client as mqtt
dev = glob.glob('/sys/bus/w1/devices/28-*/w1_slave')[0]
def read_c():
lines = open(dev).read().splitlines()
if not lines[0].endswith('YES'):
return None # CRC failed, skip this one
return int(lines[1].split('t=')[1]) / 1000.0
c = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2, client_id="basement-pi")
c.username_pw_set("YOUR_ACCESS_TOKEN") # token as username, no password
c.tls_set()
c.connect("YOUR_BROKER_HOST", 8883, keepalive=60)
c.loop_start()
while True:
t = read_c()
if t is not None:
c.publish("v1/telemetry", json.dumps({"temp_c": round(t, 2)}), qos=1)
time.sleep(60)
Use a new key name like temp_c so the CPU readings don’t mix into the same chart. Broker host is on the device’s Connection details card.
Yapay zekâ tarafından English dilinden çevrildi ·
IPAddress sınıfında fromString() var, bu yüzden bölmeye gerek yok:
IPAddress ip;
if (ip.fromString(brokerStr)) {
client.setServer(ip, 1883);
}
Ama Ciaran’ın dediği gibi Hermetry için hiç IP kullanmak istemezsiniz. Broker’ı 8883 portunda TLS ile çalışır ve SNI gerektirir, bu yüzden host adıyla bağlanmanız gerekir. setServer() fonksiyonunun host adı alan bir sürümü var; Pi’niz için de adını veya IP’sini metin olarak yazarsanız çalışır:
char brokerHost[64]; // global, lives as long as the program
void applyConfig(const String &s) {
s.toCharArray(brokerHost, sizeof(brokerHost));
client.setServer(brokerHost, 8883);
}
Önemli olan global tampon. PubSubClient, verdiğiniz işaretçiyi tutar, metni kopyalamaz. Eğer setup() sonunda kapsam dışına çıkan bir String’den brokerStr.c_str() verirseniz, işaretçi sarkar ve daha sonra çöp bir adrese bağlanmaya çalışır. Ben bunu bitirme projemde yaşadım; kart ilk açılışta bağlandı, ama yeniden bağlanma sonrası bir daha hiç bağlanamadı.Parametreyi, cihazınızın Bağlantı ayrıntıları kartındaki Hermetry host’unu alacak kadar uzun yapın; 64 karakter yeterli.
IPAddress has fromString(), so no splitting needed:
IPAddress ip;
if (ip.fromString(brokerStr)) {
client.setServer(ip, 1883);
}
But Ciaran’s point: for Hermetry you don’t want an IP at all. Its broker is TLS on 8883 and needs SNI, so you must connect by host name. setServer() has a version that takes a host name, which works for your Pi too if you type its name or IP as text:
char brokerHost[64]; // global, lives as long as the program
void applyConfig(const String &s) {
s.toCharArray(brokerHost, sizeof(brokerHost));
client.setServer(brokerHost, 8883);
}
The global buffer is the important bit. PubSubClient keeps the pointer you pass, it doesn’t copy the text. If you pass brokerStr.c_str() from a String that goes out of scope at the end of setup(), the pointer dangles and it’ll try to connect to garbage later. I lost an afternoon to that in my final year project, the board connected on first boot and then never again after a reconnect.
Make the parameter long enough for the Hermetry host on your device’s Connection details card, 64 characters is plenty.
Yapay zekâ tarafından English dilinden çevrildi ·
“cmd” SMBus adlandırmasıdır. Bir SMBus blok yazmada adresten sonraki ilk bayta komut baytı denir ve ADS1115 gibi register tabanlı çiplerde bu bayt register işaretçisidir. Yani ilk satırınız işaretçiyi Config registerına (0x01) yönlendirir ve buraya 0xC3, ardından 0x83 yazar. Hatta: start, 0x90, 0x01, 0xC3, 0x83, stop.0xC383 şu anlama gelir: tek bir dönüşüm başlat, AIN0’ı GND’ye karşı ölç, ±4.096 V aralığı, tek atımlı mod, 128 örnek/s. Okuma işlemi işaretçiyi 0x00 (Conversion registerı) olarak ayarlar ve iki bayt okur.Hatanız bayt sırasındadır. ADS1115 önce en anlamlı baytı gönderir ve sonuç işaretlidir:
data = bus.read_i2c_block_data(0x48, 0x00, 2)
raw = (data[0] << 8) | data[1]
if raw > 0x7FFF:
raw -= 0x10000
volts = raw * 4.096 / 32768
Baytlar ters olduğunda, düşük bayttaki küçük bir değişim büyük bir sıçramaya dönüşür; bu da sizin 900 ile 52.000 farkınızdır. AIN1 için MUX bitlerini değiştirin: [0xD3, 0x83]. 128 SPS’de 10 ms yeterlidir (bir dönüşüm yaklaşık 8 ms sürer), dolayısıyla bekleme süresi uygundur.
“cmd” is SMBus naming. In an SMBus block write the first byte after the address is called the command byte, and for register-based chips like the ADS1115 that byte is the register pointer. So your first line puts the pointer on the Config register (0x01) and writes 0xC3 then 0x83 into it. On the wire: start, 0x90, 0x01, 0xC3, 0x83, stop.
0xC383 means: start a single conversion, AIN0 against GND, ±4.096 V range, single-shot mode, 128 samples/s. The read sets the pointer to 0x00 (Conversion register) and reads two bytes.
Your bug is the byte order. The ADS1115 sends the most significant byte first, and the result is signed:
data = bus.read_i2c_block_data(0x48, 0x00, 2)
raw = (data[0] << 8) | data[1]
if raw > 0x7FFF:
raw -= 0x10000
volts = raw * 4.096 / 32768
With the bytes swapped, a small change in the low byte becomes a huge jump, which is your 900 vs 52,000. For AIN1 change the MUX bits: [0xD3, 0x83]. And 10 ms is enough at 128 SPS (one conversion is about 8 ms), so the sleep is fine.
Yapay zekâ tarafından English dilinden çevrildi ·
Geçen yıl RF modülüm için bir takip kartı yaptım ve rev A’da aynı “yavaş fix, yarı menzil” sonucunu aldım, bu yüzden bu büyük ölçüde hocamın bu kart üzerinde söktüğü şey.Üst dolguyu tutun, ama gerçek bir toprak yapın: her yerde dikiş via’ları ile 2. katman düzlemine bağlayın, özellikle her RF izinin boyunca ve her RF bölümünün çevresinde. Aralarını yaklaşık 3 ila 5 mm tutun, RF parçalarının yakınında daha sıkı. Birkaç rastgele via’lı bir dolgu, rezonans yapan yüzen bir parçadır ve tek başına hassasiyetinize mal olabilir.Toprağı bölmeyin. Bölümleri yerleşimle ayırın (her radyo kendi köşesinde, gürültülü LTE güç kısmı GNSS’ten uzakta) ve gerekirse dikiş via’larından oluşan bir çit ile ayırın, ama altta tek ve sürekli bir düzlem tutun.Çip anten ve yamanın altında ve çevresinde: her antenin veri sayfasındaki boşluk (keep-out) alanına tam olarak uyun. Çip antenin boşluk alanında hiçbir katmanda bakır olmamalı, yama ise altında belirtilen toprak alanını ister. Michael de haklı: iki antene farklı kenarlar verin, ideal olarak karşıt köşeler.RF izlerinizi 50 ohm’da topraklı eş düzlemli dalga kılavuzu olarak çalıştırın (katman yapınızla hesaplayın, her iki yandaki via’lar da buna dahildir) ve daha sonra ayar yapabilmek için her anten beslemesinde bir pi-ağı footprint’i bırakın.Sonra ölçün: her mesajla birlikte LoRa RSSI ve SNR değerlerini ile GNSS uydu sayısını ve fix süresini okumalar olarak gönderin, rev A ile rev B’yi tek bir grafikte karşılaştırın. Elde edebileceğiniz en kolay A/B testi budur.
I did a tracker board for my RF module last year and got the same “slow fix, half range” result on rev A, so this is mostly what my lecturer took apart on it.
Keep the top pour, but make it a real ground: connected to the layer 2 plane with stitching vias everywhere, especially along every RF trace and around each RF section. Space them about 3 to 5 mm apart, tighter near the RF parts. A pour with a few random vias is a floating patch that resonates, and that alone can cost you sensitivity.
Do not split the ground. Isolate the sections by placement (each radio in its own corner, the noisy LTE power stuff away from GNSS) and, if needed, by a stitched fence of vias, but keep one continuous plane underneath.
Under and around the chip antenna and the patch: follow each antenna’s datasheet keep-out exactly. No copper on any layer in the chip antenna’s keep-out, and the patch wants its specified ground area under it. Michael is right too: give the two antennas different edges and ideally opposite corners.
Run your RF traces as grounded coplanar waveguide at 50 ohms (calculate with your stack-up, the vias on both sides are part of it) and leave a pi-network footprint at each antenna feed so you can tune later.
Then measure: send the LoRa RSSI and SNR and the GNSS satellite count and time to fix as readings with every message, and compare rev A against rev B on one chart. That’s the easiest A/B test you’ll get.
Yapay zekâ tarafından English dilinden çevrildi ·
Ve 12 priz için, bunları ağ geçidi tarafında da toplu olarak gönderin. Tek bir v1/gw/telemetry mesajı, hepsini çocuk adına göre anahtarlanmış şekilde taşıyabilir.
And for the 12 plugs, batch them on the gateway side too. One v1/gw/telemetry message can carry all of them, keyed by child name.
Yapay zekâ tarafından English dilinden çevrildi ·
Evet. O blog, kendi ev ağınızdaki bir broker için hazırlanmış, bu yüzden 192.168 adresi var. Hermetry için hiç IP kullanmanız gerekmiyor: Connection details kartındaki host adıyla, 8883 portunda TLS üzerinden bağlanın. TLS ad bilgisini (SNI) gerektirir, bu yüzden ping attığınız IP başarısız olur; düz 1883 ise profil düz MQTT’ye izin vermediği sürece reddedilir, varsayılan olarak da izin vermez. rc=5 “not authorised” (yetkisiz) anlamına gelir; asıl neden cihazın Log sekmesinde yer alıyor, bir bakmaya değer.
import ssl, json, paho.mqtt.client as mqtt
HOST = "<host from Connection details>"
TOKEN = "<access token>"
c = mqtt.Client(client_id="reefer-01")
c.username_pw_set(TOKEN) # token as username, no password
c.tls_set(cert_reqs=ssl.CERT_REQUIRED) # normal public CA bundle
c.connect(HOST, 8883, keepalive=60)
c.loop_start()
c.publish("v1/telemetry", json.dumps({"temperature": -18.2}), qos=1)
paho 2.x ile bunun yerine mqtt.Client(mqtt.CallbackAPIVersion.VERSION2, client_id="reefer-01") kullanmanız gerekir.
Yes. That blog is for a broker on your own home network, that’s why it has a 192.168 address. For Hermetry there’s no IP you should use at all: connect by the host name from the Connection details card, TLS on 8883. TLS needs the name (SNI), so the pinged IP fails, and plain 1883 is refused unless the profile allows plain MQTT, which it doesn’t by default. rc=5 is “not authorised”, and the actual reason ends up on the device’s Log tab, worth a look.
import ssl, json, paho.mqtt.client as mqtt
HOST = "<host from Connection details>"
TOKEN = "<access token>"
c = mqtt.Client(client_id="reefer-01")
c.username_pw_set(TOKEN) # token as username, no password
c.tls_set(cert_reqs=ssl.CERT_REQUIRED) # normal public CA bundle
c.connect(HOST, 8883, keepalive=60)
c.loop_start()
c.publish("v1/telemetry", json.dumps({"temperature": -18.2}), qos=1)
With paho 2.x you need mqtt.Client(mqtt.CallbackAPIVersion.VERSION2, client_id="reefer-01") instead.
Yapay zekâ tarafından English dilinden çevrildi ·
Bu işe yaradı, 12’si de çalışıyor. Hemen device_exists hatasıyla karşılaştım çünkü hata ayıklama sırasında 3 numaralı düğümün flash belleğini silmiştim; düğüm zaten aq-3c84a1 olarak kaydolmuştu. Konsoldan o cihazı sildim ve yeniden provizyon edildi, sorunsuz çalıştı. Bu sabah hepsini karantinadan etkinleştirdim. Ayrıca tırnak işaretlerini doğru şekilde kaçışlamam gerekti; ilk sürümüm bozuk JSON gönderiyordu ve hiçbir yanıt alamıyordum.
That worked, all 12 are up. I did hit the device_exists thing straight away because I’d erased flash on node 3 while debugging, it had already registered as aq-3c84a1. Deleted that device in the console and it provisioned again fine. Activated them all from quarantine this morning. Also had to escape the quotes properly, my first version sent broken JSON and just got nothing back.
Yapay zekâ tarafından English dilinden çevrildi ·
PlatformIO’da Arduino core 2.0.14. Wi-Fi kısmı için WiFiManager kullanmaya devam etmekten memnuniyet duyarım; takıldığım nokta ise Hermetry token’ı. Mümkünse konsolu açıp 12 cihaz oluşturmak ve 12 token’ı 12 portala kopyalamak istemiyorum.
Arduino core 2.0.14 in PlatformIO. Happy to stay with WiFiManager for the Wi-Fi bit, it’s the Hermetry token I’m stuck on. I don’t want to open the console and create 12 devices and copy 12 tokens into 12 portals either if I can avoid it.
Yapay zekâ tarafından English dilinden çevrildi ·
Sorun buymuş, printer projesinden kalan disable-bt satırı. Utanç verici. Satır yorum satırı yapıldı, hciuart etkinleştirildi, hci0 geri geldi ve altı etiketin tamamı taramada görünüyor. Artık Hermetry içinde alt öğeler olarak görünüyorlar.
That was it, the disable-bt line from the printer project. Embarrassing. Commented out, hciuart enabled, hci0 is back and all six tags show up in the scan. They’re appearing as children in Hermetry now.

