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

[Accessory Request] Cover accessory #18

Open
Fannangir opened this issue Jun 19, 2020 · 67 comments
Open

[Accessory Request] Cover accessory #18

Fannangir opened this issue Jun 19, 2020 · 67 comments
Labels
active Should stay opened help wanted Extra attention is needed

Comments

@Fannangir
Copy link

Fannangir commented Jun 19, 2020

Hi,
After moving from vitramirs fork to this one, I receive the following messages:

[TuyaWebPlatform] Could not init class for device type [cover]

My cover devices do not work

@milo526
Copy link
Owner

milo526 commented Jun 25, 2020

Not an exact date but it should not be more than a few days after somebody makes a pull request or sponsors me so I can buy a Tuya cover accessory and create it myself 😄.

Where you able to test if the @next release works for you? So far as that it doesn't crash.

@milo526 milo526 added the bug Something isn't working label Jun 25, 2020
@milo526 milo526 changed the title Device support + Error message [Accessory Request] Cover accessory Jul 4, 2020
@Fannangir
Copy link
Author

Understood. Thought it might help, or at least provide any clue.
Good luck :).

@milo526
Copy link
Owner

milo526 commented Jul 6, 2020

Just receive this data from somebody using the covers, if you yourself have some Tuya cover devices and want support please also drop your device config here!

{
   "header":{
      "code":"SUCCESS",
      "payloadVersion":1
   },
   "payload":{
      "devices":[
         {
            "data":{
               "online":True,
               "state":3,
               "support_stop":True
            },
            "dev_type":"cover",
            "ha_type":"cover",
            "icon":"https://images.tuyaeu.com/smart/product_icon/cl.png",
            "id":"42787240807d3a010626",
            "name":"Curtain2"
         },
         {
            "data":{
               "online":True,
               "state":3,
               "support_stop":True
            },
            "dev_type":"cover",
            "ha_type":"cover",
            "icon":"https://images.tuyaeu.com/smart/product_icon/cl.png",
            "id":"427872402462ab0a7685",
            "name":"Name0"
         },
         {
            "data":{
               "online":True,
               "state":3,
               "support_stop":True
            },
            "dev_type":"cover",
            "ha_type":"cover",
            "icon":"https://images.tuyaeu.com/smart/product_icon/cl.png",
            "id":"42787240807d3a01048c",
            "name":"Name1"
         },
         {
            "data":{
               "online":True,
               "state":3,
               "support_stop":True
            },
            "dev_type":"cover",
            "ha_type":"cover",
            "icon":"https://images.tuyaeu.com/smart/product_icon/cl.png",
            "id":"427872402462ab0aac7e",
            "name":"Name2"
         },
         {
            "data":{
               "online":True,
               "state":3,
               "support_stop":True
            },
            "dev_type":"cover",
            "ha_type":"cover",
            "icon":"https://images.tuyaeu.com/smart/product_icon/cl.png",
            "id":"42787240a4cf12d3be9b",
            "name":"Name3"
         }
      ],
      "scenes":[

      ]
   }
}

@Aekung
Copy link

Aekung commented Jul 9, 2020

Hi,

I posted in another thread but I am posting it here once again for the device config. Hopefully it would help.

{
   "header":{
      "code":"SUCCESS",
      "payloadVersion":1
   },
   "payload":{
      "devices":[
         {
            "data":{
               "online":True,
               "state":3,
               "support_stop":True
            },
            "dev_type":"cover",
            "ha_type":"cover",
            "icon":"https://images.tuyaus.com/smart/product_icon/cl.png",
            "id":"52003233ecfabca9fdce",
            "name":"Window Cover for Front Door"
         },
         {
            "data":{
               "online":True,
               "state":3,
               "support_stop":True
            },
            "dev_type":"cover",
            "ha_type":"cover",
            "icon":"https://images.tuyaus.com/smart/product_icon/cl.png",
            "id":"10670875bcddc2b0e398",
            "name":"Window Cover for Garden"
         },
         {
            "data":{
               "online":True,
               "state":2,
               "support_stop":True
            },
            "dev_type":"cover",
            "ha_type":"cover",
            "icon":"https://images.tuyaus.com/smart/program_category_icon/cl.png",
            "id":"630777045002914b3123",
            "name":"Window Cover for Home Theater"
         }
      ],
      "scenes":[

      ]
   }

Let me know if I missed something or you want me to do something more.

@stale stale bot added the stale This issue has not received any updates for some time. label Jul 23, 2020
@milo526 milo526 removed the stale This issue has not received any updates for some time. label Jul 23, 2020
@milo526 milo526 mentioned this issue Jul 29, 2020
@milo526
Copy link
Owner

milo526 commented Aug 11, 2020

My house still does not have any Tuya cover devices, this makes it hard for me to develop for this accessory. Therefor the first part of this comment still applies 😉.

I hope you understand that the motivation to make something is severely reduced if the creator cannot enjoy the fruits of their labour. Not to say that I will never add support for this device but with the current setup it will take quite some time and I will require a lot of help from people who do have a cover accessory.

@Pelagious
Copy link

I have a cover device that I would be interested in testing for. I would really like to see cover support added. My config is below, (at the moment I'm overriding the default to make it behave as a switch, which is irritating because it is stateless switch and I can't make it stateful)


{
    "bridge": {
        "name": "Homebridge XXXX",
        "username": "xxxxxxx",
        "port": xxxxxx,
        "pin": "xxx-xx-xxx"
    },
    "accessories": [
        {
            "accessory": "SwitchBot",
            "name": "Basement Fan",
            "macAddress": "xxxxxxxxxx",
            "stateLess": false
        },
        {
            "name": "Dummy switch 1",
            "stateful": true,
            "reverse": false,
            "time": 1000,
            "accessory": "DummySwitch"
        }
    ],
    "platforms": [
        {
            "name": "Config",
            "port": 8085,
            "auth": "form",
            "theme": "dark-mode",
            "tempUnits": "f",
            "lang": "auto",
            "platform": "config",
            "sudo": true,
            "log": {
                "method": "native",
                "path": "/var/lib/homebridge/homebridge.log"
            },
            "sessionTimeout": 28800
        },
        {
            "name": "TuyaWebPlatform",
            "options": {
                "username": "xxxxxxxxxx",
                "password": "xxxxxxxxxxx",
                "countryCode": "1",
                "platform": "tuya"
            },
            "defaults": [
                {
                    "id": "xxxxxxxxxxxxxx",
                    "device_type": "switch"
                }
            ],
            "scenes": true,
            "platform": "TuyaWebPlatform"
        }
    ]
}

@milo526
Copy link
Owner

milo526 commented Aug 14, 2020

@Pelagious Hello and thank you for your interest in this plugin, could you please enable debugging in homebridge and upload the debug logs?

@Pelagious
Copy link

Pelagious commented Aug 14, 2020

Sure, operating off of phone. Let me know if I need to repost this properly from a computer for better formatting

[8/14/2020, 11:43:49] [Config] Homebridge restart request received 
[8/14/2020, 11:43:50] [Config] No restart command defined, killing process... 
[8/14/2020, 11:43:50] [HB Supervisor] Stopping services... 
[8/14/2020, 11:43:50] Got SIGTERM, shutting down Homebridge... 
[8/14/2020, 11:43:55] [HB Supervisor] Homebridge Process Ended. Code: 143, Signal: null 
[8/14/2020, 11:44:02] [HB Supervisor] OS: Linux 5.4.51-v7l+ arm 
[8/14/2020, 11:44:02] [HB Supervisor] Node.js v12.18.2 /usr/local/bin/node 
[8/14/2020, 11:44:02] [HB Supervisor] Homebridge Path: /usr/local/lib/node_modules/homebridge/bin/homebridge 
[8/14/2020, 11:44:02] [HB Supervisor] UI Path: /usr/local/lib/node_modules/homebridge-config-ui-x/dist/bin/standalone.js 
[8/14/2020, 11:44:02] [HB Supervisor] Starting Homebridge with extra flags: -I -D 
[8/14/2020, 11:44:02] �[36m[HB Supervisor] Started Homebridge v1.1.2 with PID: xxxx 
[8/14/2020, 11:44:03] Loaded config.json with 2 accessories and 2 platforms. 
[8/14/2020, 11:44:03] --- 
[8/14/2020, 11:44:04] Loaded plugin: homebridge-config-ui-x@4.25.2 
[8/14/2020, 11:44:04] Registering platform 'homebridge-config-ui-x.config' 
[8/14/2020, 11:44:04] --- 
[8/14/2020, 11:44:04] Loaded plugin: homebridge-dummy@0.4.1 
[8/14/2020, 11:44:04] Registering accessory 'homebridge-dummy.DummySwitch' 
[8/14/2020, 11:44:04] --- 
[8/14/2020, 11:44:06] [Config] Homebridge Config UI X v4.25.2 is listening on :: port 8085 
[8/14/2020, 11:44:05] Loaded plugin: homebridge-ifttt@0.4.1 
[8/14/2020, 11:44:05] Registering platform 'homebridge-ifttt.IFTTT' 
[8/14/2020, 11:44:05] --- 
[8/14/2020, 11:44:05] Loaded plugin: homebridge-switchbot-plus@0.2.1 
[8/14/2020, 11:44:05] Plugin 'homebridge-switchbot-plus' tried to register with an incorrect plugin identifier: 'homebridge-switchbot'. Please report this to the developer! 
[8/14/2020, 11:44:05] Registering accessory 'homebridge-switchbot-plus.SwitchBot' 
[8/14/2020, 11:44:05] --- 
[8/14/2020, 11:44:05] Loaded plugin: @milo526/homebridge-tuya-web@0.4.3 
[8/14/2020, 11:44:05] Registering platform '@milo526/homebridge-tuya-web.TuyaWebPlatform' 
[8/14/2020, 11:44:05] --- 
[8/14/2020, 11:44:05] Loading 2 platforms... 
[8/14/2020, 11:44:05] [Config] Initializing config platform... 
[8/14/2020, 11:44:05] [Config] Running in Service Mode 
[8/14/2020, 11:44:05] [TuyaWebPlatform] Initializing TuyaWebPlatform platform... 
[8/14/2020, 11:44:05] [TuyaWebPlatform] Finished initializing platform: TuyaWebPlatform 
[8/14/2020, 11:44:05] Loading 2 accessories... 
[8/14/2020, 11:44:05] [Basement Fan] Initializing SwitchBot accessory... 
[8/14/2020, 11:44:05] [Dummy switch 1] Initializing DummySwitch accessory... 
[8/14/2020, 11:44:05] [Dummy switch 1] Setting switch to true 
[8/14/2020, 11:44:05] [TuyaWebPlatform] Loading accessory from cache: Open the kitchen blinds 
[8/14/2020, 11:44:05] [TuyaWebPlatform] Loading accessory from cache: Close the kitchen blinds 
[8/14/2020, 11:44:05] [TuyaWebPlatform] Loading accessory from cache: Kitchen blinds 
[8/14/2020, 11:44:05] [TuyaWebPlatform] Requesting new token Setup Payload: X-HM://0024IAFNVHE8E Enter this code with your HomeKit app on your iOS device to pair with Homebridge: ┌────────────� │ xxx-xx-xxx │ └────────────┘ 
[8/14/2020, 11:44:05] Homebridge is running on port 51202. 
[8/14/2020, 11:44:06] [TuyaWebPlatform] Sending HTTP GET request to /homeassistant/skill. 
[8/14/2020, 11:44:07] [TuyaWebPlatform] Device type for "Kitchen blinds " is overruled in config to: "scene" 
[8/14/2020, 11:44:07] [TuyaWebPlatform] [Kitchen blinds ] deviceConfig: { data: { support_stop: true, online: true, state: 1 }, name: 'Kitchen blinds ', icon: 'https://images.tuyaus.com/smart/program_category_icon/cl.png', id: '20406812807d3a04b6a0', dev_type: 'scene', ha_type: 'cover' } 
[8/14/2020, 11:44:07] [TuyaWebPlatform] Existing Accessory found [Name: Kitchen blinds ] [Tuya ID: xxxxxxxxxxxxxxxxxxx] [HomeBridge ID: 39d7a6d1-f4e3-4982-8422-6c13acfc1afb] 
[8/14/2020, 11:44:07] [TuyaWebPlatform] [Kitchen blinds ] Characteristic.MomentaryOn - Enabled 
[8/14/2020, 11:44:07] [TuyaWebPlatform] [Open the kitchen blinds ] deviceConfig: { data: {}, name: 'Open the kitchen blinds ', id: 'YZrLjxfJfGRP8a0w', dev_type: 'scene', ha_type: 'scene' } 
[8/14/2020, 11:44:07] [TuyaWebPlatform] Existing Accessory found [Name: Open the kitchen blinds ] [Tuya ID: YZrLjxfJfGRP8a0w] [HomeBridge ID: 208961e4-5dae-4728-a734-5a87014216f1] 
[8/14/2020, 11:44:07] [TuyaWebPlatform] [Open the kitchen blinds ] Characteristic.MomentaryOn - Enabled 
[8/14/2020, 11:44:07] [TuyaWebPlatform] [Close the kitchen blinds ] deviceConfig: { data: {}, name: 'Close the kitchen blinds ', id: 'smq7QNNUAva2mPE2', dev_type: 'scene', ha_type: 'scene' } 
[8/14/2020, 11:44:07] [TuyaWebPlatform] Existing Accessory found [Name: Close the kitchen blinds ] [Tuya ID: smq7QNNUAva2mPE2] [HomeBridge ID: cf40e473-e9a7-4eb4-b823-4dca19d41326] 
[8/14/2020, 11:44:07] [TuyaWebPlatform] [Close the kitchen blinds ] Characteristic.MomentaryOn - Enabled 
[8/14/2020, 11:44:15] 

Repository owner deleted a comment from Fannangir Aug 14, 2020
Repository owner deleted a comment from NamelessPharaoh Aug 14, 2020
Repository owner deleted a comment from stale bot Aug 14, 2020
Repository owner deleted a comment from Fannangir Aug 14, 2020
Repository owner deleted a comment from Fannangir Aug 14, 2020
Repository owner deleted a comment from mbierman Aug 14, 2020
Repository owner deleted a comment from Faisalthe01 Aug 14, 2020
Repository owner deleted a comment from Fannangir Aug 14, 2020
@Pelagious
Copy link

Let me know if you need me to do config changes. I'm currently running the blinds as a switch-scene and imported the tuya scenes for opening and closing the blinds, since for whatever reason, when I override the blinds from a cover to a switch it is irritatingly stateless. Which really ruins a lot of automations

Repository owner deleted a comment from costispavlou Aug 19, 2020
Repository owner deleted a comment from costispavlou Aug 19, 2020
Repository owner deleted a comment from costispavlou Aug 19, 2020
Repository owner deleted a comment from costispavlou Aug 19, 2020
@milo526 milo526 added new device Request to add support for a new device and removed bug Something isn't working labels Aug 29, 2020
@milo526
Copy link
Owner

milo526 commented Dec 20, 2020

Don't expect the ability to open a certain percentage to be available anytime soon, this is not supported by the API updating the plugin to support this will require a significant amount of time sadly.

I was already afraid you'd say that. Looked at the code myself, and saw no real "quick" approach in implementing it.

Yeah what I suspect to be the best way would be - allow users to define how many seconds it takes to open or close. And based on the percentage (or difference in percentage) perform the open (or close) action for a certain amount of time.

Which is freaking ugly

@costispavlou
Copy link

i'll wait until you roll the update out, since i'm using hoobs.
also as regard the % open / close, yeah that'd be great. why would that be ugly? I mean, it's up to the user from there on.

@bwp91
Copy link

bwp91 commented Dec 20, 2020

Don't expect the ability to open a certain percentage to be available anytime soon, this is not supported by the API updating the plugin to support this will require a significant amount of time sadly.

I was already afraid you'd say that. Looked at the code myself, and saw no real "quick" approach in implementing it.

Yeah what I suspect to be the best way would be - allow users to define how many seconds it takes to open or close. And based on the percentage (or difference in percentage) perform the open (or close) action for a certain amount of time.

Which is freaking ugly

i have implemented this ugly method in my ewelink plugin. if you wanted some code 😅

@milo526
Copy link
Owner

milo526 commented Dec 20, 2020

i'll wait until you roll the update out, since i'm using hoobs.
also as regard the % open / close, yeah that'd be great. why would that be ugly? I mean, it's up to the user from there on.

Yeah it's up to the user from there on.
This whole plugin is a giant mess 🙈.

And one way or another the questions always end up here 😛 and I am mostly the one to answer them and fix the issues.

The proposed solution is very wonky at best, I suspect that it will trigger a lot of errors, bugs, unhappy users.

I'd rather take the "Apple approach" of giving the users a little less flexibility but a better experience.

@costispavlou
Copy link

i get that, but you could add the implementation and let the user play with it a bit. i mean how bad can it be i.e. 0 (infinite) seconds up / 0 seconds down as default and can be edited in the plugins settings if needed.

lastly when are you planning to roll the update? today? tomorrow ? no rush, just asking.

@josephpoon0506
Copy link

It works like a charm 😍, for both types of my cover.
I noted that it doesn't support a percentage opening so it is either fully open or close.

Great to hear!

Yeah currently it is only open or close.

Hopefully soon I will be able to add the "stop" option. that should enable you to stop it halfway through opening and/or closing.

Don't expect the ability to open a certain percentage to be available anytime soon, this is not supported by the API updating the plugin to support this will require a significant amount of time sadly.

@milo526, Thank you for your effort, but my curtain still not work. it show the below error message. it still not able to get the currect position status. Or

[12/21/2020, 7:55:39 AM] [TuyaWebPlatform] [窗簾] - Unsetting debouncedDeviceStateRequestPromise
[12/21/2020, 7:55:39 AM] [TuyaWebPlatform] [窗簾] - Resolving resolveDeviceStateRequest from cache
[12/21/2020, 7:55:39 AM] [TuyaWebPlatform] [窗簾] Characteristic.CurrentPosition - [GET] undefined
[12/21/2020, 7:55:39 AM] [TuyaWebPlatform] [窗簾] Characteristic.CurrentPosition - Updating value { online: true }
[12/21/2020, 7:55:39 AM] [TuyaWebPlatform] [窗簾] Characteristic.CurrentPosition - Unexpected state value provided: undefined
[12/21/2020, 7:55:39 AM] [TuyaWebPlatform] [窗簾] Characteristic.TargetPosition - [GET] undefined
[12/21/2020, 7:55:39 AM] [TuyaWebPlatform] [窗簾] Characteristic.TargetPosition - Unexpected state value provided: undefined
[12/21/2020, 7:55:39 AM] [TuyaWebPlatform] [細窗簾] - Unsetting debouncedDeviceStateRequestPromise
[12/21/2020, 7:55:39 AM] [TuyaWebPlatform] [細窗簾] - Resolving resolveDeviceStateRequest from cache
[12/21/2020, 7:55:39 AM] [TuyaWebPlatform] [細窗簾] Characteristic.CurrentPosition - [GET] undefined
[12/21/2020, 7:55:39 AM] [TuyaWebPlatform] [細窗簾] Characteristic.CurrentPosition - Updating value { online: true }
[12/21/2020, 7:55:39 AM] [TuyaWebPlatform] [細窗簾] Characteristic.CurrentPosition - Unexpected state value provided: undefined
[12/21/2020, 7:55:39 AM] [TuyaWebPlatform] [細窗簾] Characteristic.TargetPosition - [GET] undefined
[12/21/2020, 7:55:39 AM] [TuyaWebPlatform] [細窗簾] Characteristic.TargetPosition - Unexpected state value provided: undefined
[12/21/2020, 7:55:39 AM] [TuyaWebPlatform] [大窗簾] - Unsetting debouncedDeviceStateRequestPromise
[12/21/2020, 7:55:39 AM] [TuyaWebPlatform] [大窗簾] - Resolving resolveDeviceStateRequest from cache
[12/21/2020, 7:55:39 AM] [TuyaWebPlatform] [大窗簾] Characteristic.TargetPosition - [GET] undefined
[12/21/2020, 7:55:39 AM] [TuyaWebPlatform] [大窗簾] Characteristic.TargetPosition - Unexpected state value provided: undefined
[12/21/2020, 7:55:39 AM] [TuyaWebPlatform] [大窗簾] Characteristic.CurrentPosition - [GET] undefined
[12/21/2020, 7:55:39 AM] [TuyaWebPlatform] [大窗簾] Characteristic.CurrentPosition - Updating value { online: true }
[12/21/2020, 7:55:39 AM] [TuyaWebPlatform] [大窗簾] Characteristic.CurrentPosition - Unexpected state value provided: undefined
[12/21/2020, 7:55:39 AM] [TuyaWebPlatform] [窗簾] - Unsetting debouncedDeviceStateRequestPromise
[12/21/2020, 7:55:39 AM] [TuyaWebPlatform] [窗簾] - Resolving resolveDeviceStateRequest from cache
[12/21/2020, 7:55:39 AM] [TuyaWebPlatform] [窗簾] Characteristic.TargetPosition - [GET] undefined
[12/21/2020, 7:55:39 AM] [TuyaWebPlatform] [窗簾] Characteristic.TargetPosition - Unexpected state value provided: undefined
[12/21/2020, 7:55:39 AM] [TuyaWebPlatform] [窗簾] Characteristic.CurrentPosition - [GET] undefined
[12/21/2020, 7:55:39 AM] [TuyaWebPlatform] [窗簾] Characteristic.CurrentPosition - Updating value { online: true }
[12/21/2020, 7:55:39 AM] [TuyaWebPlatform] [窗簾] Characteristic.CurrentPosition - Unexpected state value provided: undefined

@ksxi2
Copy link

ksxi2 commented Dec 22, 2020

Cover works on 0.6.3! Only have the option to open and close the cover. Would love to have the option to open the cover half way or something like that! Any possibility? The Tuya app has the option, I think the Home Assistant thing had the option, although idk if the API has it

@costispavlou
Copy link

@milo526 can you let me know when you're planning to update the plugin on hoobs? still shows the 0.4.8 as of today

@milo526
Copy link
Owner

milo526 commented Dec 22, 2020

Cover works on 0.6.3! Only have the option to open and close the cover. Would love to have the option to open the cover half way or something like that! Any possibility? The Tuya app has the option, I think the Home Assistant thing had the option, although idk if the API has it

Please read the rest of this thread 😉 We already discussed that this is unlikely to happen soon.

@costispavlou there is no reason to ask this so often. Please remember that I am working on this alone, voluntarily, in my free time. But just so you know, it was just release, it will probably take a day to show up in hoobs.

@ksxi2
Copy link

ksxi2 commented Dec 22, 2020

Please read the rest of this thread 😉 We already discussed that this is unlikely to happen soon.

My bad, thank you! I appreciate you working on this plugin!

@costispavlou
Copy link

@milo526 apologies if my comment sounded pushy. I was only wondering. I know and appreciate the effort you've put in this.

@sybrendotinga
Copy link

sybrendotinga commented Dec 22, 2020

Yeah what I suspect to be the best way would be - allow users to define how many seconds it takes to open or close. And based on the percentage (or difference in percentage) perform the open (or close) action for a certain amount of time.

Which is freaking ugly

I haven't really looked into the API (can't find any documentation), but I know that I had to update the 'schedule time', because my cover wasn't opening all the way.

image

Maybe you can use this value to determine how far 50% is? I don't think you can fetch the current percentage from the API, right?

If you have any documentation, can you share it? Maybe I can help you looking in to it.

@milo526
Copy link
Owner

milo526 commented Dec 22, 2020

I see that there is some unclarity here and that is partly on me for not being clear myself.

I will not add support for opening a window a certain percentage anytime soon.

This is mainly because it is very hard for me to actually test this since I do not own any of these Tuya-based window coverings.
This is partly because I have strong reason to suspect that this feature will be less than elegant at best and will trigger a lot of extra issues. I do not wish these upon me right now.

If somebody else wishes to work on this (@sybrendotinga ?) please feel welcome.
This would probably require changes to currentPosition.ts and to targetPosition.ts.

The closest thing to "documentation" is the PaulAnnekov/tuyaha repository. It has a python implementation for this API. It is also used by the Home Assistant integration. From there you should take a look at the cover.py class.

@sybrendotinga
Copy link

I tried to fork your repo this summer and tried to implement it myself, but I got stuck at the same things as you: bad documentation and I expected a lot of (external influenced) issues/side-effects based on the "time to open" solution.

@milo526 milo526 removed good first issue Good for newcomers new device Request to add support for a new device labels Dec 22, 2020
@milo526
Copy link
Owner

milo526 commented Dec 27, 2020

there might be a way to get percentage based open and close to work since somebody might be willing to sponsor me a curtain device.

For the ones of you that see support_stop: True in their output above, could you please let me know the make and model (and preferably a direct link to where you purchased it)

This way I can hopefully buy such a device that has the required characteristics.

@sybrendotinga
Copy link

sybrendotinga commented Dec 28, 2020

there might be a way to get percentage based open and close to work since somebody might be willing to sponsor me a curtain device.

For the ones of you that see support_stop: True in their output above, could you please let me know the make and model (and preferably a direct link to where you purchased it)

This way I can hopefully buy such a device that has the required characteristics.

How/where can I receive this information?

Is it this script?
https://github.com/milo526/homebridge-tuya-web

@milo526
Copy link
Owner

milo526 commented Dec 28, 2020

@sybrendotinga
Copy link

Thanks @milo526, hopefully this helps:

{
   "header":{
      "code":"SUCCESS",
      "payloadVersion":1
   },
   "payload":{
      "devices":[
         {
            "data":{
               "brightness":"255",
               "color_temp":5482,
               "online":True,
               "state":"false"
            },
            "dev_type":"light",
            "ha_type":"light",
            "icon":"https://images.tuyaeu.com/smart/icon/ay1541056239985fDGjj/15620320506d600f63b54.png",
            "id":"15680460c44f33a60b25",
            "name":"LED SMART Schutting"
         },
         {
            "data":{
               "brightness":"255",
               "color_temp":5482,
               "online":True,
               "state":"false"
            },
            "dev_type":"light",
            "ha_type":"light",
            "icon":"https://images.tuyaeu.com/smart/icon/ay1541056239985fDGjj/15620320506d600f63b54.png",
            "id":"15680460c44f33a5d2f8",
            "name":"LED SMART Poort"
         },
         {
            "data":{
               "online":True,
               "state":3,
               "support_stop":True
            },
            "dev_type":"cover",
            "ha_type":"cover",
            "icon":"https://images.tuyaeu.com/smart/icon/ay1509430484182dhmed/158372064901fba692f5f.png",
            "id":"bfb7e198ec8aa592e4xqyr",
            "name":"Zonnescherm"
         },
         {
            "data":{
               "brightness":"255",
               "color_temp":5482,
               "online":False,
               "state":"false"
            },
            "dev_type":"light",
            "ha_type":"light",
            "icon":"https://images.tuyaeu.com/smart/icon/ay1541056239985fDGjj/15620320506d600f63b54.png",
            "id":"15680460c44f33a7018e",
            "name":"LED SMART Achterin"
         }
      ],
      "scenes":[
         
      ]
   }
}

Maybe you can share your thoughts so we can discuss your solution.

@milo526
Copy link
Owner

milo526 commented Dec 29, 2020

So @sybrendotinga your device does support the stop functionality (The "Zonnescherm" device), could you post a link to the device that you use? So I can also buy it and ensure that I have a device with the proper functionality.

@sybrendotinga
Copy link

So @sybrendotinga your device does support the stop functionality (The "Zonnescherm" device), could you post a link to the device that you use? So I can also buy it and ensure that I have a device with the proper functionality.

I would not recommend that ;-) It is to control my sunscreen ;-)
https://nl.aliexpress.com/item/32963064005.html

Maybe @Pelagious, @taaa22 or @Aekung can share theirs?

@milo526
Copy link
Owner

milo526 commented Dec 30, 2020

Stop functionality is now tracked in #145
Percentage based open is now tracked in #148

If you are interested in either, please subscribe to the relevant issues.

For some users there is a bug in which the curtains are in a opening or closing state.
This is a bug and is tracked in #143

@taaa22
Copy link

taaa22 commented Jan 1, 2021

So @sybrendotinga your device does support the stop functionality (The "Zonnescherm" device), could you post a link to the device that you use? So I can also buy it and ensure that I have a device with the proper functionality.

I would not recommend that ;-) It is to control my sunscreen ;-)
https://nl.aliexpress.com/item/32963064005.html

Maybe @Pelagious, @taaa22 or @Aekung can share theirs?

Smart Automatic Curtain Motor Track System
Smart Motorized Chain Roller Blinds

@bSr43
Copy link

bSr43 commented Jan 4, 2021

Hello,

Thank you for the plugin. I'm new to HomeBridge, so please forgive me if I've done anything wrong.
I have a bunch of cover accessories from Konyks.

I've successfully installed HomeBridge and your plugin, the accessories have been discovered and they appear in HomeKit on my iDevices.

The problem I have is that the status shown in the Home application is not always correct.

In fact, after looking at the logs and the code (I'm not Typescript fluent, sorry about that…) it appears that the status of the accessories is updated by requesting their state from the cloud. The state can be either 1, 2 or 3 on this accessory. But if I understand the code of targetPosition.ts correctly, you assume that the state 1 means "opened", state 2 is "half opened" and state 3 is "closed". But from my experience, the state variable returned by the cloud server reflects the cover motor state, if it is currently active or not, and its direction; the states are 1 for "motor is active, and cover is opening", 2 for "motor is active, and cover is closing" and 3 for "motor is stopped". The state of the cover itself is not returned by the accessory, only the state of the motor is.

This is why, even if my covers are open, their states turn to "closed" after a few minutes, because the motor is stopped (state 3) and the plugin thinks that the cover is closed.

@milo526
Copy link
Owner

milo526 commented Jan 4, 2021

Thanks for that update @bSr43, this is exactly the issue with me not yet owning one of these devices 😛.
The previous api output suggested that the state was used to indicate if a window is opened or not.
Your explanation seems to fit in with the bug described in #143.
Could you confirm that the API output is identical on all accounts when your cover accessories are fully opened and fully closed.

@bSr43
Copy link

bSr43 commented Jan 4, 2021

I have used the debug_discovery.py tool and the JSON looks like that:

{
    "header": {
        "code": "SUCCESS",
        "payloadVersion": 1
    },
    "payload": {
        "devices": [
            {
                "data": {
                    "online": true,
                    "state": 3,
                    "support_stop": true
                },
                "dev_type": "cover",
                "ha_type": "cover",
                "icon": "https://images.tuyaeu.com/smart/icon/ay1518345874298thrlS/157594986436cfb8dfee1.jpg",
                "id": "xxxxxxxxxxxxxxxxxxxx",
                "name": "Volet baie vitrée 1"
            },
            {
                "data": {
                    "online": true,
                    "state": 3,
                    "support_stop": true
                },
                "dev_type": "cover",
                "ha_type": "cover",
                "icon": "https://images.tuyaeu.com/smart/icon/ay1518345874298thrlS/157594986436cfb8dfee1.jpg",
                "id": "xxxxxxxxxxxxxxxxxxxx",
                "name": "Volet cellier"
            },
            {
                "data": {
                    "online": true,
                    "state": 3,
                    "support_stop": true
                },
                "dev_type": "cover",
                "ha_type": "cover",
                "icon": "https://images.tuyaeu.com/smart/icon/ay1518345874298thrlS/157594986436cfb8dfee1.jpg",
                "id": "xxxxxxxxxxxxxxxxxxxx",
                "name": "Volet salon 2"
            },
            {
                "data": {
                    "online": true,
                    "state": 3,
                    "support_stop": true
                },
                "dev_type": "cover",
                "ha_type": "cover",
                "icon": "https://images.tuyaeu.com/smart/icon/ay1518345874298thrlS/157594986436cfb8dfee1.jpg",
                "id": "xxxxxxxxxxxxxxxxxxxx",
                "name": "Volet cuisine"
            },
            {
                "data": {
                    "online": true,
                    "state": 3,
                    "support_stop": true
                },
                "dev_type": "cover",
                "ha_type": "cover",
                "icon": "https://images.tuyaeu.com/smart/icon/ay1518345874298thrlS/157594986436cfb8dfee1.jpg",
                "id": "xxxxxxxxxxxxxxxxxxxx",
                "name": "Volet salon 1"
            },
            {
                "data": {
                    "online": true,
                    "state": 3,
                    "support_stop": true
                },
                "dev_type": "cover",
                "ha_type": "cover",
                "icon": "https://images.tuyaeu.com/smart/icon/ay1518345874298thrlS/157594986436cfb8dfee1.jpg",
                "id": "xxxxxxxxxxxxxxxxxxxx",
                "name": "Volet baie vitrée 2"
            },
            {
                "data": {
                    "online": true,
                    "state": 3,
                    "support_stop": true
                },
                "dev_type": "cover",
                "ha_type": "cover",
                "icon": "https://images.tuyaeu.com/smart/icon/ay1518345874298thrlS/157594986436cfb8dfee1.jpg",
                "id": "xxxxxxxxxxxxxxxxxxxx",
                "name": "Volet bureau"
            }
        ],
        "scenes": []
    }
}

When I have generated the JSON, some covers were opened, others were closed. But every cover has the state "3" because the motor was not running. When I start the motor by using the physical switch, the state is updated accordingly to my previous explanation, ie when the cover is opening (until the motor stops), the state is "1", and when the cover is closing, the state is "2". As soon as I hear the click which indicated that the cover switch has finished its work, the state is "3".

I really appreciate the time you are spending on this project, and cannot even imagine how hard it could be to write support for something you don't even own! Thank you for that!

@milo526
Copy link
Owner

milo526 commented Jan 4, 2021

I just release a pre-release with some improvements for cover devices.
You can now also overwrite your window covering to a window.
This will enable some extra security features (I believe your phone needs to be unlocked in order to open a window), it will give you notifications on open/close and it gives you some shiny new icons.

How to install a pre-release version.
Logically do this for the @milo526/homebridge-tuya-web or TuyaWebPlatform plugin.
You should be able to install version v0.8.0-0.
Please let me know how that works for you!

@taaa22
Copy link

taaa22 commented Jan 5, 2021

I just release a pre-release with some improvements for cover devices.

You can now also overwrite your window covering to a window.

This will enable some extra security features (I believe your phone needs to be unlocked in order to open a window), it will give you notifications on open/close and it gives you some shiny new icons.

How to install a pre-release version.

Logically do this for the @milo526/homebridge-tuya-web or TuyaWebPlatform plugin.

You should be able to install version v0.8.0-0.

Please let me know how that works for you!

Thank you for this update.

  • Hold position for covers(Not working)
  • Allow overwriting devices to Window type (Working with the same reporting cover state issue)
  • Wrongly reported cover state (Still not fixed)

@milo526
Copy link
Owner

milo526 commented Jan 30, 2021

@taaa22 please see my response in #145 with regards to the stop option.
In short, the Home.app has no support for this functionality, third party apps might. I have confirmed it working using the Eve app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
active Should stay opened help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests