I am a newbie in ZWave technology. I would like to establish C++ app for controlling ZWave devices using OpenZwave library for C++.
I have a problem with Zipato Bulb2, when I want to change light color. I can set dimmer value, but the color doesn't change, although there is updated color data in the log.
I was trying to set color in this way:
Code: Select all
void SetBulbColor(){
string colorVal = "#";
string *gathered = new string[1];
for(int i=0; i<5; i++){
colorVal += RequestColorComponent();
}
int bulbNode = 11;
int colorCommandClass = 0x33;
int colorIndex = 0;
pthread_mutex_lock( &g_criticalSection);
NodeInfo *foundNode = GetNodeById(bulbNode);
for(list<ValueID>::iterator it = foundNode->m_values.begin(); it != foundNode->m_values.end(); it++){
ValueID v = *it;
if((v.GetCommandClassId() == colorCommandClass) && (v.GetIndex() == colorIndex)){
cout<<"Setting color to: "<< colorVal<<endl;
Manager::Get()->SetValue(v, colorVal);
printf("Successfully set!\n");
Manager::Get()->GetValueAsString(v, gathered);
cout << "GetValue() returned "<<gathered[0] << endl;
}
}
pthread_mutex_unlock( &g_criticalSection );
}
Thanks in advance ,
Zan