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
550 stars 117 forks source link

node_id = mac.replace(":", "-") = AttributeError: 'dict' object has no attribute 'replace' #246

Open bob-walpole opened 2 years ago

bob-walpole commented 2 years ago

[] I've read the Troubleshooting Wiki, my problem is not described there and I am already using the specified minimum bluez version.

Describe the bug

When using mithermometer in config.yaml I get this error at startup :_

node_id = mac.replace(":", "-") = AttributeError: 'dict' object has no attribute 'replace'

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior A clear and concise description of what you expected to happen.

Config Used config

Debug gateway logs run gateway.py with -d switch and paste formatted output log

Traceback (most recent call last): File "/home/pi/bt-mqtt-gateway/./gateway.py", line 84, in manager.start() File "/home/pi/bt-mqtt-gateway/workers_manager.py", line 156, in start self._publish_config() File "/home/pi/bt-mqtt-gateway/workers_manager.py", line 210, in _publish_config messages = command.execute() File "/home/pi/bt-mqtt-gateway/workers_manager.py", line 48, in execute messages = self._callback(self._args) File "/home/pi/bt-mqtt-gateway/workers/miflora.py", line 42, in config ret += self.config_device(name, data["mac"]) File "/home/pi/bt-mqtt-gateway/workers/miflora.py", line 48, in config_device "identifiers": [mac, self.format_discovery_id(mac, name)], File "/home/pi/bt-mqtt-gateway/workers/base.py", line 31, in format_discovery_id self.format_discovery_topic(mac, sensor_args) File "/home/pi/bt-mqtt-gateway/workers/base.py", line 25, in format_discovery_topic node_id = mac.replace(":", "-") AttributeError: 'dict' object has no attribute 'replace'

Server (please complete the following information):

5.10.63-v7+ #1488 SMP Thu Nov 18 16:14:44 GMT 2021 armv7l

Additional context Add any other context about the problem here.

bob-walpole commented 2 years ago

I fixed this problem by using a revised device type in config.yaml

lywsd03mmc: