gurumitts / pylutron-caseta

Apache License 2.0
153 stars 97 forks source link

Add support for SerenaTiltOnlyWoodBlind #89

Closed swails closed 2 years ago

swails commented 2 years ago

Fixes #88

I don't own one of these products, so I can't tell whether or not this is enough to fully support controlling the tilt angle. Specifically I'm not sure if the LEAP messages are implemented or, if not, what those messages should be.

rlshaw23 commented 2 years ago

I have 4 of these. I'm no programmer but I will would be able to test this.

mdonoughe commented 2 years ago

If we just add SerenaTiltOnlyWoodBlind to the same list as TriathlonRollerShade, how does the consuming code know that SerenaTiltOnlyWoodBlinds only support tilting and TriathlonRollerShades only support raising and lowering? I suspect with this code the blinds will appear in something like Home Assistant, but the default interaction will probably be to control the position that these blinds don't have.

It doesn't look like pylutron_caseta contains any code for controlling tilt and I expect it will be different from raising/lowering or else they wouldn't be able to sell any shades that have both raise/lower and tilt.

mdonoughe commented 2 years ago

I think we're missing a GoToTilt command, but more than that this library does not have support for tilting shades at all. The tilt level is being reported as a Tilt property that needs to be read.

mdonoughe commented 2 years ago

Using the leap command from #97, can you figure out how to read and control the tilt?

mdonoughe commented 2 years ago

Can somebody install the latest development version with the cli extra (see The leap tool) and try this command:

leap -X CreateRequest BRIDGE_IP/device/DEVICE_ID/commandprocessor -d '{"Command":{"CommandType":"GoToTilt","TiltParameters":{"Tilt":50}}}'

Maybe it will set the tilt to 50. My blinds are ZWave so I can't test this myself.

rlshaw23 commented 2 years ago

I’m running home assistant os. I tried to install the cli via putty. No go, pip not recognized. I’m assuming that I won’t be able to test this command? I do have the Serena tilt only blinds.

From: Matthew Donoughe @.> Sent: Sunday, April 17, 2022 8:46 AM To: gurumitts/pylutron-caseta @.> Cc: Randall Shaw @.>; Comment @.> Subject: Re: [gurumitts/pylutron-caseta] Add support for SerenaTiltOnlyWoodBlind (PR #89)

Can somebody install the latest development version with the cli extra (see The leap toolhttps://github.com/gurumitts/pylutron-caseta#the-leap-tool) and try this command:

leap -X CreateRequest BRIDGE_IP/device/DEVICE_ID/commandprocessor -d '{"Command":{"CommandType":"GoToTilt","TiltParameters":{"Tilt":50}}}'

Maybe it will set the tilt to 50. My blinds are ZWave so I can't test this myself.

— Reply to this email directly, view it on GitHubhttps://github.com/gurumitts/pylutron-caseta/pull/89#issuecomment-1100878922, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ASCV7SLXCSXKSIWJJFA72ADVFQIYTANCNFSM5NV3S46Q. You are receiving this because you commented.Message ID: @.**@.>>

mdonoughe commented 2 years ago

I'm not sure how you would do it on Home Assistant OS. I've only ever used Home Assistant Core. If pip isn't found, you may need to use pip3 instead. It may be easier to run the cli from another computer.

It can be used from Windows but if all you have is Windows it may be easier using Python in WSL than Windows Python. I had problems with quotes in command line arguments. I don't know if it was PowerShell's native command quoting bugs or Python or both.

rlshaw23 commented 2 years ago

When I installed it this is the error message I get

pip3 install pylutron_caseta[cli] Collecting pylutron_caseta[cli] Downloading pylutron_caseta-0.13.1-py3-none-any.whl (17 kB) WARNING: pylutron-caseta 0.13.1 does not provide the extra 'cli'

Any ideas what could be wrong. The leap tool will not work

mdonoughe commented 2 years ago

The CLI hasn't been released yet. For now, you need to download the code from GitHub and do pip install .[cli] from inside the pylutron-caseta folder.

rlshaw23 commented 2 years ago

I cloned the directory and ran pip install .[cli] and this is what I get. see attached. Any thoughts? error capture

mdonoughe commented 2 years ago

I think you need to update pip.

DougieJynx commented 2 years ago

deleted

DougieJynx commented 2 years ago

deleted

DougieJynx commented 2 years ago

IT WORKED!!!!

# device=$(leap "${ip}/zone/status/expanded?where=Zone.ControlType:\"Tilt\"" | jq -r '.ZoneExpandedStatuses[0].Zone.href')
# echo $device
/zone/21
# leap -X CreateRequest "${ip}${device}/commandprocessor" -d '{"Command":{"CommandType":"GoToTilt","TiltParameters":{"Tilt":50}}}'
{"ZoneStatus": {"href": "/zone/21/status", "Tilt": 50, "Zone": {"href": "/zone/21"}, "StatusAccuracy": "Good", "Availability": "Available"}}
# leap -X CreateRequest "${ip}${device}/commandprocessor" -d '{"Command":{"CommandType":"GoToTilt","TiltParameters":{"Tilt":25}}}'
{"ZoneStatus": {"href": "/zone/21/status", "Tilt": 25, "Zone": {"href": "/zone/21"}, "StatusAccuracy": "Good", "Availability": "Available"}}

Verified my blind is set to 25%!

mdonoughe commented 2 years ago

Based on that, I added support for getting and setting the tilt, similar to how the existing code has been working. However, the way it works for projects like Home Assistant is not great. Basically, they know a cover supports tilt if device['tilt'] is not None and they know a cover supports raise/lower if device['current_state'] != -1.

rlshaw23 commented 2 years ago

Any idea when this will show up in HA?

mdonoughe commented 2 years ago

I'm not happy with the current state of it but I released it so it can be used. On the consuming side, eg in Home Assistant, I guess it's possible to differentiate shades that tilt from shades that raise/lower by checking if the device has a tilt state, or by having a list of known devices that are tilting shades.

The bridge service has a concept of control types and that's how we should be detecting what operations are applicable for different devices. However, pylutron_caseta does not currently retrieve that property, and the property is associated with zones, while pylutron_caseta is currently device oriented. I think ultimately we need to be using that, but I haven't had time to set it up properly and I don't want to keep holding this up.

DougieJynx commented 1 year ago

If we just add SerenaTiltOnlyWoodBlind to the same list as TriathlonRollerShade, how does the consuming code know that SerenaTiltOnlyWoodBlinds only support tilting and TriathlonRollerShades only support raising and lowering? I suspect with this code the blinds will appear in something like Home Assistant, but the default interaction will probably be to control the position that these blinds don't have.

It doesn't look like pylutron_caseta contains any code for controlling tilt and I expect it will be different from raising/lowering or else they wouldn't be able to sell any shades that have both raise/lower and tilt.

They DON'T sell any shades that have both raise/lower and tilt... At least not currently.