Show two entities of the same device based on a value of one of those entities

Just checking if the following is possible:

Consider a device that has:

  • a boolean entity that shows whether a firmware update for the device is available
  • a button entity for OTA update

Is it possible in Lovelace to have an overview of all devices for which a firmware update is available, with next to it the button entity that can be pressed to execute the OTA update?

This is a template sensor or possibly a group depending on your outputs.

Most of the button cards in Lovelace can easily do this. As long as you have a script that can perform the action you want.
Make sure your script or automation works properly and how to refer to it as a service call, then just set the tap-action for the button. Whether its actually possible to OTA depends on how the device is connected and what integration controls it.

Thanks @NathanCu.

I have an overview of devices for which a firmware update is available through the auto-entities card (via HACS). Could you give me directions on how to add the button entities next to the ones for which an update is available. The button entities are already created through the integration

1 Like

I can’t do the whole thing but I will give you an example of something I do that’s very similar.

I try to condense all states in my home down to quick glance buttons - color/state, motion all combines such that if something is not blue or green and / or it’s blinking - it needs attention.

One such are my exterior locks (all Schlage Zwave on ZWJS2MQTT). First I made them into a group called All Locks (this is important because it creates an entity that contains all my locks AND I can use the group in place of a single lock for service calls (this becomes important later)

groups.yaml:

all_locks:
  name: All Locks
  icon: mdi:lock
  entities:
    - lock.front_door
    - lock.back_door
    - lock.garage_entry_door
  all: true

Now I have one ‘lock’ that will show as open if ANY of my locks are open.

Install custom:button-card from HACS custom-cards/button-card: :sparkle: Lovelace button-card for home assistant (github.com)

now this will work:
Lovelace, new card:

type: custom:button-card
entity: group.all_locks
name: Locks
tap_action:
  action: call-service
  service: lock.lock
  service_data:
    entity_id: entity
state:
  - value: unlocked
    color: Gold
    icon: mdi:lock-open
  - value: locked
    color: Green
    icon: mdi:lock

So the button will show the state of ‘All Locks’ and when you press it, it will issue a lock.lock call service command with the group as the target - locking any open locks. I believe (someone check that?) You could also template the tap-action command on button-card and change the service call to lock.unlock if the locks are all closed. (I haven’t started building my more advance service call actions yet, I’m still working on data consolidation and display first.)

Ends up looking something like this:
image

That weather icon is telling me there’s an active warning (it’s a freeze warning, we’re in Texas we don’t like cold 'round here… If it were a ‘watch’ it would be orange, info - blue), All doors, windows, and shades are closed, smoke and CO are clear, I have no leaks, no active water flow and the water main (on a controlled valve) is turned on. I also know at least one lock is open, the garage is closed, security is disarmed, it’s not a ‘vacation day’ as far as my system is concerned (because I forgot to put New Year’s Day it in the calendar), everyone is home, not in guest mode (prevents auto away), and finally not in entertainment mode (prevents the system from doing auto locking and stuff at night - freaks the guests out.) Oh, and nobody in my home is red/green colorblind so yes I’m choosing those colors. :slight_smile:

This is an awesome setup, Nathan. I quickly skimmed it and looked well thought through. Will have a look later today to see how I can use this for my instance

1 Like