hass-lovelace_gen
hass-lovelace_gen copied to clipboard
Unable to get lovelace_gen working
Hi
I am struggling to get this working on my Home Assistant instance. Any idea what is wrong please?
configuration.yaml
main-dashboard.yaml
Dashboard renderer
Home Assistant 2023.2.5 Supervisor 2023.01.1 Operating System 9.5 Frontend 20230202.0 - latest
Thanks
I'm having the same issues as this.
@codemunkie15 did you make any progress on this at all?
Use a space #lovelace_gen
-> # lovelace_gen
Hi, I'm trying to use lovelace_gen but I get the same errors as @codemunkie15 in his first post.
Even with the space after the dash:
# lovelace_gen
I never did get it working. I'm just using decluttering cards and auto-entities cards as a bit of a workaround.
In my case I got it working preceding Jinja2 code with # Pretty weird but it works!
example of card:
# lovelace_gen
# arguments: 'room','timeslot','field'
#{% set ent = 'sensor.schedule_riscaldamento_view_'+room %}
type: custom:button-card
entity: "{{ ent }}"
show_name: false
show_icon: false
show_state: false
show_label: true
label: >
[[[
const timeslot = {{ timeslot }};
const fld = "{{ fld }}";
const attributeName = ${fld}${timeslot};
const value = entity.attributes[attributeName];
if (!isNaN(value)) {
// Format the value to always show one decimal place
return parseFloat(value).toFixed(1);
} else {
return value;
}
]]]
styles:
state:
- color: rgb(255,255,255)
card:
- height: 50px
- width: 60px
- border: none
grid:
- background-color: rgb(3,169,244)
tap_action:
action: call-service
service: script.initialize_ts_mod
data:
room: "{{room}}"
ts: "{{timeslot}}"