razorRun / node-red-contrib-smartlifeair

Allow you to integrate any[almost] tuya, smart life supported devices to node-red. However, you will have to enrol these devices via Smart life air mobile app. https://www.smartlife.nz/smartlife-labs
https://roshan.digital/
13 stars 1 forks source link

Send ? And Configured for JSON (all values), the state is wrong, but via the UI, the state is correct? #29

Closed dachshund-digital closed 3 years ago

dachshund-digital commented 3 years ago

Send ? And Configured for JSON output (all values), the state is wrong, but via the NR UI, the state is correct? Send ? and Configured for Switch_1 value as output, the state is incorrect. but the NR UI view shows correct state.

Reference the graphic below, the left red circle shows the correct state of the smart plug. The red circle on the right, shows the payload output for all channels, and the state is true, which is incorrect.

SmartLife Air Node Error

Using NR 1.2.9 and SmartLife Air Node 1.0.11. .

dachshund-digital commented 3 years ago

Also noticed that completeData is not returned when ? is sent. I take it this was by design. I did a bit more testing. I sent true/on to plug, then false/off to the plug, then sent ?, and that returned correct switch state of false/off. It seems that right after NR is restart or a deployment, when the node has yet to receive any command, the returned state is wrong via ? is wrong. I also don't get how switch vs. switch_1 gets mixed up as well, as you can see per my screen print, that the node returned the structure property 'switch' when the given smart plug uses 'switch_1' for example. This switch vs. switch_1 issue clears up once any valid on/off command is sent, versus an initial ? command.

razorRun commented 3 years ago

Took bit of time to understand what you meant, I suppose you are talking about sending “?” To get feedback eh?

How that work is it will send you whatever the last state it get to the node. And on the startup it takes around 10-15s to authenticate and emit the first status. So I would suggest wait 15sec or so for the first state update

Cheers

On Wed, 31 Mar 2021 at 4:31 PM, dachshund-digital @.***> wrote:

Also noticed that completeData is not returned when ? is sent. I take it this was by design. I did a bit more testing. I sent true/on to plug, then false/off to the plug, then sent ?, and that returned correct switch state of false/off. It seems that right after NR is restarted, when the node has yet to receive any command, the returned state is wrong.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/razorRun/node-red-contrib-smartlifeair/issues/29#issuecomment-810731843, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFB72ECYPRTTIW7QWZOD2VLTGKJP5ANCNFSM42DOSSSA .

dachshund-digital commented 3 years ago

I am not sure I have explained the issue right? Actually it is the explicit '?' query that appears wrong before any other command, say on/off is sent. This can be quite some time after start up/flow redeploy. One test I did it after 30 minutes of any flow deployment.

Sequence That Exposes Issue, Repeatable, At Least In My Environment:

1) NR or Flow Deploy -> Initial Message From Node -> Correct State and payload property name.

2) Send ? -> Message From Node -> Incorrect State, And payload always reports property as 'switch' regardless if 'switch_1' is correct property name for the given device. My screen print shows this happening explicitly

3) Send On/Off -> Message From Node -> Correct State. And payload property name

4) Send ? -> Message From Node -> Correct State. And payload reports property as switch or switch_1 as expected for the given device

So there is something funky about the first '?' query sent, after initialization, before first command directive. Like I noted above, the initial notification message from node seems right.

Thanks for the timely response, appreciate it.

razorRun commented 3 years ago

You are welcome.

If you find this node useful make sure to drop a star to increase visibility. Coz we need to find a couple of people to maintain this repo.

Cheers

On Wed, Mar 31, 2021 at 7:20 PM dachshund-digital @.***> wrote:

Ah. So what I see immediately on node start up (after deploy or NR restart) isn't valid. That also seems to explain why if I send an explicit command, the result returned is valid... it triggers an update. Thanks for the timely response, appreciate it.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/razorRun/node-red-contrib-smartlifeair/issues/29#issuecomment-810804183, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFB72EC4UUEF7UC7ZMFZEQDTGK5MHANCNFSM42DOSSSA .

dachshund-digital commented 3 years ago

Oh, dang thought this was already closed.