Decode some data

From: Peter (BOUGHTONP)26 May 2020 12:00
To: ANT_THOMAS 4 of 10
So the other numbers are definitely all correct?

How does the data actually come in - presumably it's either binary or hex encoded rather than decimals?

Shouldn't the sensor provide documentation of the format? (Or does it expect using its own crappy software?)

From: ANT_THOMAS26 May 2020 12:01
To: Peter (BOUGHTONP) 5 of 10
I have now figured it out, kinda.
So it seems the temps are 3dp and there has been some rounding which put me off the scent a bit.
The encoding is IEEE 754

And goes as follows

0, 0, 108, 65, 60, 16, 0, 0, 97, 0

In binary
65 = 01000001
108 = 01101100

Then put that in a suitable sequence for IEEE 754 with 0 padding at the end
01000001 01101100 00000000 00000000

That converts to 14.75.

Just need to do the binary to IEEE 754 floating point number in bash somehow, or at least called from a bash script now I have the binary numbers in bash.
 
From: ANT_THOMAS26 May 2020 12:06
To: ANT_THOMAS 6 of 10
Also, the leading zeros in the array may be the padding at the end, as some other examples contain "128" at place 2, so I think I need to include them. But that's easy enough.
0, 0, 108, 65
From: ANT_THOMAS26 May 2020 12:08
To: Peter (BOUGHTONP) 7 of 10
Numbers are correct, as I've now manually successfully decoded it.
In terms of documentation, I've made and coded these sensors myself, I just didn't entirely understand how the data was encoded with the library (RadioHead ASK).

Now just need to figure out a command line binary to IEEE 754 floating point number conversion.
From: Peter (BOUGHTONP)26 May 2020 12:21
To: ANT_THOMAS 8 of 10
Bash doesn't do floating point, but I still expected it to be a simple case of calling bc or something, but nothing useful comes up from relevant searches.

Guess you'll have to convert your manual steps to Perl or Python?

From: ANT_THOMAS26 May 2020 12:26
To: Peter (BOUGHTONP) 9 of 10
Yeah, seen similar. Was wanting to use bc. Now looking at some other simple programs, C++, Perl or Python should handle it, then feed it back in.
From: ANT_THOMAS26 May 2020 13:36
To: ALL10 of 10
Done, decoded using some simple python.