Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to get lovelace_gen working #46

Open
codemunkie15 opened this issue Feb 21, 2023 · 6 comments
Open

Unable to get lovelace_gen working #46

codemunkie15 opened this issue Feb 21, 2023 · 6 comments

Comments

@codemunkie15
Copy link

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
Copy link

I'm having the same issues as this.

@dracon80
Copy link

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

@klatka
Copy link

klatka commented Oct 14, 2023

Use a space #lovelace_gen -> # lovelace_gen

@doc62
Copy link

doc62 commented May 19, 2024

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
Copy link
Author

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

@doc62
Copy link

doc62 commented Jun 16, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants