ebaauw / homebridge-rpi

Homebridge plugin for Raspberry Pi.
Apache License 2.0
308 stars 18 forks source link

“servo” as a window service #94

Closed leehadassin closed 3 years ago

leehadassin commented 3 years ago

Hi,

Love the plug-in. Just wondering if it was possible if the servo could be made a window service or one of the other similar services (window covering or slats). I understand this is a big change. I am using the servo for pan/tilt of a camera, but the control is clunky in the eve app. A couple other plugins I use have the window service type and it shows up in the native home.app as sliders similar to dimmable lights. Understand if this isn’t feasible/important. Thanks again for the great plug-in.

cheers

Lee

ebaauw commented 3 years ago

It would be a relative small change to Homebridge RPi code, but I doubt it would make sense functionally.

Slat seems to make most sense semantically: it's got Current Tilt Angle and Target Tilt Angle as optional characteristics. I would have to expose (mandatory) Slat Type and Current Slat State, which would be fixed to Horizontal and Fixed. It doesn't have On or something equivalent to enable/disable the servo. However, it doesn't seem to be supported by Home on iOS 14.5.1?!

Window Covering makes less sense: it requires mandatory Current Position and Target Position in addition to optional Current Horizontal Tilt Angle and Target Horizontal Tilt Angle. It doesn't have On or something equivalent to enable/disable the servo either. The tile in Home controls the position, not the tilt angle. The tilt angle can be controlled from Home (from the Settings of the service), but it doesn't seem to refresh. Could be caused by the HomeKit Accessory Simulator, I guess. I could add an Enabled to turn the servo on or off, but that wouldn't be controllable from Home (unless you use a HomeKit scene defined in Eve). If I were to map the tilt to the position, it would be limited to 0% to 100% instead of to -90° to 90°. And it wouldn't turn on/off the servo, even though the tile would suggest that.

There used to be a Camera Control service, with mandatory On and optional tilt characteristics, but that's no longer supported, according to a comment in the HAP-NodeJS code.

leehadassin commented 3 years ago

Thanks for looking at this.

To me, having an enable/disable separate from the target/current angle isn't an issue (I'm driving small hobbyist servos direct from the Pi and as long as I stay within 0-88deg it doesn't buzz) but I understand this could be for others. Similarly, it wouldn't bother me if it was position vs angle, but I understand this plug-in needs to be generic enough for most users. On the other hand, having a slider in the native home.app would be the simplest to use for the average user.

Thanks again.