roscoe81 / enviro-monitor

An environment monitor based on a Raspberry Pi Zero W, a Pimoroni Enviro+ and a Plantower air quality sensor to monitor, display and report on air particles, gases, temperature, humidity, noise and air pressure.
MIT License
80 stars 26 forks source link

No module named 'paho' #1

Closed prutsky closed 4 years ago

prutsky commented 4 years ago

Hi, Hi I installed paho (with sudo pip install paho-mqtt) but still I get the following error:

$ python3 Northcliff_AQI_Monitor_Gen.py 
Traceback (most recent call last):
  File "Northcliff_AQI_Monitor_Gen.py", line 5, in <module>
    import paho.mqtt.client as mqtt
ModuleNotFoundError: No module named 'paho'

Why isn't paho found?

roscoe81 commented 4 years ago

That's strange. Maybe try sudo pip3 install paho-mqtt

prutsky commented 4 years ago

Thank you, that was it! But after installing "Adafruit_IO" and creating a config.json file I got stuck at the following error:

$ python3 Northcliff_AQI_Monitor_Gen.py 
2020-04-06 12:22:37.354 INFO     Northcliff_Environment_Monitor.py - Combined enviro+ sensor capture, external sensor capture, Luftdaten and Home Manager Updates and display of readings.
#Press Ctrl+C to exit!

#Note: you'll need to register with Luftdaten at:
#https://meine.luftdaten.info/ and enter your Raspberry Pi
#serial number that's displayed on the Enviro plus LCD along
#with the other details before the data appears on the
#Luftdaten map.

#
Retrieved Config {'temp_offset': 0, 'enable_adafruit_io': False, 'aio_user_name': '<>', 'aio_key': '<>', 'aio_household_prefix': '<>', 'aio_location_prefix': '<>', 'enable_send_data_to_homemanager': False, 'enable_receive_data_from_homemanager': False, 'enable_indoor_outdoor_functionality': True, 'mqtt_broker_name': '<>', 'enable_luftdaten': True, 'enable_climate_and_gas_logging': True, 'enable_particle_sensor': True, 'incoming_temp_hum_mqtt_topic': '<>', 'incoming_temp_hum_mqtt_sensor_name': '<>', 'incoming_barometer_mqtt_topic': '<>', 'incoming_barometer_sensor_id': 0, 'indoor_outdoor_function': 'Indoor', 'mqtt_client_name': '<>', 'outdoor_mqtt_topic': '<>', 'indoor_mqtt_topic': '<>', 'city_name': 'Elst', 'time_zone': 'Europe/Amsterdam', 'custom_locations': ['Thuis, Nederland, Gelderland, 3.30000, 51.300000']}
2020-04-06 12:22:40.337 INFO     Raspberry Pi serial: xyz
2020-04-06 12:22:40.384 INFO     Wi-Fi: connected

Traceback (most recent call last):
  File "Northcliff_AQI_Monitor_Gen.py", line 1229, in <module>
    client.connect(mqtt_broker_name, 1883, 60)
  File "/usr/local/lib/python3.7/dist-packages/paho/mqtt/client.py", line 937, in connect
    return self.reconnect()
  File "/usr/local/lib/python3.7/dist-packages/paho/mqtt/client.py", line 1071, in reconnect
    sock = self._create_socket_connection()
  File "/usr/local/lib/python3.7/dist-packages/paho/mqtt/client.py", line 3522, in _create_socket_connection
    return socket.create_connection(addr, source_address=source, timeout=self._keepalive)
  File "/usr/lib/python3.7/socket.py", line 707, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
  File "/usr/lib/python3.7/socket.py", line 748, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known
roscoe81 commented 4 years ago

Do you need the mqtt messages enabled? If so, do you have an mqtt broker on your network and have you set up config.json to use that broker's name or IP address?

roscoe81 commented 4 years ago

Sorry, I answered before looking at your retrieved config file. You can solve the problem by setting 'enable_indoor_outdoor_functionality’: false in your config.json file. You need an mqtt broker if it’s set to true so that the indoor and outdoor Enviro Monitors to communicate with each other.

brunoHenriquePastor commented 2 years ago

I just want to say thank you! You really helps me!