I’m not sure if that’s possible but I don’t think it’s necessary.
I have a MyQ garage door opener that I just installed a month ago and it only has 2 positions (open & closed). there is no intermediate position. once it gets about 2 feet open it goes from closed to open & once it goes about half way closed it shows closed.
If you have your garage door opener programmed in to HA as a cover, you can go to the states page & see the status change as you operate it.
To add my MyQ opener I just added the MyQ component. It automatically found my opener and created the cover like yours did. Since I have two garage doors my doors are named north & south in my set up. So it created a cover.south_garage_door based on the MyQ name.
Then since I didn’t like just the standard arrow and square display I created a template sensor to extract out the position in words to show on the frontend to make the position more explicit. I did that for both doors so the sensor.n_gd_pos_template is the template sensor I created for the non-MyQ north garage door.
I also did some customizing for the icons and stuff too.
The example I gave was for my non_MyQ north garage door opener. the concept would be the same tho. just change sensor.n_gd_pos_template to cover.garage_door_opener. And you’ll need to change the position to ‘open’ (not capitalized). Mine is capitalized by my template sensor for the position. The original created automatically isn’t capitalized.
Is that hassio? BTW, would this command line install also work for installing to a Rock64? It doesn’t appear to be hardware specific (excep for the -m option, which im not sure what it does)
All of the following is based on just guesses on my part from the link you posted:
it looks like (from the link) you went with Hassio.
It looks like it would work on other platforms depending on the “-m” option you choose but I don’t see in the code a selection for “raspberrypi3” for the machine option. It looks like the first line in that code pulls the hardware version and then installs the correct hassio version based on that so you might be able to use one of the other options (i386, x86_64, etc) depending what hardware the Rock64 is.
Or maybe try running with everything in that curl command leaving off the -m and see if it works.
So with this, if I open the garage, close it 1 minute later, then open it again and 29 minutes elapse, then the notification will still be sent? To fix this from happening, I would need to create an automation that would reset or disable the timer if the garage is closed? How can you determine if a timer is active or running?
ETA: Actually it appears I don’t need to do that because of the for condition, though it might make sense to disable the timer upon the door being opened OR create 3 triggers where the first starts the timer when the door is opened, the second sends a notification when the timer expires, and a third which cancels the timer when the door is closed. I like this approach because you only have to define the time period once
I rewrote this to use 3 triggers. One for the door opening, one for the door closing, and one for the timer triggering which then calls IFTTT to send an SMS. I use IFTTT because the SMS always comes from the same address and I can use my iOS devices to assign that a custom tone which will always go off even if the phone is in silent mode.
automation:
- id: garage_opened
alias: 'Garage Door Opened'
trigger:
- platform: state
entity_id: cover.garage_door_opener
to: 'open'
condition:
condition: state
entity_id: cover.garage_door_opener
state: 'open'
action:
- service: timer.start
entity_id: timer.garage_door
- id: garage_closed
alias: 'Garage Door Closed'
trigger:
- platform: state
entity_id: cover.garage_door_opener
to: 'closed'
action:
- service: timer.cancel
entity_id: timer.garage_door
- id: garage_opened_timer_finished
alias: 'Garage Opened Timer Finished'
trigger:
- platform: event
event_type: timer.finished
event_data:
entity_id: timer.garage_door
condition:
condition: state
entity_id: cover.garage_door_opener
state: 'open'
action:
- service: ifttt.trigger
data: {"event": "GarageLeftOpened"}
- service: timer.start
entity_id: timer.garage_door
timer:
garage_door:
duration: '00:30:00'
Cool thinking, but you dont need all that stuff.
Lets clear it a bit if you feel ok with this:
First of all, remove the conditions. Basically you did this:
“trigger the automation when the door opens, but only if the door is open” — see what you did there?
You can think ahead and say that you want a condition when you are not home. Lets leave that for now.
Second, you dont need timers because they can be intergrated into the automations:
I rewrote your automations. I believe it is a bit more clear now. A single automation to do all the above.
automation:
- id: 'garage_open_notification'
alias: 'Garage Door Opened'
trigger:
- platform: state
entity_id: cover.garage_door_opener
to: 'open'
for:
minutes: 30
condition: []
action:
- service: ifttt.trigger
data: {"event": "GarageLeftOpened"}
No, it will happen only ONCE per trigger. That means that it will notify you once when it is open for 30 mins. If the door changes state (closed) and then opens again, then it will wait for 30 minutes and will notify you again.
I guess I’m confused about what your concern is with the code I posted originally above. It should do exactly what you want it to do.
It sends a notification 30 minutes after the door opens and sends a notification every 30 minutes until the door closes. If the door closes before the 30 minute timer is up then the condition of the door being open isn’t met so everything just stops.
No no nothing wrong at all!. The automation I posted was just to clear things up a bit. Nothing more! Sorry for the confusion! My purpose was to minimize the code as much as possible and have the same effect!
Your automation is perfect and I already mentioned it is:
@finity Oh, sorry about that. It is late here
By the way, your code on post 3 seems fine to me. I still spot some unnecessary lines, like the condition and the timer, but it is just me. I am trying to keep it as simple and less lines as possible.
Edit: And I just realized we WANT the automation to repeat itself every 30 minutes… @FutureTense I missguided you! My code DOESNT repeat itself! If you want it to repeat, then I guess the code you posted is OK! Sorry!
I agree that they aren’t necessary if you want it to only fire once but if you want it to continuously send notifications at an interval you need the condition and timer…I think…
But no worries. We all have our ways of doing things.
And yes I’m still not sure why @FutureTense needs all the different automations. I’m pretty sure my one automation will do exactly what they want. Unless I’m missing something… Which is entirely possible… Hence the question above…