homebridge / verified

Plugins Verified by Homebridge
https://homebridge.io/w/Verified-Plugins
GNU General Public License v3.0
366 stars 17 forks source link

homebridge-inkbird-wifi-gateway #537

Closed richierockskool closed 1 year ago

richierockskool commented 1 year ago

Link To GitHub Repo

https://github.com/richierockskool/homebridge-inkbird-wifi-gateway

Link To NPM Package

https://www.npmjs.com/package/homebridge-inkbird-wifi-gateway

github-actions[bot] commented 1 year ago

The following pre-checks failed:

:x: Failed to import plugin: Cannot find module '/workspace/test-area/node_modules/homebridge-inkbird-wifi-gateway/src/index.js' imported from /workspace/index.ts

Comment /check to run checks again.

richierockskool commented 1 year ago

Any help here would be greatly appreciated... ichjagger@Rich-and-Ritas-Mac-mini Hombridge-Inkbird-Wifi-Gateway % /check zsh: no such file or directory: /check

bwp91 commented 1 year ago

To start with, just had a look at your package json file and it looks absolutely wild! (maybe it works, but the formatting is wild!)

https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/blob/master/package.json

It would be a lot easier to make a start of looking at the plugin if this was sorted into a nice formatted format

bwp91 commented 1 year ago

stick your package json file into a formatter like this: https://jsonformatter.curiousconcept.com/

bwp91 commented 1 year ago

@richierockskool there is no need to create a new issue everytime, just comment here with /check and it will run the checks again

richierockskool commented 1 year ago

Okay, We have run all the bug checks and there is nothing, except... No plugin was found for the platform "HomebridgeInkbirdWifiGateway" in your config.json. Please make sure the corresponding plugin is installed correctly.

It is driving us crazy!

bwp91 commented 1 year ago

I see you took my initial advice to format your package json https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/blob/master/package.json 🙃?

bwp91 commented 1 year ago

the formatting obviously doesn't affect anything functionality-wise, but can really help if others look to see what could be causing any issues

richierockskool commented 1 year ago

I hope so, because there are no issues with package-json

bwp91 commented 1 year ago

no but i will repeat:

but can really help if others look to see what could be causing any issues

i for one cannot review this plugin if your package json file is all on one line

richierockskool commented 1 year ago

I have no idea why that happened, new.. fixing it now, and have been asking for help for while

On Apr 26, 2023, at 10:28 PM, Ben @.***> wrote:

no but i will repeat:

but can really help if others look to see what could be causing any issues

i for one cannot review this plugin if your package json file is all on one line

— Reply to this email directly, view it on GitHub https://github.com/homebridge/verified/issues/537#issuecomment-1524493852, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJE7PVUX7JLWM77WOFEEY63XDHKUTANCNFSM6AAAAAAXHEOOYQ. You are receiving this because you were mentioned.

richierockskool commented 1 year ago

fixed now...wait 10 minutes

bwp91 commented 1 year ago

Not sure if you are on the homebridge discord channel but happy to message on there, my username is bwp91

richierockskool commented 1 year ago

discord RichieRockskool#7717

bwp91 commented 1 year ago

how are we going with this plugin and verification?

richierockskool commented 1 year ago

Hi Ben,

Still having issues and problems, everything verifies in VS Code no errors or bugs. It loads in Homebridge and can find the plugin (but the Config Schema will not load) If you put it in manually it works kind of. We need someone to take a look and see what we missed. It probably something simple, please recommend how we can move forward,

Thank you,

Rich

On May 26, 2023, at 7:12 PM, Ben @.***> wrote:

how are we going with this plugin and verification?

— Reply to this email directly, view it on GitHub https://github.com/homebridge/verified/issues/537#issuecomment-1565058284, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJE7PVRTGOGXSK4SEJBK7W3XIE2E7ANCNFSM6AAAAAAXHEOOYQ. You are receiving this because you commented.

richierockskool commented 1 year ago

/check

github-actions[bot] commented 1 year ago

The following pre-checks failed:

:x: Failed to test plugin. :x: Command failed: docker run --rm -e HOMEBRIDGE_PLUGIN_NAME=homebridge-inkbird-wifi-gateway -v /home/runner/work/verified/verified/precheck/results:/results check

Comment /check to run checks again.

bwp91 commented 1 year ago

First of all I would look through your dependencies and see which ones you actually need. In the package.json file you currently have this (I have added some comments):

  "devDependencies": {
    "@types/node": "^16.10.9",
    "@typescript-eslint/eslint-plugin": "^5.0.0",
    "@typescript-eslint/parser": "^5.0.0",
    "eslint": "^8.0.1",
    "homebridge": "^1.3.9",
    "nodemon": "^1.3.3",
    "rimraf": "^3.0.2",
    "ts-node": "^10.3.0",
    "typescript": "^4.4.4"
  },
  "dependencies": {
    "@abandonware/noble": "^1.9.2-21",
    "chokidar": "^3.5.3",  <- what is this and is it needed?
    "homebridge-inkbird-wifi-gateway": "^1.2.0", <- you should NOT have your own plugin listed here
    "latest-version": "^7.0.0",  <- what is this and is it needed?
    "module-name": "^0.0.1-security",  <- what is this and is it needed?
    "my-package": "^0.0.0",  <- what is this and is it needed?
    "node-fetch": "^2.6.1", <- is this needed?
    "npm": "^9.7.1",  <- what is this and is it needed?
    "npm-run-path": "^5.1.0",  <- what is this and is it needed?
    "resolve-url": "^0.2.1",  <- what is this and is it needed?
    "source-map-resolve": "^0.6.0",  <- what is this and is it needed?
    "source-map-url": "^0.4.1",  <- what is this and is it needed?
    "urix": "^0.1.0"  <- what is this and is it needed?
  },
richierockskool commented 1 year ago

All those dependencies kept being added the deeper I got into trouble, I will start deleting and see what happens,

Thank you,

On Jun 12, 2023, at 7:02 PM, Ben @.***> wrote:

First of all I would look through your dependencies and see which ones you actually need. In the package.json file you currently have this (I have added some comments):

"devDependencies": { @./node": "^16.10.9", @./eslint-plugin": "^5.0.0", @./parser": "^5.0.0", "eslint": "^8.0.1", "homebridge": "^1.3.9", "nodemon": "^1.3.3", "rimraf": "^3.0.2", "ts-node": "^10.3.0", "typescript": "^4.4.4" }, "dependencies": { @./noble": "^1.9.2-21", "chokidar": "^3.5.3", <- what is this and is it needed? "homebridge-inkbird-wifi-gateway": "^1.2.0", <- you should NOT have your own plugin listed here "latest-version": "^7.0.0", <- what is this and is it needed? "module-name": "^0.0.1-security", <- what is this and is it needed? "my-package": "^0.0.0", <- what is this and is it needed? "node-fetch": "^2.6.1", <- is this needed? "npm": "^9.7.1", <- what is this and is it needed? "npm-run-path": "^5.1.0", <- what is this and is it needed? "resolve-url": "^0.2.1", <- what is this and is it needed? "source-map-resolve": "^0.6.0", <- what is this and is it needed? "source-map-url": "^0.4.1", <- what is this and is it needed? "urix": "^0.1.0" <- what is this and is it needed? }, — Reply to this email directly, view it on GitHub https://github.com/homebridge/verified/issues/537#issuecomment-1588222151, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJE7PVSW2EHF2SHG5673N7LXK6NZLANCNFSM6AAAAAAXHEOOYQ. You are receiving this because you commented.

bwp91 commented 1 year ago

You shouldn’t need to just go randomly deleting your dependencies and hope for the best, you should ideally know exactly which dependencies your plugin uses, and remove all the ones that are not used

richierockskool commented 1 year ago

At this point I do not remember which ones, I was going back and forth with NPM documents and Github suggestions to try and this out,

On Jun 12, 2023, at 7:45 PM, Ben @.***> wrote:

You shouldn’t need to just go randomly deleting your dependencies and hope for the best, you should ideally know exactly which dependencies your plugin uses, and remove all the ones that are not used

— Reply to this email directly, view it on GitHub https://github.com/homebridge/verified/issues/537#issuecomment-1588255627, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJE7PVTDLKHYY6XTPXKDKPDXK6SYDANCNFSM6AAAAAAXHEOOYQ. You are receiving this because you commented.

richierockskool commented 1 year ago

and, even after I delete these ones I get the same warnings (wether they are installed or not)? But, no NPM errors?

@. homebridge-inkbird-wifi-gateway % npm install -g @. npm WARN deprecated @.: See https://github.com/lydell/source-map-url#deprecated npm WARN deprecated @.: Please see https://github.com/lydell/urix#deprecated npm WARN deprecated @.: See https://github.com/lydell/source-map-resolve#deprecated npm WARN deprecated @.: https://github.com/lydell/resolve-url#deprecated

removed 1 package, and changed 95 packages in 39s

46 packages are looking for funding run npm fund for details

On Jun 12, 2023, at 7:45 PM, Ben @.***> wrote:

You shouldn’t need to just go randomly deleting your dependencies and hope for the best, you should ideally know exactly which dependencies your plugin uses, and remove all the ones that are not used

— Reply to this email directly, view it on GitHub https://github.com/homebridge/verified/issues/537#issuecomment-1588255627, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJE7PVTDLKHYY6XTPXKDKPDXK6SYDANCNFSM6AAAAAAXHEOOYQ. You are receiving this because you commented.

bwp91 commented 1 year ago

From looking at your current package json on github, you could probably remove the ones I have marked here too, unless you know for certain that you need them:

    "@abandonware/noble": "^1.9.2-21",  <- keep - i assume the plugin uses bluetooth?
    "latest-version": "^7.0.0",  <- remove (unless you know what this is for and why you have it?)
    "module-name": "^0.0.1-security",  <- remove (unless you know what this is for and why you have it?)
    "my-package": "^0.0.0",  <- remove (unless you know what this is for and why you have it?)
    "node-fetch": "^2.6.1", <- i assume your plugin makes use of this with http calls somewhere?
    "npm": "^9.7.1", <- this should NOT be here
    "npm-run-path": "^5.1.0"  <- remove (unless you know what this is for and why you have it?)

(from here https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/blob/78f5d6bbb489ab60fd50aef47a5de2f8e912e397/package.json#L56-L62)

richierockskool commented 1 year ago

I updated all the dependencies and it still loads no issues in Homebridge, but still get that “Failed to Load Plugins Config Schema” in Settings and Bridge Settings

[Homebridge UI] Running Command: npm install -g @.***

and no status errors

[HomebridgeInkbirdWifiGateway] Initializing homebridge-inkbird-wifi-gateway platform


[6/12/2023, 7:57:39 PM] Loaded plugin: @.*** [6/12/2023, 7:57:39 PM] Registering platform 'homebridge-inkbird-wifi-gateway.homebridge-inkbird-wifi-gateway’

On Jun 12, 2023, at 8:14 PM, Ben @.***> wrote:

From looking at your current package json on github, you could probably remove the ones I have marked here too, unless you know for certain that you need them:

***@***.***/noble": "^1.9.2-21",  <- keep - i assume the plugin uses bluetooth?
"latest-version": "^7.0.0",  <- remove (unless you know what this is for and why you have it?)
"module-name": "^0.0.1-security",  <- remove (unless you know what this is for and why you have it?)
"my-package": "^0.0.0",  <- remove (unless you know what this is for and why you have it?)
"node-fetch": "^2.6.1", <- i assume your plugin makes use of this with http calls somewhere?
"npm": "^9.7.1", <- this should NOT be here
"npm-run-path": "^5.1.0"  <- remove (unless you know what this is for and why you have it?)

(from here https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/blob/78f5d6bbb489ab60fd50aef47a5de2f8e912e397/package.json#L56-L62 https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/blob/78f5d6bbb489ab60fd50aef47a5de2f8e912e397/package.json#L56-L62)

— Reply to this email directly, view it on GitHub https://github.com/homebridge/verified/issues/537#issuecomment-1588279274, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJE7PVXUSLAJV57W2YWF3BTXK6WIBANCNFSM6AAAAAAXHEOOYQ. You are receiving this because you commented.

richierockskool commented 1 year ago

/check

richierockskool commented 1 year ago

/check

richierockskool commented 1 year ago

I had to put this one back in

"homebridge-inkbird-wifi-gateway": "^1.2.0", <- you should NOT have your own plugin listed here

it was not showing up in the node_modules

bwp91 commented 1 year ago

/check

github-actions[bot] commented 1 year ago

The following pre-checks failed:

:x: Failed to test plugin. :x: Command failed: docker run --rm -e HOMEBRIDGE_PLUGIN_NAME=homebridge-inkbird-wifi-gateway -v /home/runner/work/verified/verified/precheck/results:/results check

Comment /check to run checks again.

richierockskool commented 1 year ago

Anymore ideas on how to more forward? It loads successfully in Homebridge, no errors in the log, not loading Config Schema or Accessories?

On Jun 16, 2023, at 2:03 AM, Ben @.***> wrote:

/check

— Reply to this email directly, view it on GitHub https://github.com/homebridge/verified/issues/537#issuecomment-1594152466, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJE7PVVJCW7GZKEVG5WQKQ3XLPZJPANCNFSM6AAAAAAXHEOOYQ. You are receiving this because you commented.

bwp91 commented 1 year ago

Your own plugin should not be in the dependency list (or dev dependencies) in the package.json.

If without it listed it is causing an error, then you need to look into why this error is happening. In this case the fix is NOT to have your plugin in the dependencies. It simply should not be there.

richierockskool commented 1 year ago

Agreed , but when I take it out, it deletes from node_modules and can not find the plugin? so what would dependency to put there to rectify?

On Jun 16, 2023, at 12:58 PM, Ben @.***> wrote:

Your own plugin should not be in the dependency list (or dev dependencies) in the package.json.

If without it listed it is causing an error, then you need to look into why this error is happening. In this case the fix is NOT to have your plugin in the dependencies. It simply should not be there.

— Reply to this email directly, view it on GitHub https://github.com/homebridge/verified/issues/537#issuecomment-1594983478, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJE7PVWLTCIPJPKRPVMKWIDXLSGETANCNFSM6AAAAAAXHEOOYQ. You are receiving this because you commented.

bwp91 commented 1 year ago

which node_modules are you talking about? the one inside your plugin directory?

richierockskool commented 1 year ago

Yes the one the plugin directory

On Jun 16, 2023, at 1:09 PM, Ben @.***> wrote:

which node_modules are you talking about? the one inside your plugin directory?

— Reply to this email directly, view it on GitHub https://github.com/homebridge/verified/issues/537#issuecomment-1594996003, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJE7PVV2CD6PRSDAEKZ334LXLSHMLANCNFSM6AAAAAAXHEOOYQ. You are receiving this because you commented.

bwp91 commented 1 year ago

Your plugin does not need to also be inside this folder

richierockskool commented 1 year ago

When I take it out I get this error:

npm ERR! explore It doesn't look like npm is installed. npm ERR! code ENOENT npm ERR! syscall open npm ERR! path /Users/richjagger/Documents/GitHub/homebridge-inkbird-wifi-gateway/node_modules/npm/package.json npm ERR! errno -2 npm ERR! enoent Could not read package.json: Error: ENOENT: no such file or directory, open '/Users/richjagger/Documents/GitHub/homebridge-inkbird-wifi-gateway/node_modules/npm/package.json' npm ERR! enoent This is related to npm not being able to find a file. npm ERR! enoent

bwp91 commented 1 year ago

do you still have npm in that list too?

richierockskool commented 1 year ago

This is all I have now

"dependencies": { @.***/noble": "^1.9.2-21", "hashmap": "^2.4.0", "node-fetch": "^3.3.1" },

On Jun 16, 2023, at 1:58 PM, Ben @.***> wrote:

do you still have npm in that list too?

— Reply to this email directly, view it on GitHub https://github.com/homebridge/verified/issues/537#issuecomment-1595052344, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJE7PVSYMFEEEXZG3OGI7FTXLSNFDANCNFSM6AAAAAAXHEOOYQ. You are receiving this because you commented.

bwp91 commented 1 year ago

okay, and how are you trying to install the plugin? or how do you run it in dev, and where does this error come from?

richierockskool commented 1 year ago

When I run

npm explore npm homebridge-inkbird-wifi-gateway

The plugin still installs no problem on Homebridge, but it fails to load the plugins config schema and

The Inkbird Wifi Gateway as an accessory

And of course not showing up on HomeKit

On Jun 16, 2023, at 2:03 PM, Ben @.***> wrote:

okay, and how are you trying to install the plugin? or how do you run it in dev, and where does this error come from?

— Reply to this email directly, view it on GitHub https://github.com/homebridge/verified/issues/537#issuecomment-1595057994, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJE7PVRC3OLMPJSPUVQDKE3XLSNYJANCNFSM6AAAAAAXHEOOYQ. You are receiving this because you commented.

bwp91 commented 1 year ago

why are you running this command?

normally is just npm install inside your plugin folder

richierockskool commented 1 year ago

Advice from Christian Clauss to make sure everything was pointed in the right direction (might not be relevant)

There are no issues when I run npm install

On Jun 16, 2023, at 2:11 PM, Ben @.***> wrote:

why are you running this command?

normally is just npm install inside your plugin folder

— Reply to this email directly, view it on GitHub https://github.com/homebridge/verified/issues/537#issuecomment-1595084016, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJE7PVRUS5BFAKZUV642DJTXLSOU3ANCNFSM6AAAAAAXHEOOYQ. You are receiving this because you commented.

bwp91 commented 1 year ago

/check

github-actions[bot] commented 1 year ago

The following pre-checks failed:

:x: Failed to test plugin. :x: Command failed: docker run --rm -e HOMEBRIDGE_PLUGIN_NAME=homebridge-inkbird-wifi-gateway -v /home/runner/work/verified/verified/precheck/results:/results check

Comment /check to run checks again.

richierockskool commented 1 year ago

I just did VS Debug and got this

/usr/local/bin/node ./ Process exited with code 1 Uncaught ReferenceError ReferenceError: require is not defined in ES module scope, you can use import instead This file is being treated as an ES module because it has a '.js' file extension and '/Users/richjagger/Documents/GitHub/homebridge-inkbird-wifi-gateway/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension. at (/Users/richjagger/Documents/GitHub/homebridge-inkbird-wifi-gateway/src/BleScanner.js:3:15) at run (internal/modules/esm/module_job:192:25) --- await --- at runMainESM (internal/modules/run_main:53:21) at executeUserEntryPoint (internal/modules/run_main:79:5) at (internal/main/run_main_module:23:47)

On Jun 16, 2023, at 2:11 PM, Ben @.***> wrote:

why are you running this command?

normally is just npm install inside your plugin folder

— Reply to this email directly, view it on GitHub https://github.com/homebridge/verified/issues/537#issuecomment-1595084016, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJE7PVRUS5BFAKZUV642DJTXLSOU3ANCNFSM6AAAAAAXHEOOYQ. You are receiving this because you commented.

bwp91 commented 1 year ago

So i would look at addressing this 😊

richierockskool commented 1 year ago

Fixed

import noble from @.***/noble"; let’s see what happens

On Jun 16, 2023, at 5:36 PM, Ben @.***> wrote:

So i would look at addressing this 😊

— Reply to this email directly, view it on GitHub https://github.com/homebridge/verified/issues/537#issuecomment-1595341636, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJE7PVSPBLBPXGAWZXL5VETXLTGXRANCNFSM6AAAAAAXHEOOYQ. You are receiving this because you commented.

bwp91 commented 1 year ago

Does your plugin rely on bluetooth to work? I mean, if a user installed the plugin who didn’t have a bluetooth module, would the plugin be useless?

richierockskool commented 1 year ago

No and that could be my issue with getting thing to finally to work with the “inkbird wifi gateway” which is exactly that, it has an IP address that is logged into your router like any automation, from there the Bluetooth accessories are listed in the App and controlled. eg Bluetooth Pool Temperature all controlled by the Inkbird Pro App.

So, I am trying to mimic the app through this plugin. This app requires one to have an Inkbird Wifi Gateway IBSM1S for this plugin to work.

On Jun 16, 2023, at 5:58 PM, Ben @.***> wrote:

Does your plugin rely on bluetooth to work? I mean, if a user installed the plugin who didn’t have a bluetooth module, would the plugin be useless?

— Reply to this email directly, view it on GitHub https://github.com/homebridge/verified/issues/537#issuecomment-1595363343, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJE7PVX64TI3OO7FZ5LYS5TXLTJIFANCNFSM6AAAAAAXHEOOYQ. You are receiving this because you commented.