zewelor / bt-mqtt-gateway

A simple Python script which provides a Bluetooth to MQTT gateway, easily extensible via custom workers. See https://github.com/zewelor/bt-mqtt-gateway/wiki for more information.
MIT License
549 stars 116 forks source link

Error Gateway with Virtualenv #159

Open martellucci opened 4 years ago

martellucci commented 4 years ago

Hi, I’ve got a RPI 3B+ with Rasbian 10. I follow your instruction to install the gateway with virtualenv to use it with miflora. The installation seams good, no error, I installed the miflora library, but the gateway doeasn’t start with this error:

(.venv) pi@Pi:~/bt-mqtt-gateway $ sudo ./gateway.py -d Traceback (most recent call last): File "./gateway.py", line 11, in import logger File "/home/pi/bt-mqtt-gateway/logger.py", line 3, in import yaml ModuleNotFoundError: No module named 'yaml'

Can you help me?

Ciao

Stefano

Abbadon89 commented 4 years ago

try without sudo

martellucci commented 4 years ago

another error:

(.venv) pi@Pi:~/bt-mqtt-gateway $ ./gateway.py 20:58:47 Starting WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip. Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue. To avoid this problem you can invoke Python with '-m pip' instead of running pip directly. WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip. Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue. To avoid this problem you can invoke Python with '-m pip' instead of running pip directly. WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip. Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue. To avoid this problem you can invoke Python with '-m pip' instead of running pip directly. 20:58:50 Adding 1 miflora devices Traceback (most recent call last): File "./gateway.py", line 83, in manager.start(mqtt) File "/home/pi/bt-mqtt-gateway/workers_manager.py", line 157, in start mqtt.callbacks_subscription(self._mqtt_callbacks) File "/home/pi/bt-mqtt-gateway/mqtt.py", line 112, in callbacks_subscription self.mqttc.connect(self.hostname, port=self.port) File "/home/pi/bt-mqtt-gateway/.venv/lib/python3.7/site-packages/paho/mqtt/client.py", line 937, in connect return self.reconnect() File "/home/pi/bt-mqtt-gateway/.venv/lib/python3.7/site-packages/paho/mqtt/client.py", line 1071, in reconnect sock = self._create_socket_connection() File "/home/pi/bt-mqtt-gateway/.venv/lib/python3.7/site-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 727, in create_connection raise err File "/usr/lib/python3.7/socket.py", line 716, in create_connection sock.connect(sa) ConnectionRefusedError: [Errno 111] Connection refused

zewelor commented 4 years ago

Looks like you cannot connect to specified mqtt server. Double check ip and if its reachable form rpi