-
Notifications
You must be signed in to change notification settings - Fork 507
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 - Using wrong logic for reporting "Current Position Lift Percentage" #3757
Comments
It couldn't, it need, ebaauw logic is now a rule ^^. But the rule is for exemple
And from your log (from the other issue) you have
So all seem fine ? Or I have look at bad device ? |
What I have is the other way round: 100 is fully open |
Just to be clear When I have this in deconz the cover is actually fully open: If I execute the command in deconz to open the cover it goes to 100% as in the picture above. The described behavior is consistent with the buttons of the cover (meaing if I use the open button the cover goes to 100% and if I use the close button the cover goes to 0%) To close it's the other way round (0%) (idon't have a picture right now). For me this logic was right until I found out of the rule in Deconz! (% closed) This was the reason I created an issue in Home Assistant since these were my first zigbee cover devices! |
Yep, but values you are seing in deconz are not the values gived by the api. HA don't use values from deconz but values from the API. Do you have a json returned by deconz with bad values, or good values but the covering device in bad state ? Have you for exemple the covering open but lift= 100 in the json ? |
when I execute Up/open I get the following: (cover fully open)
When executing down/Close: (cover fully closed)
Please note that just to be sure I executed the Up and down actions from deconz and the output is in {} is what I get in pydeconz (home assistant component) |
So there is a problem yes. |
I know I'm always insisting with this issue but can't we have something like we already have in window_covering.cpp for Xiaomi (please note that I'm not a coder)
|
Yep it s possible but we realy need to be sure the device is realy reversed, else it break the configuration on other device
Ok, nice issue, and it don't happen when you use the original gateway ?
This is normal, the setting are reset when you change the gateway
Ok so not the wiring. Can try this code
|
No it does not happen with the original gateway
That is not really true. The settings that I make using the tuya gateway stay in the device when I pair it with deconz. Originaly I used this to calibrate the device and then use it with deconz.
I will try the code but noobie question: How can I unistall it after testing? |
I get an error when compiling:
|
Corrected, sorry typo
|
First of all sorry for the late reply. I had to learn how to install all of this! (I did manage to install the dev on docker container!) Your code works like a charm! Now everything is working as it should with standard home assistant deconz integration! |
Bad luck, the last date for PR was today, sorry. And yes It s model specific, so I don't think we need to wait for another return. |
I will skip next release until this PR is released! |
Lol, you do more work than me. |
It s a device without level check that use timed move to simulated a set level command ? |
From what I know it's possible to setup time travel through the official (tuya/zemismart/whatever) App. But I don't wanna buy a gateway to set it up. Looks like there is attributes for this purpose but only readable according to deconz (and some time not even readable) :/ |
Your device use tuya cluster or covering cluster ? |
You need to edit geral.xml to make te attribute RW (read and right). In a couple of hours I can give you the details (I need to be on a computer) |
Putting info here :
FYI : I added the device with HA Zigbee integration and not with Deconz plugin. |
Take a look in the cluster 0x0102, you will find "calibration", but he is right on some version this line is read only. |
@axellebot What you are looking for is attribute 0xF001. If in the access colunm you have RW as in the picture below you are good to go. If you don't have RW then you need to edit general.xml file as in the code: (change on line 3 bellow from
Now for calibration:
That's it , your cover should be calibrated and ready to use! P.S. I have noticed that my covers some times do not open fully. This happens after setting different positions (20%, 35%, 80%....). To solve this I fully close the cover and then the positions are correct again! |
Maybe this is not the place, but is it possible to change |
I don't really understand why I don't have the same attributes and vendor/brand info, also no "Tuya settings" section and many attributes are gray 😞 I think I do have the Zemismart version of the same product
I'm able to edit the |
You don’t have manufacture name, only model. Maybe @Smanar can help with this. |
@Smanar I experience a similar Issue with this device: It is a module for two independent curtains/shutters. Showing as The ProblemWhen I open the shutter in deconz, the Shutter moves all the way to the top. So far so good. //XXXX:YYYY/api/0D6989DFA9/lights/7 {
"etag": "8c96754153107c7502dcabf715852b44",
"hascolor": false,
"lastannounced": null,
"lastseen": "2022-03-27T00:07Z",
"manufacturername": "_TZ3000_j1xl73iw",
"modelid": "TS130F",
"name": "Rolladen Rechts",
"state": {
"bri": 254,
"lift": 100,
"on": true,
"open": false,
"reachable": true
},
"swversion": "0xFFFFFFFF",
"type": "Window covering device",
"uniqueid": "a4:c1:38:95:a7:b2:be:ee-01"
} The api reports If I click on close the shutter moves all the way to the bottom: {
"etag": "14fbeaca7115074d6c129df6c6258fa0",
"hascolor": false,
"lastannounced": null,
"lastseen": "2022-03-27T00:10Z",
"manufacturername": "_TZ3000_j1xl73iw",
"modelid": "TS130F",
"name": "Rolladen Rechts",
"state": {
"bri": 0,
"lift": 0,
"on": false,
"open": true,
"reachable": true
},
"swversion": "0xFFFFFFFF",
"type": "Window covering device",
"uniqueid": "a4:c1:38:95:a7:b2:be:ee-01"
} The API returns open: true and a lift of 0. I already played around with the motor invert setting but that results in open/close actions being switched. Please advise what I can do here. Also the device has no light, so why is there a brightness and on/off functionallity dispalyed? Thank you very much in advance! |
Ok so the command are working but the return is reversed ? You have some explanation here #5710 (comment) I can explain better after, but this trick can work only if the commande are working. |
I already experimented with that. But the "Set lift percentage" was not inverted. This is how This is my current DDF:
|
Arf, so not possible without editing code, need to use a DDF to bypass the send request, and this is not yet ready for other cluster than the tuya one. |
So anything I can do now to work around that? Code changes are currently discouraged right? |
Yep sorry, #5733 I can explain you the code edition you need to do, but will be for you only (and need a real linux machine for compilation). |
If you could point me to the relevant code lines that would be nice ! Building my own docker image should be doable for me. Although not knowing c++ at all I am quite accustomed with Java, python and golang. |
So, I just compiled my fork https://github.com/Xyaren/deconz-rest-plugin/commit/852c9384a0ebb524dec0fe193e1a2f8863bfeb13 and it seems to be working flawless. |
No, that is why I have said "only for you". And I realy don't have timestone for a "write" feature for others cluster than the tuya one. |
Well too bad :/ Is there already an Issue for the missing feature, that would allow writing a DDF for this ? |
Ha nope ^^. Can ask to have information. |
@manup Would you accept a PR if it includes a DDF for the device (as fas as currently possible), a code-fix and the promise of moving the code fix into DDF as soon as it is actually possible to do so ? 😬 |
Hi not sure if I understand the full discussion, only missing piece for the DDF to work is prevention to send certain requests from C++ code? |
I'm sure @Smanar can provide a better explanation... The curtain modules open-close percentage is reversed. 100->0 through 0->100. Additionally the device reports a brightness despite not having any light physically preset or connectable to the module. Edit: |
After reflexion we need something more complex than just a "write" feature for all clusters (like the tuya one). We need something to reverse the zigbee request, for exemple send the WINDOW_COVERING_COMMAND_OPEN instead of using WINDOW_COVERING_COMMAND_CLOSE when the user make {"open" : false } I think it will be easier to add a setting field in the DDF that can be used in rest_lights.cpp file to reverse the request. |
Something like bool |
With Options to reverse open/close and setLift setTilt ? Could single commands be part of the ddf ? |
Yes, I think it will be better, because some covering are mounting dependent, and some third app don't have this setting. And for the command/open,command/close, command/setOpenPct, it the "write" feature, but I think it work only for on/off and SetLevel ATM. |
there could be devices having open / close correct, but only the level switched around. |
This is an other problem, this need to be solved in the DDF, in this situation the device generaly don't respect rules. |
Hello, Its "lift" state is inverted on the rest API.
and when it is fully open, I have this JSON:
I am using Deconz version 2.23.01 running on Docker and a Raspbee II with firmware version 26780700. |
Depend of situation. Just make a DDF (or take the autogenerated one by deconz) and edit thoses lines
|
Hello @Smanar, I used the DDF Editor of Deconz (Edit tab > Edit DDF) to implement what you gave me and then reboot the device hosting deconz. However the JSON given by the rest API are same as before. |
The DDF will have the same impact on ALL _TZ3000_8kzqqzu4.
if it work the change is not important, you can now edit thoses lines Have you check :
|
It works now, I didn't set the DDF in "gold" state. |
Do you want to make a PR to submit the device correction ? |
Hi not sure if it is still needed but please find bellow the full DDF. The reporting of state/on is now perfect (running 2.28.1 and conbee ii 26720700) {
"schema": "devcap1.schema.json",
"manufacturername": "_TZ3000_dbpmpco1",
"modelid": "TS130F",
"product": "TS130F",
"sleeper": false,
"status": "Gold",
"path": "/devices/ts130f.json",
"subdevices": [
{
"type": "$TYPE_WINDOW_COVERING_DEVICE",
"restapi": "/lights",
"uuid": [
"$address.ext",
"0x01"
],
"items": [
{
"name": "attr/id"
},
{
"name": "attr/lastannounced"
},
{
"name": "attr/lastseen"
},
{
"name": "attr/manufacturername"
},
{
"name": "attr/modelid"
},
{
"name": "attr/name"
},
{
"name": "attr/swversion"
},
{
"name": "attr/type"
},
{
"name": "attr/uniqueid"
},
{
"name": "state/bri",
"refresh.interval": 5,
"read": {
"at": "0x0000",
"cl": "0x0008",
"ep": 0,
"fn": "zcl:attr"
},
"parse": {
"at": "0x0000",
"cl": "0x0008",
"ep": 0,
"eval": "Item.val = Attr.val",
"fn": "zcl:attr"
}
},
{
"name": "state/lift",
"refresh.interval": 300,
"read": {
"at": "0x0008",
"cl": "0x0102",
"ep": 1,
"fn": "zcl:attr"
},
"parse": {
"at": "0x0008",
"cl": "0x0102",
"ep": 1,
"eval": "Item.val = (100-Attr.val)",
"fn": "zcl:attr"
},
"default": 0
},
{
"name": "state/on",
"description": "True when device is on; false when off.",
"refresh.interval": 5,
"read": {
"at": "0x0000",
"cl": "0x0006",
"ep": 0,
"fn": "zcl:attr"
},
"parse": {
"at": "0x0000",
"cl": "0x0006",
"ep": 0,
"eval": "Item.val = Attr.val",
"fn": "zcl:attr"
}
},
{
"name": "state/open",
"read": {
"at": "0x0008",
"cl": "0x0102",
"ep": 1,
"fn": "zcl:attr"
},
"parse": {
"at": "0x0008",
"cl": "0x0102",
"ep": 1,
"eval": "Item.val = Attr.val > 90",
"fn": "zcl:attr"
}
},
{
"name": "state/reachable"
}
]
}
]
} |
Describe the bug
I have several tuya cover switch. It seems that the implementaiton of tuya cover devices is reporting the attribute 0x0008 "Current Position Lift Percentage" using the scale "% open". It seems that Deconz uses for most of it's cover the scale "% close".
A great job has been done implementing these tuya devices (cover was added in ##3134)
I spooted this issue in Home assistant in home-assistant/core#40627
Steps to reproduce the behavior
Expected behavior
@Smanar do you thing that the Deconz logic for "Current Position Lift Percentage" could be applied for tuya covers? I mean start using the scale "% closed".
This could be done by applying something in the code like "Current Position Lift Percentage" =100-(Present Current Position Lift Percentage)
Both me and @Kane610 have made extensive testing on this under #home-assistant/core#40627
In this post ##1121 (comment) @ebaauw explains the logic behind this.
Do you think it's possible to fix it?
Thank you in advance
Screenshots
Environment
deCONZ Logs
Additional context
The text was updated successfully, but these errors were encountered: