#My custom garage card

1 messages Β· Page 1 of 1 (latest)

dull grove
#

@fleet pine As asked πŸ˜‰

fleet pine
#

Totally missed the ping. πŸ€·β€β™‚οΈ

#

We'll start with this code. https://pastebin.com/8wPXDeyc
In this example, I used a single helper input_boolean entity called input_boolean.tester to simulate being able to interact with the card such as showing states, etc. It is used as the garage door sensor, the automation toggle, and the garage light.
There's some state: usage to show how to get it to look a certain way based on the entity's state.
The extra cards are contained in special_fields. There's a section for the code to make the button and then a section in styles: that allows some styling from outside the card. Using custom:button-cards, they'll have their own "internal" styling just like any other card.
Positioning is done using absolute but grid could be another option. This is just something that I threw together (relatively) quickly.
The 25%/50% buttons can take a command for a tap_action to call the script to open the garage door appropriately. The timer card (0:00) is just a mock-up and doesn't do anything. Yet.

dull grove
#

Hello, thanks I finally fot some time to work on HA. I ll try that now πŸ™‚

#

What is working:
the Auto OFF/ON
25% / 50%
Open /Close light
Open/ Close the door

The Garage status can be improve with a display of multiple status : Open/ Close/ Opening/ Closing => I ll try to fix that

The timer isn't working (and I found out on my other card that I got a 1 sec synch issue for unknow reason blocking the action.

The door position can be display

I ll try to fix some of this issue right now, I want to thank you again because you show me stuff I didn't thought was possible and I ll surely inspire myself of this card for other custom card

#

Not the best icon but I didn't found a garage opening door

dull grove
#

.. countdown: conditions: - entity: automation.garage_auto_close state: 'on' card: type: custom:timer-bar-card show_icon: false show_name: false show_label: true entities: - entity: timer.garage_auto_close_timer

fleet pine
#

I have something special for the timer. I'll post it this evening. It will need card_mod to work.
I have another idea for the opening/ closing that I think you'll like and it doesn't use an icon.

dull grove
#

ah ?

fleet pine
#

I modded an entities card to only show the remaining time when it is counting down. Combined with a state, it disappears when not counting.

dull grove
#

The thing is my old card has a synch issue, I don't know if this bug is for every card

fleet pine
#

The entities card is special in that it is not limited to how other cards update. Cards only update every so often. Like 30 or 60 seconds sometimes.

dull grove
#

the delay is less than a second, it can come from card rendering ?

#

Any idea to ignore the warning, I mean I m ok with 1 sec delay of a 2 minutes timer I m less ok if my garage door stay open because HA doesn't like the 1 sec inconsistencies xD

fleet pine
#

What do you mean? Like a notification that the timer is almost finished?

#

For the timer countdown, do you want a number or use the timer-bar-card? I can show you how to embed to so it is just the bar at the bottom of the card which looks pretty good.

dull grove
#

I trust in your idea, you have more taste than me

fleet pine
#

If you would, post your version of the code somewhere. I have another idea that will make collaboration a bit easier.

fleet pine
dull grove
#

oh the timer is not on this card yet

#

but on this one

conditions:
  - entity: automation.garage_auto_close
    state: 'on'
card:
  type: custom:timer-bar-card
  entities:
    - entity: timer.garage_auto_close_timer
fleet pine
#

Here's the next revision. https://pastebin.com/KrGPYgLe
I changed my code to match your code in regards to states, colors, tap_actions, etc.

  • Added variables section. (You should only have to make changes here and the rest of the code references the variables.)
  • Removed countdown custom_field.
  • Added timer-bar-card and incorporated it to show at the bottom of the card when the timer is running.
  • When open, the label shows Open if fully open; otherwise it shows the percentage that the door is open.
  • Incorporated your icons for opening/closing but now the label flashes.
    *Note: I think there is a bug when using the 25%/50% buttons. It uses the cover.set_cover_position service. The state, however, does not change while the door is moving. Click the icon, the state does change to opening/closing. *
#

Your variables section should look like this: ```yaml
variables:
garage_door_entity: cover.garage_door_garage_door
garage_light_entity: switch.garage_door_garage_door_light
garage_automation_entity: automation.garage_auto_close
garage_timer_entity: timer.garage_auto_close_timer

dull grove
#

thanks, I ll update it after works

dull grove
#

Hello, sorry for being late, it was a very long day. I'm staying up late to try out your work. It looks great, the card is working perfectly. I just need to fix my auto open/close automation, but it's late, so I'll do that tomorrow (or this morning because it's already late, haha).

I've integrated my garage camera into Home Assistant. I thought it would be more complex, but it only took a few minutes. Do you think it would be too heavy to show the camera feed on the card? I'm considering showing the feed when the door is open, or maybe when I click on a button inside the card.

Honestly, you have a lot of skills. I'm pretty sure your dashboard is amazing! ^^ I'll definitely rethink all my home cards in the coming weeks/months.

#

bro, you ve got a lot of skill, I m pretty sure your dashboard is amazing ^^

dull grove
#

I m adding a "dry floor button" (when we clean with water it take time to dry the floor)
And set specific time for each action

Dry mode: 30 minutes, position 6 (5 or less doesn't trigger the gate)
25% "mode will be a get the car charging cable mode" so it will be 1a and half minutes, position 25
50% will be 2 minutes, position 50
main button will be 100% and 5 minutes

To do that I ll use a script to run both action in same time, this script is useful cause It can be reuse using HA actoion in my car or a with a remote.
The auto on will bypass the time property send in the script

Here is a draft version of the card, the script and automation:

the card :
https://pastebin.com/pifwrsaF

The script:
https://pastebin.com/KQq6GASD

Auto close automation on timer event finished:
https://pastebin.com/KPQcLpqm

Auto close toggle when switched on/off
https://pastebin.com/DJQMwqx9

#

My current spotted issue

The timer continue running when the gate is closed
I don't know how to trigger the script when I push on the main button

dull grove
dull grove
#

somehow I killed definitely the timer ^^’. I don’t understand why he doesn’t popup anymore

fleet pine
#

It looks like PasteBin is currently down so I can look at any of your links.

dull grove
#

@fleet pine It’s up on my side

fleet pine
#

Weird. Not working in Firefox but works in Chrome. (Internal server error.)

#

Got all your links open. So you have individual automations/scripts to handle the different aspects of accomplishing the task at handle? (Opening/closing/setting position of the garage door)

fleet pine
#

You might find it easier working with automations by incorporating trigger_ids (what event triggered) and choose actions based on the trigger_id. This is useful for being able to "combine" different aspects of an automation into a single automation entity. Here's one that I've made: https://github.com/dsellers1/home-assistant/tree/main/automations

dull grove
#

I ll try to grouped multiple automation script in one (but I want a bug free version first xD)

#

I ve see your hardware, I m slowly going to unifi too ^^
I ve 2 U6+ and I plan to have this setup in the future:

2X UI6+
2X G4 bullet camera
1X G4 Doorbell camera
1X CloudKey+
1X Lite 8 PoE or Ultra switch

#

Also why are you using a coral usb accelerator ? do you process video feed ?

fleet pine
#

The timer continue running when the gate is closed
For this, you need an automation event that does gate changes from open to closed with an action of timer.cancel.
I don't know how to trigger the script when I push on the main button
The opposite goes here. Gate from closed to open > timer.start.

#

Also why are you using a coral usb accelerator ? do you process video feed ?
I got it for video processing in Frigate NVR. Right now, it is just kinda sitting there not doing anything. I lost all my Docker containers in Unraid a while back and just haven't revisited Frigate. I just use cheap Wyze cameras (because I rent and cannot really install something more permanent). In the past, I had issues with getting the video into HA. Last weekend, I got that working again so I may have to check out Frigate again.

dull grove
#

The opposite goes here. Gate from closed to open > timer.start.

Sorry I don't understand

dull grove
fleet pine
#

You may want to add a from: open because on start-up, the sensor will more than likely go from unavailable to closed and inadvertantely trigger the automation. (Not a big deal, but just a minor tweak to prevent doing something that doesn't need to be done.)

dull grove
#

oh right

fleet pine
#

And, yet another trigger, when timer has elapsed, call the close garage door script.

#

This is where "putting the scripts" into the choose actions helps consolidate things.

#

Basically, you've already built some of the functionality into the scripts. Technically, the "open door script" doesn't need to start the timer if you have a "door closed > open" event.

#

Think of it like this, too. What if you open the door by hand or by the button in the garage? With the script, your timer won't start. But, as an event being triggered, it will.

fleet pine
dull grove
#

where I work, flat cost 800.000€, house nearly 2 millions ^^'
impossible to afford so I live cross the border.
Anyway it's not so bad to drive because my work has a lot of flexibility solution (border office, home base working, flexi schedule and possibility to go back earlier and finish work at home to avoid traffic jam)

#

I end up with 1h drive to go to work and driving kids to kindergarden and school before going to work

dull grove
#
alias: Start auto close timer
description: When garage gate is open start the timer
trigger:
  - platform: device
    device_id: 0e618781f8fe83a670cf719dcd8e6244
    domain: cover
    entity_id: e03a6332b2951e06fbf54640f46ebb49
    type: opened
condition: []
action:
  - service: timer.start
    metadata: {}
    data: {}
    target:
      entity_id: timer.garage_auto_close_timer
mode: single
#

Something like this ?

#

but should I use a default duration just in case ?

fleet pine
#

Add trigger > State```yaml
platform: state
entity_id:

  • cover.garage_door
    from: closed
    to: open```
    The timer entity itself should have a default time.
#

I'm not sure why they put the Device trigger at the beginning of the list. Most triggers should be handled by states.

dull grove
#

the workflow is closed -> opening* -> open
Could it be an issue ?

fleet pine
#

I wouldn't use the opening/closing states. Goes back to the "manually" what-if scenarios.

dull grove
#

but does triggers understand if we jump an intermediate state ?

fleet pine
#

Technically, you could set the even to use From: Closed and no To: and it will trigger on either opening or open states.

#

But, if you're wanting to catch the opening state, for example, it's only a couple of seconds before the open state triggers.

#

The opening state (IMO) should only be needed if something specific needs to happen during that time. (Like a buzzer or flashing light.)

dull grove
#

I understand that, I mean does the trigger is smart enough to ignore the intermediate state

#

for him the fourth state should be treated as equals

fleet pine
#

Oh! I totally just got what you're saying. I'm not sure. πŸ€”

#

That's a good question now that I realize what you're asking.

dull grove
#

because close -> open never happens (probably) there is always this opening state between

#

I could add 2 triggers :
close to open
close to opening

#

the gate open in 5 seconds so it doesn't matter

fleet pine
#

After some brief searching, I think the best approach would be: ```yaml
platform: state
entity_id:

  • cover.garage_door
    from: closed
    to:
  • open
  • opening```Note, you'll have to do this modification in YAML as the UI does not allow multiple states at the same time.
dull grove
#

Isn't in this automation that I need to manage the auto close on/off ?

fleet pine
#

You're using a helper entity to manage the auto close on/off, right?

dull grove
#

yes

fleet pine
#

Set that up as a condition.

dull grove
#
description: When garage gate is open start the timer
trigger:
  - platform: state
    entity_id:
      - cover.garage_door_garage_door
    from: closed
    to:
      - open
      - opening
condition:
  - condition: state
    entity_id: automation.handle_auto_close_garage_toggle
    state: "on"
action:
  - service: timer.start
    metadata: {}
    data: {}
    target:
      entity_id: timer.garage_auto_close_timer
mode: single
fleet pine
#

That looks correct to me.

dull grove
#

So I just need to remove the start from the script
But how do I set the duration then ?

fleet pine
#

This message is for the future and not relevant right now: When/if you go start migrating to using trigger_ids and choose blocks, that condition will need to be moved into the Choose Action as an IF statement.
Right now, your flow is trigger > check condtion > action.
Later, your flow will be trigger > (no condition) > Choose (based on trigger_id) > IF > action.

fleet pine
dull grove
#

maybe overcomplicated ^^'

#

first I ve tried to do 2 different service call in parallel but it was to complicated for something so trivial

fleet pine
#

This way that I do it is by using another helper entity. (input_number). I mainly use it so the value can be changed within the front-end and not having to hard-code a value.

service: timer.start
data:
  duration: >-
    {{ states.input_number.automation_auto_bathroom_lights_duration.state |
    int(0) * 60 }}
target:
  entity_id:
    - timer.automation_auto_bathroom_lights```
fleet pine
#

Ultimately, scripts or automations are the way to go for that.

dull grove
#

I m using 4 differents duration for the garage, maybe I can use 4 input_number* as default value and inject their duration to the main one when needed

fleet pine
#

Essentially. Easy ways to change settings without having to go into the app and go find the entity and change it there. For example, double-tapping this custom:button-card for a light enables/disables the automation helper. (Automatic is hidden when the helper entity is off.)

#

I wouldn't use 4 different input_number entities; just one will get the job done.
What's the purpose of 4 different timer durations? You should be able to incorporate it into the automation.

dull grove
#

I mean the duration change regarding the opening gate button I choose.
to dry the garage I need to set around 30 minutes
to grab the charge cable, only 1 or 2 minutes
to unload groceries 3-4 minutes

Because the main road is in front my house, I don't want the door to stay open too long

#

regarding the charge cable, I have a trigger when I open the charge flap of the car, also when the charge start and the car location..

#

so I can if my car is at home and I open the charge flap -> automation to open the gate (+ open start the charget socket)
When the car is connected and charging -> close the gate xD

fleet pine
#

Are these physical buttons or buttons on your HA dashboard?

dull grove
#

anyay I ve spotted that my duration doesn't work anymore

#

button in HA but I will add one in HA companions for my watch or car

#

and i ll add remote too

fleet pine
#

I gotcha. I'll have to look into it a bit more but I imagine it wouldn't be much different than how you call the scripts with variables. When running an automation from the front-end, it bypasses the triggers (and maybe the conditions, can't remember) and just does the action. For me, since I've put everything into trigger_ids, my automations don't trigger that easily. (Basically, I need to figure out how to pass a trigger_id from the dashboard into the automation in order to get the correct sequence to fire.)

dull grove
#

fixed, I don't know how but I changed it by another variable in the custom card ..

#

6% goes to 30 minutes now

#

25 to 1'30"

#

looks good now

#

When closed -> timer is deactivated

#

The card look bug free now

#

I think I ll extract the duration in input_number props to remove this logic from the front end

#

oh I found a bug, the auto close off doesn't cut the timer

#

Ok fixed, the toggle automation script was buggy