thenewwazoo / homebridge-lutron-caseta-leap

Homebridge support for Lutron Caseta Smart Bridge 2
Apache License 2.0
80 stars 28 forks source link

Connects to RadioRA3 but fails to run #127

Closed adi7mash closed 1 year ago

adi7mash commented 1 year ago

Describe Your Problem: Hi - I saw you're working on non-Caseta LEAP library as well. I have a RadioRA3 system. I installed the Caseta LEAP homebridge plug in. It immediately recognized my RadioRA3 processor and it connected after pressing "associate". However, the plug in fails after restarting with some error messages below.

Perhaps I'm getting the error

TypeError: Cannot read properties of undefined (reading 'Devices')

Because of

leap:responseparser parsing line {"CommuniqueType":"ReadResponse","Header":{"StatusCode":"204 NoContent","Url":"/device","ClientTag":"[CLIENT TAG HERE] f"}}

Not sure if I should post it here or on thenewwazoo/lutron-leap-js, but wanted to know if I need the non-caseta library here instead of the caseta-leap. I'm happy to help with testing on my system or in other way.

Logs:

Debug log:

[9/30/2023, 2:58:32 PM] [Lutron] Restarting Process...
[9/30/2023, 2:58:33 PM] [Lutron] Launched child bridge with PID 58880
[9/30/2023, 2:58:33 PM] Registering platform 'homebridge-lutron-caseta-leap.LutronCasetaLeap'
[9/30/2023, 2:58:33 PM] [Lutron] Loaded homebridge-lutron-caseta-leap v2.5.3 child bridge successfully
[9/30/2023, 2:58:33 PM] [Lutron] LutronCasetaLeap starting up...
[9/30/2023, 2:58:33 PM] [Lutron] LutronCasetaLeap plugin finished early initialization
[9/30/2023, 2:58:33 PM] [Lutron] Finished launching; starting up automatic discovery
[9/30/2023, 2:58:33 PM] Homebridge v1.6.0 (HAP v0.11.0) (Lutron) is running on port 52787.
2023-09-30T18:58:34.166Z leap:protocol:discovery checking HostAndPort { host: '192.168.7.240', port: 22 }
2023-09-30T18:58:34.174Z leap:protocol:discovery was not ipv6: Error [AddressError]: Incorrect number of groups found
    at new AddressError (/usr/local/lib/node_modules/homebridge-lutron-caseta-leap/node_modules/ip-address/lib/address-error.ts:5:5)
    at Address6.parse (/usr/local/lib/node_modules/homebridge-lutron-caseta-leap/node_modules/ip-address/lib/ipv6.ts:713:13)
    at new Address6 (/usr/local/lib/node_modules/homebridge-lutron-caseta-leap/node_modules/ip-address/lib/ipv6.ts:153:31)
    at BridgeFinder.extractIp (/usr/local/lib/node_modules/homebridge-lutron-caseta-leap/node_modules/lutron-leap/src/BridgeFinder.ts:95:30)
    at BridgeFinder.handleDiscovery (/usr/local/lib/node_modules/homebridge-lutron-caseta-leap/node_modules/lutron-leap/src/BridgeFinder.ts:60:29)
    at MDNSServiceDiscovery.<anonymous> (/usr/local/lib/node_modules/homebridge-lutron-caseta-leap/node_modules/lutron-leap/src/BridgeFinder.ts:43:18)
    at Event.emit (/usr/local/lib/node_modules/homebridge-lutron-caseta-leap/node_modules/atvik/src/sync.ts:65:29)
    at MDNSServiceDiscovery.BasicServiceDiscovery.updateService (/usr/local/lib/node_modules/homebridge-lutron-caseta-leap/node_modules/tinkerhub-discovery/src/discovery/basic-service-discovery.ts:67:24)
    at MDNSServiceDiscovery.refreshService (/usr/local/lib/node_modules/homebridge-lutron-caseta-leap/node_modules/tinkerhub-mdns/src/discovery/mdns-discovery.ts:346:8)
    at Timeout._onTimeout (/usr/local/lib/node_modules/homebridge-lutron-caseta-leap/node_modules/tinkerhub-mdns/src/discovery/mdns-discovery.ts:206:27) {
  parseMessage: undefined
}
2023-09-30T18:58:34.215Z leap:protocol:discovery got useful ipaddr 192.168.7.240
2023-09-30T18:58:34.216Z leap:protocol:discovery extracted bridge ID: [CORRECT BRIDGE ID HERE]
2023-09-30T18:58:34.216Z leap:protocol:client new LeapClient being constructed
2023-09-30T18:58:34.281Z leap:bridge new bridge [CORRECT BRIDGE ID HERE] being constructed
2023-09-30T18:58:34.281Z leap:bridge getting info about all devices
2023-09-30T18:58:34.281Z leap:protocol:client request ReadRequest for url /device
2023-09-30T18:58:34.281Z leap:protocol:client needs to connect
2023-09-30T18:58:34.510Z leap:protocol:client connected!
2023-09-30T18:58:34.511Z leap:protocol:client securely connected
2023-09-30T18:58:34.511Z leap:protocol:client _onConnect called
2023-09-30T18:58:34.512Z leap:protocol:client request handler about to write: {"CommuniqueType":"ReadRequest","Header":{"ClientTag":"6094580e-c50d-4aa7-a96b-22258b4175df","Url":"/device"}}
2023-09-30T18:58:34.513Z leap:protocol:client sent request tag [CLIENT TAG HERE]  successfully
2023-09-30T18:58:34.513Z leap:protocol:client added promise to inFlightRequests with tag key [CLIENT TAG HERE] 
2023-09-30T18:58:34.519Z leap:protocol:client got data from socket: {"CommuniqueType":"ReadResponse","Header":{"StatusCode":"204 NoContent","Url":"/device","ClientTag":"[CLIENT TAG HERE] "}}

2023-09-30T18:58:34.520Z leap:responseparser handling data {"CommuniqueType":"ReadResponse","Header":{"StatusCode":"204 NoContent","Url":"/device","ClientTag":"[CLIENT TAG HERE] "}}

2023-09-30T18:58:34.520Z leap:responseparser buffer is 
2023-09-30T18:58:34.520Z leap:responseparser parsing line {"CommuniqueType":"ReadResponse","Header":{"StatusCode":"204 NoContent","Url":"/device","ClientTag":"[CLIENT TAG HERE] f"}}
2023-09-30T18:58:34.521Z leap:protocol:client got response to tag [CLIENT TAG HERE] 
2023-09-30T18:58:34.521Z leap:protocol:client tag [CLIENT TAG HERE]   recognized as in-flight
TypeError: Cannot read properties of undefined (reading 'Devices')
    at SmartBridge.getDeviceInfo (/usr/local/lib/node_modules/homebridge-lutron-caseta-leap/node_modules/lutron-leap/src/SmartBridge.ts:160:53)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
[9/30/2023, 2:58:34 PM] [Lutron] Child bridge process ended
[9/30/2023, 2:58:34 PM] [Lutron] Process Ended. Code: 1, Signal: null

Plugin Config:

{
    "bridge": {
        "name": "Homebridge 9CAA",
        "username": "[USER NAME REMOVED]",
        "port": [PORT],
        "pin": "[PIN REMOVED]",
        "advertiser": "bonjour-hap"
    },
    "accessories": [],
    "platforms": [
        {
            "name": "Config",
            "port": 8581,
            "platform": "config"
        },

        {
            "name": "Lutron",
            "platform": "LutronCasetaLeap",
            "options": {
                "filterPico": false,
                "filterBlinds": true,
                "clickSpeedDouble": "default",
                "clickSpeedLong": "default"
            },
            "secrets": [
                {
                    "bridgeid": "[BRIDGE ID HERE]",
                    "ca": "-----BEGIN CERTIFICATE-----\n[**CERTIFICATE HERE**]\n-----END CERTIFICATE-----\n",
                    "cert": "-----BEGIN CERTIFICATE-----\n[**CERTIFICATE HERE**]\n-----END CERTIFICATE-----\n",
                    "key": "-----BEGIN RSA PRIVATE KEY-----\r\n[**KEY HERE**]\r\n-----END RSA PRIVATE KEY-----\r\n"
                }
            ],
            "_bridge": {
                "username": "[USERNAME REMOVED",
                "port": [PORT]
            }
        }
    ],
    "disabledPlugins": [
        "homebridge-lutron-caseta-leap"
    ]
}

Screenshots:

Environment:

thenewwazoo commented 1 year ago

I did start working on extending the library but life got in the way. At present, I'm not likely to have the time to do it myself any time soon, sorry. The device model is quite different between the Caseta and non-Caseta platforms, so it's a pretty fundamental change that has to happen.