New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@ciesielskico/home-assistant-rxjs

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ciesielskico/home-assistant-rxjs

rxjs addons for home-assistant-js-websocket

  • 0.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

home-assistant-rxjs

rxjs wrapper for home-assistant-js-websocket

Getting started

  1. npm install @ciesielskico/home-assistant-rxjs

  2. Create long-lived access token under http://homeassistant:8123/profile

  3. Create a .env file

HOST=http://homeassistant.local:8123
ACCESS_TOKEN=<long-lived-access-token>
LOGLEVEL=INFO
  1. Initialize HomeAssistantRXJS and define your automations
const home = new HomeAssistantRXJS();
home.initialize();

const motion$ = home.entities.pipe(
  select('binary_sensor.hall_motion_sensor', 'state'),
);

// When motion detected turn the light on
// and after 2 seconds turn it off
motion$
  .pipe(
    filter(state => state === 'on'),
    switchMapTo(home.lights.turnOn('light.hall_light')),
    delay(2000),
    switchMapTo(home.lights.turnOff('light.hall_light')),
  )
  .subscribe();

Deploy as add-on on Home Assistant

  1. Install the Samba share add-on

  2. Open the share under \\192.168.x.<ha-ip>

  3. Create folder ha-rxjs inside addons

  4. Copy src, package.json, config.json, Dockerfile and run.sh

  5. In Home Assistant under Supervisor choose Add-On Store

  6. Refresh (upper-right corner)

  7. Install

  8. Start add-on

Development

Start Typescript dev server

npm run dev

Local build

docker build --build-arg BUILD_FROM="homeassistant/amd64-base:latest" -t ha-rxjs .

Local run

docker run --rm --env-file=.env ha-rxjs

Known bugs

  • app doesn't exit properly (probably to do with connection)
  • require/imports esm throwing warnings

Keywords

FAQs

Package last updated on 07 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc