Skip to content

Add Senzemo vendor with 9 Senstick devices - #40

Merged
brocaar merged 11 commits into
chirpstack:masterfrom
aljaz77:feat/senzemo-device-profiles
Sep 15, 2026
Merged

brocaar merged 11 commits into
chirpstack:masterfrom
aljaz77:feat/senzemo-device-profiles

Conversation

@aljaz77

@aljaz77 aljaz77 commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds the Senzemo Senstick SAM20 connector and fixes payload decoding for all Senstick connectors under decoders/connector/senzemo/, so they now decode on every network listed in their payload-config.jsonc (previously the fPort/FPort port names, base64 data/dataFrame and TTN's frm_payload were missed). It also keeps description.md short, with the longer text in install_text, and addresses the Copilot review comments.

Test plan

  • pnpm run check (or pnpm run linter + pnpm test)
  • pnpm test
  • pnpm start validator
  • Unit tests added or updated for the decoder
  • Non-decoding payload test ("shall not pass") where the decoder must ignore out-of-scope payloads
  • pnpm start generate (maintainers only, when cutting a release)

New or updated decoder

  • Folder under decoders/network/ or decoders/connector/ follows README layout
  • network.jsonc or connector.jsonc validates against schema/
  • Version folders use SemVer; per-version manifest.jsonc present
  • Decoder source is TypeScript with unit tests
  • description, install_text, and device_annotation are objective (no subjective marketing, no off-platform links)

Review context

  • Type: new connector (SAM20) + fix existing Senstick connectors
  • Decoder path: decoders/connector/senzemo/
  • Hardware or protocol documentation: https://senzemo.com/documents/
  • Example test payload: 09331a3f26b3062f on fPort 2 for SAM20; see payload.test.ts in each device's v1.0.0/ folder

Copilot AI lite review requested due to automatic review settings September 14, 2026 12:51

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved codec defects remain in smc33.js and kou20.js, including a runtime-blocking configuration decode issue.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds Senzemo as a vendor with nine Senstick/Senspuck devices, regional profiles, codecs, and test fixtures.

Changes:

  • Registers the vendor and device metadata.
  • Adds EU868, US915, AU915, and AS923 profiles.
  • Adds nine codecs with encode/decode fixtures.
File summaries
File Reviewed changes
vendors/senzemo/vendor.toml Registers Senzemo and its devices.
vendors/senzemo/profiles/US915-1_0_3.toml Adds the US915 profile.
vendors/senzemo/profiles/EU868-1_0_3.toml Adds the EU868 profile.
vendors/senzemo/profiles/AU915-1_0_3.toml Adds the AU915 profile.
vendors/senzemo/profiles/AS923-1_0_3.toml Adds the AS923 profile.
vendors/senzemo/devices/sto10.toml Defines the STO10 device.
vendors/senzemo/devices/stb10.toml Defines the STB10 device.
vendors/senzemo/devices/ssm40.toml Defines the SSM40 device.
vendors/senzemo/devices/spu30.toml Defines the SPU30 device.
vendors/senzemo/devices/smc40.toml Defines the SMC40 device.
vendors/senzemo/devices/smc33.toml Defines the SMC33 device.
vendors/senzemo/devices/smc30.toml Defines the SMC30 device.
vendors/senzemo/devices/sam20.toml Defines the SAM20 device.
vendors/senzemo/devices/kou20.toml Defines the KOU20 device.
vendors/senzemo/codecs/test_encode_sto10.json Adds STO10 encode fixtures.
vendors/senzemo/codecs/test_encode_stb10.json Adds STB10 encode fixtures.
vendors/senzemo/codecs/test_encode_ssm40.json Adds SSM40 encode fixtures.
vendors/senzemo/codecs/test_encode_spu30.json Adds SPU30 encode fixtures.
vendors/senzemo/codecs/test_encode_smc40.json Adds SMC40 encode fixtures.
vendors/senzemo/codecs/test_encode_smc33.json Adds SMC33 encode fixtures.
vendors/senzemo/codecs/test_encode_smc30.json Adds SMC30 encode fixtures.
vendors/senzemo/codecs/test_encode_sam20.json Adds SAM20 encode fixtures.
vendors/senzemo/codecs/test_encode_kou20.json Adds KOU20 encode fixtures.
vendors/senzemo/codecs/test_decode_sto10.json Adds STO10 decode fixtures.
vendors/senzemo/codecs/test_decode_stb10.json Adds STB10 decode fixtures.
vendors/senzemo/codecs/test_decode_ssm40.json Adds SSM40 decode fixtures.
vendors/senzemo/codecs/test_decode_spu30.json Adds SPU30 decode fixtures.
vendors/senzemo/codecs/test_decode_smc40.json Adds SMC40 decode fixtures.
vendors/senzemo/codecs/test_decode_smc33.json Adds SMC33 decode fixtures.
vendors/senzemo/codecs/test_decode_smc30.json Adds SMC30 decode fixtures.
vendors/senzemo/codecs/test_decode_sam20.json Adds SAM20 decode fixtures.
vendors/senzemo/codecs/test_decode_kou20.json Adds KOU20 decode fixtures.
vendors/senzemo/codecs/sto10.js Adds the STO10 codec.
vendors/senzemo/codecs/stb10.js Adds the STB10 codec.
vendors/senzemo/codecs/ssm40.js Adds the SSM40 codec.
vendors/senzemo/codecs/spu30.js Adds the SPU30 codec.
vendors/senzemo/codecs/smc40.js Adds the SMC40 codec.
vendors/senzemo/codecs/smc33.js Adds the SMC33 codec; unresolved runtime, mask, and timestamp issues remain.
vendors/senzemo/codecs/smc30.js Adds the SMC30 codec.
vendors/senzemo/codecs/sam20.js Adds the SAM20 codec.
vendors/senzemo/codecs/kou20.js Adds the KOU20 codec; its configuration length check needs correction.
Review details

Suppressed comments (4)

vendors/senzemo/codecs/kou20.js:78

  • This branch checks for a 10-byte configuration packet but only parses bytes 0 through 8; the extra byte is silently discarded. The other Senstick configuration decoders use the same nine fields with a 9-byte check, so a normal 9-byte KOU20 config frame will never decode. Align the length check with the parsed fields (or explicitly parse the tenth field) and add a config fixture.
    if (bytes.length == 10)

vendors/senzemo/codecs/smc33.js:157

  • DataRatePlusADR uses bit 7 for ADR and bits 0–6 for the data rate, so 0x0F drops valid rate bits 4–6. A configuration byte with any of those bits set will therefore be decoded with an incorrect DataRate; use the full lower-seven-bit mask (0x7F), consistent with the other Senstick codecs.
      DataRate = (DataRatePlusADR & 0x0F);

vendors/senzemo/codecs/smc33.js:104

  • The 4-byte Unix timestamp is unsigned, but bytes[8] << 24 creates a signed 32-bit value in JavaScript. Once the high bit is set (for timestamps after 2038-01-19), valid timestamps decode as negative; assemble this value and coerce it with >>> 0 (and apply the same correction to the 13-byte branch).
      Unixtime = (bytes[8] << 24) +  (bytes[9] << 16) +  (bytes[10] << 8) +  bytes[11]; 

vendors/senzemo/codecs/smc33.js:126

  • As in the 12-byte branch, the high-byte shift makes this 32-bit Unix timestamp signed. Valid timestamps with bit 31 set will be reported as negative instead of their unsigned epoch value; coerce the assembled value with >>> 0.
      Unixtime = (bytes[9] << 24) +  (bytes[10] << 16) +  (bytes[11] << 8) +  bytes[12]; 
  • Files reviewed: 41/41 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread vendors/senzemo/codecs/smc33.js
ChirpStack evaluates codecs as ES modules, which are always strict. The
SMC33 decoder assigns ADRon and DataRate without declaring them, so every
fPort 3 config packet threw a ReferenceError. Declare both in the adapter,
matching the existing Fcnt_ret declaration for STB10.

SMC33 also assembles its 32-bit Unixtime with << 24, which yields a signed
value, so timestamps from 2038 onwards decoded as negative. Normalise it to
unsigned.

No fixture exercised a config packet, which is how this went unnoticed.
Add an fPort 3 config fixture for every codec with a config branch, plus
12- and 13-byte SMC33 timestamp fixtures including one past 2038.
@brocaar
brocaar merged commit bf34bab into chirpstack:master Sep 15, 2026
2 checks passed
@brocaar

brocaar commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Thanks @aljaz77 👍

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.

3 participants