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
548 stars 116 forks source link

Config BLE devices only #152

Closed lhusoey closed 4 years ago

lhusoey commented 4 years ago

Hi,

I have managed to install this bt-mqtt-gateway on my rpi3, and I only want gateway to scan for BLE devices. How to setup config for this?

i have this setup now in config : mqtt: host: 192.168.10.102 port: 1883 username: user password: password

ca_cert: /etc/ssl/certs/ca-certificates.crt # Uncomment to enable MQTT TLS, update path to appropriate location.

ca_verify: False # Verify TLS certificate chain and host, disable for testing with self-signed certificates, default to True

topic_prefix: hostname # All messages will have that prefix added, remove if you dont need this. client_id: bt-mqtt-gateway availability_topic: lwt_topic

manager: sensor_config: topic: homeassistant retain: true topic_subscription: update_all: topic: homeassistant/status payload: online command_timeout: 35 # Timeout for worker operations. Can be removed if the default of 35 seconds is sufficient. workers:

blescanmulti:
  args:
    devices:
      beacon_x5: DC:0D:30:00:01:21
      beacon_i3: DC:0D:30:00:01:27
    topic_prefix: blescan
    available_payload: home
    unavailable_payload: not_home
    available_timeout: 0
    unavailable_timeout: 60
    scan_timeout: 10
    scan_passive: true
  update_interval: 60

And when starting gateway i get this sudo ./gateway.py 21:43:15 Starting 21:43:17 Adding 2 blescanmulti 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 "/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 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