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

Support for time-based positioned cover controllers #59

Open
darth-aragoth opened this issue Apr 18, 2023 · 8 comments
Open

Support for time-based positioned cover controllers #59

darth-aragoth opened this issue Apr 18, 2023 · 8 comments

Comments

@darth-aragoth
Copy link

Please add support for time-based positioning in cover controllers.

My cover controllers have only one DP with value 1, 2 or 3 (move up, move down, stop, I don't know in what order). In config I have time-based positioning mode and "1_2_3" command set - that works fine with rospogrigio's localtuya version. At the beginning, I had to measure time needed to full-close each cover.

In config.yaml:

  - host: x.x.x.x
    device_id: xxx
    local_key: xxx
    friendly_name: Roleta 1
    protocol_version: "3.3"
    entities:
      - platform: cover
        friendly_name: Roleta 1
        id: 1
        commands_set: "1_2_3"
        positioning_mode: "timed"
        span_time: 20.8

In SmartLife config:

	"activeTime": 1623492697,
	"devId": "xxx",
	"displayOrder": 0,
	"dpMaxTime": 1679332060540,
	"dps": {
		"1": "3"
	},
	"errorCode": 0,
	"iconUrl": "https://images.tuyaeu.com/smart/icon/15524566468s3d5rsnldv_0.png",
	"isShare": false,
	"key": "xxx",
	"lat": "xxx",
	"localKey": "xxx",
	"lon": "xxx",
	"moduleMap": {
		"mcu": {
			"cadv": "",
			"isOnline": true,
			"verSw": "1.0.2"
		},
		"wifi": {
			"bv": "5.56",
			"cadv": "",
			"isOnline": true,
			"pv": "2.2",
			"verSw": "1.0.2"
		}
	},
	"name": "Rolety parter - sypialnia",
	"productId": "xxx",
	"resptime": 0,
	"runtimeEnv": "prod",
	"timezoneId": "Europe/Warsaw",
	"uuid": "xxx",
	"virtual": false

My cover controllers are similar to the one in the picture:

image

They only control the motor that raises and lowers the cover, but they have no feedback about the position of the cover, so it has to be time-controlled.

@leeyuentuen
Copy link
Owner

maybe check the value in tuya iot. so we can see which commands are allowed to send to that tuya device

@darth-aragoth
Copy link
Author

Could you tell me please, where exactly can I find it? I'm searching Tuya IOT but I locate it.

@leeyuentuen
Copy link
Owner

https://iot.tuya.com/
Cloud -> api explorer
then see screenshot below:
general device capabilities -> general device management -> get device specification
image

search for your device_id

OR
see screenshot below to get the dps:
general device capabilities -> smart home device system-> device control -> Get device specification
and search for the device id

image

@darth-aragoth
Copy link
Author

I checked there, but there are no functions:

{
  "result": {
    "category": "clkg",
    "functions": [],
    "status": []
  },
  "success": true,
  "t": 1681826952504,
  "tid": "9842cdd3ddf211edb86062d11cecfbc6"
}

image

I'm sure that possible values for my controllers are 1, 2 and 3. I can't discover, which value means lowering and raising, probably 3 means 'stop'. Maybe you can find it in rospogrigio's integration? There were also other command sets (open_close_stop) for other controller models:

      - platform: cover
        friendly_name: Device Cover
        id: 2
        commands_set: # Optional, default: "on_off_stop"
            ["on_off_stop","open_close_stop","fz_zz_stop","1_2_3"]
        positioning_mode: ["none","position","timed"] # Optional, default: "none"
        currpos_dp: 3 # Optional, required only for "position" mode
        setpos_dp: 4  # Optional, required only for "position" mode
        position_inverted: [True,False] # Optional, default: False
        span_time: 25 # Full movement time: Optional, required only for "timed" mode

@darth-aragoth
Copy link
Author

Hello, are there any news in adding support for these covers? I noticed that the covers can now be controlled (they open and close), but every time I open or close the cover I get the "set_position_dp" error. So maybe it would be simpler to start by directly controlling these covers, without setting the desired position?

@leeyuentuen
Copy link
Owner

I've just done a quick lock, i think your parameters aren't correctly
these are the value for the cover

CONF_COMMANDS_SET = "commands_set"
CONF_POSITIONING_MODE = "positioning_mode"
CONF_CURRENT_POSITION_DP = "current_position_dp"
CONF_SET_POSITION_DP = "set_position_dp"
CONF_POSITION_INVERTED = "position_inverted"
CONF_SPAN_TIME = "span_time"

so your config should be like this

     - platform: cover
        friendly_name: Device Cover
        id: 2
        commands_set: # Optional, default: "on_off_stop"
            ["on_off_stop","open_close_stop","fz_zz_stop","1_2_3"]
        positioning_mode: ["none","position","timed"] # Optional, default: "none"
        current_position_dp: 3 # Optional, required only for "position" mode
        set_position_dp: 4  # Optional, required only for "position" mode
        position_inverted: [True,False] # Optional, default: False
        span_time: 25 # Full movement time: Optional, required only for "timed" mode

your current_position_dp and set_position_dp was not set correctly

@darth-aragoth
Copy link
Author

No, my config is correct. My cover controllers have 'timed' positioning and doesn't have 'current position' and 'set position' DP's. As you can see, these DPs are required only for 'position' mode - there are controllers, that can directly set cover position. My can't, I need to provide span_time in configuration, so HA knows, how long it should take to set desired cover position - cover position is shomehow calculated.

Everything works fine in rospogrigio's integration. At the beginning, there were also problems with this controllers, but then 'timed' positioning was added and controllers started to work.

Please see this issue:
rospogrigio#105 (comment)
rospogrigio#103

@darth-aragoth
Copy link
Author

Hi @leeyuentuen, did you manage to check the possibility of controlling covers with timed positioning?

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

No branches or pull requests

2 participants