Skip to content

Instantly share code, notes, and snippets.

@robotsandcake
Last active January 19, 2018 01:28
Show Gist options
  • Select an option

  • Save robotsandcake/54e2b3f1d1a9e2f9668ce7c170647706 to your computer and use it in GitHub Desktop.

Select an option

Save robotsandcake/54e2b3f1d1a9e2f9668ce7c170647706 to your computer and use it in GitHub Desktop.
This code will generate a customised customise.yaml file when put in the developer section of homeassistant
{% for state in states.sensor -%}
{% if loop.first %}
{% elif loop.last %}
{% else %}
{% endif %}
{{- state.entity_id }}:
friendly_name: '{{ state.attributes.friendly_name|replace("_"," ",)|title() if state.attributes.friendly_name is defined else state.name|replace("_"," ",)|title() }}'
emulated_hue: {{state.attributes.emulated_hue if state.attributes.emulated_hue is defined else 'False' }}
hidden: {{state.attributes.hidden if state.attributes.hidden is defined else "False"}}
{{'icon: '+ state.attributes.icon if state.attributes.icon is defined}}
{{'homebridge_cover_type: '+ state.attributes.homebridge_cover_type if state.attributes.homebridge_cover_type is defined}}
{{'assumed_state: '+ state.attributes.assumed_state if state.attributes.assumed_state is defined}}
{% endfor -%}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment