Skip to content

Custom Home Assistant component to push state changes to webhooks

License

Notifications You must be signed in to change notification settings

bramstroker/homeassistant-state-webhook

Repository files navigation

Version Downloads hacs_badge Code style: MyPy Coverage Status BuyMeACoffee

State webhook

Custom Home Assistant integration which allows you to sent state changes of entities to a webhook (HTTP call). Essentially you set up a webhook URL, with optionally authorization headers. In addition you configure the entities which you want to track and which data to include in the payload. The component will listen to state changes of relevant entities and will call your webhook accordingly.

You can use it for example to sent HA state data to tools like Zapier or IFTT to do all kind of automations. Or sent JSON data to any custom endpoint, the possibilities are endless.

Installation

HACS (manually)

Currently you'll need to add this integration as a custom repository in HACS. I will try to add this integration to HACS default repository, but this will take a lot of time looking at the big backlog.

  • Click the button below to open this repository in HACS:

Open your Home Assistant instance and open a repository inside the Home Assistant Community Store.

  • Click add and then the download button in the bottom right corner.
  • Restart Home Assistant and continue with the next section.

Usage

For each webhook you'd like to add go to "Devices & services", and click "Add integration", search for State webhook and follow the instructions. Or click the button below.

Open your Home Assistant instance and start setting up a new integration.

configuration screens:

alt text alt text

Payload

Currently the component will sent following payload structure using POST request to the configured endpoint:

{
  "entity_id": "person.some",
  "time": "2024-12-19T12:27:05.854243+00:00",
  "old_state": "home",
  "new_state": "not_home"
}

You can also add the new_state_attributes using a toggle in the configuration screen. And omit the old_state if you don't need it.