hass-lovelace_gen icon indicating copy to clipboard operation
hass-lovelace_gen copied to clipboard

Unable to get lovelace_gen working

Open codemunkie15 opened this issue 2 years ago • 6 comments

Hi

I am struggling to get this working on my Home Assistant instance. Any idea what is wrong please?

configuration.yaml configuration yaml

main-dashboard.yaml main-dashboard yaml

Dashboard renderer Error on dashboard renderer

Home Assistant 2023.2.5 Supervisor 2023.01.1 Operating System 9.5 Frontend 20230202.0 - latest

Thanks

codemunkie15 avatar Feb 21 '23 17:02 codemunkie15

I'm having the same issues as this.

dracon80 avatar Feb 23 '23 08:02 dracon80

@codemunkie15 did you make any progress on this at all?

dracon80 avatar Feb 25 '23 08:02 dracon80

Use a space #lovelace_gen -> # lovelace_gen

klatka avatar Oct 14 '23 22:10 klatka

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

doc62 avatar May 19 '24 15:05 doc62

I never did get it working. I'm just using decluttering cards and auto-entities cards as a bit of a workaround.

codemunkie15 avatar May 19 '24 19:05 codemunkie15

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}}"

doc62 avatar Jun 16 '24 11:06 doc62