Tuya Garage Door Opener with sensors

Hey there. Been a lurker for a while, and just registered to post this message :wink:

I installed a Tuya based garage door opener yesterday that also has sensors for open and close state detection.

It is this one: https://henractech.co.za/shop/smart-gate-garage-door-opener-switch-v2/

I installed the Tuya integration, and the opener is recognized and works perfectly as a switch in home assistant.

Here is my problem though … It does not recognize the sensor at all, which means the switch cannot have a state, nor can I build any automations around it.

I have searched high and low and read a ton of the topics on here.

All indications are that this is not supported yet.

I was just wondering if anyone has any idea if this is something that is actually being worked on, or, am I stuck mainly using the opener and sensors from within the Smart Life app?




Have the same so following…maybe I offer to pay someone smarter than me :slight_smile:

Have installed mine in the man cave and works great on the Tuya app, but would like to get it working better in HA .
I’m a super noob to this so it is currently beyond me .
if someone wants to work on it i’m willing to pay for the cost of a device and some coffees.
This is a genuine offer

Pretty noob here myself, but, pretty sure this is an issue with the Tuya integration. From all that I have been researching, looks like a limitation with the Tuya API, and not anything to do with lack of support from HA.

I am still hopeful that someone will come up with some kind of solution. I know for instance that once upon a time, Sonoff integration was very limited as well, and the only way to get it fully working in HA was to reflash the device with custom firmware. That is no longer the case as a genius figured out Sonoff completely and integration is now a breeze.

Now we just have to hope that another genius will figure out Tuya completely and get us to the same level of integration. :wink:

I’ve just migrated from Homebridge to HA - got a Garage Door opener and blinds motor via Tuya
the Blinds work perfectly and report position.

but I have the same issue with the door opener not reporting its position (had to use a template cover to get it to look act like a garage door in HA https://www.home-assistant.io/integrations/cover.template/)

Would be great to see it integrated like the blinds - at the moment I have a long way to understand the coding of it.

Same Problem here :frowning:

I found using the Tuya local package the garage door has been working perfectly for a few weeks now, I still have the original Tuya running the other devices

1 Like

I’d be happy if someone could teach me how to use it with Tasmota or ESPhome firmware , trying to get everything off cloud as I have flakey internet at times.
flashing devices is easy I’m just not up with the configuration stuff yet

1 Like

Your best bet would be to buy another sensor that is supported by HA and use that in a script on HA instead.

I personally use ZWave devices for a lot of things as they tend to work out of the box and dont really require any coding or flashing. Currently using an Aeotec Garage door opener but you’ve obviously already got this part working.

I’ve read a few people on here using ZWave tilt sensors that are around the $30 mark so could help with your problem once integrated as an automation in HA.

In localtuya, all switch works fine. But i have problem with garage opener witch sensors configuration.
Configure as a curtain or switch?

I’ve got the same issue here… doesn’t seem like anyone’s been able to get the SENSOR STATE of the Garage Door into Home Assistant yet???

@ezz9 can you confirm that using “localtuya” the state of the garage door opener is exposed to HomeAssistant (i.e. HA can see if garage is open or closed)?

I assume it does, given your previous comment on this post, suggested that is the problem you were looking to resolve.

Do you mind sharing the “localtuya” YAML syntax your using for your garage door opener? Many Thanks.

Hey @sebdoan
I used HACS to install the “localtuya” integration - and then configured with the main integration web interface. it was some trial and error finding the right setup, below is what’s working for me.
using version 3.0.1 at the moment, something in the updates something broke and I don’t have time to play so rolled back.

the only thing I’ve added to my config is in my customize.yaml

    device_class: garage
1 Like

Thanks @ezz9 I’ve been spending the past 2 days trying to find an easy way to get the “Tuya Localkey”, turns out there’s no easy way.

For the benefit of others, here’s a HOW TO: get the “Tuya Localkey” based on the steps i took and adapted from https://github.com/codetheweb/tuyapi/blob/d30ef9a1b2c51a016b3a2864cbe0b226071482c3/docs/SETUP.md

Three High Level Steps I did: (I’ve hashed the values in my keys so you can see the rough format and length to expect)

1. Get your device added to Tuya app and get Virtual ID from app

  • Virtual ID from app: b######cb43a435330jyxu

2. Do the below steps on iot.tuya.com

  • Create a new account on iot.tuya.com and make sure you are logged in. Go to Cloud -> Project in the left nav drawer and click “Create”. After you’ve created a new project, click into it. The access ID and access key are equivalent to the API key and API secret values need in step 6.
    1. Access ID/Client ID: 8######ca6xyfib0075x
    2. Access Secret/Client Secret: 6######702b84adc886d0e2b55a227b2
  • Go to App -> App SDK -> Development in the nav drawer.
    1. Click “Create” and enter whatever you want for the package names (for the Android package name, you must enter a string beginning with com.).
  • Go to Cloud -> Project and click the project you created earlier. Then click “Link Device”. Click the “Link devices by Apps” tab, and click “Add Apps”. Check the app you just created and click “Ok”.
  • On the same page, click “API Group” on the left side. Change the status to Open for the following three API Groups by clicking “Apply” for each line, entering any reason, and clicking “OK”:
    1. “Authorization Management”,
    2. “Device Management”,
    3. “Device Control”,
    4. “User Management”,
    5. “Network Management”,
    6. “Data Service”
    7. “Device Statistics”.

3. Install and run uBuntu or any other Linux Distro

  • Open a Terminal and run the below commands
  • Sudo apt-get update
  • Sudo apt install npm
  • Sudo npm i @tuyapi/cli -g
  • Sudo tuya-cli wizard
    1. Access ID/Client ID: 8######ca6xyfib0075x
    2. Access Secret/Client Secret: 6######702b84adc886d0e2b55a227b2
    3. Virtual ID from app: b######cb43a435330jyxu
    4. Output:
      [ { name: ‘Smart Garage Door Opener’,
      id: ‘b######cb43a435330jyxu’,
      key: ‘f######b4675c4e7 } ]

With these steps you now have the Tuya local key: ‘f######b4675c4e7 to run with the “localtuya” custom integration.

Tomorrow or tonight i’ll give it a go with “localtuya” and update if it all goes well.


@ezz9 I’ve used localtuya v3.1.0 and can confirm it doesn’t work for me either. I’m using the configuration via the UI as you are doing.

I’ve found that localtuya v3.0.1-v3.0.3 work the same for me.
What works:

  1. State sensor of the Garage Door works
  2. Close command works

What doesn’t:

  1. Stop/Toggle command only works when is garage door is open
  2. Open command does nothing (works as a toggle command when garage door is open)

Given that localtuya accurately gives me the sensor state I’ve combined it with the standard tuya integration to create a template switch/cover that works exactly as I expected. It’s a lot of workarounds but in the end it works…

Why use the standard Tuya integration for the switch. Is it possible to configure the switch part in the Garage Opener. When I try I only get presented with the options concerning current. No on/off functions. Or have I missed something

I have been trying to use the same config but for me only the door sensor works, the actual open/closing doesnt work. I have to use the cloud tuya to open close (which doesnt have the door sensor) so its mixed bag at the moment and I was hoping someone could point me in the right direction. Tried all possible combinations of DPs and all versions, still no luck :frowning:

@fhratul what worked for me is I added a switch then added a binary sensor to that switch like below:

Step 1:image
Step 2: add binary sensor to detect door sensor state
step 3: Then i added a button on lovelace to detect garage state and toggle door like so:

type: button
entity: binary_sensor.doorcontact_state
show_state: true
name: Garage Door
  action: call-service
  service: switch.toggle
    entity_id: switch.garageswitch

I have the same issue, hopefully my solution works for you too. The way I get around it, is to combine the sensor from LAN with the button from the CLOUD via a “template switch”. This template switch will work as expected.

Here’s my config below:

  - platform: template
        value_template: '{{ is_state("cover.front_gate_tuya", "open") }}'
          - condition: template
            value_template: '{{ is_state("cover.front_gate_tuya", "closed") }}'
          - service: switch.turn_on
            entity_id: switch.bfe76a6cb43a435330xxxx
          - delay: "00:00:10"
          - condition: template
            value_template: '{{ is_state("cover.front_gate_tuya", "closed") }}'
          - service: switch.turn_on
            entity_id: switch.bfe76a6cb43a435330xxxx
          - condition: template
            value_template: '{{ is_state("cover.front_gate_tuya", "open") }}'
          - service: switch.turn_off
            entity_id: switch.bfe76a6cb43a435330xxxx
        friendly_name: 'Front Gate'

NOTE: you’ll see that i use conditions to check the sensor just before it executes the action to open or close. I also use a 10 second delay and re-execute the action to open, because sometimes the first request to open does not work.

1 Like

Anyone else had any luck integrating a garage door? I have just installed one and direct integration with local tuya isn’t working. Might have to try your suggestion