From 2411750b355b3d0039e98e4486fface7442c9c79 Mon Sep 17 00:00:00 2001 From: Nicu Hodos Date: Thu, 30 May 2024 12:16:28 +0200 Subject: [PATCH] use chars for protocol 1 group, with leading 0, to match the way is defined in devices --- gateway/include/Protocol_1.h | 2 +- gateway/include/RcDecoder.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gateway/include/Protocol_1.h b/gateway/include/Protocol_1.h index ba57038..6f7d317 100644 --- a/gateway/include/Protocol_1.h +++ b/gateway/include/Protocol_1.h @@ -21,7 +21,7 @@ public: RcDecoder decoder; decoder.decode(value); rcSwitch["state"] = decoder.state; - rcSwitch["group"] = String(decoder.group, BIN); + rcSwitch["group"] = decoder.group; rcSwitch["channel"] = decoder.device; rcSwitch["raw_value"] = value; } diff --git a/gateway/include/RcDecoder.h b/gateway/include/RcDecoder.h index e43e564..fd2aa62 100644 --- a/gateway/include/RcDecoder.h +++ b/gateway/include/RcDecoder.h @@ -4,7 +4,7 @@ struct RcDecoder { bool state; - char group; + char group[6]; unsigned char device; void decode(unsigned long value) { @@ -16,7 +16,7 @@ struct RcDecoder { } state = RC_STATE(res); - group = RC_GROUP(res); + sprintf(group, "%05ld", RC_GROUP(res)); switch (RC_DEVICE(res)) { case 0b10000: device = 1;