Total overhaul!

This commit is contained in:
2019-06-13 22:45:59 +02:00
parent 46be70ee49
commit 1d29e2365f
14 changed files with 611 additions and 436 deletions

View File

@@ -0,0 +1,41 @@
import {Controller} from "./controller.js";
export class InputSelectController extends Controller {
get _value() {
return this.stateObj.attributes.options.indexOf(this.stateObj.state);
}
set _value(value) {
if (value in this.stateObj.attributes.options)
this._hass.callService("input_select", "select_option", {
entity_id: this.stateObj.entity_id,
option: this.stateObj.attributes.options[value],
});
}
get string() {
return this.stateObj.state;
}
get isOff() {
return false;
}
get hasToggle() {
return false;
}
get hasSlider() {
return this.stateObj.attributes.options && this.stateObj.attributes.options.length > 0
}
get _max() {
return this.stateObj.attributes.options.length - 1;
}
get _step() {
return 1;
}
}