Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
f8f9449c99
|
|||
ab35b815fb
|
@ -63,7 +63,7 @@ class DbOp(object):
|
||||
'unit': res[2]
|
||||
}
|
||||
logger.debug(f"{variable=}")
|
||||
return application
|
||||
return variable
|
||||
except Exception as e:
|
||||
logger.error(f"Error getting variable: {e}")
|
||||
raise VariableNotFoundException(appId, converterId, deviceId, variableId)
|
||||
@ -104,10 +104,10 @@ def splitTopic(topic):
|
||||
deviceId = 'mains',
|
||||
variableId = r[0]
|
||||
elif (len(r) == 2):
|
||||
(deviceId, variableid) = r
|
||||
(deviceId, variableId) = r
|
||||
else:
|
||||
raise InvalidTopicException(topic)
|
||||
return (appId, converterId, deviceId, variableid)
|
||||
return (appId, converterId, deviceId, variableId)
|
||||
|
||||
def mqttOnConnectCallback(client, userdata, flags, rc):
|
||||
logger.info("mqtt connected")
|
||||
@ -124,7 +124,7 @@ def mqttOnMessageCallback(client, userdata, message):
|
||||
(appId, converterId, deviceId, variableId) = splitTopic(topic)
|
||||
|
||||
dbh = DbOp(config)
|
||||
variable = dbh.getVariable(appId, converterId, deviceId, variableid)
|
||||
variable = dbh.getVariable(appId, converterId, deviceId, variableId)
|
||||
measurement = {
|
||||
"application": variable["application"],
|
||||
"variable": variable["variable"],
|
||||
|
Reference in New Issue
Block a user