From 674c1036c512ab8893245b794e78556dd4d42e45 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sat, 18 Nov 2023 16:58:55 +0100 Subject: [PATCH] Fixed some plugin usages of `self._bus`. Now `_bus` is a common property shared by all the plugins, so it shouldn't be overloaded. --- platypush/plugins/sensor/bme280/__init__.py | 6 +++--- platypush/plugins/zigbee/mqtt/__init__.py | 9 --------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/platypush/plugins/sensor/bme280/__init__.py b/platypush/plugins/sensor/bme280/__init__.py index f33c97184..4d0ea55ae 100644 --- a/platypush/plugins/sensor/bme280/__init__.py +++ b/platypush/plugins/sensor/bme280/__init__.py @@ -72,7 +72,7 @@ class SensorBme280Plugin(SensorPlugin): super().__init__(**kwargs) self.port = port - self._bus = None + self._smbus = None self._device = None def _get_device(self): @@ -82,8 +82,8 @@ class SensorBme280Plugin(SensorPlugin): if self._device: return self._device - self._bus = SMBus(self.port) - self._device = BME280(i2c_dev=self._bus) + self._smbus = SMBus(self.port) + self._device = BME280(i2c_dev=self._smbus) return self._device @action diff --git a/platypush/plugins/zigbee/mqtt/__init__.py b/platypush/plugins/zigbee/mqtt/__init__.py index e469f5736..73aa88429 100644 --- a/platypush/plugins/zigbee/mqtt/__init__.py +++ b/platypush/plugins/zigbee/mqtt/__init__.py @@ -18,8 +18,6 @@ from typing import ( import paho.mqtt.client as mqtt -from platypush.bus import Bus -from platypush.context import get_bus from platypush.entities import ( DimmerEntityManager, Entity, @@ -2163,13 +2161,6 @@ class ZigbeeMqttPlugin( return handler - @property - def _bus(self) -> Bus: - """ - Utility property for the bus. - """ - return get_bus() - def _process_state_message(self, client: MqttClient, msg: str): """ Process a state message.