Giter Site home page Giter Site logo

homebridge-denon-tv about verified HOT 6 CLOSED

homebridge avatar homebridge commented on September 23, 2024
homebridge-denon-tv

from verified.

Comments (6)

oznu avatar oznu commented on September 23, 2024
  • - The plugin must successfully install.
  • - The plugin must impliment the Homebridge Plugin Settings GUI.
  • - The plugin must not start unless it is configured.
  • - The plugin must not execute postinstall scripts that modify the users 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 it's own errors.
  • - The plugin must be published to npm and the source code available on GitHub.
  • - The plugin must run on all Active LTS versions of Node.js, at the time of writing this is Node.js v10 and v12.
  • - 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.

The plugin must not throw unhandled exceptions, the plugin must catch and log it's own errors

If an entry in the devices[] array does not contain a "name` attribute the following error is raised and Homebridge crashes:

[3/29/2020, 21:26:36] [AV Receiver] Initializing DenonTv platform...
[3/29/2020, 21:26:36] Error: Accessories must be created with a non-empty displayName.

It looks like the config.schema.json also needs updating to include the name property under the devices array.

To prevent it from crashing when no name is provided you could add this to about line 40:

if (!deviceName.name) {
	this.log.warn('Device Name Missing')
} else {
	this.tvAccessories.push(new denonTvDevice(log, deviceName, api));
}

This might be a good place to validate the rest of the config as well.


If the plugin needs to write files to disk (cache, keys, etc.), it must store them inside the Homebridge storage directory.

The plugin is writing files to /Users/xxxx/Library/Preferences/denonTv/ due to the persist-path module.

These should be stored in the Homebridge storage directory. You can get the storage directory for the current instance of Homebridge by calling:

api.user.storagePath()

from verified.

oznu avatar oznu commented on September 23, 2024

The plugin must not throw unhandled exceptions, the plugin must catch and log it's own errors

If the devices[] array does not exist in the config Homebridge will crash.

You could fix this on line 23 by checking devices exists before loading the plugin:

if (!config || !Array.isArray(config.devices)) {

from verified.

grzegorz914 avatar grzegorz914 commented on September 23, 2024

Can U point me how to use this to get the storagePath?

api.user.storagePath();

from verified.

oznu avatar oznu commented on September 23, 2024

api is just the 3rd function argument of your platform constructor.

https://github.com/grzegorz914/homebridge-denon-tv/blob/master/index.js#L21

From here you can just call something like:

this.prefDir = path.join(api.user.storagePath(), 'denonTv');

Note using path.join is safer (and enables cross platform compatibility) than joining paths using string concatenation.

from verified.

grzegorz914 avatar grzegorz914 commented on September 23, 2024

Thanks,

all updated and fixed.

from verified.

oznu avatar oznu commented on September 23, 2024

Looks good!

from verified.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.