mirror of
https://github.com/PiBrewing/craftbeerpi4.git
synced 2024-11-10 01:17:42 +01:00
Minor change sensor update
Change for sensor plugins. Will update also mqtt per default when push_update is called. But if False is send for mqtt parameter, only web interface will be updated. -> Good for sensors that retrieve values only once per minute or so -> WI can be continuosly updated with current value and no empty value is displayed, but mqtt does not nee to be updated (example ispindel, scd30 sensor, kettle sensor, Hydrom/Tilt,....) Plugins will be updated later in main branches
This commit is contained in:
parent
20e6aa7e59
commit
be1f066782
2 changed files with 4 additions and 3 deletions
|
@ -1,2 +1,2 @@
|
||||||
__version__ = "4.0.1.1"
|
__version__ = "4.0.1.2d1"
|
||||||
|
|
||||||
|
|
|
@ -32,9 +32,10 @@ class CBPiSensor(CBPiBase, metaclass=ABCMeta):
|
||||||
def get_unit(self):
|
def get_unit(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def push_update(self, value):
|
def push_update(self, value, mqtt = True):
|
||||||
try:
|
try:
|
||||||
self.cbpi.ws.send(dict(topic="sensorstate", id=self.id, value=value))
|
self.cbpi.ws.send(dict(topic="sensorstate", id=self.id, value=value))
|
||||||
|
if mqtt:
|
||||||
self.cbpi.push_update("cbpi/sensordata/{}".format(self.id), dict(id=self.id, value=value), retain=True)
|
self.cbpi.push_update("cbpi/sensordata/{}".format(self.id), dict(id=self.id, value=value), retain=True)
|
||||||
# self.cbpi.push_update("cbpi/sensor/{}/udpate".format(self.id), dict(id=self.id, value=value), retain=True)
|
# self.cbpi.push_update("cbpi/sensor/{}/udpate".format(self.id), dict(id=self.id, value=value), retain=True)
|
||||||
except:
|
except:
|
||||||
|
|
Loading…
Reference in a new issue