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

Stop command doesn't work for some cover devices #204

Closed
iMicknl opened this issue Aug 5, 2020 · 23 comments · Fixed by #251
Closed

Stop command doesn't work for some cover devices #204

iMicknl opened this issue Aug 5, 2020 · 23 comments · Fixed by #251
Labels
bug Something isn't working platform: cover

Comments

@iMicknl
Copy link
Owner

iMicknl commented Aug 5, 2020

Describe the bug
Currently the cover implementation relies on the available commands of a cover device. However, when a stop command is present, it doesn't mean that the stop command is functional. (thanks Somfy 👍🏻)

async def async_stop_cover(self, **_):
"""Stop the cover."""
await self.async_execute_command(
self.select_command(COMMAND_STOP, COMMAND_STOP_IDENTIFY, COMMAND_MY)
)

To Reproduce
Steps to reproduce the behavior:

  1. Open or close cover
  2. Press stop button
  3. Cover device doesn't stop moving

Additional context
The integration is not consistent in how it handles a stop command. For example, for the cover_tilt mainly used by Pergolas, we first execute COMMAND_STOP_IDENTIFY since STOP didn't work for my own device...

async def async_stop_cover_tilt(self, **_):
"""Stop the cover."""
await self.async_execute_command(
self.select_command(COMMAND_STOP_IDENTIFY, COMMAND_STOP, COMMAND_MY)
)

Best would be to:

First use COMMAND_STOP_IDENTIFY or COMMAND_MY to stop a moving cover. This needs to be thoroughly tested to ensure it doesn't cause problems with covers that are not experiencing this issue.

OR

Make sure entities can set their preferred stop method via customize.yaml, as a workaround. I am not a fan of having all those device specific if statements in the integration.

Environment (please complete the following information):

  • Platform: cover

Device: (if your problem is related to a specific device)

@iMicknl
Copy link
Owner Author

iMicknl commented Aug 22, 2020

I found out that stopping the opening of the slats via tahomalink.com doesn't send the stop command for the io:SimpleBioclimaticPergolaIOComponent, but it cancels the execution via the DELETE request...

Even though stop, stopIdentify and my are available, they don't work like they should.

stop doesn't stop the slats moving
stopIdentify does stop the slats moving, however it doesn't stop in a natural way, it moves the slats a few times both sides until it stops. This doesn't look
my doesn't stop the slats moving

{
	"commands": [{
		"commandName": "closeSlats",
		"nparams": 0
	}, {
		"commandName": "delayedStopIdentify",
		"nparams": 1
	}, {
		"commandName": "getName",
		"nparams": 0
	}, {
		"commandName": "identify",
		"nparams": 0
	}, {
		"commandName": "openSlats",
		"nparams": 0
	}, {
		"commandName": "refreshMemorized1Orientation",
		"nparams": 0
	}, {
		"commandName": "setMemorized1Orientation",
		"nparams": 1
	}, {
		"commandName": "setName",
		"nparams": 1
	}, {
		"commandName": "setSecuredOrientation",
		"nparams": 1
	}, {
		"commandName": "setOrientation",
		"nparams": 1
	}, {
		"commandName": "startIdentify",
		"nparams": 0
	}, {
		"commandName": "stop",
		"nparams": 0
	}, {
		"commandName": "stopIdentify",
		"nparams": 0
	}, {
		"commandName": "wink",
		"nparams": 1
	}, {
		"commandName": "pairOneWayController",
		"nparams": 2
	}, {
		"commandName": "unpairAllOneWayControllers",
		"nparams": 0
	}, {
		"commandName": "unpairOneWayController",
		"nparams": 2
	}],
	"states": [{
		"values": ["good", "low", "normal", "verylow"],
		"type": "DiscreteState",
		"qualifiedName": "core:DiscreteRSSILevelState"
	}, {
		"type": "ContinuousState",
		"qualifiedName": "core:Memorized1OrientationState"
	}, {
		"type": "DataState",
		"qualifiedName": "core:NameState"
	}, {
		"type": "ContinuousState",
		"qualifiedName": "core:PriorityLockTimerState"
	}, {
		"type": "ContinuousState",
		"qualifiedName": "core:RSSILevelState"
	}, {
		"type": "ContinuousState",
		"qualifiedName": "core:SecuredOrientationState"
	}, {
		"values": ["closed", "open"],
		"type": "DiscreteState",
		"qualifiedName": "core:SlatsOpenClosedState"
	}, {
		"type": "ContinuousState",
		"qualifiedName": "core:SlatsOrientationState"
	}, {
		"values": ["available", "unavailable"],
		"type": "DiscreteState",
		"qualifiedName": "core:StatusState"
	}, {
		"values": ["comfortLevel1", "comfortLevel2", "comfortLevel3", "comfortLevel4", "environmentProtection", "humanProtection", "userLevel1", "userLevel2"],
		"type": "DiscreteState",
		"qualifiedName": "io:PriorityLockLevelState"
	}, {
		"values": ["LSC", "SAAC", "SFC", "UPS", "externalGateway", "localUser", "myself", "rain", "security", "temperature", "timer", "user", "wind"],
		"type": "DiscreteState",
		"qualifiedName": "io:PriorityLockOriginatorState"
	}],
	"dataProperties": [{
		"value": "500",
		"qualifiedName": "core:identifyInterval"
	}],
	"widgetName": "BioclimaticPergola",
	"uiClass": "Pergola",
	"qualifiedName": "io:SimpleBioclimaticPergolaIOComponent",
	"type": "ACTUATOR"
}

@Glenn1986
Copy link

@iMicknl can I help with testing for this problem. I have RTS roller shutters and the stop command doesn't work?

@iMicknl
Copy link
Owner Author

iMicknl commented Sep 1, 2020

@Glenn1986 are you familiar with Developer Tools in your browser? Could you capture which XHR requests happen when you open the cover and cancel the command?

@Glenn1986
Copy link

Oke I will try, do you mean the xhr request in home assistant or in tahomalink? I think the last one but want to be sure ;)

@vlebourl
Copy link
Collaborator

vlebourl commented Sep 1, 2020

yes tahomalink!

@Glenn1986
Copy link

Glenn1986 commented Sep 2, 2020

Hope this information helps you guys
{execution: {eventTime: 1599025157127, owner: "xxxxxx", source: "mobile:mobile",…}}
execution: {eventTime: 1599025157127, owner: "xxxx", source: "mobile:mobile",…}
commands: [,…]
0: {deviceURL: "xxxx", command: "close", parameters: [], rank: 0, dynamic: false,…}
command: "close"
deviceURL: "xxxx"
dynamic: false
failureType: "CMDCANCELLED"
parameters: []
rank: 0
state: "FAILED"
duration: 7825
effectiveStartTime: 1599025157127
endTime: 1599025164952
eventTime: 1599025157127
executionSubType: "MANUAL_CONTROL"
executionType: "Immediate execution"
failureType: "CMDCANCELLED"
id: "xxxx"
label: "Slaapkamer 3.1 - Sluiten - TaHoma PC"
owner: "xxxx"
source: "mobile:mobile"
state: "FAILED"
type: "Immediate execution - MANUAL_CONTROL"

@iMicknl
Copy link
Owner Author

iMicknl commented Sep 2, 2020

Thanks @Glenn1986. Could you have a look if the previous request is a DELETE request? I will start working on it this weekend probably, so will soon have a version to test.

@Glenn1986
Copy link

Request URL: https://www.tahomalink.com/enduser-mobile-web/enduserAPI/exec/current/setup/4e440f95-ac10-3e01-2775-8dbb10e9de74
Request Method: DELETE
Status Code: 204
Remote Address: xxxx
Referrer Policy: no-referrer-when-downgrade

It's indeed a delete request before above information is received. :)

@iMicknl
Copy link
Owner Author

iMicknl commented Sep 2, 2020

Great to hear! I have implemented a first try in https://github.com/iMicknl/ha-tahoma/tree/enhancement/improve_stop_functionality, could you give it a try?

You can download this zip https://github.com/iMicknl/ha-tahoma/archive/enhancement/improve_stop_functionality.zip and extract the tahoma folder to your custom_components folder. Please delete the old one first to make sure you don't have any left overs. Please turn on debug logging to catch the errors and logging :).

@iMicknl iMicknl linked a pull request Sep 2, 2020 that will close this issue
@Glenn1986
Copy link

Hi @iMicknl. I did the test with the new version you made but didn't work. Gives me the error: Kan service cover/stop_cover niet aanroepen 'TahomaCover' object has no attribute 'debug'.

@iMicknl
Copy link
Owner Author

iMicknl commented Sep 3, 2020

@Glenn1986 oops, I made an obvious mistake. It is fixed in the latest version.
I can try this myself this Sunday the earliest unfortunately.

@Glenn1986
Copy link

Ok let me know if i can help further with testing. 😊

@iMicknl
Copy link
Owner Author

iMicknl commented Sep 3, 2020

@Glenn1986 you could download the zip again and retry :)

@Glenn1986
Copy link

@iMicknl i tested again and now it worked. The rollershutter stopped but he gives on error: Kan service cover/stop_cover niet aanroepen 'NoneType' object has no attribute 'get'.

@iMicknl
Copy link
Owner Author

iMicknl commented Sep 3, 2020

Cool! I will have a look myself and polish it up a bit, but great to know that the stop functionality is finally working for you.

@iMicknl
Copy link
Owner Author

iMicknl commented Sep 4, 2020

@Glenn1986 if you could try the latest version and report if this solved your issues, would be appreciated 👍🏻

@Glenn1986
Copy link

@iMicknl i just tested your new version. Everything worked well and no errors showing up. Nice work!

@Glenn1986
Copy link

@iMicknl in which release will you're fix for stop command cover released?

@iMicknl
Copy link
Owner Author

iMicknl commented Sep 6, 2020

@Glenn1986 it depends a little bit on the code review, I expect it to go out with a release in the next week. I will close this issue once it is merged to master, so you will get a notification :-).

@Glenn1986
Copy link

Thanks!

@golles
Copy link

golles commented Sep 14, 2020

I was about to report this bug, as I noticed it today, now I see a fix has been merged 12 hours ago. It works for my RTS awning, well done!!

@iMicknl
Copy link
Owner Author

iMicknl commented Sep 14, 2020

@golles thanks for first looking at closed issues / pr's 😄! This PR took a bit longer to get merged, but I will do a new release soon with some more fixes.

For now, you could install the latest master via HACS or manually.

@golles
Copy link

golles commented Sep 14, 2020

Great to hear that you're so active! I bought the Tahoma box recently and I'm really happy to see that you and the others rewrite this component.
I manually pull the master branch into my custom_components, I try to update all my dependencies a couple of times per week :-)
Looking forward to what's coming!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working platform: cover
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants