Browse Source

light: hide extra toggle in webui

amend b5a03dac72
pull/2575/head github230112
Maxim Prokhorov 1 year ago
parent
commit
909949b5cc
22 changed files with 9829 additions and 9798 deletions
  1. BIN
      code/espurna/data/index.all.html.gz
  2. BIN
      code/espurna/data/index.curtain.html.gz
  3. BIN
      code/espurna/data/index.garland.html.gz
  4. BIN
      code/espurna/data/index.light.html.gz
  5. BIN
      code/espurna/data/index.lightfox.html.gz
  6. BIN
      code/espurna/data/index.rfbridge.html.gz
  7. BIN
      code/espurna/data/index.rfm69.html.gz
  8. BIN
      code/espurna/data/index.sensor.html.gz
  9. BIN
      code/espurna/data/index.small.html.gz
  10. BIN
      code/espurna/data/index.thermostat.html.gz
  11. +11
    -3
      code/espurna/light.cpp
  12. +2304
    -2302
      code/espurna/static/index.all.html.gz.h
  13. +696
    -696
      code/espurna/static/index.curtain.html.gz.h
  14. +657
    -656
      code/espurna/static/index.garland.html.gz.h
  15. +1253
    -1251
      code/espurna/static/index.light.html.gz.h
  16. +660
    -659
      code/espurna/static/index.lightfox.html.gz.h
  17. +692
    -691
      code/espurna/static/index.rfbridge.html.gz.h
  18. +1440
    -1440
      code/espurna/static/index.rfm69.html.gz.h
  19. +780
    -779
      code/espurna/static/index.sensor.html.gz.h
  20. +644
    -643
      code/espurna/static/index.small.html.gz.h
  21. +679
    -678
      code/espurna/static/index.thermostat.html.gz.h
  22. +13
    -0
      code/html/custom.js

BIN
code/espurna/data/index.all.html.gz View File


BIN
code/espurna/data/index.curtain.html.gz View File


BIN
code/espurna/data/index.garland.html.gz View File


BIN
code/espurna/data/index.light.html.gz View File


BIN
code/espurna/data/index.lightfox.html.gz View File


BIN
code/espurna/data/index.rfbridge.html.gz View File


BIN
code/espurna/data/index.rfm69.html.gz View File


BIN
code/espurna/data/index.sensor.html.gz View File


BIN
code/espurna/data/index.small.html.gz View File


BIN
code/espurna/data/index.thermostat.html.gz View File


+ 11
- 3
code/espurna/light.cpp View File

@ -807,6 +807,10 @@ private:
LightTemperature _light_temperature;
#if RELAY_SUPPORT
auto _light_state_relay_id = RelaysMax;
#endif
bool _light_state_changed = false;
LightStateListener _light_state_listener = nullptr;
@ -2568,9 +2572,9 @@ void _lightApiSetup() {
namespace {
bool _lightWebSocketOnKeyCheck(espurna::StringView key, const JsonVariant&) {
return espurna::settings::query::samePrefix(key, STRING_VIEW("light"))
|| espurna::settings::query::samePrefix(key, STRING_VIEW("use"))
|| espurna::settings::query::samePrefix(key, STRING_VIEW("lt"));
return key.startsWith(STRING_VIEW("light"))
|| key.startsWith(STRING_VIEW("use"))
|| key.startsWith(STRING_VIEW("lt"));
}
void _lightWebSocketStatus(JsonObject& root) {
@ -2604,6 +2608,9 @@ void _lightWebSocketOnVisible(JsonObject& root) {
wsPayloadModule(root, PSTR("light"));
JsonObject& light = root.createNestedObject("light");
#if RELAY_SUPPORT
light["state_relay_id"] = _light_state_relay_id;
#endif
JsonArray& channels = light.createNestedArray("channels");
@ -3589,6 +3596,7 @@ void _lightSettingsMigrate(int version) {
RelayProviderBasePtr lightMakeStateRelayProvider(size_t id) {
#if RELAY_SUPPORT
if (!_light_state_listener) {
_light_state_relay_id = id;
_light_state_listener = [id](bool state) {
relayStatus(id, state);
};


+ 2304
- 2302
code/espurna/static/index.all.html.gz.h
File diff suppressed because it is too large
View File


+ 696
- 696
code/espurna/static/index.curtain.html.gz.h
File diff suppressed because it is too large
View File


+ 657
- 656
code/espurna/static/index.garland.html.gz.h
File diff suppressed because it is too large
View File


+ 1253
- 1251
code/espurna/static/index.light.html.gz.h
File diff suppressed because it is too large
View File


+ 660
- 659
code/espurna/static/index.lightfox.html.gz.h
File diff suppressed because it is too large
View File


+ 692
- 691
code/espurna/static/index.rfbridge.html.gz.h
File diff suppressed because it is too large
View File


+ 1440
- 1440
code/espurna/static/index.rfm69.html.gz.h
File diff suppressed because it is too large
View File


+ 780
- 779
code/espurna/static/index.sensor.html.gz.h
File diff suppressed because it is too large
View File


+ 644
- 643
code/espurna/static/index.small.html.gz.h
File diff suppressed because it is too large
View File


+ 679
- 678
code/espurna/static/index.thermostat.html.gz.h
File diff suppressed because it is too large
View File


+ 13
- 0
code/html/custom.js View File

@ -1681,6 +1681,9 @@ function relayToggle(event) {
function initRelayToggle(id, cfg) {
let line = loadConfigTemplate("relay-control");
let root = line.querySelector("div");
root.classList.add(`relay-control-${id}`);
let name = line.querySelector("span[data-key='relayName']");
name.textContent = cfg.relayName;
name.dataset["id"] = id;
@ -2170,6 +2173,12 @@ function colorUpdate(mode, value) {
}
}
function lightStateHideRelay(id) {
styleInject([
styleVisible(`.relay-control-${id}`, false)
]);
}
function initLightState() {
const toggle = document.getElementById("light-state-value");
toggle.addEventListener("change", (event) => {
@ -2290,6 +2299,10 @@ function updateLight(data) {
updateLightState(value);
break;
case "state_relay_id":
lightStateHideRelay(value);
break;
case "channels":
initLightState();
initBrightness();


Loading…
Cancel
Save