From 858103e08228dfdd706799c6a4062e26a3cb7e59 Mon Sep 17 00:00:00 2001 From: gemu2015 Date: Sun, 29 Dec 2019 16:49:36 +0100 Subject: [PATCH] support for hm17 (v110) and hm10 (V609) --- tasmota/xsns_52_ibeacon.ino | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/tasmota/xsns_52_ibeacon.ino b/tasmota/xsns_52_ibeacon.ino index f61bdf97d..92444bfbb 100644 --- a/tasmota/xsns_52_ibeacon.ino +++ b/tasmota/xsns_52_ibeacon.ino @@ -27,7 +27,11 @@ #define HM17_BAUDRATE 9600 -//#define IBEACON_DEBUG +#define IBEACON_DEBUG + +// use this for Version 110 +#define HM17_V110 + // keyfob expires after N seconds #define IB_TIMEOUT_INTERVAL 30 @@ -322,6 +326,14 @@ void hm17_decode(void) { hm17_result=1; #ifdef IBEACON_DEBUG if (hm17_debug) AddLog_P2(LOG_LEVEL_INFO, PSTR("DISCS OK")); +#endif + break; + } + if (!strncmp(hm17_sbuffer,"OK+DISIS",8)) { + hm17_sbclr(); + hm17_result=1; +#ifdef IBEACON_DEBUG + if (hm17_debug) AddLog_P2(LOG_LEVEL_INFO, PSTR("DISIS OK")); #endif break; } @@ -348,19 +360,26 @@ void hm17_decode(void) { break; } if (!strncmp(hm17_sbuffer,"OK+DIS0:",8)) { - if (hm17_sindex==20) { - hm17_result=HM17_SUCESS; -#ifdef IBEACON_DEBUG - if (hm17_debug) { - AddLog_P2(LOG_LEVEL_INFO, PSTR("DIS0 OK")); - AddLog_P2(LOG_LEVEL_INFO, PSTR(">>%s"),&hm17_sbuffer[8]); - } + if (hm17_cmd==HM17_DISI) { +#ifdef HM17_V110 + goto hm17_v110; #endif - hm17_sbclr(); + } else { + if (hm17_sindex==20) { + hm17_result=HM17_SUCESS; +#ifdef IBEACON_DEBUG + if (hm17_debug) { + AddLog_P2(LOG_LEVEL_INFO, PSTR("DIS0 OK")); + AddLog_P2(LOG_LEVEL_INFO, PSTR(">>%s"),&hm17_sbuffer[8]); + } +#endif + hm17_sbclr(); + } } break; } if (!strncmp(hm17_sbuffer,"OK+DISC:",8)) { +hm17_v110: if (hm17_cmd==HM17_DISI) { if (hm17_sindex==78) { #ifdef IBEACON_DEBUG