damianxd / homebridge-vera

Apache License 2.0
51 stars 37 forks source link

homebridge-vera sending off comand instead of on #118

Closed Juppers closed 7 years ago

Juppers commented 7 years ago

I have a GE/Jasco 12722 on/off switch hooked to a light in my kitchen. When I use homekit to turn it on, my vera receives an off command instead. I can turn it off if it is already on, but can't turn it on with homekit.

Here are the logs that vera sees when I send an on command.

08 03/30/17 8:46:34.766 JobHandler_LuaUPnP::HandleActionRequest device: 116 service: urn:upnp-org:serviceId:SwitchPower1 action: SetTarget <0x30fc1680> 08 03/30/17 8:46:34.768 JobHandler_LuaUPnP::HandleActionRequest argument DeviceNum=116 <0x30fc1680> 06 03/30/17 8:46:34.769 Device_Variable::m_szValue_set device: 116 service: urn:upnp-org:serviceId:SwitchPower1 variable: Target was: 1 now: 0 #hooks: 0 upnp: 0 skip: 0 v:0xacede0/NONE duplicate:0 <0x30fc1680> 06 03/30/17 8:46:34.980 Device_Variable::m_szValue_set device: 116 service: urn:upnp-org:serviceId:SwitchPower1 variable: Status was: 1 now: 0 #hooks: 3 upnp: 0 skip: 0 v:0xacee48/NONE duplicate:0 <0x2bebb680> 04 03/30/17 8:46:34.982 <0x2bebb680>

Juppers commented 7 years ago

It clipped the import part of the log, here it is.

04 03/30/17 8:46:34.982 Job ID="262" Name="OFF node 32" Device="116" Created="2017-03-30 8:46:34" Started="2017-03-30 8:46:34" Completed="2017-03-30 8:46:34" Duration="0.210576000" Runtime="0.209495000" Status="Successful" LastNote="SUCCESS! Transmit was OK" Node="32" NodeType="ZWaveNonDimmableLight" NodeDescription="Sink Light" <0x2bebb680>

Juppers commented 7 years ago

I updated to the latest version and it finds phantom devices and won't start. The devices below don't exist and aren't found with 0.6.1.

Process Device 28: Julia Lamp Process Device 29: Julia Lamp [3/30/2017, 9:48:08 AM] [Vera] Initializing platform accessory 'Julia Lamp'... [3/30/2017, 9:48:08 AM] [Vera] Initializing platform accessory 'Julia Lamp'... Unhandled rejection Error: Cannot add a bridged Accessory with the same UUID as another bridged Accessory: db350ff4-3b49-4fba-8929-4cba0299b026

drewcovi commented 7 years ago

@juppers how did you install the latest version? Can you paste in the command you used?

Juppers commented 7 years ago

npm install -g --unsafe-perm damianxd/homebridge-vera is what I found in other posts reporting similar issues.

drewcovi commented 7 years ago

@juppers, something seems super strange there. I might recommend clearing your homebridge device cache. Do you have two devices with the same name? If not then yes. Something is odd with your Vera or with your homebridge cache. This plugin simply reads the list of devices from http://[ipaddress]:3480/data_request?id=sdata and iterates through. If there are "ghost devices" can you confirm there are no ghost devices shown in your Vera? You might need to parse the output using a JSON parsing extension.

Juppers commented 7 years ago

Just installed with this command and got the same result.

git clone https://github.com/damianxd/homebridge-vera.git cd homebridge-vera git checkout master npm install -g ./

Juppers commented 7 years ago

I went to that URL and the only items close to matching are below. There is no device or scene 28 and 29 is a christmas tree module.

{ "name": "Christmas Tree", "altid": "4", "id": 29, "category": 3, "subcategory": 0, "room": 1, "parent": 1, "status": "0", "commFailure": "0", "state": -1, "comment": "" },

{ "name": "Julia Lamp Off", "id": 8, "room": 8, "active": 1, "state": -1, "comment": "" }, { "name": "Julia Lamp On", "id": 7, "room": 8, "active": 0 }, { "active": 0, "name": "Julia Lamp Toggle", "id": 18, "room": 8 },

drewcovi commented 7 years ago

So it's creating a device for the two scenes you have for Julia Lamp which is expected... Not entirely sure why it truncates the Off and On, but if you rename those with a hyphen in your Vera or remove the space something tells me the problem will go away. Otherwise you can always add them to the ignorescenes: [7,8] in your config.json and they'll just be ignored for now.

drewcovi commented 7 years ago

to clarify: Julia Lamp-Off, Julia Lamp-On or Julia LampOff, Julia LampOn

Totally not sure why homebridge would strip out this portion of the name though. I'll have to take a closer look.

Juppers commented 7 years ago

They are spaces. "Julia Lamp On" "Julia Lamp Off".

I found 6 devices that don't exist.

Process Device 28: Julia Lamp Process Device 29: Julia Lamp Process Device 30: Something off Process Device 31: Something on Process Device 46: Master Motion Tripped Process Device 47: Master Motion Untripped

Juppers commented 7 years ago

They should already be ignored. Unless the newer version knows the difference between scenes and devices now. I did add 28 and 29 to this list but it didn't make a difference.

"ignoredevices":[1,2,4,5,6,7,8,11,12,15,17,18,19,20,21,22,23,24,25,26,34,35,37,38,39,40,41,44,47,48,49,51,65,66, 68,69,71,72,74,75,94,95,96,97,98,99,101,103,104,105,106,107,108,109,110,111,112,113,114,126,136]

drewcovi commented 7 years ago

the newer version knows the difference between scenes and devices now.

Juppers commented 7 years ago

Ok, renamed to Julia Lamp-Off and Julia Lamp-On, added ignorerooms (most all scenes are in room 8) and ignorescenes, removed the cache, restarted, no change. The 6 mystery devices still show up and it has the same error.

  "ignorerooms":[7,8],
  "ignorescenes":[42,39,17,6,5,26,25,2,44,12,11,19,18,8,7,15,21,48,49,22,40,20,23,24],
  "ignoredevices":[1,2,4,5,6,7,8,11,12,15,17,18,19,20,21,22,23,24,25,26,34,35,37,38,39,40,41,44,47,48,49,51,65,66,

68,69,71,72,74,75,94,95,96,97,98,99,101,103,104,105,106,107,108,109,110,111,112,113,114,126,136]

drewcovi commented 7 years ago

@juppers have you deleted your device cache in your homebridge config directory?

drewcovi commented 7 years ago

@Juppers can you also confirm that you are not running this in "standalone" but as a homebridge plugin?

Juppers commented 7 years ago

7 and 8 are in there, close to the middle of the list. I just wrote them down as they are listed in the vera, I'll go back and sort numerically later. I deleted everything in the accessories and persist directories under ~/.homebridge. This is running as a homebridge plugin.

drewcovi commented 7 years ago

@Juppers hmmmm this one is definitely tricky. Only thing I can think of is perhaps turning on debugging in homebridge. I'll also dig deeper and see if for some reason the scenes are getting read twice

Juppers commented 7 years ago

Tried to go back to 0.6.1, but now npm install -g homebridge-vera installs 0.7.0, which does the same thing. Should i be on 0.6.2 or 0.7.0?

drewcovi commented 7 years ago

So stick with the latest for now if you can. Turn on debugging following homebridge instructions. The problem is I can't trace back where you're getting duplicate calls. If you're not running in standalone then it can't be because you're using rooms. I'll have to dig a little deeper on this. If you have time to debug and trace it to the source of the problem I'm always very happy to accept pull requests.

drewcovi commented 7 years ago

And I did update npm to the latest as we get a lot of folks dealing with old issues. I finally got permissions to update npm.

drewcovi commented 7 years ago

@Juppers can you also please post your config.json ?

Juppers commented 7 years ago

{ "bridge": { "name": "Homebridge", "username": "CC:22:3D:E3:CE:30", "port": 51826, "pin": "031-45-154" },

"description": "This is an example configuration file with one fake accessory and one fake platform. You can use t

his as a template for creating your own configuration file containing devices you actually own.",

"platforms": [ { "platform": "Vera", "name": "Vera", "veraIP": "192.168.1.6", "includesensor": false, "ignorerooms":[7,8], "ignorescenes":[42,39,17,6,5,26,25,2,44,12,11,19,18,8,7,15,21,48,49,22,40,20,23,24], "ignoredevices":[1,2,4,5,6,7,8,11,12,15,17,18,19,20,21,22,23,24,25,26,34,35,37,38,39,40,41,44,47,48,49,51,65,66, 68,69,71,72,74,75,94,95,96,97,98,99,101,103,104,105,106,107,108,109,110,111,112,113,114,126,136] } ],

"accessories": [ { "accessory": "MagicHome", "name": "Master Headboard", "ip": "192.168.1.60", "setup": "RGBW", "purewhite": false }, { "accessory": "MagicHome", "name": "Julia Headboard", "ip": "192.168.1.61", "setup": "RGBW", "purewhite": false } ] }

drewcovi commented 7 years ago

@Juppers thanks! seems fine on this end.... could you turn on debugging in homebridge and look for a point where it says "Ignoring Scene" to verify it is actually ignoring the scenes you have listed? Based on how you're running homebridge (As a service or otherwise) this is done in various ways.

Juppers commented 7 years ago

I installed afresh copy of everything on a new server with the same results. The phantom devices look like things from old or test scenes, but they are long gone and don't show up under http://192.168.1.6:3480/data_request?id=sdata at all. Is there somewhere else it may be checking the vera for device/scene info?

drewcovi commented 7 years ago

@Juppers, hmmm I think I might know what's going on. there's an initial request to user_data instead of sdata to get device information (its not available to sdata).

For some reason, Vera keeps these ghost scenes around.

Short term fix: pull up user_data instead of sdata and look for those ghost scenes. add their ID to the ignorescenes array.

drewcovi commented 7 years ago

@Juppers more permanent fix is to delete the scenes using the good old URL query string params on your Vera

http://forum.micasaverde.com/index.php?topic=37525.0

Juppers commented 7 years ago

There they are. They are notifications!

{ "name": "Julia Lamp", "notification_only": 21, "triggers": [ ], "id": 28, "Timestamp": 1458173930, "room": 0 }, { "name": "Julia Lamp", "notification_only": 21, "triggers": [ ], "id": 29, "Timestamp": 1458173930, "room": 0 }, { "name": "Something off", "notification_only": 27, "triggers": [ ], "id": 30, "Timestamp": 1475009826, "room": 0 }, { "name": "Something on", "notification_only": 27, "triggers": [ ], "id": 31, "Timestamp": 1475009826, "room": 0 }, { "name": "Master Motion Tripped", "notification_only": 107, "modeStatus": "0", "triggers": [ { "device": 107, "name": "Master Motion Tripped", "enabled": 1, "arguments": [ ], "template": "3", "last_eval": 1, "last_run": 1490887661 } ], "users": "", "id": 46, "Timestamp": 1485705592, "room": 0, "last_run": 1490887661 }, { "name": "Master Motion Untripped", "notification_only": 107, "modeStatus": "0", "triggers": [ { "device": 107, "name": "Master Motion Untripped", "enabled": 1, "arguments": [ ], "template": "4", "last_run": 1490884041, "last_eval": 0 } ], "users": "", "id": 47, "Timestamp": 1485705616, "room": 0, "last_run": 1490884041 },

drewcovi commented 7 years ago

Hmmm and they have a unique notification_only key. I can probably ignore anything with that key

Juppers commented 7 years ago

I believe I added those when I was on UI5. I can't find them in UI7 at all.

drewcovi commented 7 years ago

@Juppers so yeah I'd delete them using the URL method provided at he bottom the micasaverde link now that you have their true IDs

I can build in a safeguard for future users. Let me know if you're good to go and close the issue for now.

Juppers commented 7 years ago

Yes. I'm now up and running again. Thanks for the help with this rather odd one!

drewcovi commented 7 years ago

👍