Repository navigation
Fix WS90 Victron flow: relay device lookup and decimal scaling - #235
Merged
orlin369 merged 1 commit intoNov 4, 2026
Merged
Conversation
BLE.CloudRelay.ListInfos returns devices as an array of single-key objects keyed by MAC, not as a MAC-keyed map. The flow's lookup ran Object.keys() over that array, so it compared "0" against the configured MAC, never matched, and the flow published nothing. The BTHome decoder also scaled by multiplying with 0.1, 0.01 and 0.001, none of which are exactly representable as doubles, so values reached the Victron dbus as 7.1000000000000005 degC and 114.80000000000001 mm. Dividing by 10, 100 and 1000 is exact. Verified end to end: Venus OS Large with node-red-contrib-victron 1.7.29, an Ecowitt WS90 relayed by a Shelly Plug S Gen3, values landing on com.victronenergy.temperature/101 and com.victronenergy.meteo/101.
drHouse-gif
force-pushed
the
fix/ws90-victron-bthome-decode
branch
from
November 4, 2026 18:34
9001f02 to
039bc2e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
weather-env/ws90-shelly-to-victron.nodered.jsonnever published anything. Two defects, both in theFreshest gateway + BTHome decode + mergefunction node.1.
devicesis an array, not a MAC-keyed map (blocker)BLE.CloudRelay.ListInfosanswers like this:{"ts":1793815328,"offset":0,"count":1,"total":1, "devices":[{"c0:2c:ed:21:72:1e":{"name":null,"model":0, "sdata":{"fcd2":"QAChBQAAACAARAAARDwARgBenBg="},"mdata":{},"last_seen":1793815327}}]}The flow treated
devicesas a map keyed by MAC:Object.keys()over that array yields["0"], so the comparison was"0" === "c0:2c:ed:...". It never matched, the function returnednull, and nothing reached the Victron. Running the published function verbatim against a live gateway response:Fixed by flattening the array into the map the rest of the function already expects. Both response shapes are now handled, so this stays correct if the RPC ever returns a map.
2. Decimal scaling by multiplication put floating-point artifacts on the dbus
The decoder scaled with
* 0.1,* 0.01and* 0.001. None of those are exactly representable as doubles, so:Those values went straight onto
com.victronenergy.temperature/101and showed up in the GUI. Brute-forcing every integer a 16-bit field can hold, 40874 of 196608 scaled values stringify differently between multiplication and division; division is exact for 10, 100 and 1000. Replaced throughout the decoder, which also cleans updew_point,capacitor_voltage,wind_speed,wind_gust,uv_index,wind_direction,illuminanceandprecipitation.Verification
Hardware: Venus OS Large,
@victronenergy/node-red-contrib-victron1.7.29, Ecowitt WS90 relayed by a Shelly Plug S Gen3 on firmware 2.1.1.The patched flow decodes both of the WS90's alternating advertisements and merges them:
Read back from the GX, matching the gateway's decoded packet in the same minute:
The two-gateway path was exercised with a second Shelly that has BLE relay enabled but is out of range of the station: that branch returns
nulland the freshest-source selection picks the gateway that can see it.Notes
examples-manifest.json: it indexes.shelly.jsonly.com.victronenergy.temperatureexposes no/Connectedpath to signal otherwise./Statusstays at0("Ok") becausedbus-victron-virtualsets it once at registration and the flow never writes it.