fix decoding
This commit is contained in:
parent
5427e3f277
commit
5075af27d1
@ -107,15 +107,13 @@ def mqttOnMessageCallback(client, userdata, message):
|
|||||||
match application['sensor_type']:
|
match application['sensor_type']:
|
||||||
case 'LSE01':
|
case 'LSE01':
|
||||||
battery = struct.unpack('>H', frame[0:2])[0]
|
battery = struct.unpack('>H', frame[0:2])[0]
|
||||||
moisture = struct.unpack('>H', frame[2:4])[0]
|
moisture = struct.unpack('>H', frame[4:6])[0]
|
||||||
temperature = struct.unpack('>H', frame[4:6])[0]
|
temperature = struct.unpack('>H', frame[6:8])[0]
|
||||||
conductivity = struct.unpack('>H', frame[6:8])[0]
|
conductivity = struct.unpack('>H', frame[8:10])[0]
|
||||||
status = struct.unpack('?', frame[8:9])[0]
|
status = struct.unpack('?', frame[10:11])[0]
|
||||||
logger.debug(f"{frame=}, {battery=}, {moisture=}, {temperature=}, {conductivity=}, {status=}")
|
logger.debug(f"{frame=}, {battery=}, {moisture=}, {temperature=}, {conductivity=}, {status=}")
|
||||||
|
|
||||||
statusText = 'Ok'
|
statusText = 'Ok'
|
||||||
if not status:
|
|
||||||
statusText = 'No sensor'
|
|
||||||
|
|
||||||
measurement = {
|
measurement = {
|
||||||
'application_name': application['label'],
|
'application_name': application['label'],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user