Description
home-assistant-js-websocket is a JavaScript websocket client for Home Assistant. It retrieves authentication tokens and communicates with the Home Assistant websocket API, so you can connect a web or JavaScript app to a Home Assistant instance. The README says it has zero dependencies. Its getAuth method handles OAuth2 sign-in: it redirects the user to their Home Assistant instance to log in, then fetches the token after they return. All you need from the user is the URL of their instance. When the server advertises it in a secure context, getAuth uses S256 PKCE. Options include hassUrl, which is needed for the first redirect, clientId, which defaults to the domain of the current page and can be null for system users, and redirectUrl. The README covers a demo you can try after cloning the repository, and it lists installation steps. The library is on GitHub under the home-assistant organization, with a code of conduct and contributing and security policies.…
Highlights
- Websocket client for the Home Assistant API
- OAuth2 sign-in with getAuth
- S256 PKCE in secure contexts
- Zero dependencies
- Demo in the repository
Ratings & Reviews
No ratings yet
Be the first to rate Home Assistant JS Websocket.
People also visit
Home Assistant JS Websocket FAQ
What is this library?
A JavaScript websocket client for the Home Assistant API.
How does login work?
getAuth redirects the user to their Home Assistant instance, and returns with an authentication token after they log in. You need the instance URL.
Does it have dependencies?
No. The README says it has zero dependencies.
Does it use PKCE?
Yes, when the server advertises it in a secure context, getAuth uses S256 PKCE.
Can I try it first?
Yes. The README describes a demo that you can run from a clone of the repository.
What are the best Home Assistant JS Websocket alternatives?
Popular alternatives to Home Assistant JS Websocket include Node Red Contrib Home Assistant Websocket, Go Hass Agent and Home-Assistant. See all Home Assistant JS Websocket alternatives

