diff --git a/knx/__init__.py b/knx/__init__.py index 1cdf3a172..5eb53667c 100755 --- a/knx/__init__.py +++ b/knx/__init__.py @@ -88,7 +88,9 @@ def __init__(self, smarthome): self.date_ga = self.get_parameter_value('date_ga') self._send_time_do = self.get_parameter_value('send_time') self._bm_separatefile = False - self._bm_format = "BM': {1} set {2} to {3}" + self._bm_format = "BM: {1} set {2} to {3}" + self._bm_format_send = "BM: Sending value {3} for GA {2}" + self._bm_format_poll = "BM: Polling value for GA {2}" self._startup_polling = {} # following needed for statistics @@ -110,6 +112,8 @@ def __init__(self, smarthome): elif busmonitor.lower() == 'logger': self._bm_separatefile = True self._bm_format = "{0};{1};{2};{3}" + self._bm_format_send = "{0};{1};{2};{3}" + self._bm_format_poll = "{0};{1};{2}" self._busmonitor = logging.getLogger("knx_busmonitor").info self.logger.info(self.translate("Using busmonitor (L) = '{}'").format(busmonitor)) else: @@ -241,6 +245,8 @@ def _poll(self, **kwargs): item = 'unknown item' if 'ga' in kwargs: self.groupread(kwargs['ga']) + if self._log_own_packets is True and self.alive: + self._busmonitor(self._bm_format_poll.format(self.get_instance_name(), 'POLL', kwargs["ga"])) else: self.logger.warning(self.translate('problem polling {}, no known ga').format(item)) @@ -662,10 +668,6 @@ def parse_item(self, item): randomwait = random.randrange(15) next = self.shtime.now() + timedelta(seconds=poll_interval + randomwait) self._startup_polling.update({item: {'ga': poll_ga, 'interval': poll_interval}}) - ''' - self._sh.scheduler.add(f'KNX poll {item}', self._poll, - value={ITEM: item, 'ga': poll_ga, 'interval': poll_interval}, next=next) - ''' else: self.logger.warning("Ignoring knx_poll for item {}: We need two parameters, one for the GA and one for the polling interval.".format(item)) pass @@ -737,14 +739,14 @@ def update_item(self, item, caller=None, source=None, dest=None): for ga in self.get_iattr_value(item.conf, KNX_SEND): _value = item() if self._log_own_packets is True: - self._busmonitor(self._bm_format.format(self.get_instance_name(), 'SEND', ga, _value)) + self._busmonitor(self._bm_format_send.format(self.get_instance_name(), 'SEND', ga, _value)) self.groupwrite(ga, _value, self.get_iattr_value(item.conf, KNX_DPT)) if self.has_iattr(item.conf, KNX_STATUS): for ga in self.get_iattr_value(item.conf, KNX_STATUS): # send status update if ga != dest: _value = item() if self._log_own_packets is True: - self._busmonitor(self._bm_format.format(self.get_instance_name(), 'STATUS', ga, _value)) + self._busmonitor(self._bm_format_send.format(self.get_instance_name(), 'STATUS', ga, _value)) self.groupwrite(ga, _value, self.get_iattr_value(item.conf, KNX_DPT))