mqtt sensor fix

- mqtt sensor is now also working after changing the configuration
- config.yaml accepts now also 'true' besides 'True' to activate mqtt
This commit is contained in:
avollkopf 2021-11-23 17:33:58 +01:00
parent 71897c8276
commit 3724f76faa
5 changed files with 6 additions and 8 deletions

View file

@ -1 +1 @@
__version__ = "4.0.0.50"
__version__ = "4.0.0.51"

View file

@ -81,11 +81,9 @@ class SatelliteController:
await self.client.subscribe(topic)
async for message in messages:
await method(message.payload.decode())
except asyncio.CancelledError as e:
except asyncio.CancelledError:
# Cancel
self.logger.warning(
"Sub CancelledError Exception: {}".format(e))
return
self.logger.warning("Sub Cancelled")
except MqttError as e:
self.logger.error("Sub MQTT Exception: {}".format(e))
except Exception as e:

View file

@ -113,7 +113,7 @@ class CraftBeerPi:
self.upload : UploadController = UploadController(self)
self.notification : NotificationController = NotificationController(self)
self.satellite = None
if self.static_config.get("mqtt", False) is True:
if str(self.static_config.get("mqtt", False)).lower() == "true":
self.satellite: SatelliteController = SatelliteController(self)
self.dashboard = DashboardController(self)

View file

@ -65,5 +65,5 @@ def setup(cbpi):
:param cbpi: the cbpi core
:return:
'''
if cbpi.static_config.get("mqtt", False) is True:
if str(cbpi.static_config.get("mqtt", False)).lower() == "true":
cbpi.plugin.register("MQTTActor", MQTTActor)

View file

@ -58,5 +58,5 @@ def setup(cbpi):
:param cbpi: the cbpi core
:return:
'''
if cbpi.static_config.get("mqtt", False) is True:
if str(cbpi.static_config.get("mqtt", False)).lower() == "true":
cbpi.plugin.register("MQTTSensor", MQTTSensor)