import { mdiStop, mdiValveClosed, mdiValveOpen } from "@mdi/js"; import { LitElement, html, css, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { supportsFeature } from "../common/entity/supports-feature"; import type { ValveEntity } from "../data/valve"; import { ValveEntityFeature, canClose, canOpen, canStop } from "../data/valve"; import type { HomeAssistant } from "../types"; import "./ha-icon-button"; @customElement("ha-valve-controls") class HaValveControls extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; @property({ attribute: false }) public stateObj!: ValveEntity; protected render() { if (!this.stateObj) { return nothing; } return html`
`; } private _onOpenTap(ev): void { ev.stopPropagation(); this.hass.callService("valve", "open_valve", { entity_id: this.stateObj.entity_id, }); } private _onCloseTap(ev): void { ev.stopPropagation(); this.hass.callService("valve", "close_valve", { entity_id: this.stateObj.entity_id, }); } private _onStopTap(ev): void { ev.stopPropagation(); this.hass.callService("valve", "stop_valve", { entity_id: this.stateObj.entity_id, }); } static styles = css` :host { display: block; } .state { white-space: nowrap; } .hidden { visibility: hidden !important; } `; } declare global { interface HTMLElementTagNameMap { "ha-valve-controls": HaValveControls; } }