homeassistant-cli
v1.0.4
Published
A simple cli tool for [Home Assistant](https://home-assistant.io/) that uses [node-homeassistant](https://github.com/Mawalu/node-homeassistant).
Downloads
9
Readme
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