1.0.4 • Published 6 years ago
homeassistant-cli v1.0.4
homeassistant-cli
A simple cli tool for Home Assistant that uses node-homeassistant.
Installation
$ npm install -g homeassistant-cliIf there is an permission error you have to reconfigure npm or use sudo
Usage
Call a service
$ hac call light turn_onAdd additional service data
$ hac call light turn_on --service-data '{"entity_id": "light.komode"}'Query the state
$ hac state sun.sunSubscribe to state changes
$ hac state -s sun.sunAdditional parameters
Custom hostname, port and password
$ hac --ip 10.1.0.166 --port 80 --api-password "hunter4" state sun.sunTo find shorthands and some extra parameters use
$ hac --helpScripting 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