for (owDevice* dev :*devices) {
if (dev->configstate!=OWDCS_NONE) {
for (size_t i=0;i<4;i++) {
- if (dev->config->getPropertyID(i)!=0)
- printf("\033[3;34m[%s] \033[0m\t",dev->config->getUnit(i).c_str());
+ if (dev->config->getPropertyID(i)!=0) {
+ size_t l=utf8_length(dev->config->getUnit(i));
+ std::string ls=" ";
+ printf("\033[3;34m[%s]%s\033[0m\t",dev->config->getUnit(i).c_str(),ls.substr(0,5-l).c_str());
+ }
}
}
}
if (dev->configstate!=OWDCS_NONE) {
for (size_t i=0;i<4;i++) {
if (dev->config->getPropertyID(i)!=0) {
- if (dev->values[i]<10)
+ if (dev->values[i]<=-10)
+ printf("%0.2f \t",dev->values[i]);
+ else if (dev->values[i]<0)
+ printf("%0.3f \t",dev->values[i]);
+ else if (dev->values[i]<10)
printf("%0.4f \t",dev->values[i]);
else if (dev->values[i]<100)
printf("%0.3f \t",dev->values[i]);
printf("\n");
d->convertAll();
for (size_t i=0;i<d->values.size();i++) {
- printf("\033[1;33m%0.4f %s\033[0m ",d->values[i],d->config->getUnit(i).c_str());
+ printf("\033[1;33m%0.4f %s\033[0m ",d->values[i],d->config->getUnit(i).c_str());
}
printf("\n");
for(int i=0;i<70;i++) printf(HL);printf("\n");
printf("%i Devices found\n",(int)owi->devices.size());
} else
+ if ((s=getArg("v"))!="") {
+ printf("Reset VOC\n");
+ int sel=selectDevice();
+ if (sel==0) exit(0);
+ owDevice* dev=owi->devices[sel-1];
+ std::vector<uint8_t> cl;
+ cl.push_back(0x4E);
+ cl.push_back(0x1F);
+ cl.push_back(0x1F);
+ cl.push_back(0x1F);
+ dev->Communicate(&cl,4,0);
+ } else
if ((s=getArg("n"))!="") {
printf("Change id of selected Device\n");
sprintf(hs,"%016llX",(unsigned long long)dev->getNum().num);
std::string query;
query="INSERT INTO `"+mypre+"OW"+std::string(hs)+"` (";
- for (size_t i=0;i<4;i++) if (dev->config->getPropertyID(i)!=0) query+=std::string(hs)+"_"+std::to_string(i+1)+", ";
+ for (size_t i=0;i<4;i++) if (dev->config->getPropertyID(i)!=0) query+="`"+std::string(hs)+"_"+std::to_string(i+1)+"`, ";
query.pop_back();query.pop_back();
query+=") VALUES (";
for (size_t i=0;i<4;i++) if (dev->config->getPropertyID(i)!=0) query+=std::to_string(dev->values[i])+", ";