From 43cf92646875f1f99c5830360099bc2894f0ac4d Mon Sep 17 00:00:00 2001 From: Max Prokhorov Date: Sat, 21 Dec 2019 00:07:10 +0300 Subject: [PATCH] ha: try to avoid conflict with useCSS (#2075) --- code/espurna/homeassistant.ino | 13 +++++++++++++ code/html/index.html | 10 ++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/code/espurna/homeassistant.ino b/code/espurna/homeassistant.ino index e80fe2db..ce164184 100644 --- a/code/espurna/homeassistant.ino +++ b/code/espurna/homeassistant.ino @@ -430,6 +430,19 @@ void _haConfigure() { const bool enabled = getSetting("haEnabled", HOMEASSISTANT_ENABLED).toInt() == 1; _ha_send_flag = (enabled != _ha_enabled); _ha_enabled = enabled; + + // https://github.com/xoseperez/espurna/issues/1273 + // https://gitter.im/tinkerman-cat/espurna?at=5df8ad4655d9392300268a8c + // TODO: ensure that this is called before _lightConfigure() + // in case useCSS value is ever cached by the lights module + #if LIGHT_PROVIDER != LIGHT_PROVIDER_NONE + if (enabled) { + if (getSetting("useCSS", LIGHT_USE_CSS).toInt() == 1) { + setSetting("useCSS", 0); + } + } + #endif + _haSend(); } diff --git a/code/html/index.html b/code/html/index.html index 83909788..0bdcdc7b 100644 --- a/code/html/index.html +++ b/code/html/index.html @@ -536,7 +536,12 @@
-
Use CSS style to report colors to MQTT and REST API.
Red will be reported as "#FF0000" if ON, otherwise "255,0,0"
+
+
+ WARNING! Incompatible with Home Assistant MQTT integration +
+ Use CSS style to report colors to MQTT and REST API.
Red will be reported as "#FF0000" if ON, otherwise "255,0,0" +
@@ -1270,9 +1275,6 @@
Home Assistant auto-discovery feature. Enable and save to add the device to your HA console. - - When using a colour light you might want to disable CSS style so Home Assistant can parse the color. -