mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-16 22:06:34 +00:00
Use default behaviour for service target (#8650)
This commit is contained in:
parent
0a672c55c5
commit
5abb3dd8c1
@ -19,7 +19,6 @@ import memoizeOne from "memoize-one";
|
|||||||
import { fireEvent } from "../common/dom/fire_event";
|
import { fireEvent } from "../common/dom/fire_event";
|
||||||
import { computeDomain } from "../common/entity/compute_domain";
|
import { computeDomain } from "../common/entity/compute_domain";
|
||||||
import { computeObjectId } from "../common/entity/compute_object_id";
|
import { computeObjectId } from "../common/entity/compute_object_id";
|
||||||
import { ENTITY_COMPONENT_DOMAINS } from "../data/entity";
|
|
||||||
import { Selector } from "../data/selector";
|
import { Selector } from "../data/selector";
|
||||||
import { PolymerChangedEvent } from "../polymer-types";
|
import { PolymerChangedEvent } from "../polymer-types";
|
||||||
import { HomeAssistant } from "../types";
|
import { HomeAssistant } from "../types";
|
||||||
@ -124,11 +123,6 @@ export class HaServiceControl extends LitElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private _domainFilter = memoizeOne((service: string) => {
|
|
||||||
const domain = computeDomain(service);
|
|
||||||
return ENTITY_COMPONENT_DOMAINS.includes(domain) ? [domain] : null;
|
|
||||||
});
|
|
||||||
|
|
||||||
private _getServiceInfo = memoizeOne(
|
private _getServiceInfo = memoizeOne(
|
||||||
(
|
(
|
||||||
service?: string,
|
service?: string,
|
||||||
@ -231,11 +225,7 @@ export class HaServiceControl extends LitElement {
|
|||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.selector=${serviceData.target
|
.selector=${serviceData.target
|
||||||
? { target: serviceData.target }
|
? { target: serviceData.target }
|
||||||
: {
|
: { target: {} }}
|
||||||
target: {
|
|
||||||
entity: { domain: computeDomain(this._value!.service) },
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
@value-changed=${this._targetChanged}
|
@value-changed=${this._targetChanged}
|
||||||
.value=${this._value?.target}
|
.value=${this._value?.target}
|
||||||
></ha-selector
|
></ha-selector
|
||||||
@ -245,7 +235,6 @@ export class HaServiceControl extends LitElement {
|
|||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.value=${this._value?.data?.entity_id}
|
.value=${this._value?.data?.entity_id}
|
||||||
.label=${entityId.description}
|
.label=${entityId.description}
|
||||||
.includeDomains=${this._domainFilter(this._value!.service)}
|
|
||||||
@value-changed=${this._entityPicked}
|
@value-changed=${this._entityPicked}
|
||||||
allow-custom-entity
|
allow-custom-entity
|
||||||
></ha-entity-picker>`
|
></ha-entity-picker>`
|
||||||
|
@ -2,45 +2,3 @@ export const UNAVAILABLE = "unavailable";
|
|||||||
export const UNKNOWN = "unknown";
|
export const UNKNOWN = "unknown";
|
||||||
|
|
||||||
export const UNAVAILABLE_STATES = [UNAVAILABLE, UNKNOWN];
|
export const UNAVAILABLE_STATES = [UNAVAILABLE, UNKNOWN];
|
||||||
|
|
||||||
export const ENTITY_COMPONENT_DOMAINS = [
|
|
||||||
"air_quality",
|
|
||||||
"alarm_control_panel",
|
|
||||||
"alert",
|
|
||||||
"automation",
|
|
||||||
"binary_sensor",
|
|
||||||
"calendar",
|
|
||||||
"camera",
|
|
||||||
"counter",
|
|
||||||
"cover",
|
|
||||||
"dominos",
|
|
||||||
"fan",
|
|
||||||
"geo_location",
|
|
||||||
"group",
|
|
||||||
"image_processing",
|
|
||||||
"input_boolean",
|
|
||||||
"input_datetime",
|
|
||||||
"input_number",
|
|
||||||
"input_select",
|
|
||||||
"input_text",
|
|
||||||
"light",
|
|
||||||
"lock",
|
|
||||||
"mailbox",
|
|
||||||
"media_player",
|
|
||||||
"number",
|
|
||||||
"person",
|
|
||||||
"plant",
|
|
||||||
"remember_the_milk",
|
|
||||||
"remote",
|
|
||||||
"scene",
|
|
||||||
"script",
|
|
||||||
"sensor",
|
|
||||||
"switch",
|
|
||||||
"timer",
|
|
||||||
"utility_meter",
|
|
||||||
"vacuum",
|
|
||||||
"weather",
|
|
||||||
"wink",
|
|
||||||
"zha",
|
|
||||||
"zwave",
|
|
||||||
];
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user