konnected-io / homebridge-konnected

A Homebridge plugin for Konnected Alarm Panel devices
MIT License
35 stars 12 forks source link

Fix error on initialization for invalid url #1

Closed matthewvelie closed 3 years ago

matthewvelie commented 3 years ago

On startup the following error would be written to the logs:

error: TypeError [ERR_INVALID_URL]: Invalid URL: xxxxx.iot.us-east-1.amazonaws.com at onParseError (internal/url.js:257:9) at new URL (internal/url.js:333:5) at /usr/local/lib/node_modules/homebridge-konnected/src/platform.ts:203:48 at processTicksAndRejections (internal/process/task_queues.js:97:5)

The issue is the settings.endpoint is something similar to xxx.iot.us-east-1.amazonaws.com. When calling new URL() the url must have a protocol attached to it.

mkormendy commented 3 years ago

There’s no external endpoints that are supposed to be called. So I don’t know why you are getting this.

matthewvelie commented 3 years ago

There’s no external endpoints that are supposed to be called. So I don’t know why you are getting this.

Doesn't seem like it's actually getting called, it is just making a URL object for comparison, and making that URL object fails due to the missing schema.

mkormendy commented 3 years ago

You might be getting that error because you associated your Konnected panel with the Konnected Cloud or ST SmartApp. This plugin doesn't have any provisions for that setup. It's all local.

mkormendy commented 3 years ago

By the way this plugin is not ready for consumption or pull requests yet.

matthewvelie commented 3 years ago

You might be getting that error because you associated your Konnected panel with the Konnected Cloud or ST SmartApp. This plugin doesn't have any provisions for that setup. It's all local.

Yeah, the panel is definitely connected to the Konnected Cloud. In that case should this check be completely ignored then if the type is aws_iot?

mkormendy commented 3 years ago

This check won't be ignored, it will throw an error in the logs as it does and should, but I realize the message isn't quite useful or is misleading. I will add a notice that this plugin does not work with panels that are discovered as set up for the Konnected Cloud.

In addition, I will add this as a note on the repo README.

mkormendy commented 3 years ago

@matthewvelie I've managed to implement the changes to this in the next beta.