[RELEASE] Switch Bindings 2.0

Yup. Currently doing it with a couple rules. I just thought there might be an app available already.

Just to explain clearer. I have a virtual lock on smartthins that I can access from the st app on my galaxy watch. I mirror this lock to hubitat with hubconnect and have rules to keep the real lock in sync with hubconnect virtual lock.

All this just to have control from watch. The ST app is the prettiest way to do this. There are some tasker option but they don't look as nice.

Gotcha. No, this doesn't do that right now, but if your rules are working well, that sounds good.

I have been using this for a while now. I have some hue light strips that are bound to a light switch. I set the light switch as the master, with the intent that the light strips always follow the on/off state of the switch. I selected one-way binding. Sometimes, though, the hue light strips will stay on even after i turn off the switch. My house is mostly zwave, so maybe my zigbee network just isn't reliable enough. But I also selected polling every 5 minutes, so that theoretically the light strips should turn off at some point when polling happens after the switch has been turned off. Is that indeed what is supposed to happen with the settings I've chosen? Any suggestions on increasing reliability for my setup? Thanks

It could be the zigbee network. But I have a couple questions:

  • Is the switch z-wave, or z-wave plus?
  • Do you have the switch set as master?
  • If you turn on debug logging, and then watch the log pages, do you see a message every 5 minutes that looks like "BINDING: reSyncFromMaster()"?
  • If not, what other messages do you see from the switch bindings instance?
  • Is the switch z-wave, or z-wave plus? Plus
  • Do you have the switch set as master? Yes
  • If you turn on debug logging, and then watch the log pages, do you see a message every 5 minutes that looks like "BINDING: reSyncFromMaster()"? No, I don't see any such messages....a bit suspect huh?
  • If not, what other messages do you see from the switch bindings instance?
    [/quote] I don't see any messages except:
    BINDING: Garage Cabinets Right -> off()
    BINDING: Garage Cabinets Left -> off()
    BINDING: Garage Main Bay Lights OFF detected
    BINDING: Garage Cabinets Right -> on()
    BINDING: Garage Cabinets Left -> on()
    BINDING: Garage Main Bay Lights ON detected

That is suspect. I’ll put in some extra debug logging and push out a new version. Did it you install it through Hubitat Package Manager?

Yes

Ok, I added a bunch of debug logging and pushed out an update. Can you try it out and send me the debug logs?

HPM said no updates were available. Weird. I see your manifest is updated. Not sure what's up with HPM. I updated manually. Here's the debug output. Looks like the poll for sync works at first, but then stops once I flip the switch on and off. Then there are no more polls.

[app:142] 2020-09-28 09:15:10.742 pm [debug] BINDING: Garage Cabinets Right -> off()

[app:142] 2020-09-28 09:15:10.688 pm [debug] BINDING: Garage Cabinets Left -> off()

[app:142] 2020-09-28 09:15:10.671 pm [debug] syncSwitchState(88, false)

[app:142] 2020-09-28 09:15:10.666 pm [debug] BINDING: Garage Main Bay Lights OFF detected

[app:142] 2020-09-28 09:15:07.799 pm [debug] BINDING: Garage Cabinets Right -> on()

[app:142] 2020-09-28 09:15:07.719 pm [debug] BINDING: Garage Cabinets Left -> on()

[app:142] 2020-09-28 09:15:07.706 pm [debug] syncSwitchState(88, true)

[app:142] 2020-09-28 09:15:07.704 pm [debug] BINDING: Garage Main Bay Lights ON detected

[app:142] 2020-09-28 09:14:24.107 pm [debug] BINDING: Garage Main Bay Lights -> off()

[app:142] 2020-09-28 09:14:24.102 pm [debug] BINDING: Garage Cabinets Right -> off()

[app:142] 2020-09-28 09:14:24.091 pm [debug] BINDING: Garage Cabinets Left -> off()

[app:142] 2020-09-28 09:14:24.074 pm [debug] syncSwitchState(88, false)

[app:142] 2020-09-28 09:14:24.069 pm [debug] onOrOff: false

[app:142] 2020-09-28 09:14:24.058 pm [debug] masterSwitch: Garage Main Bay Lights

[app:142] 2020-09-28 09:14:24.055 pm [debug] masterSwitchId: 88

[app:142] 2020-09-28 09:14:24.048 pm [debug] BINDING: reSyncFromMaster()

[app:142] 2020-09-28 09:13:44.284 pm [debug] settings.pollMaster: true

[app:142] 2020-09-28 09:13:44.281 pm [debug] settings.masterSwitchId: 88

[app:142] 2020-09-28 09:13:44.272 pm [debug] switches: [Garage Cabinets Left, Garage Cabinets Right, Garage Main Bay Lights], switchList: [Garage Cabinets Left, Garage Cabinets Right]

[app:142] 2020-09-28 09:13:44.236 pm [debug] Subscribing only to master switch events

[app:142] 2020-09-28 09:13:44.234 pm [debug] initialize()

[app:142] 2020-09-28 09:13:44.220 pm [info]Updated with settings: [responseTime:5000, switches:[Garage Cabinets Left, Garage Cabinets Right, Garage Main Bay Lights], pollingInterval:1, masterSwitchId:88, enableLogging:true, masterOnly:true, pollMaster:true]

--- Live Log Started, waiting for events ---

So you're not seeing another "BINDING: reSyncFromMaster()" 5 minutes after the first? From your logs, it looks like it would have happened at 09:19, but the logs don't go that far.

No. I have it set to 1 minute as you can see from the log. But no more resynch calls

Can you keep the log running for about 10 minutes and see if any more resync messages come up? I’m wondering if the interval picker is working.

You're right. I think that's the problem with the log at least. The resynch shows up every 5 minutes, even though I selected a poll interval of 1 minute.

The problem seems to be that the poll interval is hard-coded with this call:
runEvery5Minutes(reSyncFromMaster)
Should be:
runIn(settings.pollingInterval * 60, reSyncFromMaster)

So, perhaps this narrows the reasons for occasional problems down to my sparse zigbee network. Next time i notice a problem I will check to see if the resynch is still firing.

I’ll work on that. It’s a little more complicated. RunIn() would only run it once. It I’ll push out an update.

Does this update the LEDs on Inovelli Red Dimmers to the appropriate dimmer level?

is any one else getting this error

Invalid Package File

Hubitat-Switch-Bindings/packageManifest.json at master · joelwetzel/Hubitat-Switch-Bindings · GitHub does not appear to be a valid Hubitat Package or does not exist.

or when i try

https://raw.githubusercontent.com/joelwetzel/Hubitat-Switch-Bindings/master/SwitchBindingInstance.groovy

i get this error

Metadata Error: Parent App 'joelwetzel:Switch Bindings' not found on line 19

The HPM error looks like it's pointing to the formatted version of the file, not the "raw" one. That would have to be fixed by him if that's what it's pointing to in his repo.

For the second error, you need to add the code for both SwitchBinding.groovy and SwitchBindingInstance.groovy, in that order. Looks like you're only doing the second.

I’ll take a look at it.

1 Like

I'm not able to reproduce this, and when I look at my repo and json files, they look correct.

Sorry for not getting back to you right away. I was able to figure it out. I just didn't follow the order. Thank you

1 Like