homeassistant.helpers.event

Helpers for listening to events.

homeassistant.helpers.event.track_state_change(hass, entity_ids, action, from_state=None, to_state=None)[source]

Track specific state changes.

entity_ids, from_state and to_state can be string or list. Use list to match multiple.

Returns a function that can be called to remove the listener.

Must be run within the event loop.

homeassistant.helpers.event.track_point_in_time(hass, action, point_in_time)[source]

Add a listener that fires once after a specific point in time.

homeassistant.helpers.event.track_point_in_utc_time(hass, action, point_in_time)[source]

Add a listener that fires once after a specific point in UTC time.

homeassistant.helpers.event.track_sunrise(hass, action, offset=None)[source]

Add a listener that will fire a specified offset from sunrise daily.

homeassistant.helpers.event.track_sunset(hass, action, offset=None)[source]

Add a listener that will fire a specified offset from sunset daily.

homeassistant.helpers.event.track_utc_time_change(hass, action, year=None, month=None, day=None, hour=None, minute=None, second=None, local=False)[source]

Add a listener that will fire if time matches a pattern.

homeassistant.helpers.event.track_time_change(hass, action, year=None, month=None, day=None, hour=None, minute=None, second=None)[source]

Add a listener that will fire if UTC time matches a pattern.