Hello.
Iam a new hassio user (since yesterday), very excited and very overwellmed by the amount of info i have to absorb. But during the past 24 hours, with lots of reading i managed to install, configure and set up basic functions of my hassio and tplink bulb (LB100) and tplink switch (HS110) having no prior knowledge or experience.
So now let me get down to it…
I managed to group my tplink hs100 switch AND his energy sensors (following the instructions) into one card but i want to make the energy sensors visible only when i turn the switch on.
At the moment the switch and the energy sensors are always visible in the card.
How do i do that? With if statements?
There is card for that. The most notable part is at the bottom. The state_filter will only show based on the state entered. In my case and probably what you want is to use ‘on’.
- card:
show_header_toggle: false
title: Lights That Are On
entities:
- entity: binary_sensor.garage_door
icon: 'mdi:garage'
name: Garage Door
- entity: light.bed_light
name: Bed
- entity: switch.outside_light
icon: 'mdi:lightbulb'
name: Outside Light
- entity: switch.hallway_light
icon: 'mdi:lightbulb'
name: Front Hall
- entity: switch.upstairs_light
icon: 'mdi:lightbulb'
name: Up Stairs Light
- entity: switch.kitchen_main_light
icon: 'mdi:lightbulb'
name: Kitchen Main Lignt
- entity: switch.kitchen_pot_light
icon: 'mdi:lightbulb'
name: Kitchen Pot Lights
- entity: switch.kitchen_table_light
icon: 'mdi:lightbulb'
name: Kitchen Table Light
- entity: light.07200106b4e62d281541
name: Basement 1
- entity: light.07200106bcddc2ef64c3
name: Basement 2
- entity: light.07200106b4e62d284ceb
name: Piano Light
- entity: light.07200106dc4f22396d5e
name: Family Room
state_filter:
- 'on'
type: entity-filter
@sleeepy2 This is incorrect. What OP wants is hide a couple of sensors when switch is off. What you present here is; group a couple of devices and only show them if individual state is on.
thank you for the reply
but at this stage i’d prefer a native way of solving this so i can understand better the hassio language
rather than having to learn extra dependant techniques.
first condition show’s everything when its switched on
second condition show’s only the things i want
which is great BUT
it creates two cards, when i hide the first card, it doesnt free up the space in the DOM therefore the second card appears right next to the invisible card… which makes it weird. As if the card moves on the right messing the alignment up
you need to enter the card in the “resources:” section of your Lovelace config.
I use the yaml mode but I know you can enter it in the GUI editor by manually editing the raw file. I’ve been told to “click the three dots in the top right. then click the three dots in there and click edit raw file” or something like that.
The only other things are just to make sure you copied the file over correctly (copy & paste the “raw” file contents), restart HA and then do a refresh of your browser (ctrl-F5).