OpenZWave / openzwave-dotnet-uwp

An Open-ZWave wrapper for use with .NET or UWP apps
Apache License 2.0
45 stars 27 forks source link

PowerOn non-functional in OZWForm sample app #16

Open rscott78 opened 7 years ago

rscott78 commented 7 years ago

I'm trying to use the sample app to evaluate this library for a project of mine. I'm finding that the app won't power on/off my devices.

I've tracked it down to this function:

Manager.cpp


    if( ValueID::ValueType_Int == _id.GetType() )
    {
        if( Driver* driver = GetDriver( _id.GetHomeId() ) )
        {
            if( _id.GetNodeId() != driver->GetControllerNodeId() )
            {
                LockGuard LG(driver->m_nodeMutex);
                if( ValueInt* value = static_cast<ValueInt*>( driver->GetValue( _id ) ) )
                {
                    res = value->Set( _value );
                    value->Release();
                } else {
                    OZW_ERROR(OZWException::OZWEXCEPTION_INVALID_VALUEID, "Invalid ValueID passed to SetValue");
                }
            }
        }
    } else {
        OZW_ERROR(OZWException::OZWEXCEPTION_CANNOT_CONVERT_VALUEID, "ValueID passed to SetValue is not a Int Value");
    }

First, when the SetValue is called m_manager.SetValue(new ZWValueId(m_homeId, m_rightClickNode, ZWValueGenre.Basic, 0x20, 0x01, 0x00, ZWValueType.Byte, 0x00), 0xFF); it fails on the first if statement in the above method because the value is passed as a Byte.

When I bypass that first if statement, it fails on the if statement that says if( ValueInt* value = static_cast<ValueInt*>( driver->GetValue( _id ) ) ) (invalid value id passed).

Is this a configuration problem with my devices?

dotMorten commented 7 years ago

Do I read this right that the value type is an int, but you send a byte? The types must match.

How are you calling the API that gets you in here?

rscott78 commented 7 years ago

Sure... but that's what's in the sample code provided with the project (i.e, if you ran the sample OZWForm project you'd run into the same problem). Even when I change it to a byte, it still fails on the following IF statement.