verified icon indicating copy to clipboard operation
verified copied to clipboard

homebridge-hsd

Open En3rGy opened this issue 1 year ago • 13 comments

Link To GitHub Repo

https://github.com/En3rGy/homebridge-hsd

Link To NPM Package

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

Plugin Icon (Optional)

No response

En3rGy avatar Feb 03 '24 08:02 En3rGy

The following pre-checks failed:

:x: The config.schema.json does not contain valid JSON.

Comment /check to run checks again.

github-actions[bot] avatar Feb 03 '24 08:02 github-actions[bot]

/check

En3rGy avatar Feb 03 '24 09:02 En3rGy

:white_check_mark: Pre-checks completed successfully.

github-actions[bot] avatar Feb 03 '24 09:02 github-actions[bot]

Hi @En3rGy quick question, does "jasmine": "^5.1.0", need to be in your dependencies or can this go to dev dependencies?

bwp91 avatar Feb 11 '24 03:02 bwp91

Hi @bwp91 , thanks for the point. Checked the dependencies and cleaned them up. Git and npm are up to date with the new v1.1.3.

En3rGy avatar Feb 11 '24 16:02 En3rGy

  • General
    • [x] The plugin must be of type dynamic platform.
    • [x] The plugin must not offer the same nor less functionality than that of any existing verified plugin.
  • Repo
    • [x] The plugin must be published to NPM and the source code available on a GitHub repository, with issues enabled.
    • [x] A GitHub release should be created for every new version of your plugin, with release notes.
  • Environment
    • [x] The plugin must run on all supported LTS versions of Node.js, at the time of writing this is Node v18 and v20.
    • [x] The plugin must successfully install and not start unless it is configured.
    • [x] The plugin must not execute post-install scripts that modify the users' system in any way.
    • [x] The plugin must not require the user to run Homebridge in a TTY or with non-standard startup parameters, even for initial configuration.
  • Codebase
    • [x] The plugin must implement the Homebridge Plugin Settings GUI.
    • [x] The plugin must not contain any analytics or calls that enable you to track the user.
    • [x] If the plugin needs to write files to disk (cache, keys, etc.), it must store them inside the Homebridge storage directory.
    • [x] The plugin must not throw unhandled exceptions, the plugin must catch and log its own errors.



Comment /check to run checks again.

github-actions[bot] avatar Mar 16 '24 18:03 github-actions[bot]

Hi @En3rGy I installed the plugin, then opened the plugin UI and saved an initial config without changing any values.

After restarting Homebridge, it went into a crash loop with these errors:

[16/03/2024, 18:32:57] [hsd] Initializing hsd platform...
[16/03/2024, 18:32:57] Error: hsdPlatform.ts | HsdPlatform | Invalid configuration
    at new HsdPlatform (/usr/local/lib/node_modules/homebridge-hsd/src/hsdPlatform.ts:31:13)
    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)
[16/03/2024, 18:32:57] Got SIGTERM, shutting down Homebridge...
[16/03/2024, 18:32:57] 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:518:28)
    at process.emit (/usr/local/lib/node_modules/homebridge/node_modules/source-map-support/source-map-support.js:516:21)
[16/03/2024, 18:33:02] [HB Supervisor] Homebridge Process Ended. Code: 143, Signal: null

The plugin should not terminate the process as this ended up continually restarting my homebridge and all the plugins I have.

Errors that happen should be caught properly and logged, but not crash.

bwp91 avatar Mar 16 '24 18:03 bwp91

@bwp91 could you please post your test config so that I can update my test cases?

En3rGy avatar Mar 16 '24 18:03 En3rGy

Yes is this:

        {
            "accessories": [
                {
                    "services": [
                        {
                            "serviceType": "Lightbulb",
                            "characteristics": [
                                {
                                    "characteristicName": "On"
                                }
                            ]
                        }
                    ]
                }
            ],
            "hsPort": 443,
            "platform": "hsd"
        }

is the config that is saved when opening the config screen for the first time and just clicking save straight away.

bwp91 avatar Mar 16 '24 19:03 bwp91

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Apr 27 '24 11:04 github-actions[bot]

The fix is online, see https://github.com/En3rGy/homebridge-hsd/releases/tag/v1.1.7 resp. https://www.npmjs.com/package/homebridge-hsd/v/1.1.7 I'm still struggeling to simulate a homebridge API instance for unit testing. Any tips for this one?

En3rGy avatar Apr 28 '24 18:04 En3rGy

@En3rGy with regards to unit testing, perhaps the homebridge/ui test files could be of use?

  • .spec.ts files here: https://github.com/homebridge/homebridge/blob/latest/src/api.spec.ts
  • testing folder here: https://github.com/homebridge/homebridge-config-ui-x/tree/latest/test

bwp91 avatar May 04 '24 12:05 bwp91

Also I just reinstalled the plugin, saved the default config of:

        {
            "accessories": [
                {
                    "services": [
                        {
                            "serviceType": "Lightbulb",
                            "characteristics": [
                                {
                                    "characteristicName": "On"
                                }
                            ]
                        }
                    ]
                }
            ],
            "hsPort": 443,
            "platform": "hsd",
            "_bridge": {
                "username": "removed"
            }
        }

and now getting this crash loop:

[04/05/2024, 13:18:10] Registering platform 'homebridge-hsd.hsd'
[04/05/2024, 13:18:10] [homebridge-hsd] Loaded homebridge-hsd v1.1.7 child bridge successfully
[04/05/2024, 13:18:10] [homebridge-hsd] hsdPlatform.ts | HsdPlatform | Invalid configuration
[04/05/2024, 13:18:10] [homebridge-hsd] hs.ts | HomeServerConnector | connect > Current connection state is 0

/usr/local/lib/node_modules/homebridge-hsd/node_modules/ws/lib/websocket.js:691
      throw new SyntaxError(`Invalid URL: ${address}`);
            ^
SyntaxError: Invalid URL: wss://:0/endpoints/ws?authorization=Og%3D%3D
    at initAsClient (/usr/local/lib/node_modules/homebridge-hsd/node_modules/ws/lib/websocket.js:691:13)
    at new WebSocket (/usr/local/lib/node_modules/homebridge-hsd/node_modules/ws/lib/websocket.js:85:7)
    at HomeServerConnector.connect (/usr/local/lib/node_modules/homebridge-hsd/src/hs.ts:94:16)
    at HsdPlatform.connect (/usr/local/lib/node_modules/homebridge-hsd/src/hsdPlatform.ts:24:10)
    at HomebridgeAPI.<anonymous> (/usr/local/lib/node_modules/homebridge-hsd/src/hsdPlatform.ts:45:44)
    at HomebridgeAPI.emit (node:events:518: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:194:14)
[04/05/2024, 13:18:11] [homebridge-hsd] Child bridge process ended
[04/05/2024, 13:18:11] [homebridge-hsd] Process Ended. Code: 1, Signal: null

bwp91 avatar May 04 '24 12:05 bwp91

New version v1.1.9 is online: https://www.npmjs.com/package/homebridge-hsd

En3rGy avatar May 19 '24 22:05 En3rGy

Congratulations! Your plugin has been verified!

You can now add one of the Verified by Homebridge badges 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)

verified-by-homebridge

[![verified-by-homebridge](https://img.shields.io/badge/homebridge-verified-blueviolet?color=%23491F59&style=for-the-badge&logoColor=%23FFFFFF&logo=homebridge)](https://github.com/homebridge/homebridge/wiki/Verified-Plugins)

Your plugin is now also eligible to display a :heart: 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!

As a verified plugin, you can request a channel in the Discord server to discuss your plugin with users and other developers. Just ask in the #plugin-development channel.

Thank you for your contribution to the Homebridge community.

  • The Homebridge Team

github-actions[bot] avatar May 26 '24 11:05 github-actions[bot]