rudyberends / homebridge-loxone-proxy

Homebridge Dynamic Platform Plugin which exposes a Loxone System to Homekit
Apache License 2.0
12 stars 6 forks source link

Garage Doors out of PushButton and TextState #23

Closed 350d closed 1 year ago

350d commented 1 year ago

Hello! I have some weird way of garage doors implementation with push button and text state of the door status.

{
    "13a66542-02a7-cdf9-ffffeab7a19e67ff": {
        "cat": "13a6626c-0155-2f75-ffffc1fe7adce52a",
        "defaultIcon": "IconsFilled/garage-closed-2.svg",
        "defaultRating": 1,
        "details": {
            "jLockable": false,
            "type": 71
        },
        "isFavorite": true,
        "isSecured": false,
        "name": "Parking",
        "restrictions": 0,
        "room": "13a6623e-0195-2031-ffffc1fe7adce52a",
        "states": {
            "active": "13a66542-02a7-cdf9-ffffeab7a19e67ff"
        },
        "type": "Pushbutton",
        "uuidAction": "13a66542-02a7-cdf9-ffffeab7a19e67ff"
    },
    "1843878b-0039-94a9-fffffe21e7f5dd5d": {
        "cat": "13a6626c-0155-2f75-ffffc1fe7adce52a",
        "defaultIcon": null,
        "defaultRating": 0,
        "isFavorite": false,
        "isSecured": false,
        "name": "Parking Gates",
        "restrictions": 0,
        "room": "13a6623e-0195-2031-ffffc1fe7adce52a",
        "states": {
            "iconAndColor": "1843878b-0039-94aa-fffffe21e7f5dd5d",
            "textAndIcon": "1843878b-0039-94a9-fffffe21e7f5dd5d"
        },
        "type": "TextState",
        "uuidAction": "1843878b-0039-94a9-fffffe21e7f5dd5d"
    }
}
Screenshot 2023-08-07 at 10 32 32

Is it possible to manage to create normal Garage Doors in HomeKit out of these two properties?

rudyberends commented 1 year ago

Would you be able to share a screenshot of how these items are setup in Loxone config? You might want to put your Loxone config to English before you take the screenshot. :-)

350d commented 1 year ago

Well, let me try (I have it on windows laptop)

IMG_2994 IMG_2995 IMG_2996 IMG_2997 IMG_2998 IMG_2999 IMG_3001

rudyberends commented 1 year ago

So, you have virtual inputs that give you the state of the door. How does your output look like? Is it a toggle switch, or do you have separate outputs for opening and closing?

350d commented 1 year ago

Output - you mean UI? Its a push button, just circle with no state.

Screenshot 2023-08-07 at 10 32 32
350d commented 1 year ago

It's a shared building garage. Door will open, wait 10-15 seconds and close automatically. There is some feedback from the gates available with this logic from screenshot but it doesn't work at this time (something broken I guess), so, I have CLOSED and BUSY states only (should be OPENED if it will be fixed). IMG_3002

rudyberends commented 1 year ago

no, I mean virtual output. I guess you use some form of virtual output (network command) to open and close the doors right? Based on the UI screenshot, I guess it is based on a toggle switch, as your pushbutton in the ui is also a toggle. So, every time you press it the doors change state right? (when open, they close, when closed they will open)

350d commented 1 year ago

Correct, I guess this is it in config right here: IMG_3003

350d commented 1 year ago

This GET http request fire every time I click that button and gates status changes and update status with another get request (every 10 seconds I guess) where value parsed from xml response:

350d commented 1 year ago

Hello! By checking this endpoint http://miniserverip:port/jdev/sps/io/1843878b-0039-94a9-fffffe21e7f5dd5d I can see current status of the gates (closed or busy, and should be opened in future if feedback will be fixed by the company):

{
  "LL": {
    "Code": 200,
    "control": "dev/sps/io/1843878b-0039-94a9-fffffe21e7f5dd5d",
    "output": {
      "color": 5292905,
      "icon": "0000003d-00ff-0000-0000000000000000",
      "name": "Parking Gates",
      "value": "Closed"
    },
    "value": "Closed"
  }
}

As I can understand - there is ACTIVE and POSITION states needed for proper HomeKit operation but in my case ACTIVE state available but not working properly due to gates feedback malfunction ( 1843878b-0039-94a9-fffffe21e7f5dd5d always return 0 instead of 0 or 1). Can I create new virtual device in Loxone config somehow with proper logic needed for gates in HomeKit? I mean I can (I hope so) create timers for emulate states (button clicked - set active to 1, position to 0, wait 15 seconds, set active to 0, , position to 1, wait 15 seconds, set active to -1, wait 15 seconds, set active to 0, position to 0) and then we need some UI to create custom devices in your plugin with Type and UUID selection or something like that.

rudyberends commented 1 year ago

So, to answer your question. Yes, there is enough information available in your setup to turn it into a homekit garage door.

Implementing this into my plugin would require a custom gate item which would specifically map your items to a homebridge garage door. There should be custom configuration options for the mappings, that will have to be on a naming convention. I do not think this will ever be used by anyone except for your very specific use case. So I don't think we should implement this.

However, looking at your setup, and all the info you gave me, I don't see why your setup cannot be changed to make use of the gate/garage function block. It will work flawlessly in the loxone app, and you will also have the functionality you want in HomeKit using this plugin. I am happy to help you out if you need any help in setting this up on the Loxone side.

350d commented 1 year ago

I've created fake Garage Door with my own plugin and single Loxone API call.