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

Sensor On/Off Garage Open/Closed #27

Closed robgarrett closed 8 years ago

robgarrett commented 8 years ago

Not sure if I need to change something on my ISY, but my sensor shows as ON when my garage is closed - this makes sense because the magnet triggers the sensor when the door is closed.

Unfortunately, HomeKit shows my garage as Open when it's actually closed, and closed when it's opened. I tried using "alternate" as true and it makes no difference in my home kit app. Is there something else I should do to make this work correctly?

Thanks,

R.

PaulWieland commented 8 years ago

@robgarrett you should switch your wiring so that garage door closed = normally open ("no") on the i/o linc sensor. If you have a power outage, the i/o linc will have the wrong state. This is described on UDI's wiki

The way homebridge-isy-js deals with this is explained here:

Garage door openers (in this case an I/O Linc used in a garage kit) are complex to get correct. We only have the current state of the contact sensor to determine current status. In particular, if you startup the system while the garage door is changing state (opening or closing) the code will likely get the state incorrect. If you get into this state, close the garage door and restart homebridge. The garage door is assumed open at startup and closed at startup if the contact sensor says the door is open or closed respectively.

rodtoll commented 8 years ago

@robgarrett - @fahrvergnuugen is correct, the easiest way to address this is to reverse the wiring.

The alternate setting should invert the logic unless there is a bug. This is a relatively untested path though as I don't have a garage wired inverted. And looking at the code I didn't put enough logging in there to debug remotely. Code inspection suggests it should work but that isn't reliable.

The other thing to ensure is that for the address for the garage door you put the .1 address of the IO Linc controlling your garage. The IO Linc appears as two devices and you want to ensure that you specify the .1 address when you setup your address value.

robgarrett commented 8 years ago

Thanks for the feedback. I checked my wiring last night and it's wired N/O. The sensor shows ON in my ISY. When running home bridge I get a startup message that the garage door is defaulting state to open. Does this mean I have to have my garage open for every power cycle or reset?

Setting the alternate to closed changes the startup message to defaulting state closed. However my IOS device still shows the garage as open when it's closed.

Am I confusing open/close of the sensor verses garage door?

On a separate issue, homebridge seems to stop reporting status to my IOS device routinely, which might be giving me false status. The open/close action still appears to activate the door.

I'm in the process of setting up a development rig for HomeKit and homebridge to see if I can debug the problem. I'll report back.

Thanks

R

Sent from iPhone.

On Mar 23, 2016, 1:03 PM -0400, rodtollnotifications@github.com, wrote:

@robgarrett(https://github.com/robgarrett)-@fahrvergnuugen(https://github.com/fahrvergnuugen)is correct, the easiest way to address this is to reverse the wiring.

The alternate setting should invert the logic unless there is a bug. This is a relatively untested path though as I don't have a garage wired inverted. And looking at the code I didn't put enough logging in there to debug remotely. Code inspection suggests it should work but that isn't reliable.

The other thing to ensure is that for the address for the garage door you put the .1 address of the IO Linc controlling your garage. The IO Linc appears as two devices and you want to ensure that you specify the .1 address when you setup your address value.

— You are receiving this because you were mentioned. Reply to this email directly orview it on GitHub(https://github.com/rodtoll/homebridge-isy-js/issues/27#issuecomment-200443499)

i814u2 commented 8 years ago

@robgarrett I have a similar setup to you and was able to get mine working (at least for status and manual triggering).

Have you restarted homebridge, after editing the config? I ask because it sounds like your original setup should have worked (with alternate set to true).

This is the portion of my config for garage doors:

"garageDoors": [
                { "address": "1D 5C B4 1", "name": "Garage Overhead", "timeToOpen": 10000, "alternate": true },
                { "address": "1D 59 4A 1", "name": "Shop Overhead North", "timeToOpen": 10000, "alternate": true },
                { "address": "1D 5A 14 1", "name": "Shop Overhead South", "timeToOpen": 10000, "alternate": true }
            ],

The one quirk was that nothing showed the proper status until I opened each door at least once. At first my phone thought everything was open still. So I opened each door, then closed them all. That seemed to get everything on the same page.

The only thing that I can't seem to get to work is the voice commands. I always have to refer to the relay device, and always tell it to turn on. I was hoping for "open" and "close" commands, but perhaps it isn't there yet. I'm pretty certain that excluding the relay portion of the I/O linc would still report the proper status, as well as allow manual triggering of the garage doors. However, I couldn't issue any commands to Siri which would work, so for now I've added the relay devices back to the config.json (more accurately, I haven't excluded them).

I've been using/testing Insteon+ and Elgato Eve apps on the iPhone, in case you're curious. Homebridge version: 0.3.2 Homebridge-isy-js version: 0.1.5 nodejs version: 4.4.2

rodtoll commented 8 years ago

@i814u2 - You should be able to use the name in the name field to open or close it. Mine has the following definition:

"garageDoors": [ { "address": "17 22 33 1", "name": "Garage Door", "timeToOpen": 12000 } }

And I can say: "Open the garage door" or "Close the garage door".

When you do "Open the Garage Overhead" does it work?

i814u2 commented 8 years ago

@rodtoll - It tells me that it is unable to find any devices at this time.

I've tried various changes as well, saying the words in different orders, omitting "the", etc.

I've used the Insteon+ app to see that the "Siri Control" name is "Garage Overhead", and the device name is currently "Garage Overhead Status" (I tried saying that in the command as well but it obviously didn't work). Additionally, I have the relay portion of the iolinc listed as "Garage Overhead Relay" and the Siri Control for that is "Garage Overhead Two", just for testing purposes. Oddly, when I say "Open the Garage Overhead Two" it capitalizes "Garage Overhead Two" as though it knows it is a device. But then claims it can't find the device. When I just say "Garage Overhead" it does not capitalize the words.

As a point of clarification: should I have the relay portion ignored via the config.json, or is there any special naming needed? Ideally, I'd like to ignore the relay portion so it's not another device in the list.

rodtoll commented 8 years ago

For the sensor device, which is the device ending in 1 on the IO Linc you shouldn't have to ignore it. You will have to ignore the second device (the relay) though as you suggest. In fact, if you don't ignore it I suspect there may be a bug which could cause a problem. Have you tried ignoring the relay?

If that doesn't help I would turn on debug logging by setting "debugLoggingEnabled": true in the config.json and try some siri commands and see if anything is happening in the homebridge plugin. Perhaps there is an internal error?

On Sun, Apr 17, 2016 at 2:30 PM Joshua Kukovec notifications@github.com wrote:

@rodtoll https://github.com/rodtoll - It tells me that it is unable to find any devices at this time.

I've tried various changes as well, saying the words in different orders, omitting "the", etc.

I've used the Insteon+ app to see that the "Siri Control" name is "Garage Overhead", and the device name is currently "Garage Overhead Status" (I tried saying that in the command as well but it obviously didn't work). Additionally, I have the relay portion of the iolinc listed as "Garage Overhead Relay" and the Siri Control for that is "Garage Overhead Two", just for testing purposes. Oddly, when I say "Open the Garage Overhead Two" it capitalizes "Garage Overhead Two" as though it knows it is a device. But then claims it can't find the device. When I just say "Garage Overhead" it does not capitalize the words.

As a point of clarification: should I have the relay portion ignored via the config.json, or is there any special naming needed? Ideally, I'd like to ignore the relay portion so it's not another device in the list.

— You are receiving this because you were mentioned.

Reply to this email directly or view it on GitHub https://github.com/rodtoll/homebridge-isy-js/issues/27#issuecomment-211119618

i814u2 commented 8 years ago

Originally, I had the relay portion ignored, but I will try it again. Perhaps it was a combination of not having proper words, or some other issue at the time.

With some wording changes, and naming changes, I was able to get one of the three doors to respond. The downside is that it was the wrong one. I'll mess with it some more and gather up some log info for you. I'm possibly ill at the moment, so I may not get around to this right away.

Thank you for taking the time to try and help me.

i814u2 commented 8 years ago

@rodtoll - I did a little bit of testing and some of the doors open now, but not as expected. Here is what I've got so far:

config.json:

"garageDoors": [
    { "address": "1D 5C B4 1", "name": "Garage Door", "timeToOpen": 10000, "alternate": true },
    { "address": "1D 59 4A 1", "name": "Shop Overhead North", "timeToOpen": 10000, "alternate": true },
    { "address": "1D 5A 14 1", "name": "Shop Overhead South", "timeToOpen": 10000, "alternate": true }
],
"ignoreDevices": [
    { "nameContains": "Motion", "lastAddressDigit": "", "address": "" },
    { "nameContains": "Overhead", "lastAddressDigit": "2", "address": "" }
]

In ISY, the devices look like this:

Device Name - Device ID - Device Type
Garage Overhead  - 1D 5C B4 1 - (2450) IOLinc v.41
Garage Overhead-Relay - 1D 5C B4 2 - (2450) IOLinc v.41
Shop North Overhead - 1D 59 4A 1 - (2450) IOLinc v.41
Shop North Overhead-Relay - 1D 59 4A 2 - (2450) IOLinc v.41
Shop South Overhead - 1D 5A 14 1 - (2450) IOLinc v.41
Shop South Overhead-Relay - 1D 5A 14 2 - (2450) IOLinc v.41

In Insteon+ (on my iPhone), the devices show with this information:

Device Name - Siri Control - Model (Under Additional Information)
Garage Overhead Status - Garage Door - Garage Door
Shop Overhead North Status - Shop Overhead North - Shop Overhead North
Shop Overhead South Status - Shop Overhead South - South Overhead South

The different names are from various testing. I stopped changing some of them because I noticed a few consistencies and didn't need to change some of the names. So the Siri Control field is what Siri knows the name to be (not surprising). The "Model" is whatever name I provide in the config.json. Previously, I had everything set with 'overhead' in the name because that's how I wanted to refer to those doors. Now, after some testing, I've found that if I name one of them Garage Door, and make sure that the Siri Control value is Garage Door, then the system actually starts responding. Sadly, it responds in unexpected ways. I have not yet been able to get the actual garage overhead to open. Just the shop doors respond. So I say "Open the Garage Door" and best case, it opened just one of the shop overheads (north, so be specific). When I tried again, at one point, it opened both shop overheads, but not the garage. Additionally, a lot of the time when I say to open a specific shop overhead, it tries to unlock my deadbolt. So, I said "open the shop overhead north", which matches the siri control setting for the overhead, and it said no devices found. I said "Open the shop north overhead" as a test, it printed just that on the screen, but then unlocked my "Shop Door Deadbolt" device.

And, finally, here is the logging output from when I asked for the "garage door" to be opened and both shop overheads opened instead:

11:43:25 AM] [isy-js] 116-3-1#11:43:25- GARAGE: Shop Overhead North Current state is closed and target is open. Waiting for sensor change to trigger opening state
2016-3-1#11:43:25- ISY-JS: Sending command...http://192.168.2.10/rest/nodes/1D 59 4A 2/cmd/DON
[4/18/2016, 11:43:25 AM] [isy-js] 116-3-1#11:43:25- GARAGE: Ignoring redundant set of target state
[4/18/2016, 11:43:25 AM] [isy-js] 116-3-1#11:43:25- GARAGE: Shop Overhead South Current state is closed and target is open. Waiting for sensor change to trigger opening state
2016-3-1#11:43:25- ISY-JS: Sending command...http://192.168.2.10/rest/nodes/1D 5A 14 2/cmd/DON
2016-3-1#11:43:25- Node: 1D 59 4A 2 changed
2016-3-1#11:43:26- Node: 1D 59 4A 1 changed
[4/18/2016, 11:43:26 AM] [isy-js] 116-3-1#11:43:26- GARAGE:  Shop Overhead NorthCurrent state of door is closed and now sensor says open. Setting state to opening
[4/18/2016, 11:43:26 AM] [isy-js] 116-3-1#11:43:26- GARAGE: Ignoring redundant set of target state
2016-3-1#11:43:26- ISY-JS: Variable:12 (2) changed
2016-3-1#11:43:27- Node: 1D 5A 14 2 changed
2016-3-1#11:43:27- Node: 1D 5A 14 1 changed
[4/18/2016, 11:43:27 AM] [isy-js] 116-3-1#11:43:27- GARAGE:  Shop Overhead SouthCurrent state of door is closed and now sensor says open. Setting state to opening
[4/18/2016, 11:43:27 AM] [isy-js] 116-3-1#11:43:27- GARAGE: Ignoring redundant set of target state
2016-3-1#11:43:29- ISY-JS: Variable:13 (2) changed
2016-3-1#11:43:29- Node: 1D 59 4A 2 changed
2016-3-1#11:43:30- Node: 1D 5A 14 2 changed
[4/18/2016, 11:43:36 AM] [isy-js] 116-3-1#11:43:36- GARAGE:  Shop Overhead NorthCurrent door has bee opening long enough, marking open
2016-3-1#11:43:36- Node: 1D 59 4A 1 changed
[4/18/2016, 11:43:36 AM] [isy-js] 116-3-1#11:43:36- GARAGE:  Shop Overhead NorthCurrent state of door is open and now sensor shows closed. Setting current state to closed
[4/18/2016, 11:43:36 AM] [isy-js] 116-3-1#11:43:36- GARAGE: Ignoring redundant set of target state
2016-3-1#11:43:36- ISY-JS: Variable:12 (2) changed
[4/18/2016, 11:43:37 AM] [isy-js] 116-3-1#11:43:37- GARAGE:  Shop Overhead SouthCurrent door has bee opening long enough, marking open
2016-3-1#11:43:38- Node: 1D 5A 14 1 changed
[4/18/2016, 11:43:38 AM] [isy-js] 116-3-1#11:43:38- GARAGE:  Shop Overhead SouthCurrent state of door is open and now sensor shows closed. Setting current state to closed
[4/18/2016, 11:43:38 AM] [isy-js] 116-3-1#11:43:38- GARAGE: Ignoring redundant set of target state
2016-3-1#11:43:38- ISY-JS: Variable:13 (2) changed

If this should be under a separate issue, let me know.

PaulWieland commented 8 years ago

@i814u2 I suspect this may be because the word "Garage Door" is pre programmed noun for Siri.

My garage door is named "Pod Bay Door". If I say "Siri, open the Garage Door" she says "Ok, the Pod Bay Door is opened". In other words, Siri listens for the keyword "Garage Door" and then looks for devices of the type Garage Door.

I only have one garage door so I can't tell you what happens when you have a bunch, but I would try giving your garage door a more specific name that doesn't include the words "garage" or "door" to see what happens.

For example, try naming your garage doors "Bay One", "Bay Two", "Bay Three". Then say "Siri, open Bay Two Garage Door".

rodtoll commented 8 years ago

This is a good suggestion from @fahrvergnuugen

Looking at the logs you sent it appears like Siri sent an open command to the Shop Overhead devices and not the Garage door. I'm fairly certain the code won't loop through the garage doors independently and there is clearly two specific and different open commands being sent to homebridge-isy. Try renaming as he suggests and ensuring the relay devices are properly ignored. I wouldn't see this issue in my setup as I only have one garage door.

Try ignoring the Garage Door relay device as well. (You have the overhead devices covered, but not the garage door).

In terms of opening your deadbolt I'd need to see logs for that as well. Is the name similar?

On Mon, Apr 18, 2016 at 10:37 AM fahrvergnuugen notifications@github.com wrote:

@i814u2 https://github.com/i814u2 I suspect this may be because the word "Garage Door" is pre programmed noun for Siri.

My garage door is named "Pod Bay Door". If I say "Siri, open the Garage Door" she says "Ok, the Pod Bay Door is opened". In other words, Siri listens for the keyword "Garage Door" and then looks for devices of the type Garage Door.

I only have one garage door so I can't tell you what happens when have a bunch, but I would try giving your garage door a more specific name that doesn't include the words "garage door" to see what happens.

— You are receiving this because you were mentioned.

Reply to this email directly or view it on GitHub https://github.com/rodtoll/homebridge-isy-js/issues/27#issuecomment-211491259

i814u2 commented 8 years ago

@rodtoll @fahrvergnuugen - I'll try out some more name changes. However, if what you say is true, it seems like maybe the best case would be that all of them open since Siri would find 3 Garage Door types. We'll see though.

As for the relays, they are ignored. The ISY naming is "Overhead" not "Door", so it was successfully ignoring all 3 relay devices. I can't find any Relay items in the Insteon+ app either, so it appears to work fine. However, I'll change the config to specifically ignore those three addresses, just because.

Deadbolts all follow a similar naming pattern: Front Door Deadbolt Garage Door Deadbolt Shop Door Deadbolt

I tried naming the garage as Bay One, and have all three set as garage door in the config (that could be wrong, not sure). When I said open the bay one garage door, siri unlocked my garage door deadbolt. I tried it with "Garage Overhead" as well, again, with the new config with all 3 set to "Garage Door" for name. Siri just keeps unlocking the deadbolt in the garage.

Perhaps I'll have to re-think some naming and try to research homekit a bit more to see if there's a solution. Or, perhaps for now, take out the shop overhead doors.

PaulWieland commented 8 years ago

@i814u2 you have too many doors ;)

I think Siri is confusing "Garage Door Deadbolt" and the overhead door because the deadbolt has the words "garage door" in it's name. Try "Siri Open Bay One" and don't say "garage door" - it should open the bay door and not the deadbolt.

i814u2 commented 8 years ago

@fahrvergnuugen Apparently I do have too many. Bummer.

I tried Open Bay One but it takes me to a website. If I say "Siri Open Bay One" it says no devices found. Basically it's confused and slight wording differences don't seem to help me.

For now, I'll consider just having one door setup and trying to make that work.

i814u2 commented 8 years ago

Well, for now this is probably my final comment, but I thought I'd add this info for any future reference.

I ignored all deadbolts, all overhead relays, and the two shop overhead doors. Even doing that, I had odd results.

In the config, I had the entry name set as "Garage Overhead", siri control was set as "Garage Door", and saying "open the garage door" would open the door (close worked as well).

I changed siri control to "Garage Overhead" and saying "open the garage overhead" would not work (no devices found). I tried variations like "open the garage garage overhead", "open the garage overhead in the garage", etc. Oddly, that second one properly capitalized Garage Overhead, like it it knew it was a device. None worked though. If I asked Siri to open the Garage Door, the response was that no door locks were found in the Garage (which is a room I have set up, hence the capitalization).

So it looks like I can't have deadbolts and overheads in the same room (or with similar names), and that Siri has a preference for a door to be associated with a lock. Oddly, it seems there's a lack of knowledge of overhead doors, or that someone may have both in the same room (and therefore named similarly).

As a quick test, I just made the config name "Garage Door" and left the siri control as "Garage Overhead". Commanding the garage overhead complains of no devices found, commanding the garage door complains of no door locks found. So apparently the config name/device model (as it shows in the insteon+ app, at least) does nothing, and having the siri control set to Garage Door is the only thing that overrides the built in setting to assume there's a lock to unlock. Just having door as the siri control worked as well, but I'm sure because it's in the "garage" room.

Oddly, I tried having the config set to "Garage Door", the siri control set to "Pod Bay Door", the device name (in insteon+) set to "Garage Door" and nothing would work. All responses were device not found or no door locks found in garage.

I'd assume that I'm missing something, except that the same commands I'm giving are working in a few of my test variations, just not in all of them. So I must have the proper sequence of words, but Siri just doesn't care about some of them or gets confused with others. Sadly, the ones that work do not lend for a very useful configuration in my case. Mostly because of the number of doors I have, and also because I have deadbolts which match the location/naming of the overhead doors.

I'm sure I'll figure something out, and it's not going to kill me. Just a bit frustrating that Siri has such specific requirements instead of just trusting the naming set within the Insteon+ app. I mean, it requires a unique name, so it should be able to handle any unique name. I understand if that name was reserved and the app didn't warn me, but I tried nonsense names as well, just to be sure, and those all failed.

Thanks, again, to everyone trying to help. Hopefully my posts will at least provide some sort of info to someone in the future. Or maybe I just completely missed something and someone can point it out to me. I'll try to remember to update if I ever figure out a solution.

rodtoll commented 8 years ago

Thank you for your patience and sharing your experiences. It definitely seems like Siri has a ways to go with it's command set and handling garage doors. :(

macjeff commented 8 years ago

I have three garages. I can name all three and they open but if I say Close Middle Garage door or close first garage door it says Garage Doors Closing and all three close. Is there no way to close only one at a time? Open works that way!!!