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

Update cover position #170

Closed
wants to merge 1 commit into from
Closed

Conversation

rickroetenberg
Copy link

changed line 95.. DPCODE_PERCENT_STATE return actual value of curtain.
Changes line 32 as well. In API PERCENT_STATE doesn't exist

changed line 95.. DPCODE_PERCENT_STATE return actual value of curtain.
Changes line 32 as well. In API PERCENT_STATE doesn't exist
@tsutsuku
Copy link
Collaborator

In HA Cover Entity, current_cover_position means "The current position of cover" which is DP Code percent_state. And DP Code percent_control is the target position. So I think percent_state is better.

Refs

https://developer.tuya.com/en/docs/iot/s?id=K9gf48qy7wkre

@rickroetenberg
Copy link
Author

when using percent_state the position in HA is 0. When using PERCENT_CONTROL it gives me the actual position of the motor (same as in the tuya app)

@rickroetenberg
Copy link
Author

see also:

{
"result": {
"active_time": 1609868667,
"biz_type": 0,
"category": "cl",
"create_time": 1609868667,
"icon": "smart/icon/ay1557197822668c8orI/1d85e6508ffaa5609ef8f13d45b98294.png",
"id": "xxxx",
"ip": "",
"lat": "xxxx",
"local_key": "xxxx",
"lon": "xxxxx",
"model": "M2805EIG",
"name": "xxxx",
"node_id": "xxxxx",
"online": true,
"owner_id": "xxxx",
"product_id": "n9lv2wf0099ns0an",
"product_name": "RD Intelligent BlindMotor",
"status": [
{
"code": "control",
"value": "open"
},
{
"code": "percent_control",
"value": 31
},
{
"code": "control_back_mode",
"value": "back"
},
{
"code": "work_state",
"value": "opening"
}
],
"sub": true,
"time_zone": "+08:00",
"uid": "eu1604341089686EMfjQ",
"update_time": 1626701760,
"uuid": "bf99303023011ba507f5ff"
},
"success": true,
"t": 1626953220840
}

@cesarrew
Copy link

I have 8 Tuya curtain motors in my home. After some tests, changing to "percent_control" in this last version (1.4.0) wasn't necessary. In fact, the curtain position was not been updated in HA when I was changing the position direct through SmartLife.

But your change returning position instead of "100 - position" was correct in my tests for most of my devices. These devices would not work properly if you keep return "100 - position".

Unfortunaly, I have two devices (Tuya Switchbot Curtain Bluetooth) that changing to "return position" doesn't work. For these devices, It should return "100 - position" to work. If I do not, the current position is 100 to closed and 0 to open, what makes the open and close function non-functional.

@patrik-malina
Copy link
Contributor

There should be a invert option for that. As it is in Smart Life settings and tuyalocal

@zlinoliver
Copy link
Contributor

Hi @rickroetenberg , the Tuya developer team really appreciates your contributions and efforts to this Tuya v2 integration project. As we stop maintaining it now, please help to recreate your pull request in the Home Assistant Core repository: https://github.com/home-assistant/core/tree/dev/homeassistant/components/tuya

@zlinoliver zlinoliver closed this Oct 21, 2021
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.

5 participants