A simple package to access & controll home-assistant from node.js using the websocket api.
Installation
$ npm install node-homeassistant
Usage
Create a new Homeassistant object:
const Homeassistant = let ha = host: '192.168.1.166' protocol: 'ws' // "ws" (default) or "wss" for SSL retryTimeout: 1000 // in ms, default is 5000 retryCount: 3 // default is 10, values < 0 mean unlimited password: 'http_api_password' // api_password is getting depricated by home assistant token: 'access_token' // for now both tokens and api_passwords are suported port: 8123 ha
Access & subscribe to states:
console ha
Call services:
ha
You can subscribe to the 'connection' event to get information about the websocket connection.
ha
See the example folders for a working demo.
License
MIT