mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-31 22:47:44 +00:00
Merge pull request #5890 from s-hadinger/fix/hue_alexa
Work-around for Philips Hue emulation issue (#5849)
This commit is contained in:
commit
2641e8a482
@ -2,6 +2,7 @@
|
|||||||
* Add command SetOption38 6..255 to set IRReceive protocol detection sensitivity mimizing UNKNOWN protocols (#5853)
|
* Add command SetOption38 6..255 to set IRReceive protocol detection sensitivity mimizing UNKNOWN protocols (#5853)
|
||||||
* Fix missing white channel for WS2812 (#5869)
|
* Fix missing white channel for WS2812 (#5869)
|
||||||
* Add reset of Energy values when connection to sensor is lost for over 4 seconds (#5874, #5881)
|
* Add reset of Energy values when connection to sensor is lost for over 4 seconds (#5874, #5881)
|
||||||
|
* Work-around for Philips Hue emulation issue (#5849)
|
||||||
*
|
*
|
||||||
* 6.5.0.12 20190521
|
* 6.5.0.12 20190521
|
||||||
* Add AriLux RF control GPIO option "ALux IrSel" (159) replacing "Led4i" (59) for full LED control (#5709)
|
* Add AriLux RF control GPIO option "ALux IrSel" (159) replacing "Led4i" (59) for full LED control (#5709)
|
||||||
|
@ -342,6 +342,13 @@ void HueLightStatus2(uint8_t device, String *response)
|
|||||||
response->replace("{j2", GetHueDeviceId(device));
|
response->replace("{j2", GetHueDeviceId(device));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// generate a unique lightId mixing local IP address and deice number
|
||||||
|
// it is limited to 16 devices.
|
||||||
|
uint32_t lightId(uint32_t idx) {
|
||||||
|
uint32_t ip_local = WiFi.localIP();
|
||||||
|
return ((ip_local & 0xFF000000) >> 20) + idx % 16; // >> 24 * 16 is equivalent to >> 20
|
||||||
|
}
|
||||||
|
|
||||||
void HueGlobalConfig(String *path)
|
void HueGlobalConfig(String *path)
|
||||||
{
|
{
|
||||||
String response;
|
String response;
|
||||||
@ -350,7 +357,7 @@ void HueGlobalConfig(String *path)
|
|||||||
path->remove(0,1); // cut leading / to get <id>
|
path->remove(0,1); // cut leading / to get <id>
|
||||||
response = F("{\"lights\":{\"");
|
response = F("{\"lights\":{\"");
|
||||||
for (uint8_t i = 1; i <= maxhue; i++) {
|
for (uint8_t i = 1; i <= maxhue; i++) {
|
||||||
response += i;
|
response += lightId(i);
|
||||||
response += F("\":{\"state\":");
|
response += F("\":{\"state\":");
|
||||||
HueLightStatus1(i, &response);
|
HueLightStatus1(i, &response);
|
||||||
HueLightStatus2(i, &response);
|
HueLightStatus2(i, &response);
|
||||||
@ -394,7 +401,7 @@ void HueLights(String *path)
|
|||||||
if (path->endsWith("/lights")) { // Got /lights
|
if (path->endsWith("/lights")) { // Got /lights
|
||||||
response = "{\"";
|
response = "{\"";
|
||||||
for (uint8_t i = 1; i <= maxhue; i++) {
|
for (uint8_t i = 1; i <= maxhue; i++) {
|
||||||
response += i;
|
response += lightId(i);
|
||||||
response += F("\":{\"state\":");
|
response += F("\":{\"state\":");
|
||||||
HueLightStatus1(i, &response);
|
HueLightStatus1(i, &response);
|
||||||
HueLightStatus2(i, &response);
|
HueLightStatus2(i, &response);
|
||||||
@ -562,7 +569,7 @@ void HueLights(String *path)
|
|||||||
}
|
}
|
||||||
else if(path->indexOf("/lights/") >= 0) { // Got /lights/ID
|
else if(path->indexOf("/lights/") >= 0) { // Got /lights/ID
|
||||||
path->remove(0,8); // Remove /lights/
|
path->remove(0,8); // Remove /lights/
|
||||||
device = atoi(path->c_str());
|
device = atoi(path->c_str()) % 16;
|
||||||
if ((device < 1) || (device > maxhue)) {
|
if ((device < 1) || (device > maxhue)) {
|
||||||
device = 1;
|
device = 1;
|
||||||
}
|
}
|
||||||
@ -591,7 +598,7 @@ void HueGroups(String *path)
|
|||||||
String lights = F("\"1\"");
|
String lights = F("\"1\"");
|
||||||
for (uint8_t i = 2; i <= maxhue; i++) {
|
for (uint8_t i = 2; i <= maxhue; i++) {
|
||||||
lights += ",\"";
|
lights += ",\"";
|
||||||
lights += String(i);
|
lights += lightId(i);
|
||||||
lights += "\"";
|
lights += "\"";
|
||||||
}
|
}
|
||||||
response.replace("{l1", lights);
|
response.replace("{l1", lights);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user