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

Changed values for Decimals #41

Open
abalam666 opened this issue Dec 10, 2014 · 1 comment
Open

Changed values for Decimals #41

abalam666 opened this issue Dec 10, 2014 · 1 comment

Comments

@abalam666
Copy link

I noticed that the decimal values have a cast to Interger, then the exact value is lost here :

        case OpenZWave::ValueID::ValueType_Decimal:
        {
            float val;
            OpenZWave::Manager::Get()->GetValueAsFloat(value, &val);
            valobj->Set(String::NewSymbol("value"), Integer::New(val));
            break;
        }

I had to remove those lines, and add a new line above the String case to use the same procedure a keep the exact value (in string) :

        case OpenZWave::ValueID::ValueType_Decimal:
        case OpenZWave::ValueID::ValueType_String:
        {
            std::string val;
            OpenZWave::Manager::Get()->GetValueAsString(value, &val);
            valobj->Set(String::NewSymbol("value"), String::New(val.c_str()));
            break;
        }

I'm not an expert, then maybe there's a better way to keep the Float type too ?
What do you think, folks ?

@simianhacker
Copy link

I had to do the same thing for my power meter.

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

2 participants