09-10-2019 01:50 PM - edited 09-10-2019 01:57 PM
You have to use the entire cluster as defined. If you look at the actual cluster definition you will see that the various 0s in the cluster are either represented as unsigned 8-bit values or signed/unsigned 16-bit values. The size corresponds to the protocol definition. So the temperature values are U16 integers. Wind speed and humidity would be U8 integers.
Also, change your read to only read the amount of data necessary for one set of data. This would be 16 bytes. The ACK plus the remaining 15 bytes which make up the actual sensor data. Unless of course the data is actually terminated by the 0x0A (carriage return) and you have not posted the full message definition.
09-10-2019 02:02 PM
@Mark_Yedinak wrote:
Unless of course the data is actually terminated by the 0x0A (carriage return) and you have not posted the full message definition.
Considering we are using binary/hex/raw data, that would be a horrible protocol (in theory, 10/0xA is a valid data point to have).
09-10-2019 02:04 PM - edited 09-10-2019 02:06 PM
@crossrulz wrote:
@Mark_Yedinak wrote:
Unless of course the data is actually terminated by the 0x0A (carriage return) and you have not posted the full message definition.
Considering we are using binary/hex/raw data, that would be a horrible protocol (in theory, 10/0xA is a valid data point to have).
I agree. But since we are given the information in bits and drabs, who knows what the protocol actually is. Plus, the code is using a termination character to terminate the reads. Given that the OP mentioned other sensor values (precipitation), I still don't think we have the complete definition.
09-10-2019 02:05 PM - edited 09-10-2019 02:06 PM
@feelsomoon wrote:Sorry if I misunderstand, are you just put constant number 0 in the cluster? How does it know what size is each parameter? I did the same for the part just Outside Temperature, it didn't work. Do you know what's the problem?
As stated, you need to define the entire packet cluster. I set the representation according to the number of bytes for that parameter and made sure the order was correct.
09-10-2019 02:23 PM
Thank you crossrulz! I just cut the 2 bytes for Outside Temperature. Is it enough I only define them with one constant 0 with the representation of U16? I think I did so but the result is wrong.
09-10-2019 02:26 PM
Why not decode all of the data as shown above? As the applications expands you may want access to the other data points. You read the data, simply decode it using a complete cluster and then use what pieces you need. Much simpler to work with the actual protocol as defined than to pick it apart piece meal.
09-10-2019 02:29 PM
@feelsomoon wrote:
I just cut the 2 bytes for Outside Temperature. Is it enough I only define them with one constant 0 with the representation of U16? I think I did so but the result is wrong.
If you actually get the right 2 bytes, it will work. Post your code, preferably with the data string having a representative default data, and we can have a look.
@feelsomoon wrote:
Thank you crossrulz!
Words are meaningless. I have yet to see a "thank you" from you (ie kudos and marked solutions).
09-10-2019 05:59 PM
@Mark_Yedinak wrote:
Why not decode all of the data as shown above? As the applications expands you may want access to the other data points. You read the data, simply decode it using a complete cluster and then use what pieces you need. Much simpler to work with the actual protocol as defined than to pick it apart piece meal.
Yes, it is. But the total length is 99 bytes. The snipped part is only a part of the total protocol. Anyway, I need to pick.
09-10-2019 06:15 PM
@crossrulz wrote:
@feelsomoon wrote:
I just cut the 2 bytes for Outside Temperature. Is it enough I only define them with one constant 0 with the representation of U16? I think I did so but the result is wrong.
If you actually get the right 2 bytes, it will work. Post your code, preferably with the data string having a representative default data, and we can have a look.
@feelsomoon wrote:
Thank you crossrulz!
Words are meaningless. I have yet to see a "thank you" from you (ie kudos and marked solutions).
Sorry I can't mark solution cause I still didn't the right result. I'm using another byte string.
064C 4F4F C400 C108 EE73 F902 3197 03FF FFFF 7FFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF 21FF FFFF FFFF FFFF 0000 34AC 0300 00FF FF00 0000 0003 0000 0000 0010 00FF FFFF FFFF FFFF 0000 0000 0000 0000 0000 0000 0000 0000 0000 3F03 06AA 7502 7107 0
As you suggested. 0xF902319703 should be Inside Temperature, Relative Humidity, Outside Temperature, in which 9703 is Outside Temperature, equals 91.9. I put an indicator after I cut it. This part should be fine. I set the little-endian and type as U16. I'm really confused what's wrong with it.
09-11-2019 01:30 AM
Hi feel,
you should ALWAYS show the display mode indicator with string constants. Expecially when you use data in hex display mode!
When you want the two bytes "97 03" from your (hex formatted) string you should get a substring starting at index 13 with a length of 2: