LINT fixes for zwave.mqtt backend

This commit is contained in:
Fabio Manganiello 2022-12-10 16:16:23 +01:00
parent 5a47308516
commit 6a2a3100f8
Signed by untrusted user: blacklight
GPG key ID: D90FBA7F76362774

View file

@ -6,6 +6,7 @@ from typing import Optional, Type
from platypush.backend.mqtt import MqttBackend from platypush.backend.mqtt import MqttBackend
from platypush.context import get_plugin from platypush.context import get_plugin
from platypush.config import Config
from platypush.message.event.zwave import ( from platypush.message.event.zwave import (
ZwaveEvent, ZwaveEvent,
ZwaveNodeAddedEvent, ZwaveNodeAddedEvent,
@ -55,8 +56,9 @@ class ZwaveMqttBackend(MqttBackend):
from platypush.plugins.zwave.mqtt import ZwaveMqttPlugin from platypush.plugins.zwave.mqtt import ZwaveMqttPlugin
self.plugin: ZwaveMqttPlugin = get_plugin('zwave.mqtt') plugin: Optional[ZwaveMqttPlugin] = get_plugin('zwave.mqtt')
assert self.plugin, 'The zwave.mqtt plugin is not configured' assert plugin, 'The zwave.mqtt plugin is not configured'
self.plugin = plugin
self._nodes = {} self._nodes = {}
self._groups = {} self._groups = {}
@ -99,7 +101,9 @@ class ZwaveMqttBackend(MqttBackend):
**kwargs, **kwargs,
) )
if not client_id: 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( def _dispatch_event(
self, self,
@ -218,7 +222,7 @@ class ZwaveMqttBackend(MqttBackend):
def run(self): def run(self):
super().run() super().run()
self.logger.debug('Refreshing Z-Wave nodes') 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(): while not self.should_stop():
try: try: