forked from platypush/platypush
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:
parent
8817581061
commit
674c1036c5
2 changed files with 3 additions and 12 deletions
|
@ -72,7 +72,7 @@ class SensorBme280Plugin(SensorPlugin):
|
||||||
|
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
self.port = port
|
self.port = port
|
||||||
self._bus = None
|
self._smbus = None
|
||||||
self._device = None
|
self._device = None
|
||||||
|
|
||||||
def _get_device(self):
|
def _get_device(self):
|
||||||
|
@ -82,8 +82,8 @@ class SensorBme280Plugin(SensorPlugin):
|
||||||
if self._device:
|
if self._device:
|
||||||
return self._device
|
return self._device
|
||||||
|
|
||||||
self._bus = SMBus(self.port)
|
self._smbus = SMBus(self.port)
|
||||||
self._device = BME280(i2c_dev=self._bus)
|
self._device = BME280(i2c_dev=self._smbus)
|
||||||
return self._device
|
return self._device
|
||||||
|
|
||||||
@action
|
@action
|
||||||
|
|
|
@ -18,8 +18,6 @@ from typing import (
|
||||||
|
|
||||||
import paho.mqtt.client as mqtt
|
import paho.mqtt.client as mqtt
|
||||||
|
|
||||||
from platypush.bus import Bus
|
|
||||||
from platypush.context import get_bus
|
|
||||||
from platypush.entities import (
|
from platypush.entities import (
|
||||||
DimmerEntityManager,
|
DimmerEntityManager,
|
||||||
Entity,
|
Entity,
|
||||||
|
@ -2163,13 +2161,6 @@ class ZigbeeMqttPlugin(
|
||||||
|
|
||||||
return handler
|
return handler
|
||||||
|
|
||||||
@property
|
|
||||||
def _bus(self) -> Bus:
|
|
||||||
"""
|
|
||||||
Utility property for the bus.
|
|
||||||
"""
|
|
||||||
return get_bus()
|
|
||||||
|
|
||||||
def _process_state_message(self, client: MqttClient, msg: str):
|
def _process_state_message(self, client: MqttClient, msg: str):
|
||||||
"""
|
"""
|
||||||
Process a state message.
|
Process a state message.
|
||||||
|
|
Loading…
Reference in a new issue