@@ -34,13 +34,13 @@ class CustomFanRow extends Polymer.Element {
3434 disabled ='[[_leftState]] '> [[_leftText]]</ button >
3535 < button
3636 class ='speed '
37- style ='[[_midLeftColor]] '
37+ style ='[[_midLeftColor]];[[_hideMidLeft]] '
3838 toggles name ="[[_midLeftName]] "
3939 on-click ='setSpeed '
4040 disabled ='[[_midLeftState]] '> [[_midLeftText]]</ button >
4141 < button
4242 class ='speed '
43- style ='[[_midRightColor]] '
43+ style ='[[_midRightColor]];[[_hideMidRight]] '
4444 toggles name ="[[_midRightName]] "
4545 on-click ='setSpeed '
4646 disabled ='[[_midRightState]] '> [[_midRightText]]</ button >
@@ -75,6 +75,8 @@ class CustomFanRow extends Polymer.Element {
7575 _midLeftName : String ,
7676 _midRightName : String ,
7777 _rightName : String ,
78+ _hideMidLeft : String ,
79+ _hideMidRight : String ,
7880 _leftState : Boolean ,
7981 _midLeftState : Boolean ,
8082 _midRightState : Boolean ,
@@ -90,6 +92,7 @@ class CustomFanRow extends Polymer.Element {
9092 customTheme : false ,
9193 sendStateWithSpeed : false ,
9294 reverseButtons : false ,
95+ isTwoSpeedFan : false ,
9396 isOffColor : '#f44c09' ,
9497 isOnLowColor : '#43A047' ,
9598 isOnMedColor : '#43A047' ,
@@ -110,6 +113,7 @@ class CustomFanRow extends Polymer.Element {
110113 const custTheme = config . customTheme ;
111114 const sendStateWithSpeed = config . sendStateWithSpeed ;
112115 const revButtons = config . reverseButtons ;
116+ const twoSpdFan = config . isTwoSpeedFan ;
113117 const custOnLowClr = config . isOnLowColor ;
114118 const custOnMedClr = config . isOnMedColor ;
115119 const custOnHiClr = config . isOnHiColor ;
@@ -209,6 +213,15 @@ class CustomFanRow extends Polymer.Element {
209213 let lowname = 'low' ;
210214 let offname = 'off' ;
211215
216+ let hidemedium = 'display:block' ;
217+ let nohide = 'display:block' ;
218+
219+ if ( twoSpdFan ) {
220+ hidemedium = 'display:none' ;
221+ } else {
222+ hidemedium = 'display:block' ;
223+ }
224+
212225
213226 if ( revButtons ) {
214227 this . setProperties ( {
@@ -229,6 +242,8 @@ class CustomFanRow extends Polymer.Element {
229242 _midLeftName : lowname ,
230243 _midRightName : medname ,
231244 _rightName : hiname ,
245+ _hideMidLeft : nohide ,
246+ _hideMidRight : hidemedium ,
232247 } ) ;
233248 } else {
234249 this . setProperties ( {
@@ -249,6 +264,8 @@ class CustomFanRow extends Polymer.Element {
249264 _midLeftName : medname ,
250265 _midRightName : lowname ,
251266 _rightName : offname ,
267+ _hideMidRight : nohide ,
268+ _hideMidLeft : hidemedium ,
252269 } ) ;
253270 }
254271 }
0 commit comments