Stacks
I tried with anchors and tried with different cards, but same result. Is there a way to avoid this overwrite?
I am trying to display more entities on a page when I am on laptop and show limited number of entities when I use HA on mobile.
Did you try a stack card?
Ah! Thank you for the tip. I used âstack-in-cardâ and it worked.
'c5cfe6f8-e92c2008':
type: custom:stack-in-card
title: Testing State Switch
mode: vertical
keep:
background : true
cards:
- type: markdown
<<: *mark_anchor2
- type: light
entity: light.hallway_bulb
- type: markdown
<<: *mark_anchor1
- type: markdown
content: >
NewLaptop2
Love the card, thanks again for all these.
not sure if this is possible.
I have a dropdown, which has 3 options
Office, Living Room, Kitchen.
input_select:
room_temp_display:
name: Display Room Temp Info
options:
- Office
- Living
- Kitchen
initial: Jamie
I want to âlinkâ these values, to an âaverage"sensor:
So " âAverage Temp - Living Roomââ linked to the drop down âLivingâ
and âAverage Temp - Jamie Officeâ linked to âofficeâ
## HACS: https://github.com/Limych/ha-average
- platform: average
name: 'Average Temp - Living Room'
entities:
- sensor.living_room_button_st
- sensor.living_room_window_st_dz_temp
- sensor.living_room_temperature_tracker
- platform: average
name: 'Average Temp - Jamie Office'
entities:
- sensor.jamie_office_motion_hue_dz
- sensor.jamie_office_door_st_dz
- sensor.jamie_office_temperature_tracker
Then, with the values, i want to use that for the graph card:
color_thresholds:
- color: '#f39c12'
value: 20
- color: '#d35400'
value: 25
- color: '#c0392b'
value: 30
entities:
- sensor.average_temp_jamie_office
hours_to_show: 168
name: Jamie Office Average Temp - Past Week
show:
average: true
extrema: true
labels: true
type: 'custom:mini-graph-card'
is it possible to somehow link what you selected in the âinput selectâ to the entity used for the graph card.
or do i need to just copy and paste the graph code (15x) for each room in the house?
seems like a load to load up, if thats the case
type: vertical-stack
cards:
- type: entities
title: Select Room
entities:
- entity: input_select.room_temp_display
- type: 'custom:state-switch'
entity: input_select.room_temp_display
states:
Jamie:
color_thresholds:
- color: '#f39c12'
value: 20
- color: '#d35400'
value: 25
- color: '#c0392b'
value: 30
entities:
- sensor.average_temp_jamie_office
hours_to_show: 168
name: Jamie Office Average Temp - Past Week
show:
average: true
extrema: true
labels: true
type: 'custom:mini-graph-card'
Living:
type: glance
title: Lights
entities:
- light.livingroom_all
Thanks! if i have 15 rooms, i would need to have all 15 graphs coded in, then the template would pick which one to call?
Sorry, I didnât read your question closely enough.
You will need one graph card for each graph, but you can probably make heavy use of node anchors to keep the line count down (in yaml mode).
nice! thanks for the quick reply. Just trying to see if i can get it working via the other card suggested first, if not, will try this!
any luck figuring out whatâs going on here?
trying my luck with state-switch, to display a button depending on which Lovelace dashboard I am on. Closest I could find in the current available options would be a css media rule using the media query parameter, but dont think I can create a template using
window.location.pathname
?
this would be awesome if possible:
and allow for some nifty display tricks.
Anyone can help me realize this? If not possible in the current available options, Thomas, would this be something you could and would add?
considered using the template option, but donât think the window.location.pathname
is available in Jinja?
like this (and yes I know this isnât correct, but I hope it illustrates what I am after):
type: custom:state-switch
entity: template
template: "{% if window.location.pathname == '/ui-settings/time_settings' %} day {% else %} night {% endif %}"
states:
day:
type: markdown
content: Where do you want to go today?
night:
type: markdown
content: Sleep tight!
thanks for considering
edit
been able to do this in custom:button-card with below code:
- type: custom:button-card
template: button_shortcut_menu
icon: >
[[[ return (window.location.pathname.split('/')[1] == 'ui-settings')
? 'mdi:remote-desktop' : 'mdi:flash'; ]]]
tap_action:
action: navigate
navigation_path: >
[[[ return (window.location.pathname.split('/')[1] == 'ui-settings')
? '/ui-settings/developer' : '/ui-data/home_energy'; ]]]
variables:
path: >
[[[ return (window.location.pathname.split('/')[1] == 'ui-settings')
? 'developer' : 'home_energy'; ]]]
which is alright, but quite laborious. A state-switch could do this more efficiently?
found an issue, which I am not sure is a bug or a featureâŠ
showing a button-card based on the state of a binary_sensor, which is checking the state of a sensor, sensor.saver_trash_today, see the âoffâ conditioned card, being none or not. If not, (the sensor exists) it should show the button, using the sensor for entity.
If indeed none, and the binary_sensor (problem) is on, it should show a button card with a entity_picture. translates to:
type: custom:state-switch
entity: binary_sensor.saver_offline
states:
'on':
type: custom:button-card
aspect_ratio: 1/1
show_entity_picture: true
entity_picture: /local/afvalwijzer/kringloop.png
hold_action:
action: navigate
navigation_path: tijd_agenda
'off':
type: custom:button-card
entity: sensor.saver_trash_today
aspect_ratio: 1/1
show_icon: false
show_name: false
show_label: true
tap_action:
action: more-info
hold_action:
action: navigate
navigation_path: tijd_agenda
etc etc etc
however, this is in the inspector:
button-card.js?v=3.3.6:1643 ButtonCardJSTemplateError: TypeError: Cannot read property 'state' of undefined in 'if (states['sensor.saver_trash_tomorrow'].state == 'Geen') return `url("${entity.attributes.entity...'
at HTMLElement.eval (eval at _evalTemplate
which seems to indicate, the state_switch doesnât prevent the button (that shouldnât be displayed) from being considered by the system.
Is this to be expected? I would have thought, the binary being âonâ, it state_switch would only make the âonâ card to be considered
thanks for having a look
Hi, can someone help me build a simple setup please?, I completely donât understand how to do it. All I need is 4 buttons at the top and each of them will open a new card with entities, lights etc. It will be nice to have some effect as well.
Hi,
Looking to do something similar but without going the button-card route. Did anybody manage something like this?
like what?
Sorry for the confusion. Iâm looking to display content (in my case an image element on a picture-elements card) based on the navigation_path or window.location.pathname.
not really sure what you are trying to do with the day and night here, but I donât think the window.location.pathname is available to jinja templates (which is serverside backend). It is used in the javascript templates, and really a browser side frontend thing.
Unless state-switch has access to the path in one way or another, this wont go. You might be able to try the #hash option:
but I havent tried that myself yet.
Thanks for the work on this. I needed to disable buttons for an irrigation process for about 10 seconds and this worked out perfect.
Have you read through the readme and attempted to put together any code?