Enhancement REST API Home Assistant

The main goal is udpate HA API with callbacks to device, witch create a new state with POST to /api/states/<entity_id>.

add with JSON new attrs (example rest switch):

1. callback_url_on
1.1 callback_headers_on
1.2 callback_body_on 

and of course

2. callback_url_off
2.1 callback_headers_off
2.2 callback_body_off

When device send to HA REST API new state device with callback urls and antoher data to manage switch - HA can immidetly control that, no need restful_command and another.

For developers is great options to modify and create API2API communications without a thousands integrations.

It can be helpful with light devices, for example callback “set brightness level” URL and data to device back and control that.

Advantages:

  1. More useful HA REST API – one way logic over. With callbacks (reverse web-hook) – is the way to create native devices to HA without writing any integration’s.
  2. No needed to create a lot of restful_command to control for example 25 groups of light.
  3. Fast and native as possible. No MQTT or another way co communicate with HA.

Hi

Interested. Let me know how I can help. Noonlight alarm monitoring uses this and I aways wanted to use HA to send alarm messages. Would be great if it could be added to Esphome too.

You may also want have a method to handle callback errors.

5310