Shelly 1 Garage Door Controller

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.

Your next step is to use Home Assistant instructions to customize how it will control your garage door. For example the position_topic: is where you set input 0.

I did not modify the script, but I did need to modify the config yaml file to enable python scripts, and add the automations, and reboot HA

THEN, I needed the shellies to “announce” so the script could add them, which for me was to power cycle it since that was easiest at the time

I am missing something simple. I have run bieniu’s shellies discovery script and I do see the topics created in MQTT Explorer. Issue is still that the HA entities are not created. I’ve restarted HA twice per the instructions.

image

I have been attempting this project, I have everything working as expected in home assistant and today went to install the Shelly and Reed switch on the garage door. I have the I port contracted to the Red+ port on the opener, the the O on the white - port. When I trip the relay either in HA or in the Shelly web interface, I hear the click, and the down arrow light will flash a few times on the garage opener.

You all see anything obvious in this setup I may be missing?

Your garage door opener may not work with a simple switch. If the controller at the end of the wiring has a learn button, it probably sends some required code sequence. Test by shorting the wires into the controller ports. If that doesn’t open the door, you need more than closing the circuit.

Thank you for this. Little newer to Home Assistant and your template helped with set up.

One issue that might help others. Shelly1 does not post availability topics natively to mqtt. I had to delete those from the template for it to work.

Would love to know where that availability topic setting is.

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

I double checked the setup. My shelly1 settings do not have the “Will Topic” available.

Newest Non-Beta Firmware: 20210115-102904/v1.9.4@e2732e05

Look at the rest of the post. The Shelly does not post availability on its own. You need to force it to announce with an automation.

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