1.7 KiB
1.7 KiB
lovelace_gen
configuration.yaml
lovelace_gen:
Regenerate by using the "Refresh" function in lovelace.
Example
ui_lovelace.yaml
resources:
# When you regenerate, the browser cache for this file will be invalidated
- url: !file /local/card-mod.js
type: module
...
views:
- ! include lovelace/my_cool_view.yaml
lovelace/my_cool_view.yaml
{% set my_lights = ["light.bed_light", "light.kitchen_lights", "light.ceiling_lights"] %}
title: My view
cards:
- type: entities
entities:
{% for light in my_lights %}
- {{ light }}
{% endfor %}
# Include files with arguments
# NB: JSON format for arguments
# And NO SPACE after the colons!
- !include floorplan.yaml {"lamps":"true", "title":"With Lamps"}
# Use this if you want lovelace_gen to ignore the jinja
{% raw %}
- type: markdown
content: |
# Coming soon(?)
A built-inmarkdown card with jinja templating.
So I can tell that my light is {{ states('light.bed_light') }}!
{% endraw %}
- !include floorplan.yaml {"title":"No lights"}
lovelace/floorplan.yaml
{% macro lamp(entity, x, y) -%}
{% if lamps %}
- type: state-icon
entity: {{ entity }}
{% else %}
- type: custom:gap-card
{% endif %}
style:
left: {{ x }}%
top: {{ y }}%
{%- endmacro %}
type: picture-elements
title: {{ title }}
image: https://placekitten.com/800/600
elements:
{{ lamp('light.bed_light', 25, 25) }}
{{ lamp('light.kitchen_lights', 50, 25) }}
{{ lamp('light.ceiling_lights', 50, 50) }}