Shelly 1 Garage Door Controller

My current garage control uses a Shelly 1 which is ideal for my situation. The Shelly is very compact and easily fits into the ceiling box where all the low voltage wires associated with my garage door come together.

My build was based on Make Your Own Smart Garage Door Opener for $15 - HomeTechHacker
and further inspired by Extending automation to the garage · Ramblings of a Unix Geek

The Shelly 1 setup was easy and it natively offers everything I need.
POWER ON DEFAULT MODE: OFF
AUTO OFF: 1 second or less
Button Type: Detached Switch (switch is separated from the relays)
Enable MQTT (I also set custom MQTT prefix: shelly1-garage)
Connect garage opener to O & I terminals (relay)
Connect door sensor to L & SW terminals (input)
Connect 12V DC L=+ N=-

Home Assistant setup files

configuration.yaml
mqtt:
  cover:
    - name: "Garage Door"
      position_topic: "shellies/shelly1-garage/input/0"
      command_topic: "shellies/shelly1-garage/relay/0/command"
      availability_topic: "shellies/shelly1-garage/online"
      retain: false
      payload_open: "on"
      payload_close: "on"
      payload_stop: "on"
      position_open: 0
      position_closed: 1
      payload_available: "true"
      payload_not_available: "false"

customize.yaml
cover.garage_door:
  device_class: garage
  
automations.yaml
- id: mqtt_shelly_announce
  alias: Shelly Sync at HA Start
  trigger:
  - platform: homeassistant
    event: start
  action:
  - delay: 00:00:20
  - service: mqtt.publish
    data:
      topic: shellies/command
      payload: announce
- id: garage_door_warn
  alias: Notify app when garage door left open
  trigger:
  - entity_id: cover.garage_door
    for: 0:30:00
    from: closed
    platform: state
    to: open
  action:
    service: notify.mobile_app_moto_x4
    data:
      message: The garage has been left open
      data:
        actions:
        - action: close_garage
          title: Close Garage Door
- id: shut_garage_door
  alias: Close the garage when notification action is tapped
  trigger:
  - event_data:
      action: close_garage
    event_type: mobile_app_notification_action
    platform: event
  action:
  - entity_id: cover.garage_door
    service: cover.close_cover

5 Likes

10 out 10 bro

looks like you could put sever up there with those network cables LOL

hay your next set is

just drive up and the garage open had mine in for about 3 year now even got on in wife car.

2 Likes

Yes it was convenient that the builder used Cat 5 cable for all low voltage connections. I broke a wire for one connection and just switched to another pair. I have safety sensors at the bottom corners of the door and it was easy to add a door sensor on another pair.

I have plenty of D1 Mini devices, so I can add them to our cars. But even if I install them in our cars, I suspect we will still open the garage door before we get into our cars. Automation is nice, but old habits die hard.

Bugger about cable

Its nice to see the garage open as u drive down so that let u know ha is still up and running

2 Likes

So I basically did the same project and thank you for your post it was very helpful. However my opener works with a button panel that does light/lock/learn functions and I couldn’t just jump the voltage on the opener itself (pad is pwm?).

Anyways, I ended up soldering wires to the legs of the pad’s switch and used the shelly to jump the switch instead. It worked great for about a week, however the past few days I am getting random opens. Last night the garage popped open at 9:15pm on it’s own. A few days before that I got two false opens during the day.

I have no indication that there is a security issue here (e.g. HASS user compromised) but somehow I am getting false jumps? Anyone else experience this?

If you have a learn button on your garage switch panel and there still only two wires coming off it you are better off using an extra wireless remote to trigger the garage door rather than the panel. You are likely somehow affecting the resistance sent back to the opener and thus causing it to act wonky.

Hmm I see, yeah definitely possible. Good idea with the remote, I can give that a shot!

I know I am going to be ashamed of how incompetent I am once this is solved, but I have an issue that my cover is not showing up as an entity when I use your code above. The shelly1 is working fine in the app, and the reed switch is showing the status in the app.

Below is the code in my config.yaml:

cover:
 - platform: mqtt
    name: "Garage Door"
    position_topic: "shellies/shelly-garage/input/0"
    command_topic: "shellies/shelly-garage/relay/0/command"
    availability_topic: "shellies/shelly-garage/online"
    retain: false
    payload_open: "on"
    payload_close: "on"
    payload_stop: "on"
    position_open: 0
    position_closed: 1
    payload_available: "true"
    payload_not_available: "false"

Now, when I listen for the topic in the MQTT integration its showing up with the following code:

shellies/shelly-garage/input/0
Message 0 received on shellies/shelly-garage/input/0 at 6:55:
0

When I open the garage door the input changes to 1. Also, if I just try to add a binary sensor for the reed switch its simply not showing up as an entity.

Anyone have any ideas where to look?

Did you change the name of your shelly to shelly-garage? Did you set the button type to detached?

By default, the device’s MQTT ID is <shellymodel>-<deviceid> , for example shelly1-B929CC . The MQTT ID can be changed via the mqtt_id parameter in /settings .

Button Type: Detached Switch (Only the Shelly 1 can separate the switch from the relay.)

Yes, I set the MQTT Prefix to shelly-garage. I turned that off now and referenced the full name in my config.yaml, but it didn’t make a difference.

Button type is set to detached switch.

As I say, if I listen to the topic in the MQTT integration, it shows me the state, so I don’t think the issue is in the naming specifically.

Get it working with MQTT first before you add it to HomeAssistant. I did my first testing with the Shelly on my bench. Use software such as MQTT Explorer to watch the topics and messages. Send a message to activate the relay and you will hear it click. Use a wire across the input and verify the input topic changes. Your sensor may be normally open or normally closed. Test it so you know if open is 0 or 1. Once it works “on the bench”, then add it to HomeAssistant.

I used this and it works great in Home Assistant. Thanks!

Is anyone using it with HomeKit? I’ve found that the config here mostly work, but Siri will issue a “cover close” command even if the door is already closed. This of course results in the door opening. Not what I want. I assume that means some additional logic needs to be added somewhere in HA (since HomeKit is super inflexible). Something like “close_action: <if door is closed ; do nothing ; else ; close the door >”

Any suggestions?

Yup, I had the same exact issue. The workaround is to create a script that checks the status of the door before triggering an action. Mine checks to see if the door is opened or closed and if it’s already closed it does nothing.

Check out my thread here where the answer is discussed: Need help with if/else

Got two question for you all. So i got the Shelly1 in yesterday and was messing around with it. I think mine is broken. Issue #1: First the shelly app shows it needs to be updated. Its got the most up to date firmware, but keeps saying it needs to be updated. When I click update it then says you have the most up to date firmware. Issue #2: I see the sensor on the shelly app, but when I bring it back into home assistant i only see 1 entity (which is the button). Any help would be greatly appreciated.

Not all methods of Shelly 1 access will present both the switch and sensor. The Home Assistant Shelly app does not seemto allow access to both the switch and sensor. I used MQTT. I recently found someone else who uses ESPHome. Either will work.

Im new to this whole home automation thing. Mind pointing me in the right direction for MQTT?

MQTT requires a broker (server). Clients connect and send or receive messages from queues. The MQTT broker can run on the same machine running Home Assistant or a separate machine. I use mosquitto which is available for any Linux server and many other platforms as well.

As I said earlier in this thread, test MQTT and your device without Home Assistant to verify the functions. Use software such as MQTT Explorer to watch the topics and messages. Get it working “on the bench”.

Ok, I have a similar issue as Mac. I have Mosquitto as my broker and I used MQTT Explorer to see input 0 work fine “on the bench”. Now how do get the Shelly integration to add this as an entity?

The shelly integration is separate from the MQTT integration, you can use both at the same time, but right now MQTT seems more reliable

To add MQTT Shelly devices, this is the way to go, I just used it this weekend for the first time :

Did you have to modify the python script? I tried this method too, but it did not seem to work . I am not that familiar with python and expected that to be the problem.