Closed yomotherboard closed 3 years ago
No, entities are static actually no, you should be able to use templates here, I forgot I added that 😂
Have you tried putting that variable as the text of something to verify it is returning what you expect?
Closing with no response
Sorry I thought I would get notifications for responses but I guess I was only getting email. I guess I need to look into github notification settings.
So this is where I've gotten with this, using auto-entities
- type: custom:auto-entities
card:
type: custom:fold-entity-row
head:
type: section
label: Motion
filter:
template: |
[
{% if states('input_boolean.motion_lights_' ~ (states('input_select.room') | lower | regex_replace(' ','_'))) != "unknown" %}
{{ ('input_boolean.motion_lights_' ~ (states('input_select.room') | lower | regex_replace(' ','_'))) | tojson }},
{% endif %}
{% if states('input_number.sleep_after_' ~ (states('input_select.room') | lower | regex_replace(' ','_'))) != "unknown" %}
{{ ('input_number.sleep_after_' ~ (states('input_select.room') | lower | regex_replace(' ','_'))) | tojson }},
{% endif %}
]
- type: custom:auto-entities
card:
type: custom:fold-entity-row
head:
type: section
label: Natural Lighting
filter:
template: |
[
{% if states('switch.adaptive_lighting_' ~ (states('input_select.room') | lower | regex_replace(' ','_'))) != "unknown" %}
{{ ('switch.adaptive_lighting_' ~ (states('input_select.room') | lower | regex_replace(' ','_'))) | tojson }},
{% endif %}
{% if states('switch.adaptive_lighting_' ~ (states('input_select.room') | lower | regex_replace(' ','_'))) == "on" %}
{{ ('switch.adaptive_lighting_adapt_color_' ~ (states('input_select.room') | lower | regex_replace(' ','_'))) | tojson }},
{{ ('switch.adaptive_lighting_adapt_brightness_' ~ (states('input_select.room') | lower | regex_replace(' ','_'))) | tojson }},
{{ ('switch.adaptive_lighting_sleep_mode_' ~ (states('input_select.room') | lower | regex_replace(' ','_'))) | tojson }},
{% endif %}
]
My current solution with auto-entities
is not ideal and I do think the config-template-card would probably be the way to solve this problem. I am trying to figure out a way to display settings for others on my home assistant instance. I would like to allow others set settings by room or by behavior, but the way they are displayed must be changed depending on which method is being used to configure the settings.
This has given me a good way to configure settings by room, but it relies on setting the friendly_name
the any input_booleans for settings to the display name I would like them to have in the UI. The problem with this is that if I would like to allow configuration by behavior instead of by room, I cannot change the friendly_name
to the necessary display name without creating a naming problem for the UI of the room-based configuration of settings.
For example, input_boolean.motion_lighting_living_room
(used to toggle motion activated lighting for the living room) would need to be displayed as "Living Room" if it is being set on a behavior basis (Settings -> Behavior -> Motion Activated Lights -> Living Room). But the name should be "Motion Activation" if the setting is being set on a room by room basis (Settings -> Room -> Living Room -> Motion Activated Lights).
Thank you to all for the great card! I have used this card for a couple things successfully but I haven't been able to dynamically change which entities are displayed. Is it possible to change the entity/entities displayed using a template or variables? Here is my attempt:
I don't get any errors, but I also don't get any output. I am trying to make a settings page for a couple rooms.