embedded_raumsenor_lorawan/LoRaWAN_Payload_Description.md
Jochen Gojowsky 0287921b38 add energy tracking: 15-byte payload, power consumption accumulation
- Firmware: energy.c/h tracks relay ON-time and uptime via k_uptime_get,
  load_watts (default 400W) persistent via Zephyr Settings API
- Payload extended from 7 to 15 bytes (backwards compatible):
  relay ON-time (uint24), uptime (uint24), load in watts (uint16)
- New 'w' downlink for load configuration
- Fix downlink handler: 'i'/'w' commands now checked before combined packet
- Server: g2h_rs_energy_tracking table for lifetime power_consumption_wh,
  reboot detection via uptime vs real elapsed time
- Decoder/encoder and docs updated
2026-02-19 17:17:30 +01:00

3.3 KiB

LoRaWAN Payload Description - Raumsensor Device

Port: 2 Length: 7 Bytes (ohne Energietracking) oder 15 Bytes (mit Energietracking) Format: Binary

Byte Field Type Unit Description
0-1 Room Temperature int16 0.01°C SHT4x sensor (big-endian)
2-3 Floor Temperature int16 0.01°C MLX90614 IR sensor (big-endian) *
4-5 Humidity int16 0.01% SHT4x sensor (big-endian)
6 Relay State uint8 - 0=OFF, 1=ON
7-9 Relay ON-Time uint24 Sekunden Kumulative Einschaltdauer seit Boot
10-12 Uptime uint24 Sekunden Gerätelaufzeit seit Boot
13-14 Load uint16 Watt Konfigurierte Heizlast

Hinweis zur Abwärtskompatibilität: Geräte ohne Energietracking senden 7 Bytes. Der Decoder erkennt die Version anhand von bytes.length.

Beispiel (15 Bytes):

  • 08 34 0A 28 15 E0 01 00 00 F0 00 01 2C 01 90 = 21.00°C Raum, 26.00°C Boden, 56.00% Feuchte, Relay ON, 240s ON-Zeit, 300s Uptime, 400W Last

Port: Any Format: Binary

Kombiniertes Konfigurationspaket

Length: 3 Bytes Format: [heating_enable][room_temp_threshold][floor_temp_threshold]

Byte Field Type Range Description
0 Heating Enable uint8 0-1 0=DISABLED, 1=ENABLED
1 Room Temperature Threshold uint8 0-255 Raumtemperatur-Schwellwert in °C
2 Floor Temperature Threshold uint8 0-255 Bodentemperatur-Schwellwert in °C

Beispiele:

  • 01 16 19 = Heizung AN, Raum 22°C, Boden 25°C
  • 00 14 18 = Heizung AUS

Sendeintervall

Length: 2 Bytes Format: 'i'[interval_minutes]

Byte Field Type Range Description
0 Command ASCII 0x69 Befehlskennung 'i'
1 Interval uint8 1-255 Sendeintervall in Minuten

Beispiele:

  • 69 05 = 5 Minuten
  • 69 0A = 10 Minuten
  • 69 3C = 60 Minuten

Last-Konfiguration

Length: 3 Bytes Format: 'w'[watts_high][watts_low]

Byte Field Type Range Description
0 Command ASCII 0x77 Befehlskennung 'w'
1-2 Load Watts uint16 1-65535 Heizlast in Watt (big-endian), persistent gespeichert

Beispiele:

  • 77 01 90 = 400W (0x0190)
  • 77 03 E8 = 1000W (0x03E8)

Datenkonvertierung

  • Temperatur: raw = (int16)(temperature * 100)actual = raw / 100.0
  • Luftfeuchtigkeit: raw = (int16)(humidity * 100)actual = raw / 100.0
  • ON-Zeit / Uptime: uint24 big-endian, Sekunden seit Boot (wird bei Reboot zurückgesetzt)
  • Last: uint16 big-endian, Watt

Sonderfälle

* Bodentemperatursensor: Wenn der MLX90614 nicht verfügbar ist, wird -273.15°C (hex: 95 5D) übertragen.

Reboot-Erkennung (Portal): Wenn relay_on_time im aktuellen Paket kleiner ist als im vorherigen, wurde das Gerät neu gestartet.