Fixed some plugin usages of self._bus.

Now `_bus` is a common property shared by all the plugins, so it
shouldn't be overloaded.
This commit is contained in:
Fabio Manganiello 2023-11-18 16:58:55 +01:00
parent 8817581061
commit 674c1036c5
Signed by untrusted user: blacklight
GPG key ID: D90FBA7F76362774
2 changed files with 3 additions and 12 deletions

View file

@ -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

View file

@ -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.