Add readme
This commit is contained in:
parent
90e8b312ac
commit
6765c9510f
78
README.md
Normal file
78
README.md
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
# lovelace_gen
|
||||||
|
|
||||||
|
`configuration.yaml`
|
||||||
|
```yaml
|
||||||
|
lovelace_gen:
|
||||||
|
```
|
||||||
|
|
||||||
|
Regenerate by using the "Refresh" function in lovelace.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## Example
|
||||||
|
`ui_lovelace.yaml`
|
||||||
|
```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`
|
||||||
|
```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`
|
||||||
|
```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) }}
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user