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

Problem with the Manager::GetValueListValues method #2615

Open
igorlopez opened this issue Aug 21, 2021 · 0 comments
Open

Problem with the Manager::GetValueListValues method #2615

igorlopez opened this issue Aug 21, 2021 · 0 comments

Comments

@igorlopez
Copy link

Hi,

Since the python-openzwave repo is running on the 1.4 version and I really need the 1.6 version for my Fibaro button I have been trying to modify the example app, MinOZW, to see if I can make my app in C++ instead of Python.

Anyway, I have modified main.cpp to the point it actually runs but I am not getting any values in my notification callback where I am using the Manager::GetValueListValues method.

The function call returns True but when looping over the values they are all 0 which does not match what the button is sending.
Code part printing read values:

printf("#¤#¤#¤#¤#¤#¤#¤#¤#¤#¤#¤#¤#¤#¤#\nButton pressed\n");
for(list<ValueID>::iterator it = nodeInfo->m_values.begin(); it != nodeInfo->m_values.end(); ++it)
{
    // check for correct ValueId
    if((*it) == _notification->GetValueID())
    {
        printf("\tFound ValueId\n");
        ValueID v = *it;
        const ValueID& vRef = v;
        vector<int32> values;
        if(svea_mgr->GetValueListValues(vRef, &values))
        {
            for(vector<int32>::iterator it2 = values.begin(); it2 != values.end(); ++it2)
            {
                printf("\t\t Value: %d\n", *it2);
            }
        }
    }
}

Printed in Console:

2021-08-21 10:51:02.414 Detail, Node002,   Received: 0x01, 0x0d, 0x00, 0x04, 0x00, 0x02, 0x05, 0x5b, 0x03, 0x7b, 0x80, 0x01, 0x7e, 0x00, 0x2d
2021-08-21 10:51:02.414 Detail, 
2021-08-21 10:51:02.414 Info, Node002, Received Central Scene set from node 2: scene id=1 with key Attribute 0. Sending event notification.
2021-08-21 10:51:02.414 Detail, Node002, Initial read of value
2021-08-21 10:51:02.415 Info, Node002, Automatically Clearing Scene 1 in 1000ms
2021-08-21 10:51:02.415 Info, Timer: adding event in 1000 ms
2021-08-21 10:51:02.415 Detail, Node002, Notification: ValueChanged CC: COMMAND_CLASS_CENTRAL_SCENE Instance: 1 Index: 1
#¤#¤#¤#¤#¤#¤#¤#¤#¤#¤#¤#¤#¤#¤#
Button pressed
	Found ValueId
		 Value: 0
		 Value: 1
		 Value: 2
		 Value: 3
		 Value: 4
		 Value: 5
		 Value: 6
		 Value: 7
--------------------------------------------------------

2021-08-21 10:51:02.416 Detail, Timer: waiting with timeout 1000 ms
2021-08-21 10:51:03.416 Info, Timer: delayed event
2021-08-21 10:51:03.416 Detail, Node002, Value Updated: old value=1, new value=0, type=list
2021-08-21 10:51:03.417 Detail, Node002, Changes to this value are not verified
2021-08-21 10:51:03.417 Detail, Timer: waiting with timeout -1 ms
2021-08-21 10:51:03.417 Detail, Node002, Notification: ValueChanged CC: COMMAND_CLASS_CENTRAL_SCENE Instance: 1 Index: 1
#¤#¤#¤#¤#¤#¤#¤#¤#¤#¤#¤#¤#¤#¤#
Button pressed
	Found ValueId
		 Value: 0
		 Value: 1
		 Value: 2
		 Value: 3
		 Value: 4
		 Value: 5
		 Value: 6
		 Value: 7
--------------------------------------------------------

Logging from Value.cpp shows that the value is updated and for each press (except the first press which is above) one sees the first message (button pressed down with old_value=0, new_value=1 and then when button is released it prints the reveresed.
So for some reason does my usage of the GetValueListValues not get the expected value.

I am assuming that the vector has 8 elements since during init there are 8 ValueAdded notifications, 3 COMMAND_CLASS_BASIC and 5 COMMAND_CLASS_SWITCH_MULTILEVEL:

2021-08-21 10:50:35.446 Detail, Node002, Notification: ValueAdded CC: COMMAND_CLASS_BASIC Instance: 1 Index: 0
2021-08-21 10:50:35.446 Detail, Node002, Notification: ValueAdded CC: COMMAND_CLASS_BASIC Instance: 1 Index: 1
2021-08-21 10:50:35.446 Detail, Node002, Notification: ValueAdded CC: COMMAND_CLASS_BASIC Instance: 1 Index: 2
2021-08-21 10:50:35.446 Detail, Node002, Notification: ValueAdded CC: COMMAND_CLASS_SWITCH_MULTILEVEL Instance: 1 Index: 0
2021-08-21 10:50:35.446 Detail, Node002, Notification: ValueAdded CC: COMMAND_CLASS_SWITCH_MULTILEVEL Instance: 1 Index: 1
2021-08-21 10:50:35.446 Detail, Node002, Notification: ValueAdded CC: COMMAND_CLASS_SWITCH_MULTILEVEL Instance: 1 Index: 2
2021-08-21 10:50:35.446 Detail, Node002, Notification: ValueAdded CC: COMMAND_CLASS_SWITCH_MULTILEVEL Instance: 1 Index: 3
2021-08-21 10:50:35.446 Detail, Node002, Notification: ValueAdded CC: COMMAND_CLASS_SWITCH_MULTILEVEL Instance: 1 Index: 4

Maybe I am using wrong API but then I have no idea on what to use instead.
The ValueId returns that it is a list which is why I chose the GetValueListValues method.

So either I am using the wrong API or something is not ok in the library.

I am attaching the console output since it has some more printouts than OZW_Log.txt and my modified main.cpp in case it is something else.
Main.cpp.txt

MinOZW-output.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant