Skip to content

Commit

Permalink
Fix javascript error
Browse files Browse the repository at this point in the history
Introduced in be0bd18

Fixes #755
  • Loading branch information
rojer committed Jul 31, 2021
1 parent 56f96bc commit 6108151
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
23 changes: 14 additions & 9 deletions fs_src/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -563,14 +563,13 @@ function rgbState(c, newState) {

function updateComponent(cd) {
let c = findOrAddContainer(cd);
let headText;
if (!c) return;
switch (cd.type) {
case 0: // Switch
case 1: // Outlet
case 2: // Lock
case 11: // RGB
headText = `Switch ${cd.id}`;
case 11: { // RGB
let headText = `Switch ${cd.id}`;
if (cd.name) headText += ` (${cd.name})`;
updateInnerText(el(c, "head"), headText);
setValueIfNotModified(el(c, "name"), cd.name);
Expand Down Expand Up @@ -633,7 +632,8 @@ function updateComponent(cd) {
setPreviewColor(c);
}
break;
case 3: // Stateless Programmable Switch (aka input in detached mode).
}
case 3: { // Stateless Programmable Switch (aka input in detached mode).
let headText = `Input ${cd.id}`;
if (cd.name) headText += ` (${cd.name})`;
updateInnerText(el(c, "head"), headText);
Expand Down Expand Up @@ -661,7 +661,8 @@ function updateComponent(cd) {
}
updateInnerText(el(c, "last_event"), lastEvText);
break;
case 4: // Window Covering
}
case 4: { // Window Covering
updateInnerText(el(c, "head"), cd.name);
setValueIfNotModified(el(c, "name"), cd.name);
updateInnerText(el(c, "state"), cd.state_str);
Expand Down Expand Up @@ -695,7 +696,8 @@ function updateComponent(cd) {
updateInnerText(el(c, "pos"), posText);
updateInnerText(el(c, "cal"), calText);
break;
case 5: // Garage Doot Opener
}
case 5: { // Garage Doot Opener
updateInnerText(el(c, "head"), cd.name);
setValueIfNotModified(el(c, "name"), cd.name);
updateInnerText(el(c, "state"), cd.cur_state_str);
Expand All @@ -713,15 +715,17 @@ function updateComponent(cd) {
el(c, "out_mode_container").style.display = "none";
}
break;
case 6: // Disabled Input
}
case 6: { // Disabled Input
updateInnerText(el(c, "head"), `Input ${cd.id}`);
selectIfNotModified(el(c, "type"), cd.type);
break;
}
case 7: // Motion Sensor
case 8: // Occupancy Sensor
case 9: // Contact Sensor
case 10: // Doorbell
headText = `Input ${cd.id}`;
case 10: { // Doorbell
let headText = `Input ${cd.id}`;
if (cd.name) headText += ` (${cd.name})`;
updateInnerText(el(c, "head"), headText);
setValueIfNotModified(el(c, "name"), cd.name);
Expand All @@ -737,6 +741,7 @@ function updateComponent(cd) {
}
updateInnerText(el(c, "status"), statusText);
break;
}
default:
console.log(`Unhandled component type: ${cd.type}`);
}
Expand Down
2 changes: 1 addition & 1 deletion mos.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
author: Shelly-HomeKit contributors
description: A HomeKit firmware for Shelly switches
version: 2.9.4
version: 2.9.5
platform: esp8266

libs_version: latest
Expand Down

0 comments on commit 6108151

Please sign in to comment.