Neu: Die KI-Firewall überwacht die gesamte Plattform und erklärt jeden Vorfall in einfachen Worten. So funktioniert es

Michael Wilson

wilsonmaker

@wilson-m · Mitglied seit Juli 2025

Neuling

Maker · home automation · Nottingham · new to IoT

Themen
14
Antworten
70
Punkte
0
Neuling10 Punkte an Mitglied

Erstellte Forenantworten

Ansicht von 15 Beiträgen – 46 bis 60 (von insgesamt 70)

Von English mit KI übersetzt ·

Super! Auf dieser Platine liegt Netzspannung, also steck sie zurück in ihr Gehäuse, bevor sie jemand anfasst 😄

Ask me about 4–20 mA.
♥ 0

fromString worked for the Pi, and then I switched to the char buffer version. Aoife you were right about the pointer: my first try with c_str() connected once and then failed every reconnect with rc=-2. With the global buffer it’s fine, and the shed board is now talking to Hermetry with the host typed into the setup page.

Ask me about 4–20 mA.
♥ 0

Ha, I had exactly this with my greenhouse sensor last January, so I can answer for once!

The Arduino stores int as two’s complement. -0.5 °C times 100 is -50, and -50 in 16 bits is 0xFFCE. The top bit is the sign. Read as unsigned that’s 65486, times 0.01 gives your 654.86. Read as signed it’s -50, times 0.01 gives -0.5. Same bytes, the codec just has to know they’re signed.

So in your codec change the format from u16be to i16be, keep the scale. Add a test vector for a negative value so it never sneaks back:

{ "at": 0, "field": "temperature", "fmt": "i16be", "scale": 0.01, "unit": "°C" }

"tests": [
  { "name": "positive", "fport": 1, "hex": "0960", "expect": { "temperature": 24.0 } },
  { "name": "below zero", "fport": 1, "hex": "FFCE", "expect": { "temperature": -0.5 } }
]

On the Arduino side use int16_t instead of int, so it stays 2 bytes if you move to a 32-bit board. Then Check and Publish. The key name and unit stay the same, so it can go out as a new revision of the same codec. Reference: Write your own codec

Ask me about 4–20 mA.
Akzeptierte Lösung♥ 9
Ansicht von 15 Beiträgen – 46 bis 60 (von insgesamt 70)