Tuya Garage Door Opener with sensors

Actually I think that the issue may be bigger than Home Assistant. When I log into Tuya and check debugging for the device, I get:

Device Information

Product Name Smart Wireless Garage Door Opener

Device ID 2207********207

Product Category ckmkzq

Device Status Online

Activated At 2022-08-15 13:45:20

But the instruction set is empty

When I go to API explorer and check for the instruction set, I get this:

{
  "result": {
    "category": "ckmkzq",
    "functions": []
  },
  "success": true,
  "t": 16606*******32,
  "tid": "a5********************23f65"
}

However the instruction set for the category ā€œgarage doorā€ should be producing this:

{
  "result": {
    "category": "ckmkzq",
    "functions": [
      {
        "code": "countdown_alarm",
        "desc": "countdown alarm",
        "name": "countdown alarm",
        "type": "Integer",
        "values": "{\"unit\":\"s\",\"min\":0,\"max\":86400,\"scale\":0,\"step\":1}"
      },
      {
        "code": "tr_timecon",
        "desc": "tr timecon",
        "name": "tr timecon",
        "type": "Integer",
        "values": "{\"unit\":\"s\",\"min\":10,\"max\":120,\"scale\":0,\"step\":1}"
      },
      {
        "code": "countdown_1",
        "desc": "countdown 1",
        "name": "countdown 1",
        "type": "Integer",
        "values": "{\"unit\":\"s\",\"min\":0,\"max\":86400,\"scale\":0,\"step\":1}"
      },
      {
        "code": "switch_1",
        "desc": "switch 1",
        "name": "switch 1",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "switch_alarm_sound",
        "desc": "switch alarm sound",
        "name": "switch alarm sound",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "switch_3",
        "desc": "switch 3",
        "name": "switch 3",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "door_control_3",
        "desc": "door control 3",
        "name": "door control 3",
        "type": "Enum",
        "values": "{\"range\":[\"open\",\"close\"]}"
      },
      {
        "code": "switch_alarm_1",
        "desc": "switch alarm 1",
        "name": "switch alarm 1",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "door_state_1",
        "desc": "door state 1",
        "name": "door state 1",
        "type": "Enum",
        "values": "{\"range\":[\"unclosed_time\",\"close_time_alarm\",\"none\"]}"
      },
      {
        "code": "voice_control_3",
        "desc": "voice control 3",
        "name": "voice control 3",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "door_time_1",
        "desc": "door time 1",
        "name": "door time 1",
        "type": "Integer",
        "values": "{\"unit\":\"s\",\"min\":10,\"max\":120,\"scale\":0,\"step\":1}"
      },
      {
        "code": "switch_2",
        "desc": "switch 2",
        "name": "switch 2",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "door_time_2",
        "desc": "door time 2",
        "name": "door time 2",
        "type": "Integer",
        "values": "{\"unit\":\"s\",\"min\":5,\"max\":300,\"scale\":0,\"step\":1}"
      },
      {
        "code": "door_time_3",
        "desc": "door time 3",
        "name": "door time 3",
        "type": "Integer",
        "values": "{\"unit\":\"s\",\"min\":5,\"max\":300,\"scale\":0,\"step\":1}"
      },
      {
        "code": "voice_control_2",
        "desc": "voice control 2",
        "name": "voice control 2",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "voice_control_1",
        "desc": "voice control 1",
        "name": "voice control 1",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "alarm_countdown_1",
        "desc": "alarm countdown 1",
        "name": "alarm countdown 1",
        "type": "Integer",
        "values": "{\"unit\":\"s\",\"min\":0,\"max\":86400,\"scale\":0,\"step\":1}"
      },
      {
        "code": "alarm_countdown_2",
        "desc": "alarm countdown 2",
        "name": "alarm countdown 2",
        "type": "Integer",
        "values": "{\"unit\":\"s\",\"min\":0,\"max\":86400,\"scale\":0,\"step\":1}"
      },
      {
        "code": "alarm_countdown_3",
        "desc": "alarm countdown 3",
        "name": "alarm countdown 3",
        "type": "Integer",
        "values": "{\"unit\":\"s\",\"min\":0,\"max\":86400,\"scale\":0,\"step\":1}"
      },
      {
        "code": "countdown_2",
        "desc": "countdown 2",
        "name": "countdown 2",
        "type": "Integer",
        "values": "{\"unit\":\"s\",\"min\":0,\"max\":86400,\"scale\":0,\"step\":1}"
      },
      {
        "code": "countdown_3",
        "desc": "countdown 3",
        "name": "countdown 3",
        "type": "Integer",
        "values": "{\"unit\":\"s\",\"min\":0,\"max\":86400,\"scale\":0,\"step\":1}"
      },
      {
        "code": "door_control_2",
        "desc": "door control 2",
        "name": "door control 2",
        "type": "Enum",
        "values": "{\"range\":[\"open\",\"close\"]}"
      },
      {
        "code": "door_control_1",
        "desc": "door control 1",
        "name": "door control 1",
        "type": "Enum",
        "values": "{\"range\":[\"open\",\"close\"]}"
      }
    ]
  },
  "success": true,
  "t": 16606*******32,
  "tid": "a5********************23f65"
}

But the opener is working fine via the Smartlife Android App, which is making me quite confused.

All my other tuya devices are correctly showing information under API explorer and device debug.

Any ideas ?

Pete

Tuya garage door opener is basically a switch and a contact sensor.

Switch is intitiating an action garage door;

  • if it is already stopped and last activity is opening, start closing
  • if it is already stopped and last activity is closing, start opening
  • if it is already opening or closing, stop it.

Iā€™ve managed to get the 'door state working. I set it up with protocol 3.3 and set id DP102 as ā€˜binary sensorā€™ -

On Value= Opened
Off Value= Closed
Device Class= door

Still no good setting up the ā€˜switchā€™ and actually activating the open / close sequence.

In the meantime Iā€™ve added a Sonoff PSF-B01 relay in parallel which Iā€™m using via HA to achieve the same thing.

Iā€™d be much happier doing both of the above (switch and state) off the one device so Iā€™m open to suggestions.

Pete

How about the one I suggested earlier on #50? It comes with ESPHome, and (while you still could) you donā€™t have to flash any firmware to get started.

Problem solved.

Door state solution is as of my earlier post where I setup the binary sensor.

To activate the open / close function, I had to set up the device as a cover, not as a switch. All done via GUI, no yaml configuration.

Thanks for the input.

Pete

You should buy door contact sensor. Your current device is just a relay, cant see if the door is open or not because it just toggles

hi Pete

how did you added it to GUI ?
thanks !

Hi! Would it be possible to set this template as a lock instead of a cover? :slight_smile: I tried but it does not work.

lock:
  - platform: template
    name: Garage door
    value_template: >-
     {% if is_state('binary_sensor.garage_door_status','on') %}
       Open
     {% else %}
       Closed
     {% endif %}
    lock:
      service: switch.turn_on
      target:
        entity_id: switch.garage_door
    unlock:
      service: switch.turn_off
      target:
        entity_id: switch.garage_door
    icon_template: >-
      {% if is_state('binary_sensor.garage_door_status','on') %}
         mdi:garage-open
      {% else %}
         mdi:garage
      {% endif %}

Instead of Open/Close, use on/off.

I dont see what should be changed?
this is the error i got.

Logger: homeassistant.config
Source: config.py:938
First occurred: 16:51:20 (1 occurrences)
Last logged: 16:51:20

Invalid config for [lock.template]: [icon_template] is an invalid option for [lock.template]. Check: lock.template->icon_template. (See /config/configuration.yaml, line 84). Please check the docs at Template - Home Assistant

lock:
  - platform: template
    name: Garage door
    value_template: >-
     {% if is_state('binary_sensor.garage_door_status','on') %}
       off
     {% else %}
       on
     {% endif %}
    lock:
      service: switch.turn_on
      target:
        entity_id: switch.garage_door
    unlock:
      service: switch.turn_off
      target:
        entity_id: switch.garage_door

Thanks! Tried that before but it didnā€™t work I guess i did something else wrong :slight_smile:

What is the error with this?

Previous error was about icon template which is not supported by lock template

It works now, previously i tried changing the closed/open to off/on and removing the icon but it did not work, I guess there was something else wrong. but jow it works thanks to you!

1 Like

Hi, i have been ussing Tuya Local GitHub - make-all/tuya-local: Local support for Tuya devices in Home Assistant with my generic Tuya garage opener and works wondefull.

Just add in Tuya Local and it just works.

1 Like

Hello Pete, I am also interested how you setup the cover entity. Thanks in Advanceā€¦

Hello everyone,
I have problems to configure my Loratap Garage Door opener.
My model is the Loratap GDC100W.

I am using Tuya Local and I add the device as a switch or as a Loratap Garage Opener but I can not obtain any state sensor.

Could someone help me please?

It just appears the switch and I can control the open and close actions well, but I can not know the position (opened or closed) of the garage door.

I do not know how to do it and I did not obtain good results with the configuration.yaml

I am having the opposite problem. My Tuya garage door opener is showing as a sensor and not a switch. I can see the state of the door through HA but canā€™t control it.

my garage gate is connected to a tuya wifi USB. according to the Tuya APIā€¦ it is this:

image

I then went through its properties:

dp 101 seems to be the sensor, with value changing from opened, closed and stop.

dp 102-105 looks useless, it does not update when I try to toggle on the Smart Life app. EDIT: it looks like 102-105 I cannot capture them in localtuya on HA. I am not sure whyā€¦!

DP 106 is set to true when I click open on the app. but when i click stop, it goes to false and thatā€™s it. when i click close (on the app) after that, i dont see any changes on any of the properties but I see the gate physically closing! I dont understand how it works and I cannot find any entity type to pair it. I have tried all combinations of a cover, switch etc. Anyone can guide me how else to debug this ? I am not sure how else to find out which is the relevant property to use and also what entity to use. I have been on this for very long.

thank you in advance