JetBrains / intellij-micropython

Plugin for MicroPython devices in PyCharm and IntelliJ
https://plugins.jetbrains.com/plugin/9777-micropython
Apache License 2.0
507 stars 106 forks source link

dht - unresolved reference #56

Open alleycat58uk opened 6 years ago

alleycat58uk commented 6 years ago

I'm using a DHT22 temperature and humidity sensor and use the following import:

from dht import DHT22

PyCharm flags this as an unresolved reference however, the MicroPython firmware includes this library. If I ignore this and upload my code, it runs without error.

I'm running:

Shouldn't the dht library be recognised or have I missed something?

vlasovskikh commented 6 years ago

The MicroPtyhon plugin for PyCharm knows about MicroPython modules thanks to Python stub files with type hints (see PEP 484). Type hints are located here and are structured as:

I found dht at this documentation page. This module is not covered by type hints yet.

A pull request with a stub for dht for ESP8266 is welcome. The folder for the stub file is https://github.com/vlasovskikh/intellij-micropython/tree/master/typehints/esp8266. Please take a look at other stub files to get an idea of how they should look like.