{"id":27255625,"url":"https://github.com/mawalu/node-homeassistant","last_synced_at":"2025-04-11T02:20:35.547Z","repository":{"id":50800967,"uuid":"97874708","full_name":"mawalu/node-homeassistant","owner":"mawalu","description":"Node.js wrapper for the home-assistant websocket api","archived":false,"fork":false,"pushed_at":"2021-05-29T00:39:43.000Z","size":31,"stargazers_count":29,"open_issues_count":3,"forks_count":10,"subscribers_count":6,"default_branch":"master","last_synced_at":"2023-08-21T03:07:36.688Z","etag":null,"topics":["home-assistant","home-automation","nodejs","npm","websocket"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mawalu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-20T20:15:40.000Z","updated_at":"2023-02-28T03:11:55.000Z","dependencies_parsed_at":"2022-09-06T00:21:22.780Z","dependency_job_id":null,"html_url":"https://github.com/mawalu/node-homeassistant","commit_stats":null,"previous_names":[],"tags_count":8,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mawalu%2Fnode-homeassistant","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mawalu%2Fnode-homeassistant/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mawalu%2Fnode-homeassistant/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mawalu%2Fnode-homeassistant/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mawalu","download_url":"https://codeload.github.com/mawalu/node-homeassistant/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248328364,"owners_count":21085302,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["home-assistant","home-automation","nodejs","npm","websocket"],"created_at":"2025-04-11T02:20:34.969Z","updated_at":"2025-04-11T02:20:35.540Z","avatar_url":"https://github.com/mawalu.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Node.js api for home-assistant [![](https://img.shields.io/npm/v/node-homeassistant.svg)](https://www.npmjs.com/package/node-homeassistant)\n\nA simple package to access \u0026 controll home-assistant from node.js using the websocket api.\n\n## Installation\n\n```\n$ npm install node-homeassistant\n```\n\n## Usage\n\nCreate a new Homeassistant object:\n\n```javascript\nconst Homeassistant = require('node-homeassistant')\n\nlet ha = new Homeassistant({\n  host: '192.168.1.166',\n  protocol: 'ws', // \"ws\" (default) or \"wss\" for SSL\n  retryTimeout: 1000, // in ms, default is 5000\n  retryCount: 3, // default is 10, values \u003c 0 mean unlimited\n  password: 'http_api_password', // api_password is getting depricated by home assistant\n  token: 'access_token' // for now both tokens and api_passwords are suported\n  port: 8123\n})\n\nha.connect().then(() =\u003e {\n  // do stuff\n})\n```\n\nAccess \u0026 subscribe to states:\n\n```javascript\nconsole.log(ha.state('sun.sun'))\n\n\nha.on('state:media_player.spotify', data =\u003e console.log)\n```\n\nCall services:\n\n```javascript\nha.call({\n     domain: 'light',\n     service: 'turn_on'\n   })\n```\n\nYou can subscribe to the 'connection' event to get information about the websocket connection.\n\n```javascript\nha.on('connection', info =\u003e {\n  console.log('connection state is', info)\n})\n```\n\nSee the example folders for a working demo.\n\n# License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmawalu%2Fnode-homeassistant","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmawalu%2Fnode-homeassistant","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmawalu%2Fnode-homeassistant/lists"}