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

Fix the position of TS0601_curtain #1603

Merged
merged 2 commits into from
Sep 30, 2020
Merged

Fix the position of TS0601_curtain #1603

merged 2 commits into from
Sep 30, 2020

Conversation

dinhchinh82
Copy link
Contributor

@dinhchinh82 dinhchinh82 commented Sep 29, 2020

At current, after pairing the TS0601_curtain to Zigbee coordinator, the position is not correct. Beside that, the direction from Home Assistant is also not synchronized with the direction of RF remote.
I've tried some advanced configuration as below but still not success:

  1. If we set the reverse_direction to true, the position is still not correct
  2. Even If we set the invert_cover: true in the configuration.yaml file, the position is still not correct.
  3. Tried some combination between reverse_direction & invert_cover and still not work.

Solution:

  • Fix the logic to calculate the position
  • Still need to set the invert_cover option to true.

@Koenkk
Copy link
Owner

Koenkk commented Sep 29, 2020

What is the value when the cover is fully opened and what value when fully closed (without setting invert_cover in configuration.yaml?

@dinhchinh82
Copy link
Contributor Author

@Koenkk here are the detail without setting invert_cover:

  1. Fully opened:
    Zigbee2MQTT:info 2020-09-29 16:47:16: MQTT publish: topic 'zigbee2mqtt/0xec1bbdfffe687c8d', payload '{"linkquality":76,"position":0,"running":false}'
    Home assistant:
    https://prnt.sc/upunh8

  2. Fully closed:
    Zigbee2MQTT:info 2020-09-29 16:46:17: MQTT publish: topic 'zigbee2mqtt/0xec1bbdfffe687c8d', payload '{"linkquality":63,"position":100,"running":false}'
    Home assistant:
    https://prnt.sc/upuom9

@Koenkk
Copy link
Owner

Koenkk commented Sep 29, 2020

That is not correct, for zigbee-herdsman-converters 100 = open, 0 = closed (

// For zigbee-herdsman-converters: open = 100, close = 0
) so https://github.com/Koenkk/zigbee-herdsman-converters/pull/1603/files#diff-3e0c275bd41af699153bf59d8dda4a2aR2676 should be undone.

The invert_cover option in configuration.yaml can be used when your home automation software expects the opposite (0 = open, 100 = closed)

@dinhchinh82
Copy link
Contributor Author

dinhchinh82 commented Sep 29, 2020

That is not correct, for zigbee-herdsman-converters 100 = open, 0 = closed (

// For zigbee-herdsman-converters: open = 100, close = 0

) so https://github.com/Koenkk/zigbee-herdsman-converters/pull/1603/files#diff-3e0c275bd41af699153bf59d8dda4a2aR2676 should be undone.
The invert_cover option in configuration.yaml can be used when your home automation software expects the opposite (0 = open, 100 = closed)

Yes. That's correct to set the invert_cover to be true in the configuration.yaml. But without this PR, the open/close icon to control the motor from Home Assistant is still not correct.

This is the test scenario:

  1. Set the invert_cover to "true" in "configuration.yaml"
    https://prnt.sc/uq14gd

  2. Using the remote to close the curtain (fully closed)

  3. The current panel to control the curtain from Home Assistant.
    https://prnt.sc/uq169f

So for this case, it is not able to open the curtain from the Home Assistant.
If I use the modified code in this PR, everything works well.

Thank you.

@Koenkk
Copy link
Owner

Koenkk commented Sep 29, 2020

I don't understand, why did you set invert_cover in your configuration.yaml? This is not needed for Home Assistant

@dinhchinh82
Copy link
Contributor Author

dinhchinh82 commented Sep 29, 2020

I don't understand, why did you set invert_cover in your configuration.yaml? This is not needed for Home Assistant

Sorry to make you confused but actually this case is quite difficult to explain.

Please check the 2nd test scenario when I keep the default setting :

  1. Keep the original setting (without set the 'invert_cover' in the 'configuration.yaml')
    https://prnt.sc/uq1g1m

  2. Using the remote to close the curtain (fully closed)

  3. The current panel to control the curtain from Home Assistant is still not correct:
    https://prnt.sc/uq1jdl
    as you can see in the picture, even the curtain is fully closed but it's unable to open the curtain from Home Assistant (the icon to open is unable to click).

@Koenkk
Copy link
Owner

Koenkk commented Sep 29, 2020

Isn't the problem that the remote doesn't update the position correctly?

Can you provide a debug log of this problem and clearly annotate at which moments you executed commands with the remote?

@dinhchinh82
Copy link
Contributor Author

dinhchinh82 commented Sep 29, 2020

There are 2 problems here:

  1. The Open/close button on the remote is opposite with the direction of the curtain
  2. The icon button in the Home Assistant to control is also opposite. It's unable to open the curtain from Home Assistant after closing it using remote or unable to close curtain after opening it by remote.

Here are the debug log:

1. Using remote to OPEN the curtain (actually I must use the close button on the remote to open the curtain)
Zigbee2MQTT:info 2020-09-29 23:15:51: MQTT publish: topic 'zigbee2mqtt/0x086bd7fffed0655a', payload '{"linkquality":78,"state_l1":"ON"}'
Zigbee2MQTT:info 2020-09-29 23:15:51: MQTT publish: topic 'zigbee2mqtt/0xec1bbdfffe6875e4', payload '{"linkquality":78,"position":100,"running":true}'
Zigbee2MQTT:info 2020-09-29 23:15:51: MQTT publish: topic 'zigbee2mqtt/0xec1bbdfffe6875e4', payload '{"linkquality":78,"position":100,"running":true}'
Zigbee2MQTT:info 2020-09-29 23:15:51: MQTT publish: topic 'zigbee2mqtt/0xec1bbdfffe6875e4', payload '{"linkquality":78,"position":100,"running":true}'
Zigbee2MQTT:info 2020-09-29 23:15:51: MQTT publish: topic 'zigbee2mqtt/0xec1bbdfffe6875e4', payload '{"linkquality":78,"position":100,"running":true}'
Zigbee2MQTT:info 2020-09-29 23:15:51: MQTT publish: topic 'zigbee2mqtt/0xec1bbdfffe6875e4', payload '{"linkquality":78,"position":100,"running":true}'
Zigbee2MQTT:info 2020-09-29 23:16:33: MQTT publish: topic 'zigbee2mqtt/0xec1bbdfffe6875e4', payload '{"linkquality":78,"position":0,"running":false}'
=> at this moment, the curtain is fully OPENDED.
The widget panel from Home Assistant:
https://prnt.sc/uq2gny

2. Using remote to CLOSE the curtain (actually I must use the OPEN button on the remote to close the curtain)
Zigbee2MQTT:info 2020-09-29 23:19:19: MQTT publish: topic 'zigbee2mqtt/0x086bd7fffed0655a', payload '{"linkquality":81,"state_l1":"OFF"}'
Zigbee2MQTT:info 2020-09-29 23:19:19: MQTT publish: topic 'zigbee2mqtt/0xec1bbdfffe6875e4', payload '{"linkquality":78,"position":0,"running":true}'
Zigbee2MQTT:info 2020-09-29 23:19:19: MQTT publish: topic 'zigbee2mqtt/0xec1bbdfffe6875e4', payload '{"linkquality":78,"position":0,"running":true}'
Zigbee2MQTT:info 2020-09-29 23:19:19: MQTT publish: topic 'zigbee2mqtt/0xec1bbdfffe6875e4', payload '{"linkquality":78,"position":0,"running":true}'
Zigbee2MQTT:info 2020-09-29 23:19:19: MQTT publish: topic 'zigbee2mqtt/0xec1bbdfffe6875e4', payload '{"linkquality":75,"position":0,"running":true}'
Zigbee2MQTT:info 2020-09-29 23:19:20: MQTT publish: topic 'zigbee2mqtt/0xec1bbdfffe6875e4', payload '{"linkquality":75,"position":0,"running":true}'
Zigbee2MQTT:info 2020-09-29 23:20:02: MQTT publish: topic 'zigbee2mqtt/0xec1bbdfffe6875e4', payload '{"linkquality":75,"position":100,"running":false}'
=> At this moment the curtain is fully CLOSED.
The widget panel from Home Assistant:
https://prnt.sc/uq2hkw

##Environment for Testing:

  • Zigbee2mqtt 1.4.4 HassIO add-on
  • Home Assistant 0.114.4

@Koenkk
Copy link
Owner

Koenkk commented Sep 29, 2020

@dinhchinh82
Copy link
Contributor Author

dinhchinh82 commented Sep 29, 2020

All the comments above are WITHOUT my change . I just reported the current situation.

  • When you now send to zigbee2mqtt/0xec1bbdfffe6875e4/set payload {"position": 100} does the curtain open or close?

Just send this message and the curtain is opening.
After the curtain is fully opened, the current state is as below:
Zigbee2MQTT:info 2020-09-30 00:06:35: MQTT publish: topic 'zigbee2mqtt/0xec1bbdfffe6875e4', payload '{"linkquality":21,"position":0,"running":false}'

@dinhchinh82
Copy link
Contributor Author

Just send the message
zigbee2mqtt/0xec1bbdfffe6875e4/set payload {"position": 0}

then then curtain is closing as below:

Zigbee2MQTT:info 2020-09-30 00:08:24: MQTT publish: topic 'zigbee2mqtt/0xec1bbdfffe6875e4', payload '{"linkquality":21,"position":0,"running":true}'
Zigbee2MQTT:info 2020-09-30 00:08:27: MQTT publish: topic 'zigbee2mqtt/0xec1bbdfffe6875e4', payload '{"linkquality":21,"position":0,"running":true}'
Zigbee2MQTT:info 2020-09-30 00:08:27: MQTT publish: topic 'zigbee2mqtt/0xec1bbdfffe6875e4', payload '{"linkquality":15,"position":0,"running":true}'
Zigbee2MQTT:info 2020-09-30 00:08:27: MQTT publish: topic 'zigbee2mqtt/0xec1bbdfffe6875e4', payload '{"linkquality":15,"position":0,"running":true}'
Zigbee2MQTT:info 2020-09-30 00:08:27: MQTT publish: topic 'zigbee2mqtt/0xec1bbdfffe6875e4', payload '{"linkquality":18,"position":0,"running":true}'
Zigbee2MQTT:info 2020-09-30 00:08:27: MQTT publish: topic 'zigbee2mqtt/0xec1bbdfffe6875e4', payload '{"linkquality":15,"position":0,"running":true}'
Zigbee2MQTT:info 2020-09-30 00:08:31: MQTT publish: topic 'zigbee2mqtt/0xec1bbdfffe6875e4', payload '{"linkquality":21,"position":20,"running":false}'
Zigbee2MQTT:info 2020-09-30 00:08:34: MQTT publish: topic 'zigbee2mqtt/0xec1bbdfffe6875e4', payload '{"linkquality":15,"position":20,"running":true}'
Zigbee2MQTT:info 2020-09-30 00:08:38: MQTT publish: topic 'zigbee2mqtt/0xec1bbdfffe6875e4', payload '{"linkquality":27,"position":0,"running":false}'
Zigbee2MQTT:info 2020-09-30 00:09:52: MQTT publish: topic 'zigbee2mqtt/0xec1bbdfffe6875e4', payload '{"linkquality":21,"position":0,"running":true}''
Zigbee2MQTT:info 2020-09-30 00:10:35: MQTT publish: topic 'zigbee2mqtt/0xec1bbdfffe6875e4', payload '{"linkquality":18,"position":100,"running":false}'

@Koenkk
Copy link
Owner

Koenkk commented Sep 29, 2020

All the comments above are WITHOUT my change . I just reported the current situation.

Good, that is what caused the confusion on my side.

So I assume with your changes:

  • position 100 = open
  • position 0 = closed
  • setting position 100 will open the curtain and report position 100
  • setting position 0 will close the curtain and report position 0

@dinhchinh82
Copy link
Contributor Author

So I assume with your changes:

  • position 100 = open
  • position 0 = closed
  • setting position 100 will open the curtain and report position 100
  • setting position 0 will close the curtain and report position 0

That's right. Your understanding is correct. These information above is what I want to explain.

@Koenkk
Copy link
Owner

Koenkk commented Sep 30, 2020

Thanks!

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

Successfully merging this pull request may close these issues.

None yet

2 participants