-
-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
MHA
committed
Jun 25, 2021
1 parent
c78b539
commit 6b54910
Showing
3 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { Controller } from './controller'; | ||
|
||
export class ClimateController extends Controller { | ||
_step = 1; | ||
_targetValue; | ||
|
||
get _value(): number { | ||
return this.stateObj.attributes.temperature; | ||
} | ||
|
||
set _value(value) { | ||
this._hass.callService('climate', 'set_temperature', { | ||
// eslint-disable-next-line @typescript-eslint/camelcase | ||
entity_id: this.stateObj.entity_id, | ||
temperature: value, | ||
}); | ||
} | ||
|
||
get _min(): number { | ||
return this.stateObj.attributes.min_temp; | ||
} | ||
|
||
get _max(): number { | ||
return this.stateObj.attributes.max_temp; | ||
} | ||
|
||
get isValuePercentage(): boolean { | ||
return false; | ||
} | ||
|
||
get label(): string { | ||
return `${this.value} ${this._hass.config.unit_system.temperature}` | ||
/*if (this.percentage > 0) { | ||
if (this.hasSlider) { | ||
return `${this.percentage}%` | ||
} else { | ||
return this._hass.localize('component.fan.state._.on'); | ||
} | ||
} | ||
return this._hass.localize('component.fan.state._.off');*/ | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters