Skip to content

Commit

Permalink
feat(docker): add doc and script for docker hass-cli
Browse files Browse the repository at this point in the history
  • Loading branch information
maxandersen committed Feb 10, 2019
1 parent c6397fc commit 2dfe602
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 2 deletions.
23 changes: 21 additions & 2 deletions README.rst
@@ -1,7 +1,7 @@
Home Assistant Command-line Interface (``hass-cli``)
====================================================

|Build Status| |Coverage| |Chat Status| |License| |PyPI| |Docker|
|Build Status| |Coverage| |Chat Status| |License| |PyPI|

The Home Assistant Command-line interface (``hass-cli``) allows one to
work with a local or a remote `Home Assistant <https://home-assistant.io>`_
Expand All @@ -28,7 +28,24 @@ To use latest pre-release from ``dev`` branch:

.. code:: bash
$ pip install pip3 install git+https://github.com/home-assistant/home-assistant-cli@dev
$ pip install git+https://github.com/home-assistant/home-assistant-cli@dev
Docker
-------

If you do not have a Python setup you can try use hass-cli via a container using docker.

To make auto-completion and access environment work like other scripts you'll need to
create a script file to execute.

$ curl https://raw.githubusercontent.com/home-assistant/home-assistant-cli/dev/docker-hass-cli > hass-cli
$ chmod +x hass-cli

Now put `hass-cli` script into your path and you can use it like if you had installed it via
command line as long as you don't need file system access (like for `hass-cli template`).

Setup
======

To get started you'll need to have or generate a long lasting token format
on your Home Assistant profile page (i.e. https://localhost:8123/profile).
Expand Down Expand Up @@ -453,6 +470,8 @@ Developing is (re)using as much as possible from `homeassistant development setu
Recommended way to develop is to use virtual environment to ensure isolation from rest of your system using the following steps:
Clone the git repository and do the following:
.. code:: bash
$ python3 -m venv .
Expand Down
17 changes: 17 additions & 0 deletions docker-hass-cli
@@ -0,0 +1,17 @@

## Use the tag that best fits you
## dev contains last build from dev branch.
TAG=dev
## latest is latest released build
#TAG=latest
## You can also use a specific tag, see https://hub.docker.com/r/homeassistant/home-assistant-cli/tags
## for available ones.
##TAG=0.6.0

IMAGE=homeassistant/home-assistant-cli:$TAG

## The -e arguments passes in the environment variables needed for basic hass-cli setup (HASS_SERVER and HASS_TOKEN)
## and whats needed for auto completion (_HASS_CLI_COMPLETE, COMP_WORDS, COMP_CWORD)
## Be aware that while hass-cli runs via docker these variables values will be visible using `docker inspect`.
docker run -e HASS_TOKEN -e HASS_SERVER -e _HASS_CLI_COMPLETE -e COMP_WORDS -e COMP_CWORD -e _HASS_CLI_COMPLETE $IMAGE $*

0 comments on commit 2dfe602

Please sign in to comment.