Skip to content

[4.0+] Fix EM320-TH decoder to handle negative temperatures#283

Merged
ViacheslavKlimov merged 6 commits intoqa/release/4.0.0from
fix/em320-th-4.0
Feb 6, 2026
Merged

[4.0+] Fix EM320-TH decoder to handle negative temperatures#283
ViacheslavKlimov merged 6 commits intoqa/release/4.0.0from
fix/em320-th-4.0

Conversation

@ViacheslavKlimov
Copy link
Member

#282

The decoder was not correctly handling temperatures below 0°C because it used unsigned integer parsing instead of handling signed values with two's complement representation.

Changes:

  • Added parseTemperature() function to properly handle signed 16-bit values
  • Updated current temperature parsing to use new function
  • Fixed historical temperature data parsing (also corrected byte offset bug)
  • Added test cases with -5.2°C to verify negative temperature handling

Applies to all network server implementations:

  • ChirpStack
  • HTTP
  • LORIOT
  • ThingsStackCommunity
  • ThingsStackIndustries

ViacheslavKlimov and others added 6 commits February 6, 2026 13:18
The decoder was not correctly handling temperatures below 0°C because
it used unsigned integer parsing instead of handling signed values with
two's complement representation.

Changes:
- Added parseTemperature() function to properly handle signed 16-bit values
- Updated current temperature parsing to use new function
- Fixed historical temperature data parsing (also corrected byte offset bug)
- Added test cases with -5.2°C to verify negative temperature handling

Applies to all network server implementations:
- ChirpStack
- HTTP
- LORIOT
- ThingsStackCommunity
- ThingsStackIndustries

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Enhanced the validation error message to display both expected and actual
output when converter validation fails. This makes debugging converter
issues much easier by showing exactly what the difference is.

Changes:
- Added JSON-formatted output of expected result
- Added JSON-formatted output of actual result
- Both outputs are pretty-printed with 2-space indentation

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Fixed two issues with the EM320-TH negative temperature tests:

1. Corrected timestamps in result_01.json files
   - Timestamps were calculated incorrectly (off by 3000 seconds)
   - Updated all 5 result files with correct timestamps

2. Fixed validator to properly parse and display JSON output
   - Parse JSON output before comparison and display
   - This fixes the issue where actual output was shown as a quoted string

Changes:
- Updated timestamps in all result_01.json files (ChirpStack, HTTP, LORIOT,
  ThingsStackCommunity, ThingsStackIndustries)
- Modified validator to parse output once and reuse for comparison and display

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
The LORIOT format includes timestamp directly in the payload.
Corrected from 1703329530547 to 1703326530547.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@ViacheslavKlimov ViacheslavKlimov merged commit e267cdd into qa/release/4.0.0 Feb 6, 2026
1 check passed
@ViacheslavKlimov ViacheslavKlimov deleted the fix/em320-th-4.0 branch February 6, 2026 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant