0.1.20 ā€¢ Published 1 year ago

@brittonhayes/homeassistant-ts v0.1.20

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

šŸ  Home Assistant - Typescript SDK

CI

šŸ“š SDK Docs

šŸ“š OpenAPI 3.x Spec

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