pradeepmouli / homebridge-isy-js

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

Allow device inclusion by spoken field #8

Open apnar opened 4 years ago

apnar commented 4 years ago

For folks with large deployments it's challenging to work down to a small subset of devices to be included by slicing things off with Ignores. It would be wonderful if there was an option to include all and only devices and scenes that have a Spoken field defined in their notes.

Additionally, as Spoken fields need to be globally unique (for integration into Portal and such) it'd be good to have an option to have device name in Homebridge exactly be the Spoken name (as opposed to appending Location as it does today).

By the way, I very much appreciate you picking this code back up! Huge addition to the community.

pradeepmouli commented 4 years ago

you could put everything to be excluded in a certain folder and use that to filter off of.... or do it based on device type (using nodeDef or typeCode).... Nonetheless, I'll look at implementing the that same (as well as the naming logic).

apnar commented 4 years ago

I was going to take a pass at implementing this feature but it looks like the code here in git isn't up-to-date with what you have in npm. Would you mind pushing so I can send a PR that would merge. Thanks!

apnar commented 4 years ago

Love the new changes, in particular the idea of using a bit of code in the config for Device Naming.

Would you consider using the same idea for a custom device filter? So in addition to name, address, family, folder, etc. you have a choice of "custom" where you can enter a bit of code that would be evaluated to true or false to make the condition true/false.

For my use I'd use "device.spokenName" but it'd be flexible enough for other folks that may have crazier needs.

pradeepmouli commented 4 years ago

Great idea! Sorry for not keeping git in sync... will update forthwith.

Sent from my iPhone

On May 20, 2020, at 9:19 PM, apnar notifications@github.com wrote:

 Love the new changes, in particular the idea of using a bit of code in the config for Device Naming.

Would you consider using the same idea for a custom device filter? So in addition to name, address, family, folder, etc. you have a choice of "custom" where you can enter a bit of code that would be evaluated to true or false to make the condition true/false.

For my use I'd use "device.spokenName" but it'd be flexible enough for other folks that may have crazier needs.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

pradeepmouli commented 4 years ago

Updated GIT - went ahead and updated the type definitions (filterType = ‘function’ and optional field is named ‘function’) and config schema so all you have to do is add the implementation in ISYPlatform.ts.

On May 21, 2020, at 10:26 AM, Pradeep Mouli pmouli@mac.com wrote:

Great idea! Sorry for not keeping git in sync... will update forthwith.

Sent from my iPhone

On May 20, 2020, at 9:19 PM, apnar notifications@github.com wrote:



Love the new changes, in particular the idea of using a bit of code in the config for Device Naming.

Would you consider using the same idea for a custom device filter? So in addition to name, address, family, folder, etc. you have a choice of "custom" where you can enter a bit of code that would be evaluated to true or false to make the condition true/false.

For my use I'd use "device.spokenName" but it'd be flexible enough for other folks that may have crazier needs.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/pradeepmouli/homebridge-isy-js/issues/8#issuecomment-631821852, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD5XAFJ3MNZITWVJPSG5FG3RSR6SVANCNFSM4MT6FNHQ.

apnar commented 4 years ago

Thanks! So as I mentioned in another issue I'm new to node. To-date I've just been editing the js files directly but it looks like the project is using typescript and I should be editing the .ts files and then compiling to get the js files. Would you mind letting me know the steps you use to build it? I cloned your repo, ran a "npm i" which seemed to grab the needed dependancies, ran "npm install -g typescript" which gave me the tsc command. But when I run it I'm getting some errors like this:

`src/ISYDimmableAccessory.ts:16:9 - error TS2742: The inferred type of 'map' cannot be named without a reference to 'homebridge-isy-js/node_modules/hap-nodejs'. This is likely not portable. A type annotation is necessary.

16 public map(propertyName: keyof T, propertyValue: any) {


`

I'll try to figure it out myself, but I assume the issues are with my process and not the code so I thought it might be quickest to ask you if you're using different tooling/versions.
pradeepmouli commented 4 years ago

Try npm -I —save-dev As well (that downloads dependencies needed at compile time, but not runtime - e.g. typescript type annotations)

Sent from my iPhone

On May 21, 2020, at 3:45 PM, apnar notifications@github.com wrote:

 Thanks! So as I mentioned in another issue I'm new to node. To-date I've just been editing the js files directly but it looks like the project is using typescript and I should be editing the .ts files and then compiling to get the js files. Would you mind letting me know the steps you use to build it? I cloned your repo, ran a "npm i" which seemed to grab the needed dependancies, ran "npm install -g typescript" which gave me the tsc command. But when I run it I'm getting some errors like this:

`src/ISYDimmableAccessory.ts:16:9 - error TS2742: The inferred type of 'map' cannot be named without a reference to 'homebridge-isy-js/node_modules/hap-nodejs'. This is likely not portable. A type annotation is necessary.

16 public map(propertyName: keyof T, propertyValue: any) {


`

I'll try to figure it out myself, but I assume the issues are with my process and not the code so I thought it might be quickest to ask you if you're using different tooling/versions.

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
apnar commented 4 years ago

Thanks for the tip. Reading up on save-dev it seems to be for installing a new modules and writing it to the package.json file as a Dev dependancy. That only seems to works if you're installing a new dependency, since I just wanted to download the existing ones I tried "npm install --dev" as well as "npm install --only=dev". I verified that the packages listed in the devDependencies are installed in the node_modules directory, but I'm still getting the same errors. Are you using a specific version of tsc? I found a few references to this type of error in newer versions (I'm using 3.9.3). Thanks again.