node-openzwave
node-openzwave copied to clipboard
Changed values for Decimals
trafficstars
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 ?
I had to do the same thing for my power meter.