# homeassistant-cli

> A simple cli tool for [Home Assistant](https://home-assistant.io/) that uses [node-homeassistant](https://github.com/Mawalu/node-homeassistant).

Latest version **1.0.4** (published 2019-10-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install homeassistant-cli
pnpm add homeassistant-cli
yarn add homeassistant-cli
bun add homeassistant-cli
```

Provides the command `hac`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2019-10-01 |
| First published | 2017-09-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 3.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 12 |
| Author | Martin Wagner |
| Maintainers | mawalu |

## Links

- npm: https://www.npmjs.com/package/homeassistant-cli
- Repository: https://github.com/mawalu/homeassistant-cli
- Homepage: https://github.com/mawalu/homeassistant-cli#readme
- Issues: https://github.com/mawalu/homeassistant-cli/issues
- npm.io page: https://npm.io/package/homeassistant-cli

## Dependencies (2)

- [commander](https://npm.io/package/commander.md) ^2.11.0
- [node-homeassistant](https://npm.io/package/node-homeassistant.md) ^1.6.0

## Recent versions

- 1.0.4 (latest) — 2019-10-01
- 1.0.3 — 2018-09-28
- 1.0.2 — 2017-09-21
- 1.0.1 — 2017-09-21
- 1.0.0 — 2017-09-21

## README

# homeassistant-cli

A simple cli tool for [Home Assistant](https://home-assistant.io/) that uses [node-homeassistant](https://github.com/Mawalu/node-homeassistant).

## Installation

```shell
$ npm install -g homeassistant-cli
```

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

## Usage

Call a service

```shell
$ hac call light turn_on
```

Add additional service data

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

Query the state

```shell
$ hac state sun.sun
```

Subscribe to state changes

```shell
$ hac state -s sun.sun
```

## Additional parameters

Custom hostname, port and password

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

To find shorthands and some extra parameters use

```shell
$ hac --help
```

## Scripting example

You can use this to access Home Assistant from your scripts

```bash
#!/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
```

---
_Source: https://npm.io/package/homeassistant-cli · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
