@brittonhayes/homeassistant-ts
TypeScript icon, indicating that this package has built-in type declarations

0.1.20 • Public • Published

🏠 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

Package Sidebar

Install

npm i @brittonhayes/homeassistant-ts

Weekly Downloads

2

Version

0.1.20

License

MIT

Unpacked Size

41.5 kB

Total Files

13

Last publish

Collaborators

  • brittonhayes