As powerful as homeassistant (hass.io) is, I think it lacks the capability of complex automation, and scripting. Thankfully hass exposes a REST API, which lets you write your own interface/backend, in just about any language.
I don’t like hosting servers, etc. I run everything off of old macbooks lying around the house.
This post is for a record of what I had to do to get things connected.
1 – Configure HTTP in configuration.yaml
This is needed to bypass CORS policy errors. This also sets up other aspects of the api. But not jsut the api. For detailed information, please see the HASS HTTP information page. My recipe in configuration.yaml is:
http: api_password: '1234' cors_allowed_origins: - http://192.168.31.228 - http://192.168.31.2
2 – Capture the event stream coming in from hass:
Detailed explanation is available on this hass community page.