From 6a2a3100f8a73184b7bb493fa2577d4a64f4c209 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sat, 10 Dec 2022 16:16:23 +0100 Subject: [PATCH] LINT fixes for `zwave.mqtt` backend --- platypush/backend/zwave/mqtt/__init__.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/platypush/backend/zwave/mqtt/__init__.py b/platypush/backend/zwave/mqtt/__init__.py index fd7ca8c4e3..a30b2fe71e 100644 --- a/platypush/backend/zwave/mqtt/__init__.py +++ b/platypush/backend/zwave/mqtt/__init__.py @@ -6,6 +6,7 @@ from typing import Optional, Type from platypush.backend.mqtt import MqttBackend from platypush.context import get_plugin +from platypush.config import Config from platypush.message.event.zwave import ( ZwaveEvent, ZwaveNodeAddedEvent, @@ -55,8 +56,9 @@ class ZwaveMqttBackend(MqttBackend): from platypush.plugins.zwave.mqtt import ZwaveMqttPlugin - self.plugin: ZwaveMqttPlugin = get_plugin('zwave.mqtt') - assert self.plugin, 'The zwave.mqtt plugin is not configured' + plugin: Optional[ZwaveMqttPlugin] = get_plugin('zwave.mqtt') + assert plugin, 'The zwave.mqtt plugin is not configured' + self.plugin = plugin self._nodes = {} self._groups = {} @@ -99,7 +101,9 @@ class ZwaveMqttBackend(MqttBackend): **kwargs, ) if not client_id: - self.client_id += '-zwavejs-mqtt' + self.client_id = ( + str(self.client_id or Config.get('device_id')) + '-zwavejs-mqtt' + ) def _dispatch_event( self, @@ -218,7 +222,7 @@ class ZwaveMqttBackend(MqttBackend): def run(self): super().run() self.logger.debug('Refreshing Z-Wave nodes') - self._nodes = self.plugin.get_nodes().output + self._nodes = self.plugin.get_nodes().output # type: ignore while not self.should_stop(): try: