Skip to content
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-purpleair #564

Closed
tillkruss opened this issue Sep 1, 2023 · 8 comments
Closed

homebridge-purpleair #564

tillkruss opened this issue Sep 1, 2023 · 8 comments
Labels
verified use when a plugin meets the criteria - adds the verified badge text

Comments

@tillkruss
Copy link

Link To GitHub Repo

https://github.com/tillkruss/homebridge-purpleair

Link To NPM Package

https://www.npmjs.com/package/homebridge-purpleair

@tillkruss tillkruss added the pending the label given to a new verification/icon request label Sep 1, 2023
@github-actions
Copy link

github-actions bot commented Sep 1, 2023

✅ Pre-checks completed successfully.

@bwp91
Copy link
Contributor

bwp91 commented Sep 1, 2023

There seems to be an issue with crash loop:

[01/09/2023, 23:15:05] Registering platform 'homebridge-purpleair.PurpleAir'
[01/09/2023, 23:15:05] [homebridge-purpleair] Loaded homebridge-purpleair v1.0.6 child bridge successfully
TypeError: Cannot read properties of undefined (reading 'length')
    at PurpleAirPlatform.setUpSensors (/usr/local/lib/node_modules/homebridge-purpleair/src/platform.ts:29:31)
    at HomebridgeAPI.<anonymous> (/usr/local/lib/node_modules/homebridge-purpleair/src/platform.ts:17:12)
    at HomebridgeAPI.emit (node:events:514:28)
    at HomebridgeAPI.signalFinished (/usr/local/lib/node_modules/homebridge/src/api.ts:275:10)
    at ChildBridgeFork.startBridge (/usr/local/lib/node_modules/homebridge/src/childBridgeFork.ts:189:14)
[01/09/2023, 23:15:05] [homebridge-purpleair] Child bridge process ended
[01/09/2023, 23:15:05] [homebridge-purpleair] Process Ended. Code: 1, Signal: null
[01/09/2023, 23:15:06] [Homebridge UI] Homebridge log truncated by admin.
[01/09/2023, 23:15:12] [homebridge-purpleair] Restarting Process...
[01/09/2023, 23:15:14] [homebridge-purpleair] Launched child bridge with PID 1533
[01/09/2023, 23:15:14] Registering platform 'homebridge-purpleair.PurpleAir'
[01/09/2023, 23:15:14] [homebridge-purpleair] Loaded homebridge-purpleair v1.0.6 child bridge successfully
TypeError: Cannot read properties of undefined (reading 'length')
    at PurpleAirPlatform.setUpSensors (/usr/local/lib/node_modules/homebridge-purpleair/src/platform.ts:29:31)
    at HomebridgeAPI.<anonymous> (/usr/local/lib/node_modules/homebridge-purpleair/src/platform.ts:17:12)
    at HomebridgeAPI.emit (node:events:514:28)
    at HomebridgeAPI.signalFinished (/usr/local/lib/node_modules/homebridge/src/api.ts:275:10)
    at ChildBridgeFork.startBridge (/usr/local/lib/node_modules/homebridge/src/childBridgeFork.ts:189:14)

This is with a config of:

        {
            "conversion": "US_EPA",
            "platform": "PurpleAir",
            "_bridge": {
                "username": "0E:EB:EE:B2:27:AA",
                "port": 55401
            }
        }

I installed the plugin via the Homebridge UI. When the settings screen appeared I just clicked Save, and then the child bridge window appeared which I enabled to test more easily

@bwp91 bwp91 added awaiting-user-reply use after review has started - awaiting user to reply to a comment and removed pending the label given to a new verification/icon request labels Sep 1, 2023
@tillkruss
Copy link
Author

I have not tested child-bridges, will investigate.

@tillkruss
Copy link
Author

tillkruss commented Sep 2, 2023

Fixed in tillkruss/homebridge-purpleair@b281976

Confirmed it works with child bridges, too.

@bwp91 bwp91 added reviewed and removed awaiting-user-reply use after review has started - awaiting user to reply to a comment labels Sep 3, 2023
@github-actions
Copy link

github-actions bot commented Sep 3, 2023

  • - The plugin must successfully install.
  • - The plugin must implement the Homebridge Plugin Settings GUI.
  • - The plugin must not start unless it is configured.
  • - The plugin must not execute post-install scripts that modify the user's system in any way.
  • - The plugin must not contain any analytics or calls that enable you to track the user.
  • - The plugin must not throw unhandled exceptions, the plugin must catch and log its own errors.
  • - The plugin must be published to npm and the source code available on GitHub.
  • - GitHub releases should be created for every new version of your plugin, with patch notes.
  • - The plugin must run on all Active LTS versions of Node.js, at the time of writing this is Node.js v16 and v18.
  • - The plugin must not require the user to run Homebridge in a TTY or with non-standard startup parameters, even for initial configuration.
  • - If the plugin needs to write files to disk (cache, keys, etc.), it must store them inside the Homebridge storage directory.

Everything Looks Good!

@bwp91 bwp91 added verified use when a plugin meets the criteria - adds the verified badge text and removed reviewed labels Sep 3, 2023
@github-actions
Copy link

github-actions bot commented Sep 3, 2023

Congratulations! Your plugin has been verified.

You can now add the Verified by Homebridge badge to your plugin's README:

verified-by-homebridge

[![verified-by-homebridge](https://badgen.net/badge/homebridge/verified/purple)](https://github.com/homebridge/homebridge/wiki/Verified-Plugins)

Your plugin is now also eligible to display a ❤️ Donate button on its tile in the Homebridge UI. See https://github.com/homebridge/homebridge/wiki/Donation-Links for instructions.

If for any reason in the future you can no longer maintain your plugin, please consider transferring it to our unmaintained plugins repo. We can take ownership until another willing developer comes along.

Don't forget to join the official Homebridge Discord server, where plugin developers can get tips and advice from other developers and the Homebridge project team in the #plugin-development channel!

Thank you for your contribution to the Homebridge Community.
https://homebridge.io

@bwp91
Copy link
Contributor

bwp91 commented Sep 3, 2023

Nice, is no longer crashing in this case.

All good for verification 👍

One thing I noticed that the plugin does not do is remove accessories if they are removed from the config.

Perhaps somewhere in your setUpSensors() function, loop through the this.accessories array and compare the IP address (?? although this would remove and re-add a single device if you changed the IP, or add some 'serial number' property that will always remain constant. Then in this loop you would test to see if it is still in the config, and if not, then remove them with

this.api.unregisterPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, accessoriesToRemove[]);

Something to think about!

@bwp91 bwp91 closed this as completed Sep 3, 2023
@tillkruss
Copy link
Author

Thanks! Will do!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
verified use when a plugin meets the criteria - adds the verified badge text
Projects
None yet
Development

No branches or pull requests

2 participants