|
|
|
@ -20,7 +20,8 @@ void help() {
|
|
|
|
|
printf ("\tconnect connect to the device, it will save the SID file.\n");
|
|
|
|
|
printf ("\tlist lists all devices, connection will be recovered from SID.\n");
|
|
|
|
|
printf ("\t If silent parameter is set, we will not be asked for credentials\n");
|
|
|
|
|
printf ("\tgethzr AIN options reads heating control device\n");
|
|
|
|
|
printf ("\tlisthkr shows a list of Heating Crontrols\n");
|
|
|
|
|
printf ("\tgethkr AIN options reads heating control device\n");
|
|
|
|
|
printf ("\t -nochart display no history chart\n");
|
|
|
|
|
printf ("\tsaveconfig save configfile.\n");
|
|
|
|
|
printf ("\n");
|
|
|
|
@ -69,8 +70,8 @@ void getlist(int argpos, int argc, char **argv) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#define CHARTSIZE 20
|
|
|
|
|
void gethzr(int argci, int argc, char **argv) {
|
|
|
|
|
FBSmartHomeHZR hzr;
|
|
|
|
|
void gethkr(int argci, int argc, char **argv) {
|
|
|
|
|
FBSmartHomeHKR hkr;
|
|
|
|
|
list<float>::iterator iter;
|
|
|
|
|
float fmin, fmax;
|
|
|
|
|
std::string s;
|
|
|
|
@ -88,36 +89,36 @@ void gethzr(int argci, int argc, char **argv) {
|
|
|
|
|
|
|
|
|
|
if (ain == NULL) return;
|
|
|
|
|
connect();
|
|
|
|
|
fbsh.GetHZR((std::string)ain, &hzr);
|
|
|
|
|
fbsh.GetHKR((std::string)ain, &hkr);
|
|
|
|
|
|
|
|
|
|
printf ("Name:%s ID:%s\n", hzr.name.c_str(), hzr.id.c_str());
|
|
|
|
|
printf (" Temp: %.1f\n", hzr.temp);
|
|
|
|
|
printf (" Temp Akt: %.1f\n", hzr.temp_cur);
|
|
|
|
|
printf (" Temp Set: %.1f\n", hzr.temp_set);
|
|
|
|
|
printf (" Temp Komfort: %.1f\n", hzr.temp_h);
|
|
|
|
|
printf (" Temp Absenk: %.1f\n", hzr.temp_l);
|
|
|
|
|
printf (" Offset: %d\n", hzr.offset);
|
|
|
|
|
printf (" Grid: %d\n", hzr.statsgrid);
|
|
|
|
|
printf ("Name:%s ID:%s\n", hkr.name.c_str(), hkr.id.c_str());
|
|
|
|
|
printf (" Temp: %.1f\n", hkr.temp);
|
|
|
|
|
printf (" Temp Akt: %.1f\n", hkr.temp_cur);
|
|
|
|
|
printf (" Temp Set: %.1f\n", hkr.temp_set);
|
|
|
|
|
printf (" Temp Komfort: %.1f\n", hkr.temp_h);
|
|
|
|
|
printf (" Temp Absenk: %.1f\n", hkr.temp_l);
|
|
|
|
|
printf (" Offset: %d\n", hkr.offset);
|
|
|
|
|
printf (" Grid: %d\n", hkr.statsgrid);
|
|
|
|
|
|
|
|
|
|
if (!nochart) {
|
|
|
|
|
for (iter = hzr.stats.begin(); iter != hzr.stats.end(); iter++) {
|
|
|
|
|
if (iter == hzr.stats.begin()) fmin = fmax = *iter;
|
|
|
|
|
for (iter = hkr.stats.begin(); iter != hkr.stats.end(); iter++) {
|
|
|
|
|
if (iter == hkr.stats.begin()) fmin = fmax = *iter;
|
|
|
|
|
if (fmin > *iter) fmin = *iter;
|
|
|
|
|
if (fmax < *iter) fmax = *iter;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
printf (" %-2.1f %-2.1f\n", fmin/10.0, fmax/10.0);
|
|
|
|
|
|
|
|
|
|
ctime = (ctime / hzr.statsgrid) * hzr.statsgrid;
|
|
|
|
|
ctime = (ctime / hkr.statsgrid) * hkr.statsgrid;
|
|
|
|
|
|
|
|
|
|
for (iter = hzr.stats.begin(); iter != hzr.stats.end(); iter++) {
|
|
|
|
|
for (iter = hkr.stats.begin(); iter != hkr.stats.end(); iter++) {
|
|
|
|
|
s = " ";
|
|
|
|
|
c = ((float)(CHARTSIZE * (*iter - fmin) / (fmax-fmin)));
|
|
|
|
|
for (i = 0; i < c; i++) s += " ";
|
|
|
|
|
s += "*";
|
|
|
|
|
for (i = c+1; i <= CHARTSIZE; i++) s += " ";
|
|
|
|
|
|
|
|
|
|
ctime -= hzr.statsgrid;
|
|
|
|
|
ctime -= hkr.statsgrid;
|
|
|
|
|
tmp = localtime(&ctime);
|
|
|
|
|
strftime(t, 64, "%H:%M", tmp);
|
|
|
|
|
printf (" %s |%s|\n", t, s.c_str());
|
|
|
|
@ -127,6 +128,28 @@ void gethzr(int argci, int argc, char **argv) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void listhkr(int argci, int argc, char **argv) {
|
|
|
|
|
FBSmartHomeHKR hkr;
|
|
|
|
|
std::list<FBSmartHomeDevice> *devlist;
|
|
|
|
|
std::list<FBSmartHomeDevice>::iterator iter;
|
|
|
|
|
|
|
|
|
|
connect ();
|
|
|
|
|
devlist = fbsh.GetDevices();
|
|
|
|
|
if (devlist == NULL) {
|
|
|
|
|
fprintf (stderr, "Error Retrieving Devices: %s\n", strerror(errno));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (iter = devlist->begin(); iter != devlist->end(); iter++) {
|
|
|
|
|
if (iter->type.compare("hkr") == 0) {
|
|
|
|
|
fbsh.GetHKR(iter->id, &hkr);
|
|
|
|
|
printf ("%s name:%s temp:%.1f cur:%.1f set:%.1f\n", hkr.id.c_str(), hkr.name.c_str(), hkr.temp, hkr.temp_cur, hkr.temp_set);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
delete devlist;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int main(int argc, char** argv) {
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
@ -154,9 +177,13 @@ int main(int argc, char** argv) {
|
|
|
|
|
config.SaveConfig();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else if (strcmp(argv[i], "gethzr") == 0) {
|
|
|
|
|
gethzr(i, argc, argv);
|
|
|
|
|
else if (strcmp(argv[i], "gethkr") == 0) {
|
|
|
|
|
gethkr(i, argc, argv);
|
|
|
|
|
}
|
|
|
|
|
else if (strcmp(argv[i], "listhkr") == 0) {
|
|
|
|
|
listhkr(i, argc, argv);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// parameters will follow here
|
|
|
|
|