Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Route direction in Zniffer appears to be backwards #4116

Open
3 tasks done
kpine opened this issue Feb 3, 2025 · 4 comments
Open
3 tasks done

Route direction in Zniffer appears to be backwards #4116

kpine opened this issue Feb 3, 2025 · 4 comments
Labels
bug Something isn't working

Comments

@kpine
Copy link
Contributor

kpine commented Feb 3, 2025

Checklist

  • I am not using Home Assistant. Or: a developer has told me to come here.
  • I have checked the troubleshooting section and my problem is not described there.
  • I have read the changelog and my problem is not mentioned there.

Deploy method

PKG executable

Z-Wave JS UI version

9.29.1

ZwaveJS version

14.3.7

Describe the bug

In the Zniffer pane the route direction is backwards.

To Reproduce

Make a zniffer trace.

Expected behavior

The route direction is displayed correctly.

Additional context

Here's a screenshot with a Meter Report highlighted. The route direction indicates a message from the controller (1) to the end device (64). But in reality the node has sent the message, so the direction should be 1 ← 64 or 64 → 1.

Image

In comparison, the SiLabs Zniffer application indicates the source node as 64 and the destination as 1, without a Routed indication as it is direct.

@kpine kpine added the bug Something isn't working label Feb 3, 2025
@robertsLando
Copy link
Member

I think the issue here is that the arrow should always be like '→' because later we sort nodeIds starting from sender to receiver based on the direction. This is the method I use:

export function getRoute(item, withRssi = false) {
if (item.corrupted) {
return ''
}
const repRSSI = item.repeaterRSSI || []
const dir = item.direction === 'inbound' ? '←' : '→'
const hop = item.hop !== undefined ? item.hop : -1
const route = [
item.direction === 'outbound'
? item.sourceNodeId
: item.destinationNodeId,
...(item.repeaters || []),
item.direction === 'outbound'
? item.destinationNodeId
: item.sourceNodeId,
].map(
(r, i) =>
`${r}${
withRssi && repRSSI[i - 1] && !isRssiError(repRSSI[i - 1])
? ` (${rssiToString(repRSSI[i - 1])})`
: ''
}`,
)
let routeString = ''
if (hop >= 0) {
// highlight the hop
for (let i = 0; i < route.length; i++) {
routeString += route[i]
if (i < route.length - 1) {
if (i === item.failedHop) {
routeString += ' ! '
} else {
routeString += ` ${
hop === i ? '<b class="text-decoration-underline">' : ''
}${dir}${hop === i ? '</b>' : ''} `
}
}
}
} else {
routeString = route.join(` ${dir} `)
}
return routeString
}

So making const dir = '→' should fix the issue IMO. @AlCalzone any clue? Maybe SiLabs Zniffer uses a different approach?

@kpine kpine closed this as completed Feb 3, 2025
@AlCalzone
Copy link
Member

@kpine can you verify if only 0-hop routes have their direction wrong? The code above looks like they may.
I'm not 100% sure what the intention was, but I think I wanted "request" frames to point right, and "response" frames to point left. However that logic conflicts with the conditional position of the source and destination in the route array.

@kpine
Copy link
Contributor Author

kpine commented Feb 3, 2025

I think you are correct, I turned on a light switch remotely and here is the result:

Image

Set/Get and Report are in the correct direction, in this case the source is on the left side.

@AlCalzone AlCalzone reopened this Feb 3, 2025
@AlCalzone
Copy link
Member

Ok, I think this is purely a UI issue then. Let's keep both open until I've verified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants