Skip to content

DS18B20 plugin prevents startup

If the crc module is not installed, mqtt4hass can't start, even if the DS18B20 plugin isn't used.

rtl@RTLSDR-Weather-MQTT-Bridge:~/mqtt4hass$ ./mqtt4hass.py
Traceback (most recent call last):
  File "/home/rtl/mqtt4hass/./mqtt4hass.py", line 458, in <module>
    sys.exit(main())
  File "/home/rtl/mqtt4hass/./mqtt4hass.py", line 433, in main
    ctrl = Controller()
  File "/home/rtl/mqtt4hass/./mqtt4hass.py", line 182, in __init__
    self.avialable_plugins = self.__discover_plugins()
  File "/home/rtl/mqtt4hass/./mqtt4hass.py", line 172, in __discover_plugins
    return {
  File "/home/rtl/mqtt4hass/./mqtt4hass.py", line 173, in <dictcomp>
    name: importlib.import_module(name)
  File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 790, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/home/rtl/mqtt4hass/plugins/ds18b20/__init__.py", line 3, in <module>
    from crc import CrcCalculator, Crc8  # type: ignore
ModuleNotFoundError: No module named 'crc'

Either the crc module should be a global requirement (not ideal), or the import should be moved so it doesn't happen during plugin scan at startup.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information