Lovelace UI module and migration tool for Python
Switch branches/tags
Nothing to show
Clone or download
dale3h Refactor to support Home Assistant >= 0.73.0 (#2)
* Start the refactor

* Consolidate conversion methods

* Update readme to reflect arg changes

* Generate default view if not defined

* Fix hang when using -p without a password

* More work on refactor

* Add support for output file

* Add error checking to output

* Update readme to reflect new options
Latest commit 20b5d7b Jul 23, 2018


Lovelace UI module and migration tool for Python


  • pip3
  • PyYAML
  • requests

On Raspbian Stretch pip3 is not installed by default. To install pip3, run:

$ sudo apt-get install python3-pip

After you clone this repository, you can run:

$ pip3 install -r requirements.txt

To install without the requirements.txt file:

$ pip3 install "requests>=2.14.2" "pyyaml>=3.11,<4"


$ python3 [-h] [-o <file>] [-p [<password>]] [-t <title>]
                              [--debug] [--dry-run]


If you're running, you can run the script with the Community SSH add-on.

$ python3 -o /config/ui-lovelace.yaml

Prompt for Password (Recommended)

You will be prompted to enter your API password if you use -p without specifying a password.

$ python3 -p

Remote with HTTPS/SSL (Recommended)

The migration script can use a remote URL to pull the entity configuration. It is only recommended to use this option if your server has HTTPS enabled.

$ python3 -p

Password in Command (Not Recommended)

It is not recommended to enter your password into the command because it is possible that it will be stored in your command history.

$ python3 -p YOUR_API_PASSWORD

Password Detection (Not Recommended)

This will attempt to connect to your Home Assistant server without a password, and if it requires authentication you will be prompted to enter your password.

$ python3 -p YOUR_API_PASSWORD

Note: If you have login_attempts_threshold set to a low number, it is possible that you might ban yourself by using the password detection method.

Local File as Input

A local JSON file can be used as the configuration input.

$ python3 -t Home states.json

Use Contents of stdin

You can even use the contents of stdin as the configuration for the script:

Using cat
$ cat entities.json | python3 -t Home -
Using curl
$ curl -sSL -X GET \
       -H "x-ha-access: YOUR_PASSWORD" \
       -H "content-type: application/json" \ \
       | python3 -


Quick reference table

Short Long Default Description
-h --help show this help message and exit
-o --output ui-lovelace.yaml write output to <file>
-p --password Detect/Prompt Home Assistant API password
-t --title Home title of the Lovelace UI
--debug set log level to DEBUG
--dry-run do not write to output file
<api-url> Home Assistant API URL (ending with /api)
<file> local JSON file containing dump from /api/states

-h, --help

This argument will show the usage help and immediately exit.

-o, --output

The Lovelace UI YAML output will be written to this file. A backup will automatically be created.

-p, --password

Home Assistant API password. If this argument is enabled without specifying a password, you will be prompted to enter your password.

-t, --title

This is the title that you wish to be set for the Lovelace UI. The default is Home.


Enabling this allows you to see more specific logging output.


No files are written to/moved when this argument is enabled. Instead, the Lovelace UI YAML is output to the console.



It is recommended to use your API URL as the input when migrating to Lovelace UI. This URL usually ends with /api, and commonly looks something like:



You can also load your configuration from a local file. This file must contain the same format as the data from /api/states.

*Note: Use - as the <api-url|file> to load configuration from stdin.