Skip to content

iNodeEM: emit batt as int 100 instead of string "100"#690

Merged
DigiH merged 1 commit intodevelopmentfrom
fix-inodem-batt-int
Apr 26, 2026
Merged

iNodeEM: emit batt as int 100 instead of string "100"#690
DigiH merged 1 commit intodevelopmentfrom
fix-inodem-batt-int

Conversation

@1technophile
Copy link
Copy Markdown
Member

Description:

The _batt static-value override was written as ["static_value", "100"] (quoted), so when the byte-20 condition matches, the property is set to a string "100" instead of an int. Other rules' static_value numeric literals (e.g. battery percent fallbacks elsewhere) use unquoted numbers, so unwrapping it here aligns with the rest of the decoder and matches what the existing test_ble.cpp expected array already declares ("batt":100).

Behaviour change is type-only — value is still 100 — but consumers that parse the JSON strictly (e.g. Python json.loads on an MQTT payload) now see an int where the expected output already promised an int. The upstream test passed before only because ArduinoJson 6's JsonVariant != operator silently coerces a numeric string to a number. Strict consumers (Theengs Android app surfacing this via MQTT) saw the string and reported a field-type diff vs the catalog.

Checklist:

  • The pull request is done against the latest development branch
  • Only one feature/fix was added per PR and the code change compiles without warnings
  • I accept the DCO.

The `_batt` static-value override was written as `["static_value", "100"]`
(quoted), so when the byte-20 condition matches, the property is set to a
string `"100"` instead of an int. Other rules' `static_value` numeric
literals (e.g. battery percent fallbacks elsewhere) use unquoted numbers,
so unwrapping it here aligns with the rest of the decoder and matches
what the existing test_ble.cpp `expected` array already declares
(`"batt":100`).

Behaviour change is type-only — value is still 100 — but consumers that
parse the JSON strictly (e.g. Python json.loads on an MQTT payload) now
see an int where the expected output already promised an int. The
upstream test passed before only because ArduinoJson 6's
JsonVariant `!=` operator silently coerces a numeric string to a number.
Strict consumers (Theengs Android app surfacing this via MQTT) saw the
string and reported a field-type diff vs the catalog.
@DigiH
Copy link
Copy Markdown
Contributor

DigiH commented Apr 26, 2026

Thanks

@DigiH DigiH merged commit 076bce9 into development Apr 26, 2026
14 checks passed
@DigiH DigiH deleted the fix-inodem-batt-int branch April 27, 2026 18:21
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.

2 participants