diff --git a/src/modules/WattecoDecoderModule/main.py b/src/modules/WattecoDecoderModule/main.py index 9974857..fe41d19 100644 --- a/src/modules/WattecoDecoderModule/main.py +++ b/src/modules/WattecoDecoderModule/main.py @@ -314,15 +314,15 @@ def VAQAODecoder(devEUI: str, payload: str, fport: int): def VAQAOPlusDecoder(devEUI: str, payload: str, fport: int): result = 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) - if 'CommandID' in result and result['CommandID'] == 'ReportAttributesAlarm'and result['AttributeID'] == 'MeasuredValue': + if 'CommandID' in result and (result['CommandID'] == 'ReportAttributes' or result['CommandID'] == 'ReportAttributesAlarm'): result = { result['ClusterID']: result['Data'] } - + if 'Temperature' in result: result['Temperature'] = result['Temperature'] / 100 if 'RelativeHumidity' in result: result['RelativeHumidity'] = result['RelativeHumidity'] / 100 - return result \ No newline at end of file + return result diff --git a/src/modules/WattecoDecoderModule/test_main.py b/src/modules/WattecoDecoderModule/test_main.py index 1788ead..cb29f76 100644 --- a/src/modules/WattecoDecoderModule/test_main.py +++ b/src/modules/WattecoDecoderModule/test_main.py @@ -22,6 +22,19 @@ def test_vaqaoplus(): assert json == {"Occupancy":1,"Temperature":19.7,"RelativeHumidity":54.0,"CO2":690.0,"COV":50.0,"LUX":10,"Pressure":9790} + response = client.get("/api/vaqaoplus?payload=EQoAUAAGQQUBBAwWBJg=&devEUI=70B3D5E75E009F8F&fport=125") + assert response.status_code == 200 + json = response.json() + + assert json == { + 'Configuration': { + "CurrentPowerMode": "PeriodicallyON", + "AvailablePowerSourceBitField": 4, + "DisposableBatteryVoltage": 3094, + "CurrentPowerSource": "DisposableBattery" + } + } + def test_vaqao(): response = client.get("/api/vaqao?payload=QjOAgKhPAR2g6ADckf2BU2j3QgYOUWgv%2BmYm%2BtaSFn1rSYu%2BmESxRVEUFXFoniAUmxk%3D&devEUI=70B3D5E75E009F8F&fport=125") assert response.status_code == 200