rianadon / timer-bar-card

A progress bar display for Home Assistant timers
Other
340 stars 15 forks source link

Combine Entitiy and timer #142

Open StefanDorschu opened 3 months ago

StefanDorschu commented 3 months ago

I do have some lights which (of course) can be controlled manually but are also controlled by a motion sensor.

What i would like to have is the following addition.

Based on your second "mushroomstyle" - example (the green one)

type: custom:timer-bar-card entity: switch.my_switch duration: fixed: '00:10:00' invert: true bar_direction: rtl bar_width: 60% mushroom: layout: vertical color: green

Instead of having a fixed duration when the entity is turned on i would like to show the remaining time of a timer that is running (which belongs to that light). The timer is not controlled by this card but only showing when active.

Is that possible?

Best regards,

Stefan

rianadon commented 3 months ago

Hi! Would you be able to use the timer as your entity? It's possible to edit the tap_action to show the popup for your switch when tapping the card, but doing so requires the browser mod addon.

The alternative is to set the duration from the timer itself (duration: { entity: 'timer.my_timer', attribute: 'remaining' }), but the start time is going to be computed as the last time the switch was toggled. Starting a timer countdown then toggling the switch on and off would reset the timer in the card. For your use case that may or may not be a problem.

Hope that helps!

StefanDorschu commented 3 months ago

Hi! Thank you for your quick reply. Your second idea seems to work. But using the mushroom-style-cards i am not able to activate the tap_action for the entity. Should that be possible?

Stefan

rianadon commented 3 months ago

This could be a bug, but I'm pretty sure tap_action should work for mushroom cards since it uses the same logic.

If you are using browser mod to trigger the popup card, double check your tap action is like this:


tap_action:
  action: call-service
  service: browser_mod.more_info
  data:
    entity: switch.my_switch