cptechie / homebridge-lutron-homeworks

Homebridge plugin for the circa 2005 Lutron Homeworks System
Apache License 2.0
4 stars 1 forks source link

Issue remembering devices #5

Open tennisdad opened 3 years ago

tennisdad commented 3 years ago

Hello, Thanks for this plugin. I managed to get it all configured and mostly working. I am seeing an issue that devices are not 'remembered' across restarts of HomeBridge. What happens is that after a restart, each light has to be manually turned on / off. After that, it seems to work fine.

My devices are addressed as 01:08:01:xx onwards. Any suggestions? Here's the startup log. Question: Should all discovered devices show up in the log? In which case, for some reason devices are not getting discovered at startup.

Thanks!

Preparing Advertiser for 'Lutron Homeworks 6F34' using bonjour-hap backend! [4/11/2021, 17:16:03] [Lutron Homeworks] Starting device discovery [4/11/2021, 17:16:03] [Lutron Homeworks] Finished device discovery Starting to advertise 'Lutron Homeworks 6F34' using bonjour-hap backend! [4/11/2021, 17:16:03] Homebridge v1.3.4 (Lutron Homeworks) is running on port 59097.

cptechie commented 3 years ago

Hey there! Sorry I had just seen this.

How are you running this? Are you running inside a docker container of Homebridge? My initial hunch is that your persistent volumes are not mounted if you are using docker but a little more background about your environment will help narrow this.

cptechie commented 3 years ago

Also, can you run this in debug mode and provide the log output?

Your comment that the switch works in homebridge after turning it physically on and off and consistent with your idea that homebridge is not remembering the devices. The plug-in first restores all caches devices on the network, and then it does a scan of all available devices and their initial state on the Homeworks network. If for some reason the loading of the cache does not work or the switch as not properly discovered, then the plugins then adds newly observed devices when it’s state changes.

KoopaSenior commented 1 year ago

Hi There

Thank you very much for the Plugin. I‘m really thankful it works with my Lutron Homeworks too.

I‘m running into the same Issue. When I restart the Homebridge Server after doing some changes to a device I‘ m not able to control the Lutron devices anymore until I used a physical touchpad once.

My setup:

Regards Koopa

KoopaSenior commented 1 year ago

I did some investigations in this. It seems that there are different Lutron models (processors) from this time period with different functionality.

The physical switches in my apartment are sending following actions to the Lutron processor when I press a button:

  1. KBP, [XX:XX:XX], 1
  2. DL, [XX:XX:XX:XX:XX], 100
  3. KBR, [XX:XX:XX], 1

In words: 1st step: it sends a KeypadButton-Press (KBP, address-format is aa:bb:cc) from the Keypad-Address 2nd step: it sets the Dimmer-Level (DL, address-format is aa:bb:cc:dd:ee) from the light/device itself to the desired percentage 3rd step: it sends a KeypadButton-Release (KBR, address is the same of the KBP from the 1st step) from the Keypad-Address

So I guess the Dimmer-Level requires an enablement from the Keypad first. If the Keypad was initialized then the processor is ready to receive commands for the Dimmer-Level which depends from the KeypadButton-Press.

According to the Lutron documentation (https://assets.lutron.com/a/documents/HWI%20RS232%20Protocol.pdf) there is a function which is called "Request keypad enabled/disabled state" (RKES) which returns the state of a Keypad device (KES). This function is almost similar to the RDL which you used to discover the Dimmer-Levels and device-addresses.

Maybe if you could add a function to your plattform.ts to discover all the Keypads attached to a system we could also use this as devices for better automation and maybe also to solve the problems named above.

The discover-function could look something like this:

discoverKeypads() {
    this.log.info('Starting device discovery');
    this.port.write('\r');
    this.port.write('KBMON\r');
    let a, b, c;
    for (a = 1; a <= 16; a++) {
      for (b = 4; b <= 6; b++) {
        for (c = 1; c <= 4; c++) {
            const address = '['
              + a.toString().padStart(2, '0') + ':'
              + b.toString().padStart(2, '0') + ':'
              + c.toString().padStart(2, '0') + ']';
            this.port.write('RKES, ' + address + '\r');
        }
      }
    }
    this.log.info('Finished Keypad discovery');
  }

Of course there has more to be done than just the discovery itself and it would make more sense to expand your device-class adding a property which defines the device-type.

For users like me this would be very interesting because my Lutron also controls shades, vents and some other stuff.

Regards Koopa

gpabdo commented 7 months ago

Hello all,

Has anyone had any luck solving this? I love this plugin, but recently my homebridge has been forgetting all my devices and I have to walk around pushing all the buttons again almost every morning. Looks like this is the same issue, though mine worked for almost a year before it just started randomly forgetting everything. Before then, the only time I had an issue was when the process was killed.

KoopaSenior commented 6 months ago

Hi

Since cptechie seemed to stop his great work for Lutron owners and I experienced the same issues, I was searching for another solution and finally found this:

https://github.com/nitaybz/homebridge-homeworks-serial

Works great for me, no more issues and I'm usind it for around a year now. Give it at shot.

Regards, Koopa