From bb3fb7c4d6ff128bbc313e42ca8dd75ce8950a2f Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Sun, 2 Jun 2019 13:21:12 +0200 Subject: [PATCH] Fix Hue Emulation Fix Hue Emulation (#5849) --- sonoff/xdrv_20_hue.ino | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sonoff/xdrv_20_hue.ino b/sonoff/xdrv_20_hue.ino index 6a4617ffc..7d7934106 100644 --- a/sonoff/xdrv_20_hue.ino +++ b/sonoff/xdrv_20_hue.ino @@ -344,7 +344,7 @@ void HueLightStatus2(uint8_t device, String *response) // generate a unique lightId mixing local IP address and device number // it is limited to 16 devices. -// last 16 bits of Mac address + 4 bits of local light +// last 24 bits of Mac address + 4 bits of local light uint32_t EncodeLightId(uint8_t idx) { uint8_t mac[6]; @@ -422,7 +422,7 @@ void HueLights(String *path) else if (path->endsWith("/state")) { // Got ID/state path->remove(0,8); // Remove /lights/ path->remove(path->indexOf("/state")); // Remove /state - device = atoi(path->c_str()); + device = DecodeLightId(atoi(path->c_str())); if ((device < 1) || (device > maxhue)) { device = 1; } @@ -434,7 +434,7 @@ void HueLights(String *path) if (hue_json.containsKey("on")) { response += FPSTR(HUE_LIGHT_RESPONSE_JSON); - response.replace("{id", String(device)); + response.replace("{id", String(EncodeLightId(device))); response.replace("{cm", "on"); on = hue_json["on"];