Browse Source

ha: try to avoid conflict with useCSS (#2075)

master
Max Prokhorov 4 years ago
committed by GitHub
parent
commit
43cf926468
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 4 deletions
  1. +13
    -0
      code/espurna/homeassistant.ino
  2. +6
    -4
      code/html/index.html

+ 13
- 0
code/espurna/homeassistant.ino View File

@ -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();
}


+ 6
- 4
code/html/index.html View File

@ -536,7 +536,12 @@
<div class="pure-u-1 pure-u-lg-1-4"><input type="checkbox" name="useCSS" tabindex="12" /></div>
<div class="pure-u-0 pure-u-lg-1-2"></div>
<div class="pure-u-0 pure-u-lg-1-4"></div>
<div class="pure-u-1 pure-u-lg-3-4 hint">Use CSS style to report colors to MQTT and REST API. <br />Red will be reported as "#FF0000" if ON, otherwise "255,0,0"</div>
<div class="pure-u-1 pure-u-lg-3-4 hint">
<div class="module module-ha">
<strong>WARNING! </strong>Incompatible with Home Assistant MQTT integration
</div>
Use CSS style to report colors to MQTT and REST API. <br />Red will be reported as "#FF0000" if ON, otherwise "255,0,0"
</div>
</div>
<div class="pure-g">
@ -1270,9 +1275,6 @@
<div class="pure-u-0 pure-u-lg-1-4"></div>
<div class="pure-u-1 pure-u-lg-3-4 hint">
Home Assistant auto-discovery feature. Enable and save to add the device to your HA console.
<!-- removeIf(!light) -->
When using a colour light you might want to disable CSS style so Home Assistant can parse the color.
<!-- endRemoveIf(!light) -->
</div>
</div>


Loading…
Cancel
Save