Initial project: XIAO ESP32S3 + SX1262 LoRa sensor link hytte–hjem
- cabin_node: subscribes to local MQTT (ESPHome sensors), sends temperature, battery voltage/SOC and switch states over LoRa SF12 - cabin_gw: receives LoRa packets, publishes JSON to home MQTT broker - Bidirectional: gateway forwards ON/OFF commands from home HA to node - cabin_node always in RX mode (12V powered) — commands arrive instantly - ESPHome config for ESP32 on teknisk rom: Victron MPPT BLE + JBD BMS BLE + DS18B20 temperatures + GPIO switches for varme/VVB Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include "mbedtls/md.h"
|
||||
#include "config.h"
|
||||
|
||||
// Returns a 4-byte truncated HMAC-SHA256 over `data` of `len` bytes.
|
||||
inline uint32_t hmac_sig(const uint8_t *data, size_t len)
|
||||
{
|
||||
static const char *key = HMAC_KEY;
|
||||
uint8_t out[32];
|
||||
mbedtls_md_hmac(
|
||||
mbedtls_md_info_from_type(MBEDTLS_MD_SHA256),
|
||||
reinterpret_cast<const uint8_t *>(key), strlen(key),
|
||||
data, len, out);
|
||||
uint32_t sig;
|
||||
memcpy(&sig, out, 4);
|
||||
return sig;
|
||||
}
|
||||
Reference in New Issue
Block a user