-
-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Homebridge Verification #24
Comments
@richierockskool when you make updates to this plugin, are you editing the ts files or js files? |
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 <#24 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AJE7PVWJATY76HTESL2KZ6TXSFRRVANCNFSM6AAAAAA2ZAFGYQ>.
You are receiving this because you were mentioned.
|
so if you are only editing the js files why keep the ts files in the first place? |
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 <#24 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AJE7PVVSD5TSA35VUDJD7ZDXSFXWVANCNFSM6AAAAAA2ZAFGYQ>.
You are receiving this because you were mentioned.
|
well looks like your 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", |
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 <#24 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AJE7PVUK66CPQKCTBMDY5A3XSF3IBANCNFSM6AAAAAA2ZAFGYQ>.
You are receiving this because you were mentioned.
|
yea but it’s not working right now is it? |
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 <#24 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AJE7PVUK66CPQKCTBMDY5A3XSF3IBANCNFSM6AAAAAA2ZAFGYQ>.
You are receiving this because you were mentioned.
|
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 <#24 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AJE7PVSO2ESLEFVQYP27JX3XSF5EFANCNFSM6AAAAAA2ZAFGYQ>.
You are receiving this because you were mentioned.
|
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 |
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 <#24 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AJE7PVRUMND7M4WMX47KSA3XSF52HANCNFSM6AAAAAA2ZAFGYQ>.
You are receiving this because you were mentioned.
|
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 <#24 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AJE7PVRUMND7M4WMX47KSA3XSF52HANCNFSM6AAAAAA2ZAFGYQ>.
You are receiving this because you were mentioned.
|
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 |
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. |
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. |
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 <#24 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AJE7PVVS6G5YMOASBG2XNETXSGBCFANCNFSM6AAAAAA2ZAFGYQ>.
You are receiving this because you were mentioned.
|
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 |
Thank you, will work through those changes,
… On Jul 26, 2023, at 5:40 PM, Ben ***@***.***> wrote:
#25 <#25>
—
Reply to this email directly, view it on GitHub <#24 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AJE7PVRJJTQ2563J6XBN6T3XSGFF7ANCNFSM6AAAAAA2ZAFGYQ>.
You are receiving this because you were mentioned.
|
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. |
You need to put your plugin setup code into a callback for the See the template: |
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 <#24 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AJE7PVRJXMBYCOYNY2UKTMLXSOV7TANCNFSM6AAAAAA2ZAFGYQ>.
You are receiving this because you were mentioned.
|
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 <#24 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AJE7PVRJXMBYCOYNY2UKTMLXSOV7TANCNFSM6AAAAAA2ZAFGYQ>.
You are receiving this because you were mentioned.
|
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. |
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 <#24 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AJE7PVVJB3RIXQ3FLO5UIHLXSUYIPANCNFSM6AAAAAA2ZAFGYQ>.
You are receiving this because you were mentioned.
|
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 (<anonymous>)
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 <#24 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AJE7PVVJB3RIXQ3FLO5UIHLXSUYIPANCNFSM6AAAAAA2ZAFGYQ>.
You are receiving this because you were mentioned.
|
well here you are simple setting i mean it’s not an array with objects with |
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 (<anonymous>)
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 <#24 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AJE7PVX3KK6JTUNQNGGTXNTXSU2ZBANCNFSM6AAAAAA2ZAFGYQ>.
You are receiving this because you were mentioned.
|
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 <#24 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AJE7PVX3KK6JTUNQNGGTXNTXSU2ZBANCNFSM6AAAAAA2ZAFGYQ>.
You are receiving this because you were mentioned.
|
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.<anonymous> (/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 (<anonymous>)
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 <#24 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AJE7PVX3KK6JTUNQNGGTXNTXSU2ZBANCNFSM6AAAAAA2ZAFGYQ>.
You are receiving this because you were mentioned.
|
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.
The text was updated successfully, but these errors were encountered: