Skip to content

Commit 6108151

Browse files
committed
Fix javascript error
Introduced in be0bd18 Fixes #755
1 parent 56f96bc commit 6108151

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

fs_src/script.js

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -563,14 +563,13 @@ function rgbState(c, newState) {
563563

564564
function updateComponent(cd) {
565565
let c = findOrAddContainer(cd);
566-
let headText;
567566
if (!c) return;
568567
switch (cd.type) {
569568
case 0: // Switch
570569
case 1: // Outlet
571570
case 2: // Lock
572-
case 11: // RGB
573-
headText = `Switch ${cd.id}`;
571+
case 11: { // RGB
572+
let headText = `Switch ${cd.id}`;
574573
if (cd.name) headText += ` (${cd.name})`;
575574
updateInnerText(el(c, "head"), headText);
576575
setValueIfNotModified(el(c, "name"), cd.name);
@@ -633,7 +632,8 @@ function updateComponent(cd) {
633632
setPreviewColor(c);
634633
}
635634
break;
636-
case 3: // Stateless Programmable Switch (aka input in detached mode).
635+
}
636+
case 3: { // Stateless Programmable Switch (aka input in detached mode).
637637
let headText = `Input ${cd.id}`;
638638
if (cd.name) headText += ` (${cd.name})`;
639639
updateInnerText(el(c, "head"), headText);
@@ -661,7 +661,8 @@ function updateComponent(cd) {
661661
}
662662
updateInnerText(el(c, "last_event"), lastEvText);
663663
break;
664-
case 4: // Window Covering
664+
}
665+
case 4: { // Window Covering
665666
updateInnerText(el(c, "head"), cd.name);
666667
setValueIfNotModified(el(c, "name"), cd.name);
667668
updateInnerText(el(c, "state"), cd.state_str);
@@ -695,7 +696,8 @@ function updateComponent(cd) {
695696
updateInnerText(el(c, "pos"), posText);
696697
updateInnerText(el(c, "cal"), calText);
697698
break;
698-
case 5: // Garage Doot Opener
699+
}
700+
case 5: { // Garage Doot Opener
699701
updateInnerText(el(c, "head"), cd.name);
700702
setValueIfNotModified(el(c, "name"), cd.name);
701703
updateInnerText(el(c, "state"), cd.cur_state_str);
@@ -713,15 +715,17 @@ function updateComponent(cd) {
713715
el(c, "out_mode_container").style.display = "none";
714716
}
715717
break;
716-
case 6: // Disabled Input
718+
}
719+
case 6: { // Disabled Input
717720
updateInnerText(el(c, "head"), `Input ${cd.id}`);
718721
selectIfNotModified(el(c, "type"), cd.type);
719722
break;
723+
}
720724
case 7: // Motion Sensor
721725
case 8: // Occupancy Sensor
722726
case 9: // Contact Sensor
723-
case 10: // Doorbell
724-
headText = `Input ${cd.id}`;
727+
case 10: { // Doorbell
728+
let headText = `Input ${cd.id}`;
725729
if (cd.name) headText += ` (${cd.name})`;
726730
updateInnerText(el(c, "head"), headText);
727731
setValueIfNotModified(el(c, "name"), cd.name);
@@ -737,6 +741,7 @@ function updateComponent(cd) {
737741
}
738742
updateInnerText(el(c, "status"), statusText);
739743
break;
744+
}
740745
default:
741746
console.log(`Unhandled component type: ${cd.type}`);
742747
}

mos.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
author: Shelly-HomeKit contributors
22
description: A HomeKit firmware for Shelly switches
3-
version: 2.9.4
3+
version: 2.9.5
44
platform: esp8266
55

66
libs_version: latest

0 commit comments

Comments
 (0)