pgerke / homebridge-freeathome-local-api

A Homebridge plugin that allows controlling you free@home setup using the local API provided by the System Access Point
MIT License
18 stars 2 forks source link

Add support for Shutter blinds #16

Closed fhadlich closed 2 years ago

fhadlich commented 2 years ago

Hi Philip,

this is a wonderful project and I found a great quality, especially given its young age šŸ‘ I'd like to ask if and when you plan to support free@home Shutter blinds (Jalousie = Rollladen mit Lamellen).

Best regards, Frank

pgerke commented 2 years ago

Thanks a lot for the great feedback! It is much appreciated!

Regarding the shutter blinds I'm more than happy to support them. The only issue for me is that I don't own free@home blinds myself. Consequently, I can only verify with automated tests that my code is behaving according to the specs as defined by BUSCH-JAEGER, but I have no means to test the real user experience.

Long story short: I can experimentally support blinds and I would very much appreciate any feedback you could give me regarding UX, but it take a couple of tries to get it feel right.

fhadlich commented 2 years ago

Iā€˜m fine with being a Tester here ;-) if it helps, I can also provide some infos of the app workflow and UI outside HomeKit, i.e. screenshots of controlling my shutter blinds in the free@home app.

pgerke commented 2 years ago

Thanks for the offer! I'll get back to it if necessary. What would indeed help me a lot would be an example of a shutter configuration from the local API. Then I could make sure I really have all the data points and pairings that are needed. You can get that from the System Access Points Swagger page that you can find at http://<SYSAP HOST or IP>/swagger/fhapi. You can use the same set of credentials that you are using to authenticate the Homebridge plugin. The Get device Method retrieves the configuration for a device. If you could get me the configuration for a shutter that would greatly simplify and speed up the implementation. I can also post a more detailed how-to later.

fhadlich commented 2 years ago

Hi, no worries, I'm very glad you are interested in extending the plugin :-) I exported a configuration example and put it here: https://gist.github.com/fhadlich/3c03c37685b544dd4ee12e013c6a0123 Let me know if there is anything else I can provide.

pgerke commented 2 years ago

That's perfect, thanks a lot! I already started with the implementation, and the config will speed up the process considerably. I'll probably have a version end of this week.

pgerke commented 2 years ago

I have published a pre-release version that supports the blinds. Run

sudo npm install -g homebridge-freeathome-local-api@pre

in the Homebridge terminal to install the update and restart Homebridge afterwards. Please note that you'll need to enable experimental accessories in the plugin settings or the shutters will not be recognized. I'd be very interested in your feedback!

fhadlich commented 2 years ago

Hello, I finally had the time to upgrade the plugin and play with it a very little bit. (First of all, I learned something new: upgrading a homebridge plugin within docker needs the proper prefix or the plugin will be installed in the standard path /usr/local/lib/node_modules, not the path of the homebridge plugins /homebridge/node_modules which it should be).

In homebridge UI-X, opening and closing the blinds works well, as in "Open 0%" (closing) / "Open 100%" (opening) as well as the "Go to X" with a slider. The blinds' states are correctly shown (opened, closed) in the UI-X, and controls are responsive (i.e. change of value is immediately transmitted to the free@home AP and to the actor). Edit, adding: Thank you, this again shows the great effort and quality you put into this plugin :-)

What's missing seems to be the state of the shutters, which could be blocking sunlight or letting light in. Hence I cannot control this yet like it's possible in the free@home app. Is this a limitation of HomeKit?

Also, my 6 shutter blinds are not yet shown as devices in my Home nor in the Eve.app. The "Homebridge"-bridge still lists only 31 devices, not 37 as expected. Any idea why this could be the case?

pgerke commented 2 years ago

In homebridge UI-X, opening and closing the blinds works well, as in "Open 0%" (closing) / "Open 100%" (opening) as well as the "Go to X" with a slider. The blinds' states are correctly shown (opened, closed) in the UI-X, and controls are responsive (i.e. change of value is immediately transmitted to the free@home AP and to the actor)

I am very happy to hear that!!

What's missing seems to be the state of the shutters, which could be blocking sunlight or letting light in. Hence I cannot control this yet like it's possible in the free@home app. Is this a limitation of HomeKit?

This is not yet included in the plugin. I wanted to take this one at a time, so that it's easier to track issues. From your feedback it seems I got the opening and closing right, so I'll include the tilt angle in the next preview. In free@home, there are several functionIDs for blinds and shutters and I'll need to find a way to determine which of them support tilting.

Also, my 6 shutter blinds are not yet shown as devices in my Home nor in the Eve.app. The "Homebridge"-bridge still lists only 31 devices, not 37 as expected. Any idea why this could be the case?

I'm a bit confused, from your second paragraph I thought you can see and control them in the Homebridge UI? Or are the missing shutter another kind than the ones you can see and control? In that case it's probably just a missing functionID, which would be a trivial fix.

fhadlich commented 2 years ago

What's missing seems to be the state of the shutters, which could be blocking sunlight or letting light in. Hence I cannot control this yet like it's possible in the free@home app. Is this a limitation of HomeKit?

This is not yet included in the plugin.

Alright - that was my second guess ;-)

Also, my 6 shutter blinds are not yet shown as devices in my Home nor in the Eve.app. The "Homebridge"-bridge still lists only 31 devices, not 37 as expected. Any idea why this could be the case?

I'm a bit confused, from your second paragraph I thought you can see and control them in the Homebridge UI? Or are the missing shutter another kind than the ones you can see and control? In that case it's probably just a missing functionID, which would be a trivial fix.

In the Homebridge UI-X (web app / browser), I can see and controls all 6 blinds as device/actor of type Window Covering. On my Apple devices (in Home.app nor Eve.app), I cannot see the 6 blinds.

I'm confused about this fact myself, because I expected to have the 6 new free@home actors appear immediately on my Apple devices. I am not sure how to start debugging this. Enable verbose logging and then to look "somewhere" for "something"..?

pgerke commented 2 years ago

Forgot to say, the next version supporting tilt, will arrive in the next couple of days depending on my workload.

Now regarding the missing actors: If you can see and control them in Homebridge UI, the plugin seems to be working as expected. The actuators are recognized from the SysAP and configured. You should be able to confirm this from the plugin output Homebridge logs especially when Homebridge is (re-)started and the accessories are recognized or when you use the controls in Homebridge UI X. Just for the sake of completeness: You did restart Homebridge after updating the plugin, right? And you did check the room in Apple Home that also holds the Homebridge bridge, right? Where does it say 31 devices instead of the expected 37? In the Homebridge Device List in Apple Home?

fhadlich commented 2 years ago

Yes, I did restart Homebridge (many times), and yes, I meant "31 devices" in Apple Home. :-)

I managed to make a step forward, and two steps backwards unfortunately. After a reset of both my Homebridge and my Apple Home, all blinds/Jalousie actors are still properly recognized by Homebridge and also recognized as accessories by my Apple Home.

However, the states are not properly shown for longer than a few minutes. Additionally, I now experience serious lags/delays in the communication between Homebridge and my Apple Home. I suspect a combination of the plugin with blinds added as well as being the victim of a not very common HomeKit bug. A simple light switch command now needs at least 15 seconds to be completed. The lag is between the tap on an iPhone and the event being transmitted/received in the Homebridge.

I have not found a solution for this yet, but after several attempts I came to one conclusion: when I add the blinds to the Ignored Channels in the Homebridge plugin, updating states and completing commands need the 15 seconds as mentioned. When blinds have not been added to the Ignored Channels, the lag/delay is much longer, maybe indefinitely, the accessory state is "Loading...".

I'll keep you updated once the communication between my Homebridge and Apple Home is working properly without the blinds to be able to debug further.

fhadlich commented 2 years ago

Philip, unfortunately, I have not managed yet to establish a stable communication between my Homebridge and my Apple Home again. I assume there is no direct relation between this and my upgrade to homebridge-freeathome-local-api@pre. I tried to make things work with homebridge-freeathome-local-api being deactivated and other plugins. Even configured in child bridges it wouldn't help.

I hope this issue get's some attention, until then I cannot use my Homebridge at all and will have to look for alternatives ;-(

pgerke commented 2 years ago

Wow, I'm so sorry to hear that! I wasn't aware of the issue you mentioned and it sounds really frustrating. If possible I'd like to rule out that the issues you are experiencing are related to my plugin. I'd hate to be responsible for screwing up your system. Maybe what you could try is to remove (not disable) the plugin altogether and restart Homebridge twice. Then all accessories created by the plugin that were cached by Homebridge will be gone. Maybe that helps to restore pervious functionality.

fhadlich commented 2 years ago

No worries, it's most certainly not to do with a single plugin and its dependencies. To make you feel safe, I tested just that and deinstalled the plugin homebridge-freeathome-local-api. After adding a first child bridge to my Home.app, within 1 minute its accessories send and receive "no response" ("Aktualisieren") forever. Interestingly, in this test, at least all other accessories remained usable and up to date. I was certain I would achieve just that before, but as assumed in the HB issue 3116 already, this is most likely a network/software related issue between Homebridge itself and HomeKit.

I will continue following that issue, and maybe, maybe I find leads in the source code myself. Luckily I keep backups of my Homebridge instances, and I hope I could go back to one of those versions some day ;-)

pgerke commented 2 years ago

I'm merging the initial support for the blinds to main without the tilt support and closing the issue. Please feel free to re-open it or create a new one at any time.

github-actions[bot] commented 1 year ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.