homebridge / plugins

Information and resources for Homebridge plugins.
https://homebridge.io/w/Verified-Plugins
GNU General Public License v3.0
368 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

bwp91 commented 1 year ago

So you need to design the plugin to account for anything going wrong.

  1. what happens if a user is on a machine that can't install the abandonware/noble dependency?
  2. what happens if a user can install the abandonware/noble dependency but doesn't have a ble module?
  3. what happens if a user doesnt have an Inkbird Wifi Gateway IBSM1S?

This is not a full list, but in any case that a user doesn't have anything to make the plugin work, the plugin should just log an warning in the homebridge log and 'stop' without crashing the node process.

richierockskool commented 1 year ago

Okay let me get back to work, and I think all the bluetooth dependencies must go, and all the src folders dedicated to it, and just focus on the wifi (ip address) and getting the Inkbird Wifi Gateway connected. Once that is connected in Homebridge I will be on a better route to getting it to work and verified.

On Jun 16, 2023, at 6:28 PM, Ben @.***> wrote:

So you need to design the plugin to account for anything going wrong.

what happens if a user is on a machine that can't install the abandonware/noble dependency? what happens if a user can install the abandonware/noble dependency but doesn't have a ble module? what happens if a user doesnt have an Inkbird Wifi Gateway IBSM1S? This is not a full list, but in any case that a user doesn't have anything to make the plugin work, the plugin should just log an warning in the homebridge log and 'stop' without crashing the node process.

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

richierockskool commented 1 year ago

/check

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 have to update src

bwp91 commented 1 year ago

The issue here is the bluetooth package (noble) being listed in the dependencies section. As it can’t be installed on the github environment, so it fails.

ideally you should put this into an “optionalDependencies” section of the package json, like i have with my govee plugin:

https://github.com/bwp91/homebridge-govee/blob/4fe51fe47f782e53367ce8bda10f6f68950b3338/package.json#L65

bwp91 commented 1 year ago

Hi @richierockskool any update on this?

richierockskool commented 1 year ago

Ben, we are still having difficulties getting Homebridge to load the accessory/accessories,

It does this fine [InkbirdWifiGateway] Initializing homebridge-inkbird-wifi-gateway platform..

but when it tries “[InkbirdWifiGateway]Starting Inkbird Platform etc.” (API) We have tried the API route and even though it loads the accessories it crashes with error.

We have found module/folder to control the Starting is here, but we are missing the “didFinishLaunching”, function () part after the constructors and do not understand how to use it properly.

homebridge-inkbird-wifi-gateway https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/tree/master/src https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/tree/master/src/InkbirdPlatform.js

with this code

import BleScanner from './BleScanner.js'; import IBSTH1Accessory from './IBSTH1Accessory.js'; import IBSPO1Accessory from './IBSPO1Accessory.js';

class InkbirdPlatform {

constructor(log, config, api) { this.log = log; this.config=config; this.email=config.email; this.password=config.password; this.accessToken = config.accessToken; this.device = config.devices; this.myAccessories = []; this.api=api;

//This has to be coded correctly to make this work

“didFinishLaunching”, function ()

// Boot scanner and register devices to scanner
new api.hap.Service.TemperatureSensor;
this.scanner = new BleScanner(this.log);

for (let device of this.devices = '2') {
  this.scanner.addDevice(device.deviceId);
  if (device.type === 'IBSTH1') {
    // eslint-disable-next-line no-undef
    let accessory = new IBSTH1Accessory(this.log, this.scanner, device, global.homebridge);
    this.myAccessories.push(accessory);
  }
  if (device.type === 'IBSPO1') {
    // eslint-disable-next-line no-undef
    let accessory = new IBSPO1Accessory(this.log, this.scanner, device, global.homebridge);
    this.myAccessories.push(accessory);
  }

}

}

accessories(callback) { callback(this.myAccessories); } }

export default InkbirdPlatform;

On Jul 17, 2023, at 5:53 PM, Ben @.***> wrote:

Hi @richierockskool https://github.com/richierockskool any update on this?

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

bwp91 commented 1 year ago

Closing as not ready, will defer to https://github.com/richierockskool/homebridge-inkbird-wifi-gateway/issues/24

richierockskool commented 1 year ago

/check