home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
74.18k stars 31.15k forks source link

Garage Door Opener Displaying as Switch #59036

Closed christianzappa closed 3 years ago

christianzappa commented 3 years ago

The problem

LoraTap Tuya Garage Door Opener displays as switch/outlet. No Sensor to show if the door is open or closed or ability to open/close the door. Switch in HA appears as always on, switching it off does nothing.

https://www.aliexpress.com/item/4000786503603.html?spm=a2g0o.search0304.0.0.1a4f5cbeSqAqlb&algo_pvid=fff6cd80-18c2-4c0a-ae63-24c962c1225f&algo_exp_id=fff6cd80-18c2-4c0a-ae63-24c962c1225f-10

What version of Home Assistant Core has the issue?

core-2021.11.0

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Tuya

Link to integration documentation on our website

https://www.home-assistant.io/integrations/tuya/

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

Tuya Product - https://www.aliexpress.com/item/4000786503603.html?spm=a2g0o.search0304.0.0.1a4f5cbeSqAqlb&algo_pvid=fff6cd80-18c2-4c0a-ae63-24c962c1225f&algo_exp_id=fff6cd80-18c2-4c0a-ae63-24c962c1225f-10 Smart Garage Door Opener HA Entity Page Smart Garage Door Opener HA Entity Screenshot_20211104-170632_Smart Life

probot-home-assistant[bot] commented 3 years ago

Hey there @tuya, @zlinoliver, @metisu, @frenck, mind taking a look at this issue as it has been labeled with an integration (tuya) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)


tuya documentation tuya source (message by IssueLinks)

mbo18 commented 3 years ago

You can help us with this issue by providing some information about your device.

To do that, please follow the next steps:

From this debugger, we can get some information that can be useful. From the "Basic Information" tab, please provide:

Next, click on the "Device Debugging" tag. Once on that tab, you will find a small link called "JSON Editing", click on that link. It will now show a text field called JSON_EDITOR with some code in it. It looks something like this:

image

Copy and share that code from that text field into this issue.

That will help a lot! Thanks already!

felipecrs commented 3 years ago

Hi, I have exact the same issue. Here is the device info:

Product Name: Garage Door Opener

Product Category: kg

JSON:

[
  {
    "code": "switch_1",
    "value": false
  },
  {
    "code": "countdown_1",
    "value": 0
  },
  {
    "code": "countdown_1",
    "value": 0
  }
]

image

By the way this is the device which I bought: https://aliexpress.com/item/4000903671119.html

@mbo18 if you need any other information I can provide.

frenck commented 3 years ago

kg is a generic switch. If manufacturers have used those for other ends (e.g., a garage door), there is nothing we can do. I can use my wallplug to switch on/off my airconditioner too, but that doesn't make it a climate entity in Home Assistant.

Please report the issue with the manufacturer in this case.

See also the Tuya documentation for reference:

https://developer.tuya.com/en/docs/iot/categorykgczpc?id=Kaiuz08zj1l4y

felipecrs commented 3 years ago

Hm... perhaps a firmware update could rescue us? Would it be feasible?

Otherwise, adding a way to customize the device_class like the SonoffLAN could also solve the issue.

https://github.com/AlexxIT/SonoffLAN#custom-device_class-for-any-mode

felipecrs commented 3 years ago

Please report the issue with the manufacturer in this case.

Do you have a suggestion on which words to use? I can of course send an Aliexpress message, but they need to fully understand what's supposed to be done at their end.

frenck commented 3 years ago

Otherwise, adding a way to customize the device_class like the SonoffLAN could also solve the issue.

That is not something Home Assistant supports.

Do you have a suggestion on which words to use?

That the device exposes itself as the kg category instead of a garage door device category? Dunno... 🤷

felipecrs commented 3 years ago

That is not something Home Assistant supports.

Hm... what do you mean? I'm talking about allowing to configure the Tuya integration in a way that the device_class can be overridden per device.

frenck commented 3 years ago

Hm... what do you mean? I'm talking about allowing to configure the Tuya integration in a way that the device_class can be overridden per device.

That is not something we will support.

felipecrs commented 3 years ago

Ok. Thank you anyway. I also sent a message to the seller, I will update if they say something.

felipecrs commented 3 years ago

Bad news:

image

I guess the only solution for this device in specific will be to flash Tasmota and stop using Tuya at all then. Sad.

frenck commented 3 years ago

@felipecrs Sorry m8 :(

From the Home Assistant side of things, you could use a template entity to wrap the switch into a cover entity:

https://www.home-assistant.io/integrations/cover.template/

felipecrs commented 3 years ago

That's perfect! Thanks a lot for sharing this, this is just what I needed.

christianzappa commented 3 years ago

That's perfect! Thanks a lot for sharing this, this is just what I needed.

Hey @felipecrs how did you go? The only issue I see is that there is no sensor passed to home assistant that shows if the door is opened or closed.

felipecrs commented 3 years ago

On my device, the switch ON means open and OFF means closed. But I did not write it yet... Once I do I will post here.

christianzappa commented 3 years ago

Thanks @felipecrs

I actually go this working using the HACS Tuya Local Integration. image

I was able to add the Garage Door Opener as a Switch and Binary Sensor image

Switch - Value 7 Binary Sensor - Value 101 (False closed, True Open)

I then made a cover entity cover:

felipecrs commented 3 years ago

That's indeed much better than what the current integration provides, as there is no binary sensor.

I'm thinking about flashing Tasmota on the device though, as I already flashed on some others.

Thanks for letting me know about the Tuya Local anyway. Very cool.