# HG changeset patch # User Michiel Broek # Date 1462970847 -7200 # Node ID 0e2c58f8eb78818689fddfdcbc3af2491e3f16c5 # Parent 52bb55ba0b018d99e5eacfce14a7af7c7e04b365 Fixed some MQTT messages. Added more profile MQTT messages. Version 0.5.7 diff -r 52bb55ba0b01 -r 0e2c58f8eb78 configure --- a/configure Mon May 09 21:37:25 2016 +0200 +++ b/configure Wed May 11 14:47:27 2016 +0200 @@ -2035,7 +2035,7 @@ PACKAGE="mbsePi-apps" -VERSION="0.5.6" +VERSION="0.5.7" COPYRIGHT="Copyright (C) 2014-2016 Michiel Broek, All Rights Reserved" CYEARS="2014-2016" diff -r 52bb55ba0b01 -r 0e2c58f8eb78 configure.ac --- a/configure.ac Mon May 09 21:37:25 2016 +0200 +++ b/configure.ac Wed May 11 14:47:27 2016 +0200 @@ -8,7 +8,7 @@ dnl General settings dnl After changeing the version number, run autoconf! PACKAGE="mbsePi-apps" -VERSION="0.5.6" +VERSION="0.5.7" COPYRIGHT="Copyright (C) 2014-2016 Michiel Broek, All Rights Reserved" CYEARS="2014-2016" AC_SUBST(PACKAGE) diff -r 52bb55ba0b01 -r 0e2c58f8eb78 thermferm/server.c --- a/thermferm/server.c Mon May 09 21:37:25 2016 +0200 +++ b/thermferm/server.c Wed May 11 14:47:27 2016 +0200 @@ -2189,7 +2189,7 @@ if (unit->name) { if (strcmp(unit->name, val)) { syslog(LOG_NOTICE, "Fermenter unit %s name `%s' to `%s'", unit->uuid, unit->name, val); - mqtt_publish_str(unit->uuid, (char *)"name", val); + mqtt_publish_str(unit->alias, (char *)"name", val); } free(unit->name); } @@ -2393,11 +2393,11 @@ } } if (unit->heater_address) - mqtt_publish_int(unit->uuid, (char *)"heater", 0); + mqtt_publish_int(unit->alias, (char *)"heater", 0); if (unit->cooler_address) - mqtt_publish_int(unit->uuid, (char *)"cooler", 0); + mqtt_publish_int(unit->alias, (char *)"cooler", 0); if (unit->fan_address) - mqtt_publish_int(unit->uuid, (char *)"fan", 0); + mqtt_publish_int(unit->alias, (char *)"fan", 0); break; } } @@ -2514,11 +2514,11 @@ device_out(unit->fan_address, unit->fan_state); device_out(unit->light_address, unit->light_state); if (unit->heater_address) - mqtt_publish_int(unit->uuid, (char *)"heater", 0); + mqtt_publish_int(unit->alias, (char *)"heater", 0); if (unit->cooler_address) - mqtt_publish_int(unit->uuid, (char *)"cooler", 0); + mqtt_publish_int(unit->alias, (char *)"cooler", 0); if (unit->fan_address) - mqtt_publish_int(unit->uuid, (char *)"fan", 0); + mqtt_publish_int(unit->alias, (char *)"fan", 0); unit->mqtt_flag |= (MQTT_FLAG_PROFILE | MQTT_FLAG_SP); } @@ -2529,17 +2529,17 @@ case PROFILE_OFF: if (unit->prof_state == PROFILE_DONE) { unit->prof_state = PROFILE_OFF; syslog(LOG_NOTICE, "Fermenter unit %s profile to OFF", unit->uuid); - mqtt_publish_str(unit->uuid, (char *)"profile/state", (char *)PROFSTATE[i]); + mqtt_publish_str(unit->alias, (char *)"profile/state", (char *)PROFSTATE[i]); } break; case PROFILE_PAUSE: if (unit->prof_state == PROFILE_RUN) { unit->prof_state = PROFILE_PAUSE; syslog(LOG_NOTICE, "Fermenter unit %s profile PAUSE", unit->uuid); - mqtt_publish_str(unit->uuid, (char *)"profile/state", (char *)PROFSTATE[i]); + mqtt_publish_str(unit->alias, (char *)"profile/state", (char *)PROFSTATE[i]); } else if (unit->prof_state == PROFILE_PAUSE) { unit->prof_state = PROFILE_RUN; syslog(LOG_NOTICE, "Fermenter unit %s profile RESUME", unit->uuid); - mqtt_publish_str(unit->uuid, (char *)"profile/state", (char *)PROFSTATE[PROFILE_RUN]); + mqtt_publish_str(unit->alias, (char *)"profile/state", (char *)PROFSTATE[PROFILE_RUN]); } break; case PROFILE_RUN: if (unit->prof_state == PROFILE_OFF) { @@ -2548,7 +2548,7 @@ unit->prof_paused = unit->prof_primary_done = 0; unit->prof_peak_abs = unit->prof_peak_rel = 0.0; syslog(LOG_NOTICE, "Fermenter unit %s profile to RUN", unit->uuid); - mqtt_publish_str(unit->uuid, (char *)"profile/state", (char *)PROFSTATE[i]); + mqtt_publish_str(unit->alias, (char *)"profile/state", (char *)PROFSTATE[i]); } break; case PROFILE_DONE: break; /* Command is illegal */ @@ -2556,7 +2556,7 @@ unit->prof_state = PROFILE_OFF; unit->prof_started = 0; syslog(LOG_NOTICE, "Fermenter unit %s profile ABORT", unit->uuid); - mqtt_publish_str(unit->uuid, (char *)"profile/state", (char *)PROFSTATE[i]); + mqtt_publish_str(unit->alias, (char *)"profile/state", (char *)PROFSTATE[i]); } break; } diff -r 52bb55ba0b01 -r 0e2c58f8eb78 thermferm/thermferm.c --- a/thermferm/thermferm.c Mon May 09 21:37:25 2016 +0200 +++ b/thermferm/thermferm.c Wed May 11 14:47:27 2016 +0200 @@ -1808,6 +1808,12 @@ if (unit->mqtt_flag & MQTT_FLAG_PROFILE) { mqtt_publish_str(unit->alias, (char *)"profile/uuid", unit->profile); mqtt_publish_str(unit->alias, (char *)"profile/state", (char *)PROFSTATE[unit->prof_state]); + for (profile = Config.profiles; profile; profile = profile->next) { + if (strcmp(unit->profile, profile->uuid) == 0) { + mqtt_publish_str(unit->alias, (char *)"profile/name", profile->name); + mqtt_publish_int(unit->alias, (char *)"profile/fridgemode", profile->fridge_mode); + } + } } if (unit->mqtt_flag & MQTT_FLAG_PERCENT) { mqtt_publish_int(unit->alias, (char *)"profile/percent", unit->prof_percent);