Initial haptics support (#3099)

* Initial haptics support

* Move window stuff into types.ts

* Fire haptic events instead of expecting a messageHandler

* Style fixes, linting fixes

* Only allow whitelisted haptics

* Make requested changes
This commit is contained in:
Robbie Trencheny
2019-04-22 09:24:30 -07:00
committed by Paulus Schoutsen
parent b3c1bead39
commit f4cfbc6678
5 changed files with 36 additions and 0 deletions

View File

@@ -14,6 +14,7 @@ import {
} from "lit-element";
import { HomeAssistant } from "../../types";
import { HassEntity } from "home-assistant-js-websocket";
import { forwardHaptic } from "../../util/haptics";
const isOn = (stateObj?: HassEntity) =>
stateObj !== undefined && !STATES_OFF.includes(stateObj.state);
@@ -89,6 +90,7 @@ class HaEntityToggle extends LitElement {
if (!this.hass || !this.stateObj) {
return;
}
forwardHaptic(this, "light");
const stateDomain = computeStateDomain(this.stateObj);
let serviceDomain;
let service;