8 lines
441 B
TypeScript
8 lines
441 B
TypeScript
import type { HomeAssistant } from "./types.ts";
|
|
|
|
/** Presentation guard only. The Symcon API independently checks every requested native target. */
|
|
export function canControl(hass: HomeAssistant | undefined, id: string): boolean {
|
|
if (!hass || hass.symconObjects === undefined) return true;
|
|
return !!hass.states[id] && hass.states[id].attributes.symcon_can_control !== false && hass.states[id].attributes.symcon_has_action !== false;
|
|
}
|