Closed eggfriedrice closed 1 year ago
Hi @eggfriedrice can you send an example of the error, I just test the decoder file and I don't get errors, but as you have the device will be easier to see this:
bytes: [0x07 0x71 0x0D 0x01 0xAC 0xDD 0x01 0x05]
{ "acceleration.xaxis": 3.329, "acceleration.yaxis": -21.283, "acceleration.zaxis": 0.261 }
decoded_data['acceleration.xaxis'] ..
is coded correct, it is not necessary to change it to decoded_data.acceleration.(x,y,z)axis ..
Hi @Jaime-Trinidad, thanks for following up
Hi @eggfriedrice can you send an example of the error, I just test the decoder file and I don't get errors, but as you have the device will be easier to see this:
I don't have one in front of me right now, but...
decoded_data['acceleration.xaxis'] ..
is coded correct, it is not necessary to change it todecoded_data.acceleration.(x,y,z)axis ..
Kinda, the code actually uses both the decoded
and decoded_data
variables, but only decoded_data
is returned at the end. I don't think decoded
is ever even defined.
Cheers, Al
I made a complete review of the file and there is no decoded
variable used in it, only decoded_data
, I will close the issue, please feel free to reopen it if needed.
Hi @Jaime-Trinidad
Are we looking at the same file? Check /vendor/tektelic/decoder_smart_room_sensor.js and look at line 122
Cheers, Al
Hi @Jaime-Trinidad
Are we looking at the same file? Check /vendor/tektelic/decoder_smart_room_sensor.js and look at line 122
Cheers, Al
Hi yes, I checked /vendor/tektelic/decoder_smart_room_sensor.js it contain only decoded_data
in the three axes as variable, also in the complete file, from line 120 to 126:
key: [0x07, 0x71],
fn: function (arg) {
decoded_data['acceleration.xaxis'] = decode_field(arg, 0, 15, "signed") * 0.001;
decoded_data['acceleration.yaxis'] = decode_field(arg, 16, 31, "signed") * 0.001;
decoded_data['acceleration.zaxis'] = decode_field(arg, 32, 47, "signed") * 0.001;
return 6;
}
This is what is in the repository and server, I made other test in the console and don't have errors, let me know.
@Jaime-Trinidad any update here?
I will close the issue, decoder and encoder files were already modified by tektelic, it is almost a 3,000-line decoder file, I run some tests, and does not present issues. feel free to reopen it.
Summary
There seems to be an error in vendor/tektelic/decoder_smart_room_sensor.js where an undeclared variable
decoded
is used instead of thedecoded_data
variable.What do you see now?
Decoding certain payloads that include, for example those that include accelerometer data, cause a ReferenceError error to be thrown and the decode fails.
What do you want to see instead?
Successfully decoded payloads
How do you propose to implement this?
I think any line starting like this:
decoded['acceleration.xaxis']
should be changed todecoded_data.acceleration.xaxis
Can you do this yourself and submit a Pull Request?
I could do a simple find and replace on this if needed, but it would be nice if @akashpanchal92 or @taraskuzyk had a quick look!