Homeassitant (HASS) rest API + Javascript to supercharge automation and frontend

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 personally like Javascript, to run a frontend, as well as a backend, from the browser. I like to see what’s going on. I think I’m a control freak.

On rare occasions that javascript is not capable enough, I fall back on PHP.

I don’t like hosting servers, etc. I run everything off of old macbooks lying around the house.

So, now, I have homeassistant (hass), talking to javascript. I can pull information. I can toggle switches/lights. And I can hook on to a stream, which pushes events in realtime to my javascript.

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:

api_password: '1234'


2 – Capture the event stream coming in from hass:

Detailed explanation is available on this hass community page.


3 – Set up some javascript to use the api


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s