appdaemon
appdaemon copied to clipboard
Feature Request: Conditional Card / Layout
I'd love to add some flexibility to my dashboards and change parts of a dashboard based on conditions. So you could show buttons for window shades when the sun is bright and buttons for lights when there's no sun. Or show some traffic sensors before work in the morning and the media player card when you're back home in the evening (there are endless more options, but I think you get the point). At the moment the only solution is to switch between several similar dashboards, which works if you only have one condition, but get's really complicated if you want to use multiple conditions for different parts of the dashboard.
I could think of two solutions:
- Conditional cards:
my_conditional_card:
widget_type: conditional
condition:
- condition: state
entity_id: device_tracker.paulus
state: 'home'
card:
light_level:
widget_type: sensor
title: Light Level
units: "lux"
precision: 0
shorten: 1
entity: sensor.side_multisensor_luminance_25_3
- condition: state
entity_id: device_tracker.paulus
state: 'not_home'
card:
porch_motion:
widget_type: binary_sensor
title: Porch
entity: binary_sensor.porch_multisensor_sensor_27_0
fallback: #optional
light_sensor:
widget_type: binary_sensor
title: Test
entity: binary_sensor.test
- Conditional layouts:
layout:
- light.hall, light.living_room, input_boolean.heating
- condition:
- condition: state
entity_id: device_tracker.paulus
state: 'home'
layout: media_player(2x1), sensor.temperature
The code structure is nothing near good, but is just to roughly sketch my idea ;)
By the way: I'd prefer the conditional card, because I think it's more flexible and easier to understand - the layout can cause quite a headache sometimes (when you use different card sizes and spacers) and with conditions i think gets worse. The advantage of the conditional layout is, that you can use your existing cards.
Nico
New idea: Another solution could be a conditional card with a reference to an existing card:
my_conditional_card:
widget_type: conditional
condition:
- condition: state
entity_id: device_tracker.paulus
state: 'home'
card: light_level
- condition: state
entity_id: device_tracker.paulus
state: 'not_home'
card: porch_motion
light_level:
widget_type: sensor
title: Light Level
units: "lux"
precision: 0
shorten: 1
entity: sensor.side_multisensor_luminance_25_3
porch_motion:
widget_type: binary_sensor
title: Porch
entity: binary_sensor.porch_multisensor_sensor_27_0
I think this is my new favorite, because it's clear and easy to understand - and you can use your existing cards.
But I don't know if it's realizable ;)
Nico
I like idea #2 :)
I think this would be a good addition, I'll add it to the feature backlog.
@noxhirsch things like that will be possible when we start to change the dashboard, but that can take a while. at this moment its only possible by creating a custom widget for it. allthough conditional cards are not really realistic, because it would the need to create 2(or more) widgets and hide all but 1 based on the state.
conditional layout is absolut there in the future (its already somewhat there in the icon widget, so you can use that for device trackers, sensors, etc.)