Merge pull request #4291 from ascillato/patch-1

Reverting PR #4279 that brokes Alexa support
This commit is contained in:
Theo Arends 2018-11-06 15:36:46 +01:00 committed by GitHub
commit 6b3f57a8f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 28 deletions

View File

@ -1,18 +1,14 @@
/* /*
xplg_wemohue.ino - wemo and hue support for Sonoff-Tasmota xplg_wemohue.ino - wemo and hue support for Sonoff-Tasmota
Copyright (C) 2018 Heiko Krupp and Theo Arends Copyright (C) 2018 Heiko Krupp and Theo Arends
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
@ -461,19 +457,15 @@ const char HUE_DESCRIPTION_XML[] PROGMEM =
"\r\n"; "\r\n";
const char HUE_LIGHTS_STATUS_JSON[] PROGMEM = const char HUE_LIGHTS_STATUS_JSON[] PROGMEM =
"{\"on\":{state}," "{\"on\":{state},"
"\"bri\":{b},"
"\"hue\":{h},"
"\"sat\":{s},"
"\"xy\":[0.5, 0.5],"
"\"ct\":{t},"
"\"alert\":\"none\"," "\"alert\":\"none\","
"\"effect\":\"none\"," "\"effect\":\"none\","
"\"reachable\":true"; "\"colormode\":\"{m}\","
const char HUE_LIGHTS_STATUS_JSON_DIM[] PROGMEM = "\"reachable\":true}";
",\"bri\":{b}";
const char HUE_LIGHTS_STATUS_JSON_RGB[] PROGMEM =
",\"hue\":{h},"
"\"sat\":{s},"
"\"xy\":[0.5, 0.5]";
const char HUE_LIGHTS_STATUS_JSON_CT[] PROGMEM =
",\"ct\":{t}";
const char HUE_LIGHTS_STATUS_JSON_CM[] PROGMEM =
",\"colormode\":\"{m}\"";
const char HUE_LIGHTS_STATUS_JSON2[] PROGMEM = const char HUE_LIGHTS_STATUS_JSON2[] PROGMEM =
",\"type\":\"Extended color light\"," ",\"type\":\"Extended color light\","
"\"name\":\"{j1\"," "\"name\":\"{j1\","
@ -580,19 +572,6 @@ void HueLightStatus1(byte device, String *response)
ct = LightGetColorTemp(); ct = LightGetColorTemp();
} }
*response += FPSTR(HUE_LIGHTS_STATUS_JSON); *response += FPSTR(HUE_LIGHTS_STATUS_JSON);
//The light can be dimmed
if (light_subtype >= LST_SINGLE) *response += FPSTR(HUE_LIGHTS_STATUS_JSON_DIM);
//The light has adjustabe color temperature
if (light_subtype == LST_COLDWARM || light_subtype == LST_RGBWC) *response += FPSTR(HUE_LIGHTS_STATUS_JSON_CT);
//The light has RGB
if (light_subtype >= LST_RGB) *response += FPSTR(HUE_LIGHTS_STATUS_JSON_RGB);
//The light supports colormode
if (light_subtype >= LST_COLDWARM) *response += FPSTR(HUE_LIGHTS_STATUS_JSON_CM);
*response += "}";
response->replace("{state}", (power & (1 << (device-1))) ? "true" : "false"); response->replace("{state}", (power & (1 << (device-1))) ? "true" : "false");
response->replace("{h}", String((uint16_t)(65535.0f * hue))); response->replace("{h}", String((uint16_t)(65535.0f * hue)));
response->replace("{s}", String((uint8_t)(254.0f * sat))); response->replace("{s}", String((uint8_t)(254.0f * sat)));