node-zwave-js icon indicating copy to clipboard operation
node-zwave-js copied to clipboard

[question] Device only update status after tapping (off) twice (manual)

Open lee-costa opened this issue 3 years ago • 38 comments

I have this switch and noticed that it's OFF status will only update in Home Assistant after tapping it twice. So for example, turn on switch manually, HA shows correct status. Turn off switch manually, HA shows switch as ON. Tap off again and HA updates correctly.

I read about pooling but not sure if this is what I want. If so, what is a good pooling interval to configure? I plan on doing this to a total of 3 devices. I am aware of the consequences but should I worry even if only pooling 3 devices?

lee-costa avatar Feb 08 '22 15:02 lee-costa

I think it's a device issue as device is not reporting its status, please attach zwavejs logs

robertsLando avatar Feb 08 '22 15:02 robertsLando

I think it's a device issue as device is not reporting its status, please attach zwavejs logs

Attached zwavejs2mqtt-store.zip

lee-costa avatar Feb 08 '22 15:02 lee-costa

And by the way, this also happens when turning on this (and other two switches)

https://user-images.githubusercontent.com/22748735/153018808-fba946e7-cfa4-4774-8505-5c84f7f09cd5.mov

switch:

lee-costa avatar Feb 08 '22 15:02 lee-costa

@AlCalzone

robertsLando avatar Feb 09 '22 16:02 robertsLando

Which Node ID am I looking for? When (time and timezone) did you interact with it? The log is 77k lines long :)

AlCalzone avatar Feb 09 '22 20:02 AlCalzone

@AlCalzone I have generated a new log file and you will find it attached. I purposely interacted with the device between 5:58pm and 6:10pm today (eastern time) and the Node ID is Device ID 99-12337-18756 (0x0063-0x4944-0x3031). The same behavior is still noticed.

Thank you. zwavejs2mqtt-store.zip


edit

I believe the correct ID is 31.

lee-costa avatar Feb 10 '22 00:02 lee-costa

In the time frame you mention I see a couple of these interactions:

2022-02-09T23:02:03.600Z DRIVER « [Node 031] [REQ] [ApplicationUpdateRequest]
                                    payload: 0x1f0a04110126277370867277
2022-02-09T23:02:03.601Z CNTRLR « [Node 031] Received updated node info
2022-02-09T23:02:03.601Z CNTRLR   [Node 031] Node does not send unsolicited updates; refreshing actuator and sen
                                  sor values...
2022-02-09T23:02:03.602Z CNTRLR » [Node 031] requesting current switch state...
2022-02-09T23:02:03.604Z DRIVER » [Node 031] [REQ] [SendData]
                                  │ transmit options: 0x25
                                  │ callback id:      166
                                  └─[MultilevelSwitchCCGet]
...
2022-02-09T23:02:03.648Z CNTRLR   [Node 031] [~] [Multilevel Switch] currentValue: 2 => 97          [Endpoint 0]
2022-02-09T23:02:03.654Z DRIVER « [Node 031] [REQ] [ApplicationCommand]
                                  └─[MultilevelSwitchCCReport]
                                      current value: 97

Or in plain english: device: "hey there is something new!" zwave-js: "okay whats your status?" device: "I'm currently at level 97"


Most of these are just a tiny bit off the limits of fully off (2 or 3 instead of 0) or fully on (97 instead of 99). I think this is a timing issue. The device isn't done dimming when its status is refreshed, so the status ends up as "almost off" instead of off.

We have a compat flag to delay these refreshes, I'm going to try with 250ms which shouldn't feel too long but long enough to avoid the half-dimmed states.

AlCalzone avatar Feb 10 '22 07:02 AlCalzone

@zwave-js-bot add compat flag to 0x0063:0x4944:0x3031:3.37

manualValueRefreshDelayMs: 250

AlCalzone avatar Feb 10 '22 07:02 AlCalzone

🔨 I created a PR at #4221 - check it out!

zwave-js-bot avatar Feb 10 '22 07:02 zwave-js-bot

@junior466 If you have zwavejs2mqtt installed, you can test this file by following this guide and let me know if that works.

If not, also let me know - then I'll just merge and you can test on the next update.

AlCalzone avatar Feb 10 '22 08:02 AlCalzone

@AlCalzone Thanks for the prompt (possible) fix. I will try it as soon as I can today. And just to be sure, where will my ‘app-root’ be if installed using Snap on Ubuntu?

lee-costa avatar Feb 10 '22 11:02 lee-costa

@jmgiaever?

AlCalzone avatar Feb 10 '22 12:02 AlCalzone

/var/snap/zwavejs2mqtt/<revision>/ where each revision contains data (backup) from each. You should most likely use the highest revision, or the symlink current.

jmgiaever avatar Feb 10 '22 12:02 jmgiaever

So inside there should be a ‘store’ folder where I create a ‘config’ folder and upload? Apologies but away from desk.

lee-costa avatar Feb 10 '22 12:02 lee-costa

Hi, no, that folder is your «store folder». Everything essential is created by z2m itself, but if you need to store config files, use the config folder specified in the «config priority path» within the zwave section in the setting. In my case it's set to (by default): /var/snap/zwavejs2mqtt/340/config.

However this path is not automatically created. Create it with sudo mkdir <path you have>.

Note that 340 is the revision number. Snap will increase/decrease this value whenever you're upgrading or downgrading.

For what I'm aware you're not able to upload files through the Z2M UI. If you have to upload from your local computer, use scp or something like that to upload it to your server in an SSH like way

scp /my/local/file username@my-host:<path you have>

EDIT: Note «username» needs root access to write to this directory (<path you have>). You might just scp it to this users home dir (e.g scp /my/local/file username@my-host:~, ~ is important) and then log in with SSH and move it with sudo mv ~/file <path you have>.

jmgiaever avatar Feb 10 '22 20:02 jmgiaever

You can edit files in the UI, which is enough in this case https://github.com/zwave-js/node-zwave-js/issues/4188#issuecomment-1035491752

AlCalzone avatar Feb 10 '22 21:02 AlCalzone

@AlCalzone I have followed the instructions but no luck. Attached are the logs. I tried it a couple times between 7:10PM and 7:30PM eastern time.

One thing I didn't do is re-interview that device as per the guide since I was afraid of loosing my configuration. If it must be done, let me know and I will try it.

zwavejs2mqtt-store.zip

lee-costa avatar Feb 11 '22 00:02 lee-costa

Doesn't look like the config was applied. Did you restart zwavejs2mqtt? If so, please keep logging enabled there and download the logfile from the store after restarting so I can see what happens during startup.

AlCalzone avatar Feb 11 '22 07:02 AlCalzone

I made sure to restart it at the command line after clicking save. I have logging enabled since yesterday. I just finished restarting and attached the logs. I interacted with the switch today between 4:20PM and 4:25PM eastern time. zwavejs2mqtt-store.zip

lee-costa avatar Feb 11 '22 21:02 lee-costa

@AlCalzone Anything else you recommend I try? Any more logs needed?

lee-costa avatar Feb 12 '22 14:02 lee-costa

2022-02-11T21:23:19.367Z CNTRLR   [Node 031] Node does not send unsolicited updates; refreshing actuator and sen
                                  sor values in 250 ms...
2022-02-11T21:23:19.617Z CNTRLR » [Node 031] requesting current switch state...

Looks like the change was applied, but maybe 250 ms is still not enough. How long does that device need for dimming?

You could try changing

"manualValueRefreshDelayMs": 250

at the end of the file to

"manualValueRefreshDelayMs": 1000

or maybe even

"manualValueRefreshDelayMs": 2000

and see if this gets better after restarting zwavejs2mqtt.

AlCalzone avatar Feb 15 '22 12:02 AlCalzone

So I tried all those three values and neither has worked (made sure to click "save" and restart zwavejs2mqtt.zwavejs2mqtt service). One thing I just noticed though is that when I tap the switch to turn off, it dims itself to 80 and stops there (what home assistant sees). The actual light in the ceiling already shows as off. I recorded a video of the behavior using Home Assistant:

edit - The reason it eventually goes to the "off" state is because I tap it a second time after turning it off. So in the video, I tap it to ON, then tap it to OFF then at this point the light is off but Home Assistant shows it ON still so a third tap gets it to OFF.

https://user-images.githubusercontent.com/22748735/154074682-56d97a5a-a772-4e2a-b49c-978d11a883e4.mov

lee-costa avatar Feb 15 '22 13:02 lee-costa

Can you try something ridiculously long, like 10000? I wonder if the delay has any influence on how close the reported value is to the actual brightness.

Also how is the dimming configured? grafik

AlCalzone avatar Feb 15 '22 14:02 AlCalzone

Yes, the value of 10000 works! And here's what I see:

Screen Shot 2022-02-15 at 9 16 54 AM

lee-costa avatar Feb 15 '22 14:02 lee-costa

Ok I'm not 100% sure how to interpret these settings. Maybe @blhoward2 has a better idea? If this means each dim level changes the brightness by 1 and takes 30ms for each step, then dimming down from 99 to 0 would take almost 3 seconds. This would mean that a value of 3000 or higher should work.

AlCalzone avatar Feb 15 '22 14:02 AlCalzone

This means it should take one 30ms step. I just confirmed that's what mine are set to and they barely ramp down at all. It's practically instant.

I'm not sure the compat flag is the issue. I've seen this exact behavior but only at certain combinations of original dim level and step/timing. And not in a way that makes sense either. It seems that going down too many levels too fast is a larger issue then catching it mid-ramp.

Some of the GE switches are a bit buggy when it comes to steps and the brightness level they're originally at. One of mine won't go the whole way off if it is below 20% and set to take more than one step, even at the switch. Another of the same model works fine. I'd play around with the settings before the config file.

blhoward2 avatar Feb 15 '22 14:02 blhoward2

Interesting... we should definitely mention this in the device config comments when we can pin the issue down further.

AlCalzone avatar Feb 15 '22 14:02 AlCalzone

So what @blhoward2 said is I should change the step to 30ms? What setting exactly? There are multiple Dim Rate Steps.

lee-costa avatar Feb 15 '22 15:02 lee-costa

It’s already at 30 ms. The unit is 10ms. There are two that matter. Manual is the local switch. Zwave is zwave. I’d try two or three steps at 30 ms. Then if that doesn’t work try 1-3 steps at 10 ms. Too slow and the get will catch it on the ramp but just play around with it.

If you can’t find a combination that you’re happy with, try setting up an automation that is triggered by the brightness changing and have it refresh the device using the refresh service after a second or two. Just do a trigger on the brightness attribute. While it’s staying on I’m assuming the level changes to something else in HA.

I’ve also had this behavior go away after a factory reset. So you might try that too.

blhoward2 avatar Feb 15 '22 15:02 blhoward2

I think I want to try a factory reset before going further just in case. Should I just reset the switch manually or do I need to do anything from within the control panel?

lee-costa avatar Feb 15 '22 15:02 lee-costa