Created
August 7, 2019 04:34
-
-
Save hannesbe/6069b370c1f40b458e829deafd56a12a to your computer and use it in GitHub Desktop.
Jinja2 template, generating hass-cli commands, to make renaming Z-Wave entities for example a lot easier
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{%- set find = "shenzhen_neo_electronics_co_ltd_water_leakage_detector" -%} | |
{%- set replace = "boiler_water_leak_sensor" -%} | |
{%- for item in states -%} | |
{% if find in item.object_id %} | |
hass-cli entity rename --name "{{ item.object_id.replace(find, replace).replace("_", " ")|title }}" {{ item.entity_id }} {{ item.entity_id.replace(find, replace) }} | |
{%- endif -%} | |
{%- endfor -%} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
eval "$(hass-cli template ./entity_rename_find_replace.j2)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment