-
-
Notifications
You must be signed in to change notification settings - Fork 911
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
Infinite loop when verifying change #1220
Comments
Can you provide log files? this sounds strange.... |
I also found out that it showed the same infinite loop behavior with the door locks as well. (Log file: The session was something like below:
For door locks, the current and new values didn't have to be equal. |
Here's the log when same value is used. the behavior is similar It almost seems like manager is calling refresh again and again |
Here's the log for setting a dimmer to 0 when it's already at 0. Same result if you're setting it to any value that it is currently already set to. The only way to end the loop is to set verify change to false for that value id. |
ok. based on your doorlock log file I think I can see whats happening.... The Door Lock (and devices are automatically sending) Reports after the SET message is processed. So we end up with 2 GET reponses in the (1 automatic, 1 from the Queue thats automatically sent when a SET request is made) The SET and GET messages are queued after you make the change at 1916 The automatic report triggers a VerifyChange Block at line 1966 The GET returns at line 2011 and the change is verified Now the original GET request queued at line 1916 is sent (which is spurious) at line 2038 the 2nd Get returns at line 2071 In the code - we get stuck in a loop at line 679 of Value.cpp. Can you change Line 679 to Value::OnValueChanged(); but here is the question - This code was introduced for Dimmers that report their intermediary values (as they are changing) rather than their final values. To save some bandwidth on your network, I'd actually only set SetChangeVerified for Dimmers (or any Value tied to the CommandClass SwitchMultiLevel) rather than everything... (and those devices were buggy and not spec compliant - I haven't seen them around in ages, so you might be able to get away without using it at all) |
adding the SetCheckingChange(true) after the initial test would break the logic for devices that take their time to actually come to their final value... like dimmers with a slow dim speed setting but don't report their final value.... |
the value polling can also delegate to the gateway? I have some "buggy" dimmer and even with this I have to perform a refresh few second after a level change's action, to get the real final level. |
Yep. Applications can do it that way. The SetChangeVerified() should automate it for you tho, so you don't have to put in "hacks" to the application for individual devices. In fact, maybe we should add this as a Config option so it can be set on buggy devices and then it's transparent to user/application |
yes a config option can be a good way to do this |
@techgaun ping. Does those changes fix your issue? |
@Fishwaldo Sorry for the delay. I will test it out tomorrow and will get back to you |
@Fishwaldo I updated the lines as per your instruction. The diff of changes look like below: @ Value.cpp:678 @ int Value::VerifyRefreshedValue
if( bOriginalEqual )
{
// values are the same, so signal a refresh and return
Value::OnValueRefreshed();
//Value::OnValueRefreshed();
Value::OnValueChanged();
return 0; // value hasn't changed
}
@ Value.cpp:736 @ int Value::VerifyRefreshedValue
{
Log::Write( LogLevel_Info, m_id.GetNodeId(), "Spurious value change was noted." );
SetCheckingChange( false );
Value::OnValueRefreshed();
//Value::OnValueRefreshed();
Manager::Get()->RefreshValue( GetID());
return 0;
} I still see the same issue. Here's the log attached Update: the text diff above is not clear. Screenshot attached: Also, I installed it through python-openzwave by running |
You need to comment out the OnValueRefreshed() lines... @ Value.cpp:736 @ int Value::VerifyRefreshedValue |
@Fishwaldo yeah that's what I did for the test(for which I've attached log on #1220 (comment)) .. commented out OnValudeRefreshed lines and added appropriate lines just like you mentioned above. |
ok... I'll do some testing once i'm home tomorrow |
@Fishwaldo : have you look at this bug ? |
I'll get back to it soon, but as mentioned, SetChangeVerified should only be used for buggy devices - not everything. |
I'm also running into this issue with HomeSeer HS-WD100+ dimmers and HomeAssistant. Would more logs help? I can reproduce it in more cases than setting the level to the same value. I also see it happen when controlling the switch physically. Here's a log from remotely turning a switch off: https://gist.github.com/jvolkman/3b1a714f90be04bffbf53a9dcf1b310d As an aside, I don't think these devices are necessarily buggy. V1 of the Multilevel Switch CC's Report command states:
In addition to the "current value" field that exists in V1, V4 of the CC adds a "target value" field to the Report message which contains the value that the device will reach after a transition. |
@Fishwaldo seems like neither Value::OnValueRefreshed() nor Value::OnValueChanged() need to be called if bOriginalEqual is true. OnValueRefreshed() causes the infinite loop, and OnValueChanged() is already called after the changing value is confirmed (and bCheckEqual is true). #1352 removes the call to OnValueRefreshed(). This small change has fixed the infinite loop in my setup. |
remove verify_changes="true" to avoid #1220
Ran into this issue with a dimmer specifically. If a command is sent to set the dimmer to a value it is already at it will infinitely check to see if the value is correct. Seems to be caused by the below code because it can never break out of the first condition and go to the actual verification of the value.
isCheckingChange()
will always return false andbOriginalEqual
will always be true. We tested by simply setting theSetCheckingChange(true)
after the initial check and the values were still verified properly when setting to any value within the valid range of the dimmer, but prevented the infinite loop.The code in question:
https://github.com/OpenZWave/open-zwave/blob/master/cpp/src/value_classes/Value.cpp#L673-L687
The text was updated successfully, but these errors were encountered: