Custom component with REST interface

I have written a custom platform to control my heating. It switches on the boiler, monitors thermostat temperature, etc. via a VeraLight controller (which handles all the z-wave stuff). I would like the platform to be able to respond to REST post requests sent to HomeAssistant from the VeraLight (so that, for example, I can instantly send out notifications about the boiler switching on, rather than waiting for HomeAssistant to synchronise with the VeraLight).

Is it possible to get access to the HomeAssistant webserver from within a custom component and respond to get and post requests?

Is this what you’re looking for?

https://home-assistant.io/developers/python_api/

I think that’s the API for the HomeAssistant REST interface. I need the opposite - to be able to handle a request from within a HomeAssistant custom component. For example, I would like my VeraLight to send a post request to HomeAssistant and my component to be able to define the response. Any idea if that’s possible? One solution might be for my component to contain its own webserver on a different port, but that seems a bit clunky if there is one already up and running…

1 Like

Yes, it’s possible. Take a look at the mystrom implementation for their buttons. The view is handling the requests.

Check out MiniMote + Vera. That’s what I’m using to create an event in Home Assistant when a scene is activated in Vera.

Brilliant, that’s exactly what I need. Thanks.