thomasloven / hass-lovelace_gen

🔹 Improve the lovelace yaml parser for Home Assistant
MIT License
218 stars 22 forks source link

Unable to get lovelace_gen working #46

Open codemunkie15 opened 1 year ago

codemunkie15 commented 1 year ago

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

dracon80 commented 1 year ago

I'm having the same issues as this.

dracon80 commented 1 year ago

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

klatka commented 11 months ago

Use a space #lovelace_gen -> # lovelace_gen

doc62 commented 4 months ago

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

codemunkie15 commented 4 months ago

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

doc62 commented 3 months ago

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