Lovelace UI module and migration tool for Python
$ pip3 install requests pyyaml
$ python3 lovelace_migrate.py [-h] [-n <name>] [-p [<password>]] [<api-url|file>]
You will be prompted to enter your API password if you use -p
without specifying a password.
$ python3 lovelace_migrate.py -p http://192.168.1.100:8123/api
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 lovelace_migrate.py -p https://your.domain.com/api
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 lovelace_migrate.py -p YOUR_API_PASSWORD http://192.168.1.100:8123/api
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 lovelace_migrate.py -p YOUR_API_PASSWORD http://192.168.1.100:8123/api
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.
A local JSON file can be used as the configuration input.
$ python3 lovelace_migrate.py -n Home states.json
Note: Loading from file is currently not implemented. For a temporary
workaround, please see Using cat
.
You can even use the contents of stdin
as the configuration for the script:
$ cat .data/entities.json | python3 lovelace_migrate.py -n Home -
$ curl -sSL -X GET \
-H "x-ha-access: YOUR_PASSWORD" \
-H "content-type: application/json" \
http://192.168.1.100:8123/api/states \
| python3 lovelace_migrate.py -
Note: When using a file or stdin
as input, the default name for the
Lovelove UI will be set to Home. You can override this using the -n
(or
--name
) argument.
Short | Long | Default | Description |
---|---|---|---|
-h |
--help |
show this help message and exit | |
-n |
--name |
auto |
name to give the Lovelace UI |
-p |
--password |
Home Assistant API password | |
<api-url> |
Home Assistant API URL (ending with /api ) |
||
<file> |
local JSON file containing dump from /api/states |
This argument will show the usage help and immediately exit.
This is the name that you wish to be set for the Lovelace UI. If using an API
URL, this will attempt to be loaded from /api/config
. If it
cannot be loaded automatically via the API URL, or it is not specified when
using a file or stdin
as the configuration, the default is Home.
Home Assistant API password. If this argument is enabled without specifying a password, you will be prompted to enter your password.
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:
http://192.168.1.100:8123/api
https://your.domain.com/api
https://my-domain.duckdns.org/api
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
.