feat: Add event-based automation triggers (#2537)
This commit is contained in:
committed by
dermotduffy
parent
b701366762
commit
a31816c168
@@ -0,0 +1,16 @@
|
||||
import { HomeAssistant } from './types';
|
||||
|
||||
/**
|
||||
* `HASSSource` is the observer-pattern API that `HASSManager` exposes for any
|
||||
* long-lived code that needs to react to HASS changes. The listener fires on
|
||||
* every non-null HASS push; `oldHass` is the previous value (null on first
|
||||
* fire).
|
||||
*/
|
||||
export type HASSListener = (hass: HomeAssistant, oldHass: HomeAssistant | null) => void;
|
||||
|
||||
export type HASSUnlistenCallback = () => void;
|
||||
|
||||
export interface HASSSource {
|
||||
getHASS(): HomeAssistant | null;
|
||||
addListener(listener: HASSListener): HASSUnlistenCallback;
|
||||
}
|
||||
Reference in New Issue
Block a user