mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-23 17:26:42 +00:00
Use execute_script call in services developer tool (#8657)
This commit is contained in:
parent
60de74a375
commit
e3b72fe0aa
8
src/data/service.ts
Normal file
8
src/data/service.ts
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
import { HomeAssistant } from "../types";
|
||||||
|
import { Action } from "./script";
|
||||||
|
|
||||||
|
export const callExecuteScript = (hass: HomeAssistant, sequence: Action[]) =>
|
||||||
|
hass.callWS({
|
||||||
|
type: "execute_script",
|
||||||
|
sequence,
|
||||||
|
});
|
@ -21,6 +21,7 @@ import "../../../components/ha-service-picker";
|
|||||||
import "../../../components/ha-yaml-editor";
|
import "../../../components/ha-yaml-editor";
|
||||||
import type { HaYamlEditor } from "../../../components/ha-yaml-editor";
|
import type { HaYamlEditor } from "../../../components/ha-yaml-editor";
|
||||||
import { ServiceAction } from "../../../data/script";
|
import { ServiceAction } from "../../../data/script";
|
||||||
|
import { callExecuteScript } from "../../../data/service";
|
||||||
import { haStyle } from "../../../resources/styles";
|
import { haStyle } from "../../../resources/styles";
|
||||||
import "../../../styles/polymer-ha-style";
|
import "../../../styles/polymer-ha-style";
|
||||||
import { HomeAssistant } from "../../../types";
|
import { HomeAssistant } from "../../../types";
|
||||||
@ -250,17 +251,10 @@ class HaPanelDevService extends LitElement {
|
|||||||
);
|
);
|
||||||
|
|
||||||
private _callService() {
|
private _callService() {
|
||||||
const domain = computeDomain(this._serviceData!.service);
|
if (!this._serviceData?.service) {
|
||||||
const service = computeObjectId(this._serviceData!.service);
|
|
||||||
if (!domain || !service) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.hass.callService(
|
callExecuteScript(this.hass, [this._serviceData]);
|
||||||
domain,
|
|
||||||
service,
|
|
||||||
this._serviceData!.data,
|
|
||||||
this._serviceData!.target
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private _toggleYaml() {
|
private _toggleYaml() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user