Tuya cloud curtain position status reversed

Hi,
Just installed and calibrated wifi “Curtain Switch-N1” on tuya app, works and shows position correctly. But on home assistant it shows reversed position, if tuya app shows 100% open, then home assistant shows 0% closed. Is it possible to reverse position?
Diagnostic shows tuya “percent_control” 100%, home assistant “current_position” 0%:

"integration_manifest": {
    "domain": "tuya",
    "name": "Tuya",
    "documentation": "https://www.home-assistant.io/integrations/tuya",
    "requirements": [
      "tuya-iot-py-sdk==0.6.6"
    ],
.......
"status": {
      "control": "stop",
      "percent_control": 100,
      "cur_calibration": "start",
      "control_back_mode": "forward",
      "tr_timecon": 13,
      "light_mode": "relay"
    },
    "home_assistant": {
      "name": "Curtain switch",
      "name_by_user": "Miegamojo langas",
      "disabled": false,
      "disabled_by": null,
      "entities": [
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": null,
          "device_class": "window",
          "original_device_class": "curtain",
          "icon": null,
          "original_icon": null,
          "unit_of_measurement": null,
          "state": {
            "entity_id": "cover.miegamojo_langas_curtain",
            "state": "closed",
            "attributes": {
              "current_position": 0,
              "device_class": "window",
              "friendly_name": "Miegamojo langas",
              "supported_features": 15
            },

You can make a template sensor to reverse it.
The issue have been up before, but it is not a bug.
It is a matter of perspective.

Are the blinds 100% open or 100% closed.

Well, I use it for window opening, so position and buttons does opposite what they should. I found, that I am not first with this problem and it is not fixed yet https://github.com/home-assistant/core/issues/63942.
Tried to do cover template, but can’t get it to work correctly.

cover:
  - platform: template
    covers:
      room_window:
        device_class: window
        friendly_name: "Langas"
        position_template: "{{ states('sensor.room_window') }}"
        close_cover:
          - condition: state
            entity_id: sensor.room_window
            state: "close"
          - service: cover.close_cover
            target:
              entity_id: cover.miegamojo_langas_curtain
        open_cover:
          - condition: state
            entity_id: sensor.room_window
            state: "open"
          - service: cover.open_cover
            target:
              entity_id: cover.miegamojo_langas_curtain
        stop_cover:
          service: cover.stop_cover
          target:
            entity_id: cover.miegamojo_langas_curtain
        set_cover_position:
          - service: cover.set_cover_position
            data:
              position: "{{((100 - position) / 100)|int }}"
            target:
              entity_id: cover.miegamojo_langas_curtain
        value_template: "{{is_state('sensor.room_window', 'open')}}"
        icon_template: >-
          {% if is_state('sensor.room_window', 'open') %}
            mdi:window-open
          {% else %}
            mdi:window-closed
          {% endif %}

To swap the scale around on a percentage value you do 100-(current value*-1)

it wont work, because with “current value” = 100 you would get 200 and error:

Error executing script. Invalid data for call_service at pos 1: value must be at most 100 for dictionary value @ data['position']

dooh!!
Of course it is just 100-current value :slight_smile:

Heloo
I have the same problem. Where can I instert the code, in Developer Tools\template?
When I put this code, I habe an error “TemplateSyntaxError: unexpected ‘end of print statement’” in this line
set_cover_position:
- service: cover.set_cover_position
data:
position: “{{100-current_position*}}”

You sort of have to build a system on top of the original one.
This means you either need to make a change to your lovelace cards or make a template sensor that make the calculation and then just show that.
You also need to make scripts that inverse the numbers from the one you want to see and input to the ones the system actually understand.

Similar issue here… However I have few windows where I have the motor from right on the others I have it from left. So few of them works as expected others not…
On the other side with the localtuya integration always shows the real status as it is setup in the motor itself. Unfotunately localtuya doesn’t work with all my devices (some shutters are in other network which is not accessible from HA) so I have to use both integrations…

Can this issue be prioritized?

It is an old issue and the template is the solution.
Here is a thread with Petro explaining it from 2021.