1.0.4 • Published 5 years ago

homeassistant-cli v1.0.4

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

homeassistant-cli

A simple cli tool for Home Assistant that uses node-homeassistant.

Installation

$ npm install -g homeassistant-cli

If there is an permission error you have to reconfigure npm or use sudo

Usage

Call a service

$ hac call light turn_on

Add additional service data

$ hac call light turn_on --service-data '{"entity_id": "light.komode"}'

Query the state

$ hac state sun.sun

Subscribe to state changes

$ hac state -s sun.sun

Additional parameters

Custom hostname, port and password

$ hac --ip 10.1.0.166 --port 80 --api-password "hunter4" state sun.sun

To find shorthands and some extra parameters use

$ hac --help

Scripting example

You can use this to access Home Assistant from your scripts

#!/bin/bash

hac state -s light.komode | while read -r change; do
  state=$(echo "$change" | jq ".new_state.state")

  echo "Light is now $state"
done
1.0.4

5 years ago

1.0.3

6 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago