File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ export class SchedulerItemRow extends LitElement {
2323 try {
2424 const stateObj = this . hass . states [ this . schedule . entity_id ! ] ;
2525 if ( ! stateObj ) return html `` ;
26- const disabled = stateObj . state == 'off' ;
26+ const disabled = [ 'off' , 'completed' ] . includes ( stateObj . state ) ;
2727 const nextAction = this . schedule . entries [ 0 ] . slots [ this . schedule . next_entries [ 0 ] || 0 ] . actions [ 0 ] ;
2828
2929 let icon = computeActionIcon ( nextAction , this . config . customize ) ;
@@ -52,10 +52,11 @@ export class SchedulerItemRow extends LitElement {
5252 </ div>
5353 </ div>
5454 <div class= "state" >
55- <ha- entity- to ggle
56- .hass = ${ this . hass }
57- .stateObj = ${ stateObj }
58- > </ ha- entity- to ggle>
55+ <ha- switch
56+ ?checked= ${ [ 'on' , 'triggered' ] . includes ( stateObj . state || '' ) }
57+ ?dis abled= ${ stateObj . state == 'completed' }
58+ @click = ${ this . _toggleEnableDisable }
59+ > </ ha- switch>
5960 </ div>
6061
6162 ` ;
@@ -114,6 +115,12 @@ export class SchedulerItemRow extends LitElement {
114115 this . dispatchEvent ( myEvent ) ;
115116 }
116117
118+ private _toggleEnableDisable ( ev : Event ) {
119+ ev . stopPropagation ( ) ;
120+ const checked = ! ( ev . target as HTMLInputElement ) . checked ;
121+ this . hass . callService ( 'switch' , checked ? 'turn_on' : 'turn_off' , { entity_id : this . schedule . entity_id } ) ;
122+ }
123+
117124
118125 static get styles ( ) : CSSResultGroup {
119126 return css `
You can’t perform that action at this time.
0 commit comments