Ping not returning correct value #44
Replies: 2 comments
-
Thanks @georgeinva2004, i'll fix that along with the key change today.
If you know what the difference is, and why one is needed compared to the other, I'm dying to find out A little tip on multiline code in Github - use 3 back ticks (I edited your comment)😄
EDIT I'll scan though them today, and get it optimised |
Beta Was this translation helpful? Give feedback.
-
I'm in the same boat as you. I wish I could tell you. The docs say that it should work the way you have it implemented. And thanks for the code-insertion tip. I thought just clicking the button was enough :)
Get Outlook for Android<https://aka.ms/AAb9ysg>
…________________________________
From: Marcus Davies ***@***.***>
Sent: Saturday, October 21, 2023 8:46:58 AM
To: zwave-js/ZWaveJS.NET ***@***.***>
Cc: John M. George ***@***.***>; Mention ***@***.***>
Subject: Re: [zwave-js/ZWaveJS.NET] Ping not returning correct value (Discussion #44)
Thanks @georgeinva2004<https://github.com/georgeinva2004>, i'll fix that along with the key change today.
I must admit, despite using Newtonsoft.JSON for years, I still am confused between:
JObject.value<T>(path) and JObject.SelectToken(path)
If you know what the difference is, and why one is needed compared to the other, I'm dying to find out
—
Reply to this email directly, view it on GitHub<#44 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABJAZ4JOQPKP2R35IR7BKGLYAO74FAVCNFSM6AAAAAA6JVK4DSVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM3TGNBWGMYDG>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Ping was always returning a "false" in the CMDResult. Did some digging and noticed that the ZWaveNode.Ping() method had this to set the payload value.
The actual response JSON looks like this:
I think the index needs to be "result.responded" not "responded" as currently implemented, so I changed it :). BUT, that didn't work either. I ended up rewriting it a bit to use the Newtonsoft JObject.SelectToken method which is providing the correct value for "responded". The new code looks like this:
I'm not sure if it's a bug in the Newtonsoft code or something else. Based on the docs, the original code should have worked, but it's not for some reason. I'm targeting .NET 7 in my application, if that makes a difference.
Beta Was this translation helpful? Give feedback.
All reactions