Hey Everyone,
I would like help in being able to hide 3 buttons when a switch is on, below is a screengrab of what i have.
The Shutdown, Hibernate and Restart buttons are all useless if my PC is already off so i’d like to hide these when the switch (ryzen at the top) is off
This is currently a vertical stack card and the a horizontal stack card for the buttons if that matters.
Thanks
tom_l
January 14, 2022, 12:29pm
2
You could use conditional cards, or even better:
Ever wanted a lovelace card that’s only shown for certain users?
Ever wanted to show a certain lovelace card in one spot if the door is open, and another one otherwise?
Ever wanted to be able to swap out a part of your layout when you press a button?
Ever wanted to do that only on one device, and not on all of them at once?
Ever wanted to show different cards depending on the size of your window, or on wheter you’re viewing it on a touch enabled device or not?
[image]
[image]
State-sw…
@DTMHibbert did you find a suitable solution for this?
Also curious what you’re running to get the button/how it was made. It looks awesome and I’d like to integrate something like that to control some VMs I have.
Hey,
Yep, i settled with the conditional card, little tricky to setup i was a noob with YAML back then im a bit better now.
hopefully my code below will help.
type: vertical-stack
cards:
- type: entities
entities:
- entity: switch.ryzen
- entity: sensor.ryzen3900x_cpu_usage
name: CPU Usage
- entity: sensor.ryzen3900x_memory_usage
name: RAM Usage
- entity: sensor.ryzen3900x_storage_c_usage
name: C:/ Drive Usage
- entity: sensor.ryzen3900x_storage_f_usage
name: F:/ Drive Usage
- entity: sensor.ryzen3900x_system_uptime
name: Uptime
- entity: sensor.ryzen3900x_system_idle_time
name: Idle Time
title: Ryzen
- type: conditional
conditions:
- entity: switch.ryzen
state: 'on'
card:
type: horizontal-stack
cards:
- type: button
entity: script.shutdown
name: Shutdown
icon: ios:poweroff
tap_action:
action: call-service
service: script.shutdown
service_data: {}
target: {}
- type: button
entity: script.hibernate
name: Hibernate
icon: ios:sleep
tap_action:
action: call-service
service: script.hibernate
service_data: {}
target: {}
- type: button
entity: script.restart
name: Restart
show_state: false
show_icon: true
icon: ios:restart
tap_action:
action: call-service
service: script.restart
service_data: {}
target: {}
Let me know if you have any problems.
Thanks