mirror of
https://github.com/home-assistant/frontend.git
synced 2026-09-30 00:39:08 +01:00
* Add helper UI * Oops * Update * Update * Update * Lint * Add all input forms * Return extended entity registry entry from update * Comments Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
44 lines
944 B
TypeScript
44 lines
944 B
TypeScript
import { HomeAssistant } from "../types";
|
|
|
|
export interface InputBoolean {
|
|
id: string;
|
|
name: string;
|
|
icon?: string;
|
|
initial?: boolean;
|
|
}
|
|
|
|
export interface InputBooleanMutableParams {
|
|
name: string;
|
|
icon: string;
|
|
initial: boolean;
|
|
}
|
|
|
|
export const fetchInputBoolean = (hass: HomeAssistant) =>
|
|
hass.callWS<InputBoolean[]>({ type: "input_boolean/list" });
|
|
|
|
export const createInputBoolean = (
|
|
hass: HomeAssistant,
|
|
values: InputBooleanMutableParams
|
|
) =>
|
|
hass.callWS<InputBoolean>({
|
|
type: "input_boolean/create",
|
|
...values,
|
|
});
|
|
|
|
export const updateInputBoolean = (
|
|
hass: HomeAssistant,
|
|
id: string,
|
|
updates: Partial<InputBooleanMutableParams>
|
|
) =>
|
|
hass.callWS<InputBoolean>({
|
|
type: "input_boolean/update",
|
|
input_boolean_id: id,
|
|
...updates,
|
|
});
|
|
|
|
export const deleteInputBoolean = (hass: HomeAssistant, id: string) =>
|
|
hass.callWS({
|
|
type: "input_boolean/delete",
|
|
input_boolean_id: id,
|
|
});
|