dresden-elektronik / deconz-rest-plugin

deCONZ REST-API plugin to control ZigBee devices
BSD 3-Clause "New" or "Revised" License
1.9k stars 502 forks source link

Tuya Zigbee Curtain module QS-Zigbee-C01 #3939

Closed AdrienBigot closed 3 years ago

AdrienBigot commented 3 years ago

Hello,

I bought a zigbee module to automate my roller shutter garage. Unfortunally, deconz mistakenly identified it as a TS130F device ( https://es.aliexpress.com/item/4001190275372.html ). In reallity this is not a switch , it's this :

IMG_20201127_084837

Bought here : https://fr.aliexpress.com/item/1005001530266723.html

I successfully manage to go up and down with the detected TS130F configuration but the problem I encounter is that each time I execute the command to go UP or down, the opening/closing time is only 10 secondes. My roller shutter takes approximatively 30 secondes to Open/close so I have to execute 3 times the opening/closing command.

Device

Screenshots

basic_cluster_info

node_infos

thanks !

Adrien

Mimiix commented 3 years ago

Hi!

Can you provide all screenshots of the clusters?

AdrienBigot commented 3 years ago

Hi,

group

scenes

windows_covering windows_covering_2

Smanar commented 3 years ago

For me it s the normal working mode, you probalby need to calibrate the device, you have the command on the cluster 0x0102, and the instructions on your manual.

There is the same issue somewhere for a covering switch

AdrienBigot commented 3 years ago

Hi @Smanar and thank you for your response.

I discovered this thread that is very close to my problem. https://github.com/dresden-elektronik/deconz-rest-plugin/issues/3134

After setting in the XML file the calibration access to RW I was finally able to calibrate my module !!!!!

<attribute-set id="0xf001" description="Tuya Window Covering Setting">
                        <attribute id="0xf001" name="Calibration" type="enum8" default="0" required="m" access="rw">

I don't know why this setting is in ReadOnly Mode because it is needed for any new/unconfigured module.

Normally, I use Jeedom to control my domotic, and frankly, it's not very easy to setup this essential feature ... Do you know if it would be possible to have this kind of feature (calibration) available with the Jeedom DeCONZ plugin ? (I don't know who are the developpers of this plugin).

Thank you for your support !

Adrien

Smanar commented 3 years ago

They are already in RW mode on the last version, wich one version are using ?

And I m agree with you, so there is an hidden command (not documented yet) to use this feature with the API

PUT, PATCH /api/<apikey>/lights/<id> with {"calibration":true}

AdrienBigot commented 3 years ago

Hello,

I'm using 2.07.00-raspbian-buster-beta package but I just see there is a new revision 2.08.00-raspbian-buster-beta.

Adrien

Smanar commented 3 years ago

Ha yes, the change as done 19 days ago, so it 's recent.

AdrienBigot commented 3 years ago

SO, it'sgood for me. I close this issue. thank you again for your help !

Mimiix commented 3 years ago

@adbig Great:)

Sjonnie2018 commented 3 years ago

Hi All,

I have this device (TS130F) and have read through all the mentioned threads to find out how I can change the close and open times to more then 10 seconds. Frankly, I am stumped with all the technical info and am looking for some guidance so I can get the module to close/open my roller shutters for 40 seconds.

Could somebody please explain to me in simple words how I can get the device to extend the power when opening or closing my shutters?

Working with Deconz (-gui) version 2.07.01

ConBee II firmware version 0x26660700

Thanks a million in advance!

Greetz,

Sjonnie

Smanar commented 3 years ago

Do you still have the manual gived with the device ? I haven't it to make tries, but I think you can do exactly like in the manual except you use deconz GUI to set the "set calibration mode" instead of the app.

Sjonnie2018 commented 3 years ago

Hi Smanar,

Thanks for your reply and support!

I have the manual but it does not give any information about changing the timings for the module. I can not find "set calibration mode" in deconz-gui. Maybe I overlooked. If so, please tell me where I can find it.

Greetz,

Sjonnie

AdrienBigot commented 3 years ago

Hi,

First, you must have the latest version of Deconz because in the previous versions I had to modify the "general.xml" file to allow the switch to calibration mode. This section was in read only mode : <attribute id="0xf001" name="Calibration" type="enum8" default="0" required="m" access="rw">

At the the bottom of this screen you'll see "Calibration : end"

Enjoy, your module is now calibrated because it knows how many times it is needed to open and close :-D

(sorry for my appromative english ...)

Adrien

Sjonnie2018 commented 3 years ago

@adbig : You Sir, are now officially declared Sjonnie's Hero of The Day 2021! :)

Very clear explanation and instructions. Calibrating the module was very easy following your guidance.

Now I can safely order these for my other roller shutters.

One note for future generations: after the last "write" action the device shows "start" in the calibration field. You can remedie that by doing a read of the attributes.

Again Sir: Kudos!

AdrienBigot commented 3 years ago

Glad it helped you !

incognitomailincognitomail commented 3 years ago

@adbig can you explain how to connect to curtain module, I didn't find calibration dialogs in DeconZ plugin And how I can edit general.xml file

see attached files deCONZ configuration

image

Sjonnie2018 commented 3 years ago

You will have to open deconz-gui (in your case: connect to the device in the last screenshot). After that you will find the node in the gui. Select the right most "radio button" on the top right of the node and check the cluster info.

EDIT: just realised you are working from HA. I expect you have Conbee on a Pi. If so, you will have to open the deconz-gui application on the Pi. If you have deconz (not deconz-gui) running you will have to stop that first. Note that you will need a desktop environment. You could use VNC for that. I use the following sequence if I want to switch from deconz to deconz gui:

sudo systemctl stop deconz sudo systemctl enable deconz-gui sudo systemctl start deconz-gui

Give deconz-gui some time to visualize your network. It can take a few minutes depending on your Pi

EDIT 2: Added screenshot image

incognitomailincognitomail commented 3 years ago

@Sjonnie2018 What is Conbee (I have ZigBee cc2531 usb dongle). Can you please send me toturial

Sjonnie2018 commented 3 years ago

Hi, I figured from your screenshot that you had a Conbee (2) stick from Dresden Electronics. I haven't got a clue how to connect Deconz(-GUI) to your cc2531 stick. Sorry! I don't quite understand how and why you would use Deconz if you do not have a device from Dresden Electronics. Maybe I am missing something or do not fully understand you situation. If so, please enlighten me.

The tutorial I used is the one adlbg wrote down in post 8 of this thread.

Mimiix commented 3 years ago

@incognitomailincognitomail deCONZ only works with Conbee / Raspbee. Those are sticks/heads from Dresden-Elektronik, the creator of deCONZ.

incognitomailincognitomail commented 3 years ago

@Mimiix thanks. I can use Conbee stick to calibrate the curtain module only, and after the calibration to use my ZigBee cc2531 usb dongle)

Sjonnie2018 commented 3 years ago

I am a bit stumped here. You have a Conbee II stick to configure the roller shutter module and after that you want to use your cc2531 to control it? If that's the case the information in this particular thread will help you achieve your goal. Connect your Conbee II stick to the device running Deconz (using a USB extension cord) and follow the steps in this thread. Good luck!

Mimiix commented 3 years ago

I am a bit stumped here. You have a Conbee II stick to configure the roller shutter module and after that you want to use your cc2531 to control it? If that's the case the information in this particular thread will help you achieve your goal. Connect your Conbee II stick to the device running Deconz (using a USB extension cord) and follow the steps in this thread. Good luck!

I am wondering if that would work. To pair it to the cc stick he would need to reset the device. Wondering if the device keeps the settings.

Sjonnie2018 commented 3 years ago

I honestly don't have a clue! I wouldn't even bother if I was him and just buy a Conbee II. Not overly expensive and as a bonus he gets support from this community :)

Smanar commented 3 years ago

And for information, if It work, it s possible use the API, if you don't have the GUI PUT, PATCH /api/<apikey>/lights/<id> with {"calibration":true}

incognitomailincognitomail commented 3 years ago

ok thanks for all. Can I calibrate the roller shutter in other way? (without Conbee)

AdrienBigot commented 3 years ago

With the tuya smart life app .... If you Read the doc provided with your module it's explained...

incognitomailincognitomail commented 3 years ago

@adbig can you please send link with the details Additional Q, With smart life I can use my ZigBee cc2531 usb dongle?

Mimiix commented 3 years ago

@incognitomailincognitomail This repository is for deCONZ only. This issue is about the specific device for deCONZ. Keep it on topic here. With teh CC Stick, your kind of on your own.

@adbig Does the device work properly with deCONZ?

AdrienBigot commented 3 years ago

Yes the device works very Fine with decone since monthes.

incognitomailincognitomail commented 3 years ago

Hi

I don't see all modules only "hone Automation configuration tool" @adbig Please advise

image

Smanar commented 3 years ago

Your devices are not included at all. And as your network is new, can be a deconz issue, start from the start, check in phoscon if there is a firmware number, test with USB extension, check logs, checks config, .....

2chilled commented 3 years ago

Hi, using REST API I can activate calibration mode using: curl "http://openhabian:80/api/abc/lights/22" -d '{"calibration":"Start"}' -XPUT

But how can I deactivate it? I've tried setting calibration to "End", but that does not have any effect.

ping @Smanar

Smanar commented 3 years ago

"calibration" work with true and false.

2chilled commented 3 years ago

@Smanar I tried with true and false, but it seems to be still in calibration mode after putting false. This is the sequence I tried:

curl "http://openhabian:80/api/abc/lights/22" -d '{"calibration":true}' -XPUT
curl "http://openhabian:80/api/abc/lights/22/state" -d '{"lift":0}' -XPUT
curl "http://openhabian:80/api/abc/lights/22/state" -d '{"lift":"stop"}' -XPUT
curl "http://openhabian:80/api/abc/lights/22/state" -d '{"lift":100}' -XPUT
curl "http://openhabian:80/api/abc/lights/22/state" -d '{"lift":"stop"}' -XPUT
curl "http://openhabian:80/api/abc/lights/22" -d '{"calibration":false}' -XPUT

The stop commands were issued when the curtain was fully open or closed. After that sequence when setting "lift" to 50, the curtain always goes to end position. What am I missing?

AdrienBigot commented 3 years ago

@Smanar are you sure it is true and false ?

In the XML file I read I read start and stop :

     </attribute-set>
                <attribute-set id="0xf001" description="Tuya Window Covering Setting">
                        <attribute id="0xf001" name="Calibration" type="enum8" default="0" required="m" access="rw">
                                <value name="Start" value="0"></value>
                                <value name="End" value="1"></value>
                        </attribute>
                        <attribute id="0xf002" name="Motor Reversal" type="enum8" default="0" required="m" access="rw">
                                <value name="Off" value="0"></value>
                                <value name="On" value="1"></value>
                        </attribute>
        </attribute-set>

@2chilled why don't you try with Deconz GUI ?

2chilled commented 3 years ago

@AdrienBigot I'm running Conbee2 on a headless raspi without any X libs installed. If calibration can't be done with REST API I'll bite the bullet and change that. I think I need to connect via vnc then?

Smanar commented 3 years ago

Sure, from the code

        qint64 value = 0x00;
        if (map["calibration"].toBool())
        {
            value = 0x01;
        }

So the code send the value 0 or 1 according to True or False (true = 0x01 = End and False = 0x00 = Start, and BTW they are reversed .....) You have not an error message as return when you make the request ?

2chilled commented 3 years ago

@Smanar No, I'm getting 200 response code. I guess your toBool ist not very strict with it's inputs ;)

Ok, does that mean I have to activate calibration with false and deactivate it with true?

2chilled commented 3 years ago

Just tried with switching false to true and vice versa. No change. Device stays in calibration mode as it does not stop moving. Power off and power on leads to the initial state, that is 10 seconds duration until stop. Do I really need to use the GUI for calibrating?

Smanar commented 3 years ago

You have a 200 code, but there is a message too (to confim the value) ? IDK, I have checked the code again, and all seem fine, you haven't access to log ?

AdrienBigot commented 3 years ago

@2chilled I have the same setup as you with a headless Debian buster on a raspberry Pi2 and I use deCONZ gui over ssh.

On the machine running deCONZ :

On your client : ssh -X user@your_server_address. Once you're logged, just launch deCONZ binary (/usr/bin/deCONZ for me). It opens a new windows with your deCONZ GUI :-D (don't try with root user. On my side I must ssh with my "pi" user (who usually also run deconz.service).

Here a screenshot :

deCONZ_over_ssh

Adrien

2chilled commented 3 years ago

@AdrienBigot Thank you very much for that howto! Just realized that I already have all tools in front of my eyes, but I didn't see them. X11Forwarding, that's the key :) My rollerblind works now and calibrating is easy peasy using the GUI. Thanks again, appreciate it :)

AdrienBigot commented 3 years ago

Happy it works for you !

But it's strange that we cannot do the calibration with API. I admit I never try do do it in this way and don't want to reset my working config :-D I know somebody that will buy this device. I'll try to test the calibration with API on my side and will give a feedback here.

Adrien.

2chilled commented 3 years ago

I still have a bunch of these devices to install, I'll try to post API Info requested by @Smanar this evening.

2chilled commented 3 years ago

@Smanar here is the response body:

curl "http://openhabian:80/api/abc/lights/22" -d '{"calibration":true}' -XPUT
[{"success":{"/lights/22/calibration":true}}]

But this does not end calibration mode. Since @AdrienBigot told me how to easily start the GUI I have another verification that this is true.

Smanar commented 3 years ago

But I realy don't understand, all seem fine, can you take a look in log in same time, you are making the request (with aps/info/info_l2)

The synthax is good because it work to enable it, but it s like if (map["calibration"].toBool()) is never trigger, so the value is always 0x00

2chilled commented 3 years ago

I can have a look tomorrow, but where is that log located? I see nothing in journal of deconz systemd unit.

Smanar commented 3 years ago

If you have headless mode, you have only 1 solution, using command line https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/deCONZ-debug-flags

2chilled commented 3 years ago

I have a new issue with this device to report. Sometimes, I don't have a pattern yet, I cannot write the state of the device. I provide a communication flow:

curl "http://192.168.0.207:80/api/2D58761B15/lights/51/state" -XPUT -d'{"lift": 10}'
[{"success":{"/lights/51/state/lift":10}}]

curl "http://192.168.0.207:80/api/2D58761B15/lights/51" | json_pp
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   364  100   364    0     0  72800      0 --:--:-- --:--:-- --:--:-- 72800
{
   "etag" : "95ff636c780d8c1d6751efc547f0b537",
   "hascolor" : false,
   "lastannounced" : null,
   "lastseen" : "2021-10-04T07:38Z",
   "manufacturername" : "_TZ3000_vd43bbfq",
   "modelid" : "TS130F",
   "name" : "Rolladen Wohnzimmer Süd OG 1",
   "state" : {
      "bri" : 0,
      "lift" : 0,
      "on" : false,
      "open" : true,
      "reachable" : true
   },
   "swversion" : null,
   "type" : "Window covering device",
   "uniqueid" : "cc:86:ec:ff:fe:be:71:0a-01"
}

When I hit the manual switch and stop it again, the device is writeable again through Zigbee. Please tell me what info you need in addition to tackle this. Thank you!