Skip to content

Commit

Permalink
Merge pull request #7 from kbeaugrand-org/dev-1.0
Browse files Browse the repository at this point in the history
Update Temparature value
  • Loading branch information
kbeaugrand authored Sep 22, 2021
2 parents 6938a0d + 7e54925 commit 4654367
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions src/modules/WattecoDecoderModule/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,14 @@ def parseFor(tagz: int, commands, payload: str):
result["timestamp"] = batch["batch_absolute_timestamp"]

for x in batch["dataset"]:
result[x["data"]["label_name"]] = x["data"]["value"]

value = x["data"]["value"]
label = x["data"]["label_name"]

if (label == "Temperature"):
value = value / 100

result[label] = value

return result
else:
return parseUnitaryFrame(payload)
Expand Down Expand Up @@ -85,14 +91,6 @@ def THDecoder(devEUI: str, payload: str, fport: int):
def FlashoDecoder(devEUI: str, payload: str, fport: int):
return parseFor(1, ['0,1,10,Index', '1,100,6,BatteryLevel'], payload)

@app.get("/api/vaquaoplus")
def VAQAOPlusDecoder(devEUI: str, payload: str, fport: int):
result = parseFor(3, ['0,1,4,OCC', '1,10,7,T', '2,100,6,H', '3,10,6,CO2', '4,10,6,COV', '5,10,6,LUX', '6,10,6,P'], payload)

result['T'] = result['T'] / 100

return result

@app.get("/api/t")
def TDecoder(devEUI: str, payload: str, fport: int):
return parseFor(2, ['0,10,7,Temperature', '2,1,6,BatteryLevel', '3,1,1,OpenCase'], payload)
Expand All @@ -119,8 +117,8 @@ def RemoteTemperature2CTNDecoder(devEUI: str, payload: str, fport: int):

@app.get("/api/vaquao")
def VAQAODecoder(devEUI: str, payload: str, fport: int):
result = parseFor(3, ['1,10,7,T' ,'2,100,6,H', '3,10,6,CO2', '4,10,6,COV'], payload)

result['T'] = result['T'] / 100
return parseFor(3, ['1,10,7,Temperature' ,'2,100,6,RelativeHumidity', '3,10,6,CO2', '4,10,6,COV'], payload)

return result
@app.get("/api/vaquaoplus")
def VAQAOPlusDecoder(devEUI: str, payload: str, fport: int):
return parseFor(3, ['0,1,4,Occupancy', '1,10,7,Temperature', '2,100,6,RelativeHumidity', '3,10,6,CO2', '4,10,6,COV', '5,10,6,LUX', '6,10,6,Pressure'], payload)

0 comments on commit 4654367

Please sign in to comment.