Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tuya Cover Controller opened/closed inverted #59099

Open
DickSwart opened this issue Nov 4, 2021 · 39 comments
Open

Tuya Cover Controller opened/closed inverted #59099

DickSwart opened this issue Nov 4, 2021 · 39 comments

Comments

@DickSwart
Copy link

The problem

First off, thank you for all the hard work for the new Tuya integration.

My issue is the cover controller of the Tuya integration. It is reporting a state of unknown for all my curtain rails and the open and close serves is inverted.

Service

  • cover.close_cover open my curtains
  • cover.open_cover close my curtains

All three of the curtain rails are the Zemismart New Design WiFi Curtain Motor Tuya Smart Life Customized Electric Curtains Track with RF Remote Alexa Echo Control

It used to work fine with the original Tuya integration, reported the state and controls were not inverted.

Let me know if there is any more info you need to help problem-solve this?

What version of Home Assistant Core has the issue?

2021.11.0

What was the last working version of Home Assistant Core?

2021.9.7

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 IoT Platform Logs per device

Device Name: Sliding Door Curtain
Actual State: Open

[
  {
    "code": "control",
    "value": "stop"
  },
  {
    "code": "percent_control",
    "value": 0
  }
]

Device Name: Small Window Curtain
Actual State: Closed

[
  {
    "code": "control",
    "value": "stop"
  },
  {
    "code": "percent_control",
    "value": 100
  }
]

Device Name: Corner Curtain
Actual State: Closed

[
  {
    "code": "control"
  },
  {
    "code": "percent_control",
    "value": 0
  }
]
@probot-home-assistant
Copy link

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)

@carlosCastro99
Copy link

I noticed the same issue with all my covers (blitzwolf SS6). since I updated to Tuya V2 the covers are reverted, so showing down when they are completely open and the reverse.
In localtuya it shows just fine (even saying that I'm not able to use the up/down as they are set as position controlled - strange though).

@NeWoKiKi
Copy link

NeWoKiKi commented Jan 3, 2022

Hello,

Same problem here.

Curtain's states in HA are different from Tuya IoT Platform.
For example one curtain is currently fully open (100%) and Tuya IoT Platform returns 100% however HA returns 0%

Tuya IoT Platform :
image

Home Assistant :
image

Entity :
image

@t3lmoazevedo
Copy link

Same problem here: inverted status on Tuya cover devices.

@shaynahum
Copy link

Same here :-(

@frenck
Copy link
Member

frenck commented Jan 24, 2022

Please, don't respond with "same problem", "+1", "I have it too" and similar. Instead, if you experience the same issue as the issue listed on GitHub, use the 👍 reaction on the bug report.

Thanks 👍

@github-actions
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label May 30, 2022
@Lesboy72
Copy link

Lesboy72 commented May 31, 2022

Same problem here: inverted status on Tuya cover devices.
Hi,

Has there been a solution to the problem of reverse treatment?

@Lesboy72
Copy link

Hello,

Same problem here.

Curtain's states in HA are different from Tuya IoT Platform. For example one curtain is currently fully open (100%) and Tuya IoT Platform returns 100% however HA returns 0%

Tuya IoT Platform : image

Home Assistant : image

Entity : image

Hi,

Has there been a solution to the problem of reverse treatment?

@github-actions github-actions bot removed the stale label May 31, 2022
@rwitlmarkf
Copy link

rwitlmarkf commented Jun 7, 2022

HA slider allows me to set the position to a % that is (100% - the position % in Smart Life).
Blind is down/closed = 0% slider in HA & 100% slider in Smart Life. HA Open button is disabled. Close button is enabled but has no effect.
Blind is up/open = 100% slider in HA & 0% slider in Smart Life - Blind is open - HA Close button works.
Open button in HA is disabled Close button is enabled and works.

Slider in HA sets the position of the blind (incorrectly). Slider in Smart Life is not reflected in HA slider
HA Call Service Cover: Open opens the blind
HA Call Service Cover: Close closes the blind

using the Tuya IoT portal sending Open/Close with a position will move to the position, sending Open/Close without a position moves to 0%/100%

@blastbeng
Copy link

Same problem here, just installed the Curtains and on HomeAssistant they are all inverted, any workaround i can do for now?

@francecisco
Copy link

francecisco commented Nov 7, 2022

Hello, I also have the same problem since the beginning.
the solution (he work fine for me and you could set up the % of cover opening) is to work around the problem by creating virtual cover in configuration.yaml with file editor or other : you must have somethink like that : then restart home assistant (i don't remeber where i find this solution)

Capture d’écran 2022-11-07 184500

cover:

  • platform: template
    covers:
    volet_parents_inverse:
    friendly_name: 'Volet Parents'
    position_template: "{{ 100 - (state_attr('cover.volet_parents_tuya', 'current_position') | int) }}"
    open_cover:
    service: cover.close_cover
    data:
    entity_id: cover.volet_parents_tuya
    close_cover:
    service: cover.open_cover
    data:
    entity_id: cover.volet_parents_tuya
    stop_cover:
    service: cover.stop_cover
    data:
    entity_id: cover.volet_parents_tuya
    set_cover_position:
    service: cover.set_cover_position
    data_template:
    entity_id: cover.volet_parents_tuya
    position: "{{ 100 - position }}"

@blastbeng
Copy link

blastbeng commented Nov 9, 2022

For anyone having this problem, I solved eveything using the localtuya addon installable via HACS.

https://github.com/rospogrigio/localtuya

I have 5 electric shutter and 4 dimmers.

Electric shutters are working good and flawlessly under localtuya, and most important... they are not inverted!!

The dimmers are configured as "switch" on localtuya, unfortunately localtuya has no configuration for the "dimmable" lights. but If you configure em as switch, you can still turn on/off.

@arnenys89
Copy link

Having the same issue. The shutters appear as curtains and are reversed compared to how they appear in Tuya Smart.

@Splinter911
Copy link

Splinter911 commented Jan 22, 2023

👍 issue. my blinds are sub devices so not sure if 'Localtuya' on HACS is an option. Localtuya does not show the sub devices only the hub

@darthstark1138
Copy link

darthstark1138 commented Jan 25, 2023

👍 issue. my blinds are sub devices so not sure if 'Localtuya' on HACS is an option. Localtuya does not show the sub devices only the hub

Same thing for me. My blinds motor (AM43) connect to a Zigbee hub and then to Tuya IoT. The position of the blinds is inverted in relation to the "Smart Life" app.

@Splinter911
Copy link

Splinter911 commented Jan 29, 2023

My device is

smart motor (qtemqjy7axczkkls)
by Tuya

Tuya app can connect no problem. HA Tuya can connect but reversed - LocalTuya can only connect to the hub. Reaching out for help to the community . Best regards Splinter911

@Splinter911
Copy link

Splinter911 commented Feb 19, 2023

👍 issue. my blinds are sub devices so not sure if 'Localtuya' on HACS is an option. Localtuya does not show the sub devices only the hub

Same thing for me. My blinds motor (AM43) connect to a Zigbee hub and then to Tuya IoT. The position of the blinds is inverted in relation to the "Smart Life" app.

@issue-triage-workflows
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@egennric
Copy link

egennric commented May 21, 2023

"NH-ZS 108" still in inverse state

Home Assistant 2023.5.3
Supervisor 2023.04.1
Operating System 10.1
Frontend 20230503.3 - latest

@brijeshsinghparihar
Copy link

Still issue remains for SUNFREE honeycomb Tuya shutters.
Why there is no option to inverse during setup or later, this issue is open from Nov 4, 2021!!

@issue-triage-workflows
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@egennric
Copy link

problem still exist in 2023.11.2
config_entry-tuya-0b1e179775ea978e6ea62b86463a0f55.json.txt

@darthstark1138
Copy link

Yeah, this is very annoying. It's the only thing preventing me from automating the natural lighting in my office based on the sun's position.

@KatsuoRyuu
Copy link

This is very frustrating, all my curtains are operating in reverse

@DNAngelX
Copy link

guys, it's pretty simple to solve this. This is a config from the motor,...

https://www.zigbee2mqtt.io/devices/TS0601_cover_1.html

Send:
{ "options":{ "reverse_direction": true } }

And it will work correct

@darthstark1138
Copy link

guys, it's pretty simple to solve this. This is a config from the motor,...

https://www.zigbee2mqtt.io/devices/TS0601_cover_1.html

Send: { "options":{ "reverse_direction": true } }

And it will work correct

All it does is show the correct status initially. But pressing "Open" or "CLose" still make the curtain go until halfway and then reverse direction (and flip the status).

@Splinter911
Copy link

Splinter911 commented Jan 1, 2024 via email

@bernardofortes
Copy link

bernardofortes commented Mar 11, 2024

My thanks to @francecisco.

It's a bit confusing for newbies (such as myself) to sort this out. Specially because there are just too many topics on this without the full detail in how to do it.

So, I've used @francecisco 's suggestion to include my curtains and it worked as a charm.

Step by Step:

1 - You'll need to add the code from the original post #59099 (comment) below into your configuration.yaml file. (I use the Studio Code Server Add-on in HA)
2 - Replace all 'cover.office_shutter_curtain' for whatever is the device in your HA config that you want it to apply in the code below
3 - There was a bit of manual adjusting of spaced for yaml to be happy.
4 - be sure to check in Developer Tools / Check Configuration prior to restart.

@CaiqueR
Copy link

CaiqueR commented May 3, 2024

My thanks to @francecisco.

It's a bit confusing for newbies (such as myself) to sort this out. Specially because there are just too many topics on this without the full detail in how to do it.

So, I've used @francecisco 's suggestion to include my curtains and it worked as a charm.

Step by Step:

1 - You'll need to add the code from the original post #59099 (comment) below into your configuration.yaml file. (I use the Studio Code Server Add-on in HA) 2 - Replace all 'cover.office_shutter_curtain' for whatever is the device in your HA config that you want it to apply in the code below 3 - There was a bit of manual adjusting of spaced for yaml to be happy. 4 - be sure to check in Developer Tools / Check Configuration prior to restart.

Yes, it worked for me too. Here it's the configuration.yaml formatted:

cover:
  platform: template
  covers:
    caique_curtain:
      friendly_name: 'Curtain'
      position_template: "{{ 100 - (state_attr('cover.zemismart_zigbee_roller_motor_curtain', 'current_position') | int) }}"
      open_cover:
        service: cover.close_cover
        data:
          entity_id: cover.zemismart_zigbee_roller_motor_curtain
      close_cover:
        service: cover.open_cover
        data:
          entity_id: cover.zemismart_zigbee_roller_motor_curtain
      stop_cover:
        service: cover.stop_cover
        data:
          entity_id: cover.zemismart_zigbee_roller_motor_curtain
      set_cover_position:
        service: cover.set_cover_position
        data_template:
          entity_id: cover.zemismart_zigbee_roller_motor_curtain
          position: "{{ 100 - position }}"

@issue-triage-workflows
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@luis-garza
Copy link

luis-garza commented Aug 2, 2024

It still there, please don't close it 🙏

I don''t know if this issue happens with all tuya cover/shutter devices, but it would be nice implement a flag to invert the operation for this kind of devices.

@github-actions github-actions bot removed the stale label Aug 2, 2024
@Splinter911
Copy link

Splinter911 commented Aug 2, 2024 via email

@darthstark1138
Copy link

There's a slightly less bothersome workaround, not a fix for the bothersome bug.

@sprobst76
Copy link

Is there some final solution to this topic? Even I found a valid configuration I would prefer a standard solution :-)

@michelgre
Copy link

Je viens d'installer des interrupteurs de volets roulants Tuya. Le fonctionnement sous l'appli Tuya Smart était OK.
Pour Home Assistant j'ai d'abord essayé l'integration Tuya, qui me permet de gérer aussi l'allumage des LEDs sur les boutons (c'est un modèle avec ça), mais le gros inconvénient est en effet l'inversion de montée et descente ! Ce qui ne va pas du tout...

Ensuite j'ai intégré sous Tuya Local, et là, magie, après avoir choisi le type d'appareil adéquat (volets mais en Anglais) j'ai bien mes boutons monter / arrêt / descendre qui fonctionnent correctement !

Donc je vais utiliser les appareils Tuya Local dans mes tableaux de commande Home Assistant. De toutes façons, je suis contre le fait de passer par un serveur externe.

Je m'associe à tous mes prédecesseurs qui ne comprennent pas pourquoi l'intégration Tuya (et pass Tuya Local) ne permet pas de configurer le sens du 0% / 100% puisque visiblement ils ne le gèrent pas bien (je répète que mon appli Tuya Smart n'inverse pas les commandes). Il doit y avoir un truc, mais quand on ne sait pas automatiser on laisse au moins l'utilisateur gérer.

@PauloFerreira25
Copy link

Hello, everyone. I came across this thread due to the same issue. In my Home Assistant setup, the behavior is also inverted. I also wasn't satisfied with the solution of creating a template-based cover.
I looked into the code and found that the Tuya integration is programmed in an inverted manner.

https://github.com/home-assistant/core/blob/dev/homeassistant/components/tuya/cover.py#L245
https://github.com/home-assistant/core/blob/dev/homeassistant/components/tuya/cover.py#L300
https://github.com/home-assistant/core/blob/dev/homeassistant/components/tuya/cover.py#L324

To fix this, it would be necessary to change the values, replacing 0 with 100 and 100 with 0, and set reverse=False.

However, I believe the best solution would be to add a configuration field for all covers, optionally specifying something like "manufacturer," which would allow the reverse setting to be either true or false based on the user’s preference.

If there is a Home Assistant developer willing to mentor me, I am happy to take on the task.

@Splinter911
Copy link

Splinter911 commented Jan 10, 2025 via email

@PauloFerreira25
Copy link

In this PR, they changed it to always be 0 for open and 100 for closed.
#59858

Later, this PR came along, which switched to using remap_value_from, and the issue reappeared.
#61369

From what I could understand, the CLKG model works with the standard 0 for open and 100 for closed.

Everyone creating some kind of "alternative," such as "inverting the motor" (software zigbee2mqtt), is doing so because of this issue.

I tried everything I could before diving into the code—reversing wires, changing the configuration in Tuya.

It is definitely a code issue in the integration with the CLKG.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests