🏠 Home Assistant - Typescript SDK
This is typescript REST API client for the Home Assistant API. Allows you to interact with your Home Assistant instance from Typescript/JS projects.
⚡ Usage
How to use the library
📦 Installation
npm install @brittonhayes/homeassistant-ts
🚀 Quickstart
Create a client
import * as homeassistant from '@brittonhayes/homeassistant-ts';
const ha = new homeassistant.Client({
baseUrl: process.env.HASS_URL,
token: process.env.HASS_TOKEN,
});
List all home assistant services
const services = await ha.services.list();
console.log(services);
List all logbook entries (as plaintext)
const logs = await ha.logbook.list();
console.log(logs);
Retrieve all calendar events from a calendar
const calendar = await ha.calendars.retrieve('calendar.calendar_name');
console.log(calendar);
Development
# Install dependencies
npm install
# Format the code
npm run format
# Build the library
npm run build