Closed aukeboskma closed 9 years ago
Hmm, it looks ok, but it definitely seems like the 'dht_devices' variable is not being interpreted correctly.
Is your settings file called "settings.py" or "Settings.py". You mentioned it with a capital S, so I wanted to make sure. I think that it is case sensitive.
The error indicates that the 'dht_devices' variable is empty (not iterable), so I wonder if it's trying to use the default_settings.py instead, which has an empty 'dht_devices' variable. You could try putting your device information directly in default_settings.py instead of settings.py, to see if that's what's happening.
Ok, I did what you said. I also deleted settings.py (it was with s not capital). but I get the same error message. Any other thoughts?
EDIT: Damn I think I see the problem. I have an AM2302 sensor instead of a DHT22. So I need to remove the resistor beacuse a AM2302 has his own resistor. I will let you know if this solved my problem :)
Ah ok. So maybe it was a hardware issue then?
Still, the error you pasted did sound like it was an issue with the dht_devices variable in the settings. If you deleted the settings.py, then the script will fall back on default_settings.py, which has an empty dht_devices variable... so be sure to fill that in with your device settings like you did in settings.py.
Also... I don't remember, but you may need to restart Apache for the changes in settings.py to take affect. So maybe give that a try too.
Good luck!
Still the same problem. Like you said. It is not a hardware error. What is the best thing to try? Hardcode measure-dht.py? Or if you have time acces my pi via putty.
Can you paste your full default_settings.py file verbatim? (Or settings.py, if you're using that.)
I deleted settings.py. And only have default_settings.py. I have a Raspbery Pi B+ so that is why I use pin 37.
default_settings.py GNU nano 2.2.6 File: default_settings.py
settings = {
# Absolute path to the SQLite database file.
'db': '/home/pi/atmospi/log.db',
# Define the DHT devices and the GPIO pin they are connected to.
#
# dht_devices should be a dictionary of dictionaries. The name of each
# dictionary will be used as the device's unique ID.
#
# For example:
#
# 'dht_devices': {
# 'Name of sensor': {
# 'type': 'DHT22',
# 'pin': 22
# }
# }
#
# Available device types: DHT11, DHT22, AM2302
'dht_devices': {
'DHT22': {
'type': 'DHT22',
'pin': 37
}
}
}
I'm stumped. And I don't remember how to SSH into your Pi. Can you email me the login again?
I have sent you a message via your website.
Thanks.
FYI I made the following changes in your Pi:
Then I googled, and found this: http://www.raspberrypi.org/forums/viewtopic.php?t=60932&p=455119
It sounds like the issue might actually be coming from the dhtlibrary itself, not from atmospi. But, atmospi is not handling the error, and crashes. I don't think that really matters, though, since this is just a script that runs on cron, unlike the init.py which needs to continue running.
The issue described in the link above sounds like it happens intermittently for them... but it's happening all the time for you.
Are you sure you have the right PIN? And are you sure it's wired correctly? Could you post a photo perhaps?
First, thanks for helping me with this.
This is how I wired it up. I have the sensor connected to 5V, I also tried 3V3 same result. Blue is data, red is +5 and white is -. Data(blue) is connected to PIN 37.
F*CK.. I know the problem.... I just thought lets try GPIO26 instead of pin 37 and I it is working now. stupid that i didn't tried this before. Thanks for helping.
Awesome! I had a feeling it would be something simple. Glad it's working!
Last question for now, how to add a second DHT22
'dht_devices': {
'DHT22': {
'type': 'DHT22',
'pin': 26
}
'DHT22_outside': {
'type': 'DHT22',
'pin': 19
}
}
What am I doing wrong in this. Sorry with my python skills I can't solve this one.
It looks OK to me. What is happening when you run it?
To be honest, I've never tried with multiple DHT sensors... so this will be the first real test of that.
This is the error when I run it.
full code:
settings = {
# Absolute path to the SQLite database file.
'db': '/home/pi/atmospi/log.db',
# Define the DHT devices and the GPIO pin they are connected to.
#
# dht_devices should be a dictionary of dictionaries. The name of each
# dictionary will be used as the device's unique ID.
#
# For example:
#
# 'dht_devices': {
# 'Name of sensor': {
# 'type': 'DHT22',
# 'pin': 22
# }
# }
#
# Available device types: DHT11, DHT22, AM2302
'dht_devices': {
'DHT22': {
'type': 'DHT22',
'pin': 26
}
'DHT22_outside': {
'type': 'DHT22',
'pin': 19
}
}
}
Oh you're missing a comment after the closing bracket of the 'DHT22' device (the first one). It should be:
'dht_devices': {
'DHT22': {
'type': 'DHT22',
'pin': 26
},
'DHT22_outside': {
'type': 'DHT22',
'pin': 19
}
}
Awesome it is working fine now :+1: Thank you so much.
What you said here https://github.com/mstenta/atmospi/issues/15#issuecomment-61984941 I see it happening sometimes when I run measure-dht.py manually. So sometimes I will have some missing data in my graph, but that's not really a problem.
Closing this issue, because you got it working! :-)
Hi,
I'm trying to add a DHT22 sensor. But I got an error and I have no idea how to fix this. Hope you can help.
pi@raspberrypi ~/atmospi/Atmospi $ sudo ./measure-dht.py Traceback (most recent call last): File "./measure-dht.py", line 52, in
readings = read_sensors()
File "./measure-dht.py", line 33, in read_sensors
tc, h = dhtreader.read(sensor_types[device['type']], device['pin'])
TypeError: 'NoneType' object is not iterable
Settings.py looks like this
Atmospi settings.
settings = {
}