MMM-HomeAssistant-Touch/UIClasses/Light.js
2021-04-04 19:38:03 +02:00

22 lines
517 B
JavaScript

class Light extends Base {
getContainer() {
const entity = super.getContainer();
entity.onclick = () => {
this.mm.sendSocketNotification("TOGGLE_STATE", { entity: this.id });
};
entity.ontouchend = () => {
this.mm.sendSocketNotification("TOGGLE_STATE", { entity: this.id });
};
return entity;
}
render() {
super.render();
const container = document.getElementById(this.id);
container.classList.add(this.state);
container.appendChild(statusCheckbox);
}
}