diff --git a/tasmota/xdrv_20_hue.ino b/tasmota/xdrv_20_hue.ino index d468c7ef0..37c3308d0 100644 --- a/tasmota/xdrv_20_hue.ino +++ b/tasmota/xdrv_20_hue.ino @@ -603,10 +603,11 @@ void HueLightStatus2(uint8_t device, String *response) // last 24 bits of Mac address + 4 bits of local light + high bit for relays 16-31, relay 32 is mapped to 0 // Zigbee extension: bit 29 = 1, and last 16 bits = short address of Zigbee device #ifndef USE_ZIGBEE -uint32_t EncodeLightId(uint8_t relay_id) { +uint32_t EncodeLightId(uint8_t relay_id) #else -uint32_t EncodeLightId(uint8_t relay_id, uint16_t z_shortaddr = 0) { +uint32_t EncodeLightId(uint8_t relay_id, uint16_t z_shortaddr = 0) #endif +{ uint8_t mac[6]; WiFi.macAddress(mac); uint32_t id = (mac[3] << 20) | (mac[4] << 12) | (mac[5] << 4); @@ -635,10 +636,11 @@ uint32_t EncodeLightId(uint8_t relay_id, uint16_t z_shortaddr = 0) { // If the Id encodes a Zigbee device (meaning bit 29 is set) // it returns 0 and sets the 'shortaddr' to the device short address #ifndef USE_ZIGBEE -uint32_t DecodeLightId(uint32_t hue_id) { +uint32_t DecodeLightId(uint32_t hue_id) #else -uint32_t DecodeLightId(uint32_t hue_id, uint16_t * shortaddr = nullptr) { +uint32_t DecodeLightId(uint32_t hue_id, uint16_t * shortaddr = nullptr) #endif +{ uint8_t relay_id = hue_id & 0xF; if (hue_id & (1 << 28)) { // check if bit 25 is set, if so we have relay_id += 16;