Browse Source

Usage of default values if no gpio in config

spike_filter
Dirk Alders 4 years ago
parent
commit
fd86c70c83
1 changed files with 6 additions and 2 deletions
  1. 6
    2
      __init__.py

+ 6
- 2
__init__.py View File

1
-from config import dht_gpio
1
+try:
2
+    from config import dht_gpio
3
+except ImportError:
4
+    dht_gpio = None
5
+
2
 try:
6
 try:
3
     import Adafruit_DHT as dht
7
     import Adafruit_DHT as dht
4
 except ImportError:
8
 except ImportError:
25
         #
29
         #
26
         # DHT22
30
         # DHT22
27
         #
31
         #
28
-        if dht is None:
32
+        if dht is None or dht_gpio is None:
29
             h = -17.3
33
             h = -17.3
30
             t = -125.7
34
             t = -125.7
31
         else:
35
         else:

Loading…
Cancel
Save