Skip to content

Commit

Permalink
Merge pull request emsesp#1400 from MichaelDvP/dev2x
Browse files Browse the repository at this point in the history
Small change from my Dev2
  • Loading branch information
proddy authored Nov 9, 2023
2 parents 06f5e12 + 5d0242b commit 8c03592
Show file tree
Hide file tree
Showing 14 changed files with 248 additions and 193 deletions.
10 changes: 5 additions & 5 deletions src/analogsensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ void AnalogSensor::publish_values(const bool force) {
StaticJsonDocument<EMSESP_JSON_SIZE_MEDIUM> config;

char stat_t[50];
snprintf(stat_t, sizeof(stat_t), "%s/%s_data", Mqtt::basename().c_str(), F_(analogsensor)); // use base path
snprintf(stat_t, sizeof(stat_t), "%s/%s_data", Mqtt::base().c_str(), F_(analogsensor)); // use base path
config["stat_t"] = stat_t;

char val_obj[50];
Expand Down Expand Up @@ -561,7 +561,7 @@ void AnalogSensor::publish_values(const bool force) {
if (sensor.type() == AnalogType::DIGITAL_OUT) {
#endif
snprintf(topic, sizeof(topic), "switch/%s/%s_%02d/config", Mqtt::basename().c_str(), F_(analogsensor), sensor.gpio());
snprintf(command_topic, sizeof(command_topic), "%s/%s/%s", Mqtt::basename().c_str(), F_(analogsensor), sensor.name().c_str());
snprintf(command_topic, sizeof(command_topic), "%s/%s/%s", Mqtt::base().c_str(), F_(analogsensor), sensor.name().c_str());
config["cmd_t"] = command_topic;
if (EMSESP::system_.bool_format() == BOOL_FORMAT_TRUEFALSE) {
config["pl_on"] = true;
Expand All @@ -576,23 +576,23 @@ void AnalogSensor::publish_values(const bool force) {
}
} else if (sensor.type() == AnalogType::DIGITAL_OUT) { // DAC
snprintf(topic, sizeof(topic), "number/%s/%s_%02d/config", Mqtt::basename().c_str(), F_(analogsensor), sensor.gpio());
snprintf(command_topic, sizeof(command_topic), "%s/%s/%s", Mqtt::basename().c_str(), F_(analogsensor), sensor.name().c_str());
snprintf(command_topic, sizeof(command_topic), "%s/%s/%s", Mqtt::base().c_str(), F_(analogsensor), sensor.name().c_str());
config["cmd_t"] = command_topic;
config["min"] = 0;
config["max"] = 255;
config["mode"] = "box"; // auto, slider or box
config["step"] = 1;
} else if (sensor.type() >= AnalogType::PWM_0 && sensor.type() <= AnalogType::PWM_2) {
snprintf(topic, sizeof(topic), "number/%s/%s_%02d/config", Mqtt::basename().c_str(), F_(analogsensor), sensor.gpio());
snprintf(command_topic, sizeof(command_topic), "%s/%s/%s", Mqtt::basename().c_str(), F_(analogsensor), sensor.name().c_str());
snprintf(command_topic, sizeof(command_topic), "%s/%s/%s", Mqtt::base().c_str(), F_(analogsensor), sensor.name().c_str());
config["cmd_t"] = command_topic;
config["min"] = 0;
config["max"] = 100;
config["mode"] = "box"; // auto, slider or box
config["step"] = 0.1;
} else if (sensor.type() == AnalogType::COUNTER) {
snprintf(topic, sizeof(topic), "sensor/%s/%s_%02d/config", Mqtt::basename().c_str(), F_(analogsensor), sensor.gpio());
snprintf(command_topic, sizeof(command_topic), "%s/%s/%s", Mqtt::basename().c_str(), F_(analogsensor), sensor.name().c_str());
snprintf(command_topic, sizeof(command_topic), "%s/%s/%s", Mqtt::base().c_str(), F_(analogsensor), sensor.name().c_str());
config["cmd_t"] = command_topic;
config["stat_cla"] = "total_increasing";
// config["mode"] = "box"; // auto, slider or box
Expand Down
155 changes: 98 additions & 57 deletions src/devices/boiler.cpp

Large diffs are not rendered by default.

15 changes: 9 additions & 6 deletions src/devices/boiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,11 @@ class Boiler : public EMSdevice {

// ww
uint8_t wwSetTemp_; // DHW set temperature
uint8_t wwSelTemp_; // DHW selected temperature
uint8_t wwSelTempLow_; // DHW lower selected temperature
uint8_t wwSelTemp_; // DHW selected temperature (comfort)
uint8_t wwSelTempLow_; // DHW lower selected temperature (eco)
uint8_t wwSelTempOff_; // DHW selected temperature for off position
uint8_t wwSelTempSingle_; // DHW single charge temperature
uint8_t wwSelTempEcoplus_; // DHW ECO+ temperature
uint8_t wwType_; // 0-off, 1-flow, 2-flowbuffer, 3-buffer, 4-layered buffer
uint8_t wwComfort_; // WW comfort mode
uint8_t wwComfort1_; // WW comfort mode RC310
Expand Down Expand Up @@ -192,10 +193,10 @@ class Boiler : public EMSdevice {
uint16_t hpBrineOut_;
uint8_t hpSwitchValve_;
uint8_t hpActivity_;
uint8_t hpHeatingOn_;
uint8_t hpCoolingOn_;
uint8_t hpWwOn_;
uint8_t hpPoolOn_;
// uint8_t hpHeatingOn_;
// uint8_t hpCoolingOn_;
// uint8_t hpWwOn_;
// uint8_t hpPoolOn_;
int16_t hpTc0_;
int16_t hpTc1_;
int16_t hpTc3_;
Expand Down Expand Up @@ -263,6 +264,7 @@ class Boiler : public EMSdevice {
uint8_t primePump_;
uint8_t primePumpMod_;
uint8_t hp3wayValve_;
uint8_t hp4wayValve_;
uint8_t elHeatStep1_;
uint8_t elHeatStep2_;
uint8_t elHeatStep3_;
Expand Down Expand Up @@ -355,6 +357,7 @@ class Boiler : public EMSdevice {
bool set_ww_circulation_mode(const char * value, const int8_t id);
bool set_ww_temp(const char * value, const int8_t id);
bool set_ww_temp_low(const char * value, const int8_t id);
bool set_ww_temp_eco(const char * value, const int8_t id);
bool set_ww_temp_single(const char * value, const int8_t id);
bool set_ww_disinfect_temp(const char * value, const int8_t id);
bool set_ww_maxpower(const char * value, const int8_t id);
Expand Down
5 changes: 1 addition & 4 deletions src/emsesp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -481,8 +481,6 @@ void EMSESP::publish_all(bool force) {
publish_device_values(EMSdevice::DeviceType::SOLAR);
publish_device_values(EMSdevice::DeviceType::MIXER);
publish_other_values(); // switch and heat pump, ...
webSchedulerService.publish();
webCustomEntityService.publish();
publish_sensor_values(true); // includes temperature and analog sensors
system_.send_heartbeat();
}
Expand Down Expand Up @@ -514,8 +512,6 @@ void EMSESP::publish_all_loop() {
break;
case 5:
publish_other_values(); // switch and heat pump
webSchedulerService.publish(true);
webCustomEntityService.publish(true);
break;
case 6:
publish_sensor_values(true, true);
Expand Down Expand Up @@ -606,6 +602,7 @@ void EMSESP::publish_other_values() {
// publish_device_values(EMSdevice::DeviceType::GATEWAY);
// publish_device_values(EMSdevice::DeviceType::CONNECT);
// publish_device_values(EMSdevice::DeviceType::GENERIC);
webSchedulerService.publish();
webCustomEntityService.publish();
}

Expand Down
1 change: 1 addition & 0 deletions src/locale_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ MAKE_ENUM(enum_lowNoiseMode, FL_(off), FL_(reduced_output), FL_(switchoff), FL_(
// heat pump
MAKE_ENUM(enum_hpactivity, FL_(none), FL_(heating), FL_(cooling), FL_(hot_water), FL_(pool), FL_(unknown), FL_(defrost))
MAKE_ENUM(enum_silentMode, FL_(off), FL_(auto), FL_(on))
MAKE_ENUM(enum_4way, FL_(cool_defrost), FL_(heat_ww))

// solar
MAKE_ENUM(enum_solarmode, FL_(constant), FL_(pwm), FL_(analog))
Expand Down
Loading

0 comments on commit 8c03592

Please sign in to comment.