richierockskool / homebridge-inkbird-wifi-gateway

homebridge Inkbird wifi gateway
https://github.com/richierockskool/homebridge-inkbird-wifi-gateway
Apache License 2.0
7 stars 6 forks source link

Homebridge Verification #24

Open bwp91 opened 11 months ago

bwp91 commented 11 months ago

Gonna close your issue in the verified repo for now, and start one here, so that a new issue can be created in the verified repo once the plugin is ready.

bwp91 commented 11 months ago

@richierockskool when you make updates to this plugin, are you editing the ts files or js files?

richierockskool commented 11 months ago

js files.

On Jul 26, 2023, at 2:53 PM, Ben @.***> wrote:

@richierockskool https://github.com/richierockskool when you make updates to this plugin, are you editing the ts files or js files?

— Reply to this email directly, view it on GitHub https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/issues/24#issuecomment-1652327288, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJE7PVWJATY76HTESL2KZ6TXSFRRVANCNFSM6AAAAAA2ZAFGYQ. You are receiving this because you were mentioned.

bwp91 commented 11 months ago

so if you are only editing the js files why keep the ts files in the first place? delete them all and delete the tsconfig file etc

richierockskool commented 11 months ago

Okay, will start doing that and see where we end up. (They were in the original Homebridge Plugin template) The only one that is not js in the setting ts should that one be renamed setting js?

On Jul 26, 2023, at 3:45 PM, Ben @.***> wrote:

so if you are only editing the js files why keep the ts files in the first place? delete them all and delete the tsconfig file etc

— Reply to this email directly, view it on GitHub https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/issues/24#issuecomment-1652396983, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJE7PVVSD5TSA35VUDJD7ZDXSFXWVANCNFSM6AAAAAA2ZAFGYQ. You are receiving this because you were mentioned.

bwp91 commented 11 months ago

well looks like your inkbirdPlatform.js doesn't use this file so i think just delete the settings.ts file

Also looks like your platform file exports as es module, so you will need this in your package json (replacing any existing properties with these names)

  "type": "module",
  "main": "src/inkbirdPlatform.js",
richierockskool commented 11 months ago

already have

"type": "module",

"main": “src/index.js", In the current package.json

On Jul 26, 2023, at 4:16 PM, Ben @.***> wrote:

well looks like your inkbirdPlatform.js doesn't use this file so i think just delete the settings.ts file

Also looks like your platform file exports as es module, so you will need this in your package json (replacing any existing properties with these names)

"type": "module", "main": "src/inkbirdPlatform.js", — Reply to this email directly, view it on GitHub https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/issues/24#issuecomment-1652432067, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJE7PVUK66CPQKCTBMDY5A3XSF3IBANCNFSM6AAAAAA2ZAFGYQ. You are receiving this because you were mentioned.

bwp91 commented 11 months ago

yea but it’s not working right now is it?

richierockskool commented 11 months ago

It will not let me run build when I delete tsconfig.json (so that one is back in for now), but no errors happened when I deleted the rest of the ts files, except not sure what to do with settings.ts

{ "compilerOptions": { "target": "ES2018", "module": "commonjs", "lib": [ "es2015", "es2016", "es2017", "es2018" ], "declaration": true, "declarationMap": true, "sourceMap": true, "outDir": "./dist", "rootDir": "./src", "strict": true, "esModuleInterop": true, "noImplicitAny": false, "resolveJsonModule": true }, "include": [ "src/" ], "exclude": [ "*/.spec.ts" ] }

On Jul 26, 2023, at 4:16 PM, Ben @.***> wrote:

well looks like your inkbirdPlatform.js doesn't use this file so i think just delete the settings.ts file

Also looks like your platform file exports as es module, so you will need this in your package json (replacing any existing properties with these names)

"type": "module", "main": "src/inkbirdPlatform.js", — Reply to this email directly, view it on GitHub https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/issues/24#issuecomment-1652432067, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJE7PVUK66CPQKCTBMDY5A3XSF3IBANCNFSM6AAAAAA2ZAFGYQ. You are receiving this because you were mentioned.

richierockskool commented 11 months ago

correct it is not working, still need to build in the "start function” into InkbirdPlatform.js

On Jul 26, 2023, at 4:32 PM, Ben @.***> wrote:

yea but it’s not working right now is it?

— Reply to this email directly, view it on GitHub https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/issues/24#issuecomment-1652452276, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJE7PVSO2ESLEFVQYP27JX3XSF5EFANCNFSM6AAAAAA2ZAFGYQ. You are receiving this because you were mentioned.

bwp91 commented 11 months ago

the build command is meant to convert the typescript files to js. if you are simply using js files then the build command is not needed. just delete the line from your package json file.

I personally also do not use typescript, all my plugin files are js. You can see an example here

https://github.com/bwp91/homebridge-meross/blob/latest/package.json

I only have two scripts in my package json, a personal one to rebuild the package json, and a lint command. no build command

richierockskool commented 11 months ago

Now must do a rebuild the InkbirdPlatform.js to reflect all the functions for accessories that were in Platform.ts

or will the at redirect you suggested do anything?

"main": "src/inkbirdPlatform.js",

On Jul 26, 2023, at 4:37 PM, Ben @.***> wrote:

the build command is meant to convert the typescript files to js. if you are simply using js files then the build command is not needed. just delete the line from your package json file.

I personally also do not use typescript, all my plugin files are js. You can see an example here

https://github.com/bwp91/homebridge-meross/blob/latest/package.json https://github.com/bwp91/homebridge-meross/blob/latest/package.json I only have two scripts in my package json, a personal one to rebuild the package json, and a lint command. no build command

— Reply to this email directly, view it on GitHub https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/issues/24#issuecomment-1652459707, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJE7PVRUMND7M4WMX47KSA3XSF52HANCNFSM6AAAAAA2ZAFGYQ. You are receiving this because you were mentioned.

richierockskool commented 11 months ago

ERROR INITIALIZING PLUGIN homebridge-inkbird-wifi-gateway: [7/26/2023, 4:50:44 PM] TypeError: Class constructor InkbirdPlatform cannot be invoked without 'new' at Plugin.initialize (/usr/local/lib/node_modules/homebridge/src/plugin.ts:243:17) at PluginManager.initializePlugin (/usr/local/lib/node_modules/homebridge/src/pluginManager.ts:173:20) at PluginManager.initializeInstalledPlugins (/usr/local/lib/node_modules/homebridge/src/pluginManager.ts:162:18) at Server.start (/usr/local/lib/node_modules/homebridge/src/server.ts:173:5)

On Jul 26, 2023, at 4:37 PM, Ben @.***> wrote:

the build command is meant to convert the typescript files to js. if you are simply using js files then the build command is not needed. just delete the line from your package json file.

I personally also do not use typescript, all my plugin files are js. You can see an example here

https://github.com/bwp91/homebridge-meross/blob/latest/package.json https://github.com/bwp91/homebridge-meross/blob/latest/package.json I only have two scripts in my package json, a personal one to rebuild the package json, and a lint command. no build command

— Reply to this email directly, view it on GitHub https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/issues/24#issuecomment-1652459707, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJE7PVRUMND7M4WMX47KSA3XSF52HANCNFSM6AAAAAA2ZAFGYQ. You are receiving this because you were mentioned.

bwp91 commented 11 months ago

Now must do a rebuild the InkbirdPlatform.js to reflect all the functions for accessories that were in Platform.ts

So you were using some of the ts files? you can't half and half use the js or ts files, either:

but what you cannot do is a mixture of both. i think this might be your general issue

bwp91 commented 11 months ago

so for example if you browse my repos, you can determine that I don't use ts at all, all my files are in js. there are no ts files at all. so no 'building' is required.

the homebridge plugin template uses ts which is why most of the existing plugins are written in ts (i have a personal distaste). but if you look at some examples you will see that these repos do not include any js files.

bwp91 commented 11 months ago

so you need to basically choose right now if you want to continue with your plugin in typescript or javascript, and then stick to one with your development.

richierockskool commented 11 months ago

It seems that whatever that has been done, Homebridge is picking up the js files to load on, so definitely sticking with that and not throwing errors. Just need to code those accessories for HomeKit to show up, which they are not. So, when the idea was to combine ts, the meaning is to borrow the functions to make the InkbirdPlatform start and accessories to load, from the ts accessories and ts platform files

On Jul 26, 2023, at 5:05 PM, Ben @.***> wrote:

so you need to basically choose right now if you want to continue with your plugin in typescript or javascript, and then stick to one with your development.

— Reply to this email directly, view it on GitHub https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/issues/24#issuecomment-1652493848, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJE7PVVS6G5YMOASBG2XNETXSGBCFANCNFSM6AAAAAA2ZAFGYQ. You are receiving this because you were mentioned.

bwp91 commented 11 months ago

i made a pr which you could look into. i can't pretend that it will make everything magically start working, but you can see what i am aiming towards, from your feedback/replies on this issue

bwp91 commented 11 months ago

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

richierockskool commented 11 months ago

Thank you, will work through those changes,

On Jul 26, 2023, at 5:40 PM, Ben @.***> wrote:

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

— Reply to this email directly, view it on GitHub https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/issues/24#issuecomment-1652534512, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJE7PVRJJTQ2563J6XBN6T3XSGFF7ANCNFSM6AAAAAA2ZAFGYQ. You are receiving this because you were mentioned.

richierockskool commented 11 months ago

Good news all those changes are done and the plugin still loads with no errors, but no start function on the platform and accessories are not loading.

bwp91 commented 11 months ago

You need to put your plugin setup code into a callback for the didFinishLaunching event, maybe this is the missing piece here.

See the template: https://github.com/homebridge/homebridge-plugin-template/blob/d0bca523f5cd56f68d9d1e9b21ae20389bbcb2e5/src/platform.ts#L29

richierockskool commented 11 months ago

this is before the didFinishLauching

Build and Lint #461: Commit 1d08b44 https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/commit/1d08b44857b0a6775d712217e86f6f7dbeaff2c4 pushed by richierockskool https://github.com/richierockskool is failing now, should this be put back?

npm install @@.*** --save-dev

Oops! Something went wrong! :( https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/actions/runs/5692364335/job/15429212439#step:5:11 https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/actions/runs/5692364335/job/15429212439#step:5:12ESLint: 8.42.0 https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/actions/runs/5692364335/job/15429212439#step:5:13 https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/actions/runs/5692364335/job/15429212439#step:5:14ESLint couldn't find the plugin @./eslint-plugin". https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/actions/runs/5692364335/job/15429212439#step:5:15 https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/actions/runs/5692364335/job/15429212439#step:5:16(The package @./eslint-plugin" was not found when loaded as a Node module from the directory "/Users/runner/work/homebridge-inkbird-wifi-gateway/homebridge-inkbird-wifi-gateway".) https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/actions/runs/5692364335/job/15429212439#step:5:17 https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/actions/runs/5692364335/job/15429212439#step:5:18It's likely that the plugin isn't installed correctly. Try reinstalling by running the following: https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/actions/runs/5692364335/job/15429212439#step:5:19 https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/actions/runs/5692364335/job/15429212439#step:5:20 npm install @@. --save-dev https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/actions/runs/5692364335/job/15429212439#step:5:21 https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/actions/runs/5692364335/job/15429212439#step:5:22The plugin @./eslint-plugin" was referenced from the config file in ".eslintrc". https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/actions/runs/5692364335/job/15429212439#step:5:23 https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/actions/runs/5692364335/job/15429212439#step:5:24If you still can't figure out the problem, please stop by https://eslint.org/chat/help https://eslint.org/chat/help to chat with the team.

On Jul 28, 2023, at 8:28 AM, Ben @.***> wrote:

You need to put your plugin setup code into a callback for the didFinishLaunching event, maybe this is the missing piece here.

See the template: https://github.com/homebridge/homebridge-plugin-template/blob/d0bca523f5cd56f68d9d1e9b21ae20389bbcb2e5/src/platform.ts#L29 https://github.com/homebridge/homebridge-plugin-template/blob/d0bca523f5cd56f68d9d1e9b21ae20389bbcb2e5/src/platform.ts#L29 — Reply to this email directly, view it on GitHub https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/issues/24#issuecomment-1655606806, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJE7PVRJXMBYCOYNY2UKTMLXSOV7TANCNFSM6AAAAAA2ZAFGYQ. You are receiving this because you were mentioned.

richierockskool commented 11 months ago

We are getting

[7/28/2023, 11:58:31 AM] [InkbirdWifiGateway] Initializing homebridge-inkbird-wifi-gateway platform... [7/28/2023, 11:58:31 AM] [InkbirdWifiGateway] Finished initializing platform: InkbirdWifiGateway [7/28/2023, 11:58:32 AM] [InkbirdWifiGateway] Executed didFinishLaunching callback [7/28/2023, 11:58:32 AM] Publishing bridge accessory (name: Homebridge 88AB, publishInfo: { username: '0E:84:85:50:88:AB’,

Which is great,

But not showing up in Homebridge Status,

and still getting a failure to build, is there a js plug in to fix this?

https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/actions/runs/5693914217/job/15434019284#step:5:5 https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/actions/runs/5693914217/job/15434019284#step:5:6> @.* lint https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/actions/runs/5693914217/job/15434019284#step:5:7> eslint src/*.js --max-warnings=0 https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/actions/runs/5693914217/job/15434019284#step:5:8 https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/actions/runs/5693914217/job/15434019284#step:5:9 https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/actions/runs/5693914217/job/15434019284#step:5:10Oops! Something went wrong! :( https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/actions/runs/5693914217/job/15434019284#step:5:11 https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/actions/runs/5693914217/job/15434019284#step:5:12ESLint: 8.45.0 https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/actions/runs/5693914217/job/15434019284#step:5:13 https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/actions/runs/5693914217/job/15434019284#step:5:14ESLint couldn't find the plugin @./eslint-plugin". https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/actions/runs/5693914217/job/15434019284#step:5:15 https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/actions/runs/5693914217/job/15434019284#step:5:16(The package @./eslint-plugin" was not found when loaded as a Node module from the directory "/Users/runner/work/homebridge-inkbird-wifi-gateway/homebridge-inkbird-wifi-gateway".) https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/actions/runs/5693914217/job/15434019284#step:5:17 https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/actions/runs/5693914217/job/15434019284#step:5:18It's likely that the plugin isn't installed correctly. Try reinstalling by running the following: https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/actions/runs/5693914217/job/15434019284#step:5:19 https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/actions/runs/5693914217/job/15434019284#step:5:20 npm install @@. --save-dev https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/actions/runs/5693914217/job/15434019284#step:5:21 https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/actions/runs/5693914217/job/15434019284#step:5:22The plugin @.***/eslint-plugin" was referenced from the config file in ".eslintrc". https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/actions/runs/5693914217/job/15434019284#step:5:23 https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/actions/runs/5693914217/job/15434019284#step:5:24If you still can't figure out the problem, please stop by https://eslint.org/chat/help https://eslint.org/chat/help to chat with the team. https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/actions/runs/5693914217/job/15434019284#step:5:25 https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/actions/runs/5693914217/job/15434019284#step:5:26Error: Process completed with exit code 2.

On Jul 28, 2023, at 8:28 AM, Ben @.***> wrote:

You need to put your plugin setup code into a callback for the didFinishLaunching event, maybe this is the missing piece here.

See the template: https://github.com/homebridge/homebridge-plugin-template/blob/d0bca523f5cd56f68d9d1e9b21ae20389bbcb2e5/src/platform.ts#L29 https://github.com/homebridge/homebridge-plugin-template/blob/d0bca523f5cd56f68d9d1e9b21ae20389bbcb2e5/src/platform.ts#L29 — Reply to this email directly, view it on GitHub https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/issues/24#issuecomment-1655606806, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJE7PVRJXMBYCOYNY2UKTMLXSOV7TANCNFSM6AAAAAA2ZAFGYQ. You are receiving this because you were mentioned.

richierockskool commented 11 months ago

Before I do this, is this the correct way?

@./eslint-plugin-json @./eslint-plugin-json>

On Jul 28, 2023, at 8:28 AM, Ben @.***> wrote:

You need to put your plugin setup code into a callback for the didFinishLaunching event, maybe this is the missing piece here.

See the template: https://github.com/homebridge/homebridge-plugin-template/blob/d0bca523f5cd56f68d9d1e9b21ae20389bbcb2e5/src/platform.ts#L29 https://github.com/homebridge/homebridge-plugin-template/blob/d0bca523f5cd56f68d9d1e9b21ae20389bbcb2e5/src/platform.ts#L29 — Reply to this email directly, view it on GitHub https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/issues/24#issuecomment-1655606806, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJE7PVRJXMBYCOYNY2UKTMLXSOV7TANCNFSM6AAAAAA2ZAFGYQ. You are receiving this because you were mentioned.

richierockskool commented 11 months ago

Fixed the build with "build": "node src/index.js”

All eslint errors have gone,

still not seeing what I see in vs code/terminal in the Homebridge io

Looks like the accessories are loading when I call homebridge -D in VS, but not in the Homebridge io?

On Jul 28, 2023, at 8:28 AM, Ben @.***> wrote:

You need to put your plugin setup code into a callback for the didFinishLaunching event, maybe this is the missing piece here.

See the template: https://github.com/homebridge/homebridge-plugin-template/blob/d0bca523f5cd56f68d9d1e9b21ae20389bbcb2e5/src/platform.ts#L29 https://github.com/homebridge/homebridge-plugin-template/blob/d0bca523f5cd56f68d9d1e9b21ae20389bbcb2e5/src/platform.ts#L29 — Reply to this email directly, view it on GitHub https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/issues/24#issuecomment-1655606806, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJE7PVRJXMBYCOYNY2UKTMLXSOV7TANCNFSM6AAAAAA2ZAFGYQ. You are receiving this because you were mentioned.

bwp91 commented 11 months ago

the build command should not start the plugin. it builds the plugin.

For a homebridge plugin, the build command converts the typescript code to javascript.

since you are using raw javascript, you do not need to build.

richierockskool commented 11 months ago

If it is deleted the build fails

On Jul 29, 2023, at 12:06 PM, Ben @.***> wrote:

the build command should not start the plugin. it builds the plugin.

For a homebridge plugin, the build command converts the typescript code to javascript.

since you are using raw javascript, you do not need to build.

— Reply to this email directly, view it on GitHub https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/issues/24#issuecomment-1656765719, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJE7PVVJB3RIXQ3FLO5UIHLXSUYIPANCNFSM6AAAAAA2ZAFGYQ. You are receiving this because you were mentioned.

richierockskool commented 11 months ago

It is now building in and accessories are showing up, then Homebridge crashes

[7/29/2023, 12:11:37 PM] [InkbirdWifiGateway] Initializing homebridge-inkbird-wifi-gateway platform... [7/29/2023, 12:11:37 PM] [InkbirdWifiGateway] Finished initializing Inkbird Platform: InkbirdWifiGateway [7/29/2023, 12:11:37 PM] [InkbirdWifiGateway] [class IBSPO1Accessory] [class IBSTH1Accessory] [7/29/2023, 12:11:37 PM] TypeError: Cannot read properties of undefined (reading 'name') at new IBSPO1Accessory (file:///Users/richjagger/Documents/GitHub/homebridge-inkbird-wifi-gateway/src/IBSPO1Accessory.js:6:24) at new InkbirdPlatform (file:///Users/richjagger/Documents/GitHub/homebridge-inkbird-wifi-gateway/src/InkbirdPlatform.js:58:9) at /usr/local/lib/node_modules/homebridge/src/server.ts:474:40 at Array.forEach () at Server.loadPlatforms (/usr/local/lib/node_modules/homebridge/src/server.ts:401:27) at Server.start (/usr/local/lib/node_modules/homebridge/src/server.ts:176:29) [7/29/2023, 12:11:37 PM] Got SIGTERM, shutting down Homebridge... [7/29/2023, 12:11:37 PM] AssertionError [ERR_ASSERTION]: Cannot generate setupURI on an accessory that isn't published yet! at Bridge.Accessory.setupURI (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:994:11) at Server.setServerStatus (/usr/local/lib/node_modules/homebridge/src/server.ts:155:45) at Server.teardown (/usr/local/lib/node_modules/homebridge/src/server.ts:199:10) at signalHandler (/usr/local/lib/node_modules/homebridge/src/cli.ts:93:12) at process.emit (node:events:514:28) at process.emit (/usr/local/lib/node_modules/homebridge/node_modules/source-map-support/source-map-support.js:516:21)

On Jul 29, 2023, at 12:06 PM, Ben @.***> wrote:

the build command should not start the plugin. it builds the plugin.

For a homebridge plugin, the build command converts the typescript code to javascript.

since you are using raw javascript, you do not need to build.

— Reply to this email directly, view it on GitHub https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/issues/24#issuecomment-1656765719, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJE7PVVJB3RIXQ3FLO5UIHLXSUYIPANCNFSM6AAAAAA2ZAFGYQ. You are receiving this because you were mentioned.

bwp91 commented 11 months ago

well here you are simple setting this.devices to 2 so it’s not a proper object with a name property

i mean it’s not an array with objects with name properties

richierockskool commented 11 months ago

get the same with this.device to 1?

InkbirdWifiGateway] [class IBSPO1Accessory] [7/29/2023, 12:34:33 PM] TypeError: Cannot read properties of undefined (reading 'name') at new IBSPO1Accessory (file:///Users/richjagger/Documents/GitHub/homebridge-inkbird-wifi-gateway/src/IBSPO1Accessory.js:6:24) at new InkbirdPlatform (file:///Users/richjagger/Documents/GitHub/homebridge-inkbird-wifi-gateway/src/InkbirdPlatform.js:58:9) at /usr/local/lib/node_modules/homebridge/src/server.ts:474:40 at Array.forEach () at Server.loadPlatforms (/usr/local/lib/node_modules/homebridge/src/server.ts:401:27) at Server.start (/usr/local/lib/node_modules/homebridge/src/server.ts:176:29) [7/29/2023, 12:34:33 PM] Got SIGTERM, shutting down Homebridge... [7/29/2023, 12:34:33 PM] AssertionError [ERR_ASSERTION]: Cannot generate setupURI on an accessory that isn't published yet! at Bridge.Accessory.setupURI (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:994:11) at Server.setServerStatus (/usr/local/lib/node_modules/homebridge/src/server.ts:155:45) at Server.teardown (/usr/local/lib/node_modules/homebridge/src/server.ts:199:10) at signalHandler (/usr/local/lib/node_modules/homebridge/src/cli.ts:93:12) at process.emit (node:events:514:28) at process.emit (/usr/local/lib/node_modules/homebridge/node_modules/source-map-support/source-map-support.js:516:21)

On Jul 29, 2023, at 12:28 PM, Ben @.***> wrote:

well here you are simple setting this.devices to 2 so it’s not a proper object with a name property

— Reply to this email directly, view it on GitHub https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/issues/24#issuecomment-1656776570, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJE7PVX3KK6JTUNQNGGTXNTXSU2ZBANCNFSM6AAAAAA2ZAFGYQ. You are receiving this because you were mentioned.

richierockskool commented 11 months ago

fix some code InkbirdPlatform.js

result

[7/30/2023, 9:05:19 AM] [InkbirdWifiGateway] Initializing homebridge-inkbird-wifi-gateway platform... [7/30/2023, 9:05:19 AM] [InkbirdWifiGateway] [class InkbirdPlatform] [7/30/2023, 9:05:19 AM] [InkbirdWifiGateway] [class InkbirdPlatform] [7/30/2023, 9:05:19 AM] [InkbirdWifiGateway] [class InkbirdPlatform]

this only shows up in homebridge -D not in Homebridge [7/30/2023, 9:05:19 AM] [InkbirdWifiGateway] Executed didFinishLaunching callback [7/30/2023, 9:13:13 AM] Publishing bridge accessory (name: Homebridge 88AB, publishInfo: { username: '0E:84:85:50:88:AB', port: 51516, pincode: '--', category: 2, bind: [ 'en0', [length]: 1 ], mdns: undefined, addIdentifyingMaterial: true, advertiser: 'ciao' }).

And, no accessories appear?

On Jul 29, 2023, at 12:28 PM, Ben @.***> wrote:

well here you are simple setting this.devices to 2 so it’s not a proper object with a name property

— Reply to this email directly, view it on GitHub https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/issues/24#issuecomment-1656776570, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJE7PVX3KK6JTUNQNGGTXNTXSU2ZBANCNFSM6AAAAAA2ZAFGYQ. You are receiving this because you were mentioned.

richierockskool commented 11 months ago

In homebridge now…

[8/5/2023, 1:56:54 PM] [InkbirdWifiGateway] Initializing homebridge-inkbird-wifi-gateway platform... [8/5/2023, 1:56:54 PM] [InkbirdWifiGateway] Starting Inkbird Platform using homebridge API 2.7 [8/5/2023, 1:56:54 PM] [InkbirdWifiGateway] [class InkbirdPlatform] [8/5/2023, 1:56:54 PM] [InkbirdWifiGateway] [class InkbirdPlatform] [8/5/2023, 1:56:54 PM] [InkbirdWifiGateway] [class InkbirdPlatform] [8/5/2023, 1:56:54 PM] [InkbirdWifiGateway] [ { UniqueId: 'IBS-M1S', DisplayName: 'Backyard Gateway' }, { UniqueId: 'IBS-PO1/B', DisplayName: 'Pool Temperature Sensor' }, { UniqueId: 'IBS-TH1', DisplayName: 'Hot Tub Temperature Sensor' } ]

In homebridge -D

[8/5/2023, 1:59:14 PM] [InkbirdWifiGateway] Initializing homebridge-inkbird-wifi-gateway platform... [8/5/2023, 1:59:14 PM] [InkbirdWifiGateway] Starting Inkbird Platform using homebridge API 2.7 [8/5/2023, 1:59:14 PM] [InkbirdWifiGateway] [class InkbirdPlatform] [8/5/2023, 1:59:14 PM] [InkbirdWifiGateway] [class InkbirdPlatform] [8/5/2023, 1:59:14 PM] [InkbirdWifiGateway] [class InkbirdPlatform] [8/5/2023, 1:59:14 PM] [InkbirdWifiGateway] Adding Bridge Device [8/5/2023, 1:59:14 PM] [InkbirdWifiGateway] Found device undefined [8/5/2023, 1:59:14 PM] [InkbirdWifiGateway] [ { UniqueId: 'IBS-M1S', DisplayName: 'Backyard Gateway' }, { UniqueId: 'IBS-PO1/B', DisplayName: 'Pool Temperature Sensor' }, { UniqueId: 'IBS-TH1', DisplayName: 'Hot Tub Temperature Sensor' } ]

[8/5/2023, 1:59:14 PM] [InkbirdWifiGateway] Executed didFinishLaunching callback

then this error,

[8/5/2023, 1:59:15 PM] Error: listen EADDRINUSE: address already in use :::51516 at Server.setupListenHandle [as _listen2] (node:net:1872:16) at listenInCluster (node:net:1920:12) at Server.listen (node:net:2008:7) at EventedHTTPServer.listen (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/util/eventedhttp.ts:164:20) at HAPServer.listen (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/HAPServer.ts:377:21) at Bridge. (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:1365:18) at step (/usr/local/lib/node_modules/homebridge/node_modules/tslib/tslib.js:193:27) at Object.next (/usr/local/lib/node_modules/homebridge/node_modules/tslib/tslib.js:174:57) at /usr/local/lib/node_modules/homebridge/node_modules/tslib/tslib.js:167:75 at new Promise ()

What is happening here?

And still no accessories show up..

when I add this in it asks for a uuid? AssertionError [ERR_ASSERTION]: Services must be created with a valid UUID. https://www.google.com/search?client=safari&rls=en&q=AssertionError+%5BERR_ASSERTION%5D%3A+Services+must+be+created+with+a+valid+UUID.&ie=UTF-8&oe=UTF-8

:this.log.debug('Creating and configuring new bridge') bridgeAccessory=(devicesDiscovered) bridgeService=(Service.Tunnel) bridgeService=(devicesDiscovered)

    this.Service = this.api.hap.Service;
    this.Characteristic = this.api.hap.Characteristic;
    this.name = config.name;
    // create a new Bridge Configuration service
    this.service = new this.Service(this.Service.InkbirdWifiGateway);
    // create handlers for required characteristics
    this.service.getCharacteristic(this.Characteristic.InkbirdWifiGateway)
      .onGet(this.handleDiscoverBridgedAccessoriesGet.bind(this))
      .onSet(this.handleDiscoverBridgedAccessoriesSet.bind(this));

    this.service.getCharacteristic(this.Characteristic.DiscoveredBridgedAccessories)
      .onGet(this.handleDiscoveredBridgedAccessoriesGet.bind(this));

    this.bridgeService.getCharacteristic(Characteristic.StatusFault).updateValue(!devicesDiscovered.is_connected)
    this.bridgeAccessory.addService(bridgeService)
    this.accessories[uuid]=bridgeAccessory
    this.log.info('Adding Gen-1 Bridge')
    this.log.debug('Registering platform accessory')
    this.api.registerPlatformAccessories(PluginName, PlatformName, [bridgeAccessory])
}

Very close to making this work, any help would be great.

On Jul 29, 2023, at 12:28 PM, Ben @.***> wrote:

well here you are simple setting this.devices to 2 so it’s not a proper object with a name property

— Reply to this email directly, view it on GitHub https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/issues/24#issuecomment-1656776570, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJE7PVX3KK6JTUNQNGGTXNTXSU2ZBANCNFSM6AAAAAA2ZAFGYQ. You are receiving this because you were mentioned.