Repository navigation
Replies: 2 comments 2 replies
|
Thanks for this, it's a good one. You can mostly do it already with the optional marker. Put a features:
- type: '[[light_type?]]'leaves you with Until that changes, you can get there by passing the whole block as the variable: decluttering_templates:
room_light:
card:
type: tile
entity: '[[light]]'
name: '[[room]]'
features: '[[features?]]'- type: custom:decluttering-card-plus
template: room_light
variables:
- light: light.living_room
- room: Living Room
- features:
- type: toggle
- type: custom:decluttering-card-plus
template: room_light
variables:
- light: light.garage
- room: GarageThe garage card ends up with no That's a bit more typing than you were after, so I've fixed the underlying problem. Once that's released, a block that's left empty after its optional placeholders drop out gets removed as well, all the way up. Your first example then works pretty much as you wrote it, with no new syntax: features:
- type: '[[light_type?]]'Set The partial-template idea (dropping a chunk of one template into another) is interesting, but it's a much bigger change, so I'll leave it to think about for now. |
|
I saw this show up in v1.12, THANKS! few implementation questions.. (these aren't to imply that it's a problem if you cant do these, I'm only trying to make sure I understand the scope of the implementation). I appreciate this getting in at all!
is this only looking for the specific string "yes"? or is it looking for a bool? or something that could be made into a bool? in other words,
can I also do something like: [[variable|if:other|or:backup_var|or:fallback_var|default:final string]] with the assumtion of:
[[variable|or:backup_var|if:test_var]] with the assumption of:
so,
Thanks! Dan |
Uh oh!
There was an error while loading. Please reload this page.
To have an option to include a block in a config, if another value matches a condition. (is not empty?)
For example.
So, in the living room card, where light type is defined, there would be a features block, and the garage card would not have the features block at all. (honestly, I don't know if that card would work without a features block, but the example is for the concept only. ).
or, perhaps have a template that could be used as -part- of a larger template, so, for example:
Which might allow even more options for flexibility.
All reactions