diff --git a/TheengsGateway/__init__.py b/TheengsGateway/__init__.py index e358b0c0..2474c012 100644 --- a/TheengsGateway/__init__.py +++ b/TheengsGateway/__init__.py @@ -38,7 +38,7 @@ "presence_topic": "home/TheengsGateway/presence", "presence": 0, "publish_all": 1, - "log_level": "WARNING", + "log_level": "INFO", "discovery": 1, "hass_discovery": 1, "discovery_topic": "homeassistant/sensor", diff --git a/TheengsGateway/ble_gateway.py b/TheengsGateway/ble_gateway.py index c5860499..ee0c7802 100644 --- a/TheengsGateway/ble_gateway.py +++ b/TheengsGateway/ble_gateway.py @@ -76,6 +76,7 @@ def __init__( self.scanning_mode = scanning_mode self.stopped = False self.clock_updates: Dict[str, float] = {} + self.published_messages = 0 def connect_mqtt(self) -> None: """Connect to MQTT broker.""" @@ -190,7 +191,8 @@ def publish( result = self.client.publish(pub_topic, msg, 0, retain) status = result[0] if status == 0: - logger.info("Sent `%s` to topic `%s`", msg, pub_topic) + logger.debug("Sent `%s` to topic `%s`", msg, pub_topic) + self.published_messages = self.published_messages + 1 else: logger.error("Failed to send message to topic %s", pub_topic) @@ -229,7 +231,7 @@ async def update_clock_times(self) -> None: await clock.set_time(ampm=self.time_format) logger.info("Synchronized time") else: - logger.info(f"Didn't find device {address}.") + logger.warning(f"Didn't find device {address}.") except UnsupportedDeviceError: logger.exception("Unsupported clock") # There's no point in retrying for an unsupported device. @@ -290,9 +292,13 @@ async def ble_scan_loop(self) -> None: while not self.stopped: try: if self.client.is_connected(): + self.published_messages = 0 await scanner.start() await asyncio.sleep(self.scan_time) await scanner.stop() + logger.info( + "Sent %s messages to MQTT", self.published_messages + ) await asyncio.sleep(self.time_between_scans) # Update time for all clocks once a day diff --git a/docs/use/use.md b/docs/use/use.md index 47867f0c..e1b88882 100644 --- a/docs/use/use.md +++ b/docs/use/use.md @@ -115,7 +115,7 @@ docker run --rm \ -e PUBLISH_ALL=true \ -e TIME_BETWEEN=60 \ -e SCAN_TIME=60 \ - -e LOG_LEVEL=DEBUG \ + -e LOG_LEVEL=INFO \ -e HAAS_DISCOVERY=true \ -e DISCOVERY=true \ -e DISCOVERY_TOPIC=homeassistant/sensor \