Referencing 3:d-party packages


I couldn't find any previous mentions of this in the docs or in the forum so I'll post this here.

I'm thinking about adding support for an ambient temp sensor (DHT11/22) in the Dashboard plugin. This could be achieved by using the Adafruit_DHT package (MIT license). This package is available via PIP and I wonder what the best practice is in regards to referencing/including 3:d-party packages like that is?

Should i include it in plugin_additional_packages in Does that mean that it gets installed automatically by pip in the installer?

plugin_additional_packages = ["Adafruit_DHT"]
resulted in:
error: package directory 'Adafruit_DHT' does not exist

Edit2: plugin_requires = ["Adafruit_DHT"] did the trick.

I need to follow this up with a related question.

The installer for Adafruit_DHT will fail on non-rpi/beaglebone hw unless forced with --force-pi or --force-bbb parameter to force using the Raspberry Pi or Beaglebone Black respectively.

  1. Is it possible to make plugin_requires conditional depending on the target platfrom?
  2. If not, is it possible to pass the parameter "--force-pi" and then handle the platform dependency when importing the package?

Nvm. I found that i can test if RPI.GPIO loads and load the DHT module based on the result.