Skip to content

Instantly share code, notes, and snippets.

@glance-
Created June 12, 2020 07:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save glance-/3586ac05cc00b3e74b4bb2707837be08 to your computer and use it in GitHub Desktop.
Save glance-/3586ac05cc00b3e74b4bb2707837be08 to your computer and use it in GitHub Desktop.
use hass-cli to edit lovelace config as yaml in vim
# make edit_lovelace-ui.yml
edit_lovelace-ui.yml:
TMPFILE=$$(mktemp /tmp/XXXXXX-lovelace-ui.yml) ; \
~/lap/homeassistant/bin/hass-cli raw ws lovelace/config > "$${TMPFILE}" ; \
perl -pi -e 'BEGIN {undef $$/;} s/^id: 1\ntype: result\nsuccess: true\nresult:\n/config:\n/' "$${TMPFILE}"; \
vim "$${TMPFILE}" ; \
~/lap/homeassistant/bin/hass-cli raw ws lovelace/config/save --yaml "@$${TMPFILE}" && \
rm -f "$${TMPFILE}"
@glance-
Copy link
Author

glance- commented Jun 12, 2020

Btw, home-assistant-ecosystem/home-assistant-cli#319 is needed to get yaml/file-support

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment