Conditional card - show when state is "equal or more than" or "equal or less than" number (displays a warning for lock with low batteries for example)

I want Lovelace to display a conditional card telling me that the lock’s battery is in critical condition, so I know to buy more batteries and replace it soon before I get locked out - It is a Yale Conexis L1 so there is no mechanical override (there is a 9V override but this is not easy to get locally and I won’t keep one outside since there is no place to store it (it’s a townhouse so the door opens straight onto the sidewalk).

I am using the lock entity for this, the lock integration has created a battery sensor, so I used it. The state is from 0 to 100, and it’s a percentage of charge remaining.

I want to set the message to appear at any percentage below 20, but there is no simple way of doing this using the default conditional card. I believe it would be extremely useful in use cases like mine, and hopefully something easy to implement. I would do it myself however I have no clue how to program. Please vote if you’d find this useful and thanks in advance to whoever makes the implementation.

Bump please vote y’all, this can be useful in so many ways :heart:

Unfortunately nobody really cared to make this work so I created a binary sensor that is ON when the lock battery entity has a value of less than 30, I then used the binary sensor in the conditional card to show up when the value is ON. Works perfectly, but very cumbersome. I still wish that HA developers would tweak the card to be easier for people who can’t do something “custom” like I did.

4 Likes

@anon78847916 - sorry for the complete Newbie question, but how would I add a Binary Sensor? This page describes how to configure it, but not how to install it.

Many thanks!

You create it in configuration.yaml… you can use the template editor in dev tools on the sidebar to test it.
Once the sensor is created it will be ON or OFF depending on the value you specify for the battery level, in my example my template was created so the binary sensor is ON when the battery level from the relevant entity is less than 10%, or OFF when it is above. So on the conditional card, I set it to show the card if the binary sensor is ON. You don’t “install” it, it’s just a manually created sensor on configuration.yaml that reads the value of another entity (in this case the battery percentage that comes from your lock or whatever device it is) and turns that into ON or OFF depending on the condition you’ve set in the value template. It will show as an entity for you to use. Here’s information on templates:

This is how I set mine on configuration.yaml:

binary_sensor:
  - platform: template
    sensors:
      low_front_door_lock_battery:
        friendly_name: "Front Door Lock Low Battery Warning"
        value_template: "{{ states('sensor.front_door_lock_battery_level')|float < 10 }}"

Note that sensor.front_door_lock_battery_level is an entity created by my lock and shows the level as a number, my template is telling it to read the state from the lock and if the value is less than 10 it shows ON, otherwise OFF.

1 Like

Yeah. The conditional-card should really support the same condition syntax as the entity-filter card.

@anon78847916 @esbenr But how do you prevent the conditional cards from turning on or off all the time when transitioning values? I guess it’s fine a for something that doesn’t change state often, but i’m using it here to monitor when my washing machine is on or off, and that (measuring current) changes every 2 minutes.

Is there a way to either not update the conditional card so often or maybe for the template sensor to do that?

Thanks!