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 TS0601 _TZE200_pw7mji0l Cover Motor: Open and Close state not working properly in Home Assistant #19665

Closed
didi3r opened this issue Nov 11, 2023 · 30 comments
Labels
problem Something isn't working

Comments

@didi3r
Copy link

didi3r commented Nov 11, 2023

What happened?

The "open" and "closed" states reported to Home Assistant are not working as expected. They seem to be based on whatever you set on the "state".

  1. If you set it to "Open" in zigbee2mqtt, and then change the position through zigbee2mqtt or the remote. The state would be "open" regarding the position.

image

image

  1. If you set it to "Close" in zigbee2mqtt, and then change the position through zigbee2mqtt or the remote. The state would be "closed" regarding the position.

image

image

  1. If you set it to "Stop" in zigbee2mqtt, and then change the position through zigbee2mqtt or the remote. The state would be "open" or "closed" based on the position.

image

image

image

image

What did you expect to happen?

I would like the reported state of the covers to be always based on the position, not on what the user can randomly change.

How to reproduce it (minimal and precise)

No response

Zigbee2MQTT version

1.33.2-dev commit: c8dcd71

Adapter firmware version

20220219

Adapter

Sonoff ZBDongleP (CC2652P)

Debug log

No response

@didi3r didi3r added the problem Something isn't working label Nov 11, 2023
@GvdbW
Copy link

GvdbW commented Nov 18, 2023

I have the same issue with the roller TZE200_bv1jcqqu

it all worked normally until the last update. Now all my automation are broken and work randomly.

It seems related to this issue
#19539

@elad-bar
Copy link

elad-bar commented Mar 2, 2024

i have the same issue for all tuya homeetec covers, checked the converters (i added them almost a year ago), nothing change in them but it now throws errors as described above

@elad-bar
Copy link

elad-bar commented Mar 2, 2024

adding more details, devices:

  • _TZE200_p6vz3wzt
  • _TZE200_jhkttplm
  • _TZE200_5nldle7w

seems that the issue is not as described here, pls ignore my comments

@alexeiw123
Copy link

I am seeing this behaviour as well, has anyone identified the source of the problem?

@alexeiw123
Copy link

@Koenkk how can we take an integrated device from .ts and use that to in a local .js external converter? I'd like to see if I can find a way around this but the only way I can see is starting from scratch.

The devices position updates OK so somehow just need the state to reflect the position regardless of if it is operated by ZigBee or RF remote.

@Koenkk
Copy link
Owner

Koenkk commented Aug 12, 2024

Could you check if the issue is fixed with the following external converter:

  • save this as file next to configuration.yaml as ext_converter.js
  • add it to configuration.yaml:
external_converters:
  - ext_converter.js
  • start z2m,
  • in the frontend, check if the description of this device now ends with CUSTOM (this indicates the external converter has been loaded correctly)
  • check if issue is fixed

@alexeiw123
Copy link

Could you check if the issue is fixed with the following external converter:

  • save this as file next to configuration.yaml as ext_converter.js
  • add it to configuration.yaml:
external_converters:
  - ext_converter.js
  • start z2m,
  • in the frontend, check if the description of this device now ends with CUSTOM (this indicates the external converter has been loaded correctly)
  • check if issue is fixed

Thanks - I have added this external converter and I get no errors in my logs, however the blind description is still cover motor not cover motor CUSTOM as I'd expect.

external converter is showing in the GUI settings, so config seems to be working OK.

@alexeiw123
Copy link

  • check if issue is fixed

OK I updated this line:
tuya.whitelabel('Zemismart', 'ZM25EL', 'Cover motor', ['_TZE200_pw7mji0l']),
To this:
tuya.whitelabel('Zemismart', 'ZM25EL', 'Cover motor CUSTOM', ['_TZE200_pw7mji0l']),

The external converter was loading but the white label line was preventing the description form updating

@alexeiw123
Copy link

  • check if issue is fixed

Unfortunately no - using the external converter, the position expose doesn't update at all anymore.

@alexeiw123
Copy link

temporary workaround:

This will create a new cover entity in HA that interacts with the Z2MQTT created cover entity, but updates state based on the reported position in Z2M. in my very short testing this seems to be working for me until the converter issue is figure out.

cover:
  - platform: template
    covers:
      your_blind_temp:
        device_class: shade
        friendly_name: "Your blind temp"
        unique_id: your_blind_temp
        position_template: >-
          {{ state_attr('cover.your_blind', 'current_position')}}
        value_template: >-
          {% if state_attr('cover.your_blind', 'current_position') | int(default=0) > 0 %}
            open
          {% else %}
            closed
          {% endif %}
        open_cover:
          action: cover.open_cover
          target:
            entity_id: cover.your_blind
        close_cover:
          action: cover.close_cover
          target:
            entity_id: cover.your_blind
        stop_cover:
          action: cover.stop_cover
          target:
            entity_id: cover.your_blind
        set_cover_position:
          action: cover.set_cover_position
          data:
            position: "{{position}}"
          target:
            entity_id: cover.your_blind

@Koenkk
Copy link
Owner

Koenkk commented Aug 15, 2024

Could you provide the debug log when changing the position of the cover and it not being updated?

See this on how to enable debug logging.

@alexeiw123
Copy link

alexeiw123 commented Aug 16, 2024

Could you provide the debug log when changing the position of the cover and it not being updated?

See this on how to enable debug logging.

log.log

Here you go. FYI I opened the blind at 10:58 using the RF remote - I have trimmed the log from before that to reduce irrelevant content.

[2024-08-16 10:58:12] debug: z2m: Received Zigbee message from 'Ava blind' <-- this is the device I tested on

You can see from this screenshot that the Z2M provided entity is still reporting as 'closed' even though it's now open with position at 100. The other entity is from the template cover as per post above.
image

@Koenkk
Copy link
Owner

Koenkk commented Aug 17, 2024

I updated https://gist.github.com/Koenkk/ea7f0f705ad78880088b84ac380415f4, can you try again?

@alexeiw123
Copy link

I updated https://gist.github.com/Koenkk/ea7f0f705ad78880088b84ac380415f4, can you try again?

Unfortunately with this converter the position value doesn't get populated. The state doesn't change on cover movement either.

@Koenkk
Copy link
Owner

Koenkk commented Aug 18, 2024

I updated https://gist.github.com/Koenkk/ea7f0f705ad78880088b84ac380415f4, can you provide the logging when changing the position again?

@alexeiw123
Copy link

Have tested again, here are the logs:
log.log
closed from Z2M at 08:28 and then opened from RF remote at 8:29.

Z2M was throwing this: z2m: Exception while calling fromZigbee converter: logger.error is not a function}

@Koenkk
Copy link
Owner

Koenkk commented Aug 20, 2024

@alexeiw123
Copy link

Fixed https://gist.github.com/Koenkk/ea7f0f705ad78880088b84ac380415f4

log.log

I believe that these lines (2640 on) capture the blind reaching the open position from an external input, returning state open but the state in Z2M is shown as CLOSE.

[2024-08-21 18:07:22] debug: 	z2m: Received Zigbee message from 'Ava blind', type 'commandDataReport', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[0,0,0,100],"type":"Buffer"},"datatype":2,"dp":2}],"seq":256}' from endpoint 1 with groupID 0
[2024-08-21 18:07:22] error: 	z2m: RECIEVED 100
[2024-08-21 18:07:22] error: 	z2m: RETURN POSITON 100 and STATE OPEN
[2024-08-21 18:07:22] info: 	z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Ava blind', payload '{"battery":90,"border":"up","click_control":"down","linkquality":144,"motor_fault":false,"position":{"position":100,"state":"OPEN"},"reverse_direction":"back","state":"CLOSE"}'

Seems to have logged those values this time. Same behaviour and noticed that

@Koenkk
Copy link
Owner

Koenkk commented Aug 22, 2024

Updated https://gist.github.com/Koenkk/ea7f0f705ad78880088b84ac380415f4, can you try again?

@alexeiw123
Copy link

alexeiw123 commented Aug 22, 2024

Updated https://gist.github.com/Koenkk/ea7f0f705ad78880088b84ac380415f4, can you try again?

🎉 this does appear to have fixed it for me. Do you need logs or anything from me?

edit: I can switch to dev version easily and test once the PR is merged. I've removed my workaround here and can confirm this is now working as expected in both Z2M and the HA entities.

@Koenkk
Copy link
Owner

Koenkk commented Aug 24, 2024

I updated https://gist.github.com/Koenkk/ea7f0f705ad78880088b84ac380415f4, could you do one more check?

@alexeiw123
Copy link

I updated https://gist.github.com/Koenkk/ea7f0f705ad78880088b84ac380415f4, could you do one more check?

Quick test - all seems to be working OK both with commands from Z2M, HA and RF remote.

I see the changes are in the 'invert cover' which I didn't see any issue with either in this version or previous.

I'll update here if I come across any issues but I think you've fixed this issue.

@alexeiw123
Copy link

alexeiw123 commented Aug 25, 2024

Edit: ignore that - all was working and ran in to issues but it seems to be more widespread than the covers. Lights are affected too. I think the external converter is still ok.
Edit2: @Koenkk no changes needed to your latest version. Something fell over in my install and setting debug back to info and restarting everything resolved it. MQTT Might have been flooded with messages.

@alexeiw123
Copy link

Probably not new, but saw that zemismart supply the zigbee driver for these:
https://www.zemismart.com/pages/zigbee-handler-download-38
https://drive.google.com/file/d/1yBfsBpusYI1SKvMm4o0dnYRYMmD3LNiP/view

@Koenkk
Copy link
Owner

Koenkk commented Aug 27, 2024

Integrated the fix, thanks for testing!

Changes will be available in the dev branch in a few hours from now.

@alexeiw123
Copy link

Integrated the fix, thanks for testing!

Changes will be available in the dev branch in a few hours from now.

Hi @Koenkk These devices are all working as expected but noticed that I am getting errors pop up in the Z2M UI whenever the exposes are interacted with, (for example, pressing stop, or refreshing position. I don't think this was happening when using the external converter. Any clues to what has introduced this in the logs?

2024-09-06 09:13:16z2m: No converter available for 'get' 'position' ()
2024-09-06 09:13:20z2m: EventBus error 'Publish/mqttMessage': Cannot read properties of undefined (reading 'some')
2024-09-06 09:13:58z2m: EventBus error 'Publish/mqttMessage': Cannot read properties of undefined (reading 'some')
2024-09-06 09:14:08z2m: No converter available for 'get' 'position' ()

@Koenkk
Copy link
Owner

Koenkk commented Sep 6, 2024

Tuya devices doesn't support reading, so that's why the refresh fails. Disabled that now. Publish/mqttMessage': Cannot read properties of undefined (reading 'some') has already been fixed.

Changes will be available in the dev branch in a few hours from now.

Koenkk added a commit to Koenkk/zigbee-herdsman-converters that referenced this issue Sep 6, 2024
@kabturek
Copy link

The fix works great! thanks for the work!

@SikaiGGMU
Copy link

Just find _TZE204_r0jdjrvi is experiencing the same issue. If press open, the motor will move to open,but the position does get updated (still stays at 0), and the other way around.

@juslex
Copy link

juslex commented Oct 9, 2024

I have the same problem involving the engines
TS0601 _TZE200_fzo2pocs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
problem Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants