entmike / homebridge-cmdaccessory

Command plugin for HomeBridge to appear as different accessories (Switch, Lock, Window Blinds, Lights, etc)
16 stars 5 forks source link

Window covering? #1

Open hjdhjd opened 7 years ago

hjdhjd commented 7 years ago

Thanks for creating what looks to be the answer to some of the things I'd love to be able to do.

Looking through your code it appears to also work with a WindowCovering accessory type, but the documentation doesn't indicate this...is the code supporting WindowCovering complete?

I've tried using a type of WindowCovering, and it errors out with:

[3/26/2017, 10:58:08 AM] [CMD Platform] Service not found for undefined... [3/26/2017, 10:57:51 AM] [CMD Platform] Initializing platform accessory 'LLR1' type 'WindowCovering'... /usr/local/lib/node_modules/homebridge-cmdaccessory/index.js:201 var prop = this.getStatePropertyName(data.type); ^

ReferenceError: data is not defined at cmdAccessoryPlatform.getInitState (/usr/local/lib/node_modules/homebridge-cmdaccessory/index.js:201:40) at cmdAccessoryPlatform.addAccessory (/usr/local/lib/node_modules/homebridge-cmdaccessory/index.js:113:7) at cmdAccessoryPlatform.didFinishLaunching (/usr/local/lib/node_modules/homebridge-cmdaccessory/index.js:38:8) at emitNone (events.js:91:20) at API.emit (events.js:188:7) at Server.run (/usr/local/lib/node_modules/homebridge/lib/server.js:93:13) at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:40:10) at Object. (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22) at Module._compile (module.js:571:32) at Object.Module._extensions..js (module.js:580:10) at Module.load (module.js:488:32) at tryModuleLoad (module.js:447:12) at Function.Module._load (module.js:439:3) at Module.runMain (module.js:605:10) at run (bootstrap_node.js:427:7) at startup (bootstrap_node.js:148:9) at bootstrap_node.js:542:3

On the next restart of homebridge I'll see:

[3/26/2017, 10:58:23 AM] [CMD Platform] Service not found for undefined... [3/26/2017, 10:58:23 AM] [CMD Platform] Initializing platform accessory 'LLR1' type 'WindowCovering'... /usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Accessory.js:222 throw new Error("Cannot add a bridged Accessory with the same UUID as another bridged Accessory: " + existing.UUID); ^

Error: Cannot add a bridged Accessory with the same UUID as another bridged Accessory: c28015a1-0ba2-48ad-afb6-4b044f41be69 at Bridge.Accessory.addBridgedAccessory (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Accessory.js:222:13) at Bridge.Accessory.addBridgedAccessories (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Accessory.js:268:10) at Server._handleRegisterPlatformAccessories (/usr/local/lib/node_modules/homebridge/lib/server.js:437:16) at Server. (/usr/local/lib/node_modules/homebridge/lib/server.js:36:10) at emitOne (events.js:96:13) at API.emit (events.js:191:7) at API.registerPlatformAccessories (/usr/local/lib/node_modules/homebridge/lib/api.js:155:8) at cmdAccessoryPlatform.addAccessory (/usr/local/lib/node_modules/homebridge-cmdaccessory/index.js:78:12) at cmdAccessoryPlatform.didFinishLaunching (/usr/local/lib/node_modules/homebridge-cmdaccessory/index.js:38:8) at emitNone (events.js:91:20) at API.emit (events.js:188:7) at Server.run (/usr/local/lib/node_modules/homebridge/lib/server.js:93:13) at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:40:10) at Object. (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22) at Module._compile (module.js:571:32) at Object.Module._extensions..js (module.js:580:10) at Module.load (module.js:488:32) at tryModuleLoad (module.js:447:12) at Function.Module._load (module.js:439:3) at Module.runMain (module.js:605:10) at run (bootstrap_node.js:427:7) at startup (bootstrap_node.js:148:9)

The relevant section of my config is:

    {
        "platform": "cmdAccessory",
        "name": "CMD Platform",

        "switches" : [
      {
    "name": "LLR1",
    "on_cmd": "/some/command/here",
    "off_cmd": "/other/command/here",
    "type": "WindowCovering"
      }
    ]
}

Thoughts on what's going on here?

entmike commented 7 years ago

Hey, I'm glad you've been able to hopefully use it for some things! Regarding Window Coverings, I never finished that one as I do not have any devices to know how it would work :(

This was mostly just an experimental-like thing I did but I never fleshed it out. Device types like Window Covering was just stub code I thought about finishing later but I got busy with other stuff.

I hope you didn't spend too much time trying to get it to work and hope you got some use out of it!

hjdhjd commented 7 years ago

Thanks for the followup! I'm happy to take on the effort to finish this up if you point me in the right direction...I haven't spent much time with your code yet, but I will over the weekend. I'm determined. :)

My biggest issue is the error I called out...it seems that things aren't even registering correctly if I try a window covering type.

Would appreciate pointers...I'll play with it over the weekend and will be happy to contribute to getting the support for it built out.

Thanks!

On Mar 26, 2017, at 8:34 PM, Mike Howles notifications@github.com wrote:

Hey, I'm glad you've been able to hopefully use it for some things! Regarding Window Coverings, I never finished that one as I do not have any devices to know how it would work :(

This was mostly just an experimental-like thing I did but I never fleshed it out. Device types like Window Covering was just stub code I thought about finishing later but I got busy with other stuff.

I hope you didn't spend too much time trying to get it to work and hope you got some use out of it!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

hjdhjd commented 7 years ago

Following up...can you point me to what needs to be updated / completed? I've tried poking through the code, and I'm a bit lost frankly. It seems like the bulk of what needs to be there is there already...what's missing? I get the sense this is a relatively small amount of work to make it happen...so close. Help? :)

hjdhjd commented 7 years ago

I created an alternative plugin...though candidly, I'd much rather use something more general purpose like what you've begun creating here. My window covering / window blinds homebridge plugin can be found is called homebridge-blinds-cmd at https://github.com/hjdhjd/homebridge-blinds-cmd

Cloudore commented 7 years ago

Hey @hjdhjd, I have the same need for windows covering! I'm trying to use your plug in but you don't have the issues page active which is why I'm posting here.

The shades keeps on giving me a "Unable to retrieve state" log in Homebridge and in the app it's always "Not Responding". Could you pinpoint me in the right direction? what I'm I doing wrong? in the state parameter in config.json I pointed it to an empty .sh file since my shades do not report state; they are RF blinds that I am manipulating with an RF transmitter on the pi, and have .sh files that do something like "RFsniffer play Window1UP'

Also, could we maybe take the update given to the Homebridge-blinds plug-in and apply it to yours? it would allow for stop commands, and with them, percentage manipulation of the blind, all of these while keeping the current state in a variable.

Thanks for the work on your plug in and hope to be able to use it soon.

hjdhjd commented 6 years ago

Shift over to the issues page on the plugin...I'm activating it. Let's figure out what's going on...I'm going to be updating the plugin over the holidays with a couple of additional things I'd like to do with it.

entmike commented 6 years ago

Hey guys - Sorry for the lack of response from me. This ended up being a "one and done" thing for me and I never used it again. Please feel free to fork it or I can add you guys as collaborators to this repo to fix/add anything you'd like!

Have a happy holidays all.