jerrod-lankford / GarageQTPi

An MQTT server for a raspberry pi garage door opener. Most commonly used as a HomeAssistant cover component.
MIT License
75 stars 36 forks source link

Rebooting/Starting up Raspberry Pi triggers relay #13

Closed Curvin777 closed 7 years ago

Curvin777 commented 7 years ago

Hi!

Thanks for the great work! I've set this up on my Raspberry Pi Zero W and it works great, integrates perfectly with Home Assistant, everything works.

However, when I reboot the Pi (or power is otherwise removed e.g. a power outage), then upon startup the script automatically "cycles" the pins and triggers the relay to open/close the garage door. Due to the stability of the Pi and this application, I only noticed this issue recently even though I have had this running for quite a while 👍

Any suggestions? I'm ok with beginner Python, so my guess is it might have something to do with setting the pull_up_down to PUD_DOWN? Or would that just reverse the situation so that it will still cycle during startup? :)

It almost sounded like someone was having a similar issue but was in the wrong topic: https://github.com/Jerrkawz/GarageQTPi/issues/3 But I didn't see any resolution to their issue in there either.

Thanks! -Chad

jerrod-lankford commented 7 years ago

Read the very last post in the thread and see if that is your issue. The home assistant configuration should not have the retain:true flag in it

jerrod-lankford commented 7 years ago

It's possible that there is another issue but check that first

Curvin777 commented 7 years ago

Thanks!

This happens even without having it hooked up to Home Assistant, upon rebooting the Pi.

I did test by adding and changing "retain: True" and "retain: False" in my HA config.yaml with no effect (restarting Home Assistant after each change). Subsequent reboots of the Pi still caused the garage door to open.

Thanks for any further thoughts or things to try! -Chad

jerrod-lankford commented 7 years ago

Hey,

So one thing I failed to mention, once a retained message is sent to a thread it is retained until its blown away. Can you change the command topic in the GarageQTPi configuration to point to something different that you haven't used before and then reboot the pi and see if it still opens?

If that doesn't work then its likely your wiring, or your pi. Im not sure familiar with the raspberry pi zero but I can look into it.

perJand commented 7 years ago

Hi! Thank you for a great work!

I have hade some issues with reconnection and reboot. Now I'm down to only when the garageRPi reboots. First I hade with reconnections also but it was solved with #3.

So, every time the garageRPi reboots it opens the doors (if they where closed). I do not have any sensors, could that be the problem?

jerrod-lankford commented 7 years ago

The problem is likely that the pin you chose for the relay is on by default. Im not familiar with the pinouts on the pi zero, maybe you could find some documentation and try a different pin? If i have a chance i can also look

perJand commented 7 years ago

I believe it is the main.py that triggers the pins on start up. When I reboot without the autostart of main.py the do not go up (or down). Starting main.py manually triggers the pins.

ps. RPi zero w starts with GPIO0/2, GPIO1/3, GPIO4, GPIO7 and GPIO8 high https://www.raspberrypi.org/forums/viewtopic.php?t=24491#p225835 ds.

jerrod-lankford commented 7 years ago

@perJand I just merged a new PR that allows support for inverted relay. Can you pull and try it? The default behavior is reversed now. Try it both ways in the config.yaml, probably with invert_relay: false first (since true used to be the default behavior)

jerrod-lankford commented 7 years ago

@ChadCurvin FYI ^^^

perJand commented 7 years ago

Thank you @Jerrkawz, it works perfectly! using invert_relay: false

jerrod-lankford commented 7 years ago

Glad to hear it! You can thank @tagno25 :)

Curvin777 commented 6 years ago

Woohoo!! Just wanted to chime in here and mention that this fixed it for me as well.

Thank you!