rodtoll / homebridge-isy-js

Homebridge platform plugin for the ISY series of home controllers from Universal Devices.
MIT License
22 stars 27 forks source link

Keypad Status Sync #42

Closed VeniceNerd closed 7 years ago

VeniceNerd commented 7 years ago

I have a question:

If I use the ISY994i Pro (instead of the Insteon Hub) I can use that to program my Insteon Keypads and Insteon DIN modules, correct? Now, if i use this Homelink Plugin will it sync the Insteon device status and HomeKit status?

So for example, if I press Button B on my keypad, which turns on my dining room light, will this also show the dining room light as turned on in HomeKit?

I'm currently using the Insteon Hub Pro and it will not keep the keypads and HomeKit in sync. It's a disaster. Hoping this could be the solution?

PaulWieland commented 7 years ago

Yes it will.

PaulWieland commented 7 years ago

Let me elaborate a little - this plugin opens a socket to the isy and watches the state of all of the devices. Therefore anything that updates the isy admin GUI should also update HomeKit.

I have an H key that shuts every device off in my house, and the states are updated correctly in HomeKit.

VeniceNerd commented 7 years ago

@fahrvergnuugen oh wow that would be great! And is is a pretty reliable experience? So I would basically throw out my Insteon Hub and reset all my devices and then re-program everything with the ISY? Any chance I could get in touch with you outside the forum to ask a few more questions? Thx!

VeniceNerd commented 7 years ago

@fahrvergnuugen I guess my two main questions right now are this:

1) currently I used my Insteon Hub and it's iPhone app to program all of my 6 or 8 button keypads to turn on and off lights. When I get the ISY will I start from scratch or will the ISY be in my network in addition to my Insteon Hub?

2) as far as I understand, once they keypads are programmed, they execute commands without a Hub, correct? So wont ISY and homebridge be left out of the loop when I press button "C" on keypad 1 which in turn executes a scene that turns on my dining room light (which is physically connected to a DIN module)? Same goes for the other way around: if I use HomeKit to turn on the dining room light will button "c" on keypad 1 light up as well? That's really the solution that I'm after. That my physical INSTEON DIN modules, the keypads they are controlled by, and it's HomeKit status are all in sync so that I can use either Siri, the keypad, or the physical module button, to control the lights and everything stays in sync.

Would love to understand if and how the ISY + homebridge Plugin would tackle this.

PaulWieland commented 7 years ago

@VeniceNerd

  1. It's been a while since I went through the linking procedure with my insteon switches, but if I recall, Universal Devices recommends that you wipe the linking table out when linking to the ISY. The Hub is completely redundant, and far less powerful than the ISY (with the exception of its utterly shameful lack of native homekit support), so if you get one and you also use homebridge, you dont really need a Hub.
  2. There are insteon scenes and there are ISY programs. Programs only run on the ISY and they can be triggered by events. Scenes can exist without any hub whatsoever, as they are simply device to device links stored in the memory of each insteon device. The ISY acts like one of those devices and it gets linked with every single insteon switch/outlet/keypad/etc in your network. When any switch is pressed, a broadcast message is sent out to all devices, and those who are programmed to "listen" (e.g. other devices in the scene or the ISY) respond accordingly. Your described use case works just fine as that's what I have in my house - pressing the "Deck" key on one keypad triggers four separate switches to turn on and all the other "Deck" keys in the house to light up. The deck scene in homekit is also syncronized correctly. Telling siri to turn the deck lights off causes the scene to turn off. Controlling the backlight on the keypads is a bit weird due to the limitations of insteon, but you can make it work.
VeniceNerd commented 7 years ago

@fahrvergnuugen this sounds is interesting. I ordered all the hardware and will give this a shot. Least read the ISY manual and some of the homebridge documentation as well.

So as far as I understand the ISY Homebridge plugin will import Insteon Scenes as HomeKit devices instead of Insteon devices directly? So when I tell HomeKit to "turn off my kitchen light" it will actually trigger that Insteon Scene, which on turn will turn of the light, correct?

I assume that would also be the only way to keep keypads and HomeKit in sync since they keypads always link to scenes instead of devices. If you'd let the ISY homebridge plugin trigger devices directly the keypads wouldn't get updated.

Please let me know if I understood this correctly or if I mixed stuff up. ;)

PaulWieland commented 7 years ago

Your understanding is correct.

There are other things you can do using isy programs, but if you can base everything on insteon scenes it's much simpler.

VeniceNerd commented 7 years ago

@fahrvergnuugen awesome thanks. Just looked at the homebridge script again and it appears that it loads BOTH scenes AND devices into HomeKit? Wouldn't that double stuff up, though? Do you have both loaded into yours or just your scenes? Can you still do stuff like dim your scenes through HomeKit?

PaulWieland commented 7 years ago

@VeniceNerd you use the configuration file to filter out which devices you want to exclude. For example, my Deck scene has 3 keypad buttons and 4 switches. All 7 of those devices are filtered out in my configuration file while the Deck scene is included.

Its a little bit more of a pain dealing with dimmable scenes because Insteon does not support discrete scene brightnesses (a major flaw in their protocol if you ask me). Instead you can only tell a scene to dim or brighten and turn on or off.

Because of this, it is fundamentally incompatible with Homekit's dimmable switch API because that sends discrete 0-100% brightness values. Individual insteon dimmer switches work just fine however.

@rodtoll was contemplating a workaround in this plugin for this dimmable scene problem, but I don't know if he ever solved it. I haven't kept up with the release notes for quite some time...

VeniceNerd commented 7 years ago

@fahrvergnuugen Argh ok dang it. That still wouldn't quite work for me then. I guess I could still use the ISY Homebirdge plugin to "listen" in on the devices so at least they are in Sync with HomeKit (something that the Hub Pro itself can not do...) but I would have to live with my Keypads being out of sync in that scenario....

Very curious to hear if @rodtoll was able to figure that one out....

Another solution I started reading about is OpenHab2. It appears that it reads out the Insteon Hub and has HomeKit support built in. I wonder how far you could get with that one....

suderman commented 7 years ago

I have an ISY-994i with homebridge-isy-js. I have a lot of Insteon scenes—mostly for keypad buttons and virtual three-way switches, but I don't include any of these scenes in homebridge. I only map the actual Insteon devices to Homekit, and control the devices themselves with my iPhone. I then keep the keypad buttons synchronized with the device status by using ISY-994i programs, which watch the status of Insteon devices.

For example, I have a lamp in my living room which can be controlled by a button on two keypads (one on each side of the room). The two buttons and the lamp are set up as an Insteon scene, in the usual way. Then, (for the sake of Homekit), an ISY program watches the status of the lamp, and if it's changed, updates both keypads.

isy

It's extra complication, but I want my keypads to change when Siri controls my lights! :-)

VeniceNerd commented 7 years ago

@suderman dang that's cool!

Now does that just turn on the light in the button or does it actually update the function as well? What I mean is this:

If I turn on your light via Siri it will turn on and then the program listens for the device turning on and updates your keypad buttons.

However, if I now press that lit keypad button will it actually turn off the scene? Or if i press and hold will it dim/brighten the scene?

suderman commented 7 years ago

Pressing the keypad button works as you would expect without Homebridge or an ISY involved—just using the normal communication between devices as setup in an Insteon Scene. So yes: pressing and holding the keypad button will brighten the Insteon scene, and in this case, my brighten my lamp and light up the button. Homebridge-js-isy then communicates this change to Homekit and I see this change to the lamp accessory on my iPhone.

In fact, everything works great on its own—except for when I bypass the keypad and control the device directly with my iPhone. This skips the Insteon scene, and that's the problem—those keypad buttons rely on Insteon scenes to turn on or off!

So in a way, the scene is defined twice—just in the other direction. In addition to assigning devices to a scene (the usual way), I use ISY programs to assign scenes to a device (by watching their statuses).

VeniceNerd commented 7 years ago

@suderman that sounds awesome. I may try this. One question: you said "everything works great unless you bypass the keypad and control the device directly from your iPhone"

What do you mean by that? You don't mean HomeKit or Siri control do you?

suderman commented 7 years ago

Yes, that's what I mean. And that's because as I said earlier, I don't include Insteon scenes in my homebridge-isy-js config. It can cause duplicates and I don't get the individual device dimming ability via Siri if I try to use scenes this way. But I still want scenes to happen on my ISY, so as I explained above, I trigger those scenes using programs that watch my device statuses.

I recorded a demo just now: http://d.pr/v/3JOy+

It starts with the scene on (the button on and the lamp on). I push the button to turn off the scene and that turns off the lamp. I then turn on the lamp with Homekit, and after a short delay, the program notices and turns on the rest of the scene (causing the button to turn on too). I then dim the lamp with my iPhone (the webcam auto-corrected the changing light levels, so you can really see the lamp get dim too well), until the lamp is dimmed all the way off. Again, the program notices the lamp is off, and triggers the scene to turn off as well (causing the button to turn off too).

VeniceNerd commented 7 years ago

Holy shit, you are living my dream, @suderman. That's really great! Thanks for the video as well.

I think I'll give this a go this week. Hopefully I'll be able to figure it all out. Is the system running pretty stable or do you get a lot of HomeKit "can't reach this accessory" errors?

I'm running Homebridge on an iMac already to interface with my Logitech Hub. Works pretty well but once every so often the device is "unreachable."

Now I just need to install the ISY Hub I got and set up my entire Insteon network from scratch.

Do you happen to know by any chance if the ISY and Homebridge support the Insteon Micro Open/Close Module? Using that for my external shutters.

PaulWieland commented 7 years ago

@suderman In case of a three+ way dimmer switch scene, do you have a solution to keep the dimmer switch brightness LEDs in sync with each other?

suderman commented 7 years ago

@VeniceNerd It's pretty stable. The most stable component of my setup are the links between keypad button and light, as Insteon scenes don't require any controller running or even WiFi. After that, the ISY is very solid, and homebridge works great 95% of the time. Occasionally HomeKit accessories will not respond or become unreachable, but that's usually because my phone is somewhere between a WiFi and LTE connection at the time.

And sorry, I don't have an Insteon Micro Open/Close Module, but it looks like there are people using it with their ISY here. Even if it's not specifically supported by homebridge-isy-js, you can make any ISY program appear as a lightbulb in your HomeKit, by including a scene in your homebridge-isy-js config (and have that ISY program act on that scene).

Or if you want something more complex, you can make pretty much any HomeKit accessory (see list of available services here) using ISY state variables and my own homebridge plugin, homebridge-isy-maker. I use this to control my iTach infrared devices.

@fahrvergnuugen Sorry, I don't have a solution for dimmer switches—I've only done three-way switches using keypad buttons and lamp modules/bulbs, turning them fully bright or fully off.

VeniceNerd commented 7 years ago

@Suderman so I'm slowly starting to set everything up and so far so good. Got the ISY up and running and programmed in one room. Tomorrow I'll try the Homebridge plugin before setting up the rest of the house. Have two questions for you:

1) when it comes time to set up the Homebridge setup and I want to exclude devices and scenes by name does it just use the actual item name from ISY or does it use the "folder / subfolder / device name" name?

2) so now that I have all this power I'm wondering if I could trick the system into allowing to turn on my hue lights with an Insteon keypad button. Here is what I'm thinking:

Create an empty "Trigger scene" that is turned on/off by Keypad Button "D". The scene itself won't have any devices. Import that "trigger scene" as a device into HomeKit. Now in HomeKit set a rule that if "Trigger scene" is turned on it turns on the hue lights. If "Trigger scene" is turned off it turns off the hue lights.

Do you think something like that could work or am I getting too excited?

Also, is there any way to tell ISY to invoke different scenes depending on if a keypad button is pressed once or double tapped? That way you could map two different hue scenes to one button! :)

suderman commented 7 years ago

@VeniceNerd

  1. I exclude all scenes and then include only what I want by address. This address looks like a 5-digit number, for example: 27346). I ignore devices using "nameContains", and I'm pretty sure this is only their name (not the full / folder / structure). At least that's been my working assumption.

  2. Yes, I think your approach would work, although I'm not using any HomeKit Automation triggers for my own setup. I mostly own Insteon lightbulbs, which work natively with the ISY, but I also own a few Hue bulbs for colour-changing fun.

By the way, there are a couple of ways to control your Hue lights directly with the ISY:

  1. Use an ISY program that calls a Network Resource (enabling the Network Resources module was an extra purchase for me). It's a bit finicky to setup, but reasonable for the purposes of a single keypad button. There's a thread about it here.

  2. The second, more involved method is to update your ISY to the 5.0 beta release, setup a Raspberry Pi (or similar device) and install Polyglot. This is how Universal Devices is planning to extend the ISY to communicate with third-party devices, like the Hue hub. This is a lot more setup, but the advantage is that the Hue lights will appear just like native devices in the ISY admin. I haven't done this yet, but I plan to.

As for your last question, yes, the ISY sees the double-tap as a separate event. It's called Fast On/Fast Off (instead of just regular On/Off), and you can create a program that responds to that specifically. I use the double tap Off button on a keypad by my front door, which turns off all the lights in the house. :-)

rodtoll commented 7 years ago

@suderman @fahrvergnuugen @VeniceNerd - This was a great discussion -- although a little off topic for homebridge-isy-js support. :) Hope you all figured out your issues.