rename topics

This commit is contained in:
MichaelDvP
2020-10-24 17:47:10 +02:00
parent b42b7664ee
commit 9ecb4f4a73
19 changed files with 161 additions and 184 deletions

View File

@@ -124,9 +124,9 @@ class MqttSettingsForm extends React.Component<MqttSettingsFormProps> {
variant="outlined" variant="outlined"
onChange={handleValueChange('mqtt_qos')} onChange={handleValueChange('mqtt_qos')}
margin="normal"> margin="normal">
<MenuItem value={0}>0</MenuItem> <MenuItem value={0}>0 - At most once</MenuItem>
<MenuItem value={1}>1</MenuItem> <MenuItem value={1}>1 - At least once</MenuItem>
<MenuItem value={2}>2</MenuItem> <MenuItem value={2}>2 - Exactly once</MenuItem>
</SelectValidator> </SelectValidator>
<BlockFormControlLabel <BlockFormControlLabel
control={ control={
@@ -191,13 +191,13 @@ class MqttSettingsForm extends React.Component<MqttSettingsFormProps> {
<TextValidator <TextValidator
validators={['required', 'isNumber', 'minNumber:0', 'maxNumber:65535']} validators={['required', 'isNumber', 'minNumber:0', 'maxNumber:65535']}
errorMessages={['Publish time is required', "Must be a number", "Must be 0 or greater", "Max value is 65535"]} errorMessages={['Publish time is required', "Must be a number", "Must be 0 or greater", "Max value is 65535"]}
name="publish_time_mixing" name="publish_time_mixer"
label="Mixer Publish Interval (seconds, 0=on change)" label="Mixer Publish Interval (seconds, 0=on change)"
fullWidth fullWidth
variant="outlined" variant="outlined"
value={data.publish_time_mixing} value={data.publish_time_mixer}
type="number" type="number"
onChange={handleValueChange('publish_time_mixing')} onChange={handleValueChange('publish_time_mixer')}
margin="normal" margin="normal"
/> />
<TextValidator <TextValidator

View File

@@ -30,7 +30,7 @@ export interface MqttSettings {
publish_time_boiler: number; publish_time_boiler: number;
publish_time_thermostat: number; publish_time_thermostat: number;
publish_time_solar: number; publish_time_solar: number;
publish_time_mixing: number; publish_time_mixer: number;
publish_time_other: number; publish_time_other: number;
publish_time_sensor: number; publish_time_sensor: number;
mqtt_format: number; mqtt_format: number;

View File

@@ -103,7 +103,7 @@ class EMSESPDevicesForm extends Component<
return ( return (
<TableContainer> <TableContainer>
<Typography variant="h6" color="primary"> <Typography variant="h6" color="primary">
Devices EMS Devices
</Typography> </Typography>
<p></p> <p></p>
{!this.noDevices() && ( {!this.noDevices() && (
@@ -180,7 +180,7 @@ class EMSESPDevicesForm extends Component<
<TableContainer> <TableContainer>
<p></p> <p></p>
<Typography variant="h6" color="primary" paragraph> <Typography variant="h6" color="primary" paragraph>
Sensors Dallas Sensors
</Typography> </Typography>
{!this.noSensors() && ( {!this.noSensors() && (
<Table size="small" padding="default"> <Table size="small" padding="default">

View File

@@ -187,7 +187,7 @@ void MqttSettings::read(MqttSettings & settings, JsonObject & root) {
root["publish_time_boiler"] = settings.publish_time_boiler; root["publish_time_boiler"] = settings.publish_time_boiler;
root["publish_time_thermostat"] = settings.publish_time_thermostat; root["publish_time_thermostat"] = settings.publish_time_thermostat;
root["publish_time_solar"] = settings.publish_time_solar; root["publish_time_solar"] = settings.publish_time_solar;
root["publish_time_mixing"] = settings.publish_time_mixing; root["publish_time_mixer"] = settings.publish_time_mixer;
root["publish_time_other"] = settings.publish_time_other; root["publish_time_other"] = settings.publish_time_other;
root["publish_time_sensor"] = settings.publish_time_sensor; root["publish_time_sensor"] = settings.publish_time_sensor;
root["mqtt_format"] = settings.mqtt_format; root["mqtt_format"] = settings.mqtt_format;
@@ -211,7 +211,7 @@ StateUpdateResult MqttSettings::update(JsonObject & root, MqttSettings & setting
newSettings.publish_time_boiler = root["publish_time_boiler"] | EMSESP_DEFAULT_PUBLISH_TIME; newSettings.publish_time_boiler = root["publish_time_boiler"] | EMSESP_DEFAULT_PUBLISH_TIME;
newSettings.publish_time_thermostat = root["publish_time_thermostat"] | EMSESP_DEFAULT_PUBLISH_TIME; newSettings.publish_time_thermostat = root["publish_time_thermostat"] | EMSESP_DEFAULT_PUBLISH_TIME;
newSettings.publish_time_solar = root["publish_time_solar"] | EMSESP_DEFAULT_PUBLISH_TIME; newSettings.publish_time_solar = root["publish_time_solar"] | EMSESP_DEFAULT_PUBLISH_TIME;
newSettings.publish_time_mixing = root["publish_time_mixing"] | EMSESP_DEFAULT_PUBLISH_TIME; newSettings.publish_time_mixer = root["publish_time_mixer"] | EMSESP_DEFAULT_PUBLISH_TIME;
newSettings.publish_time_other = root["publish_time_other"] | EMSESP_DEFAULT_PUBLISH_TIME; newSettings.publish_time_other = root["publish_time_other"] | EMSESP_DEFAULT_PUBLISH_TIME;
newSettings.publish_time_sensor = root["publish_time_sensor"] | EMSESP_DEFAULT_PUBLISH_TIME; newSettings.publish_time_sensor = root["publish_time_sensor"] | EMSESP_DEFAULT_PUBLISH_TIME;
newSettings.mqtt_format = root["mqtt_format"] | EMSESP_DEFAULT_MQTT_FORMAT; newSettings.mqtt_format = root["mqtt_format"] | EMSESP_DEFAULT_MQTT_FORMAT;
@@ -239,8 +239,8 @@ StateUpdateResult MqttSettings::update(JsonObject & root, MqttSettings & setting
if (newSettings.publish_time_solar != settings.publish_time_solar) { if (newSettings.publish_time_solar != settings.publish_time_solar) {
emsesp::EMSESP::mqtt_.set_publish_time_solar(newSettings.publish_time_solar); emsesp::EMSESP::mqtt_.set_publish_time_solar(newSettings.publish_time_solar);
} }
if (newSettings.publish_time_mixing != settings.publish_time_mixing) { if (newSettings.publish_time_mixer != settings.publish_time_mixer) {
emsesp::EMSESP::mqtt_.set_publish_time_mixing(newSettings.publish_time_mixing); emsesp::EMSESP::mqtt_.set_publish_time_mixer(newSettings.publish_time_mixer);
} }
if (newSettings.publish_time_other != settings.publish_time_other) { if (newSettings.publish_time_other != settings.publish_time_other) {
emsesp::EMSESP::mqtt_.set_publish_time_other(newSettings.publish_time_other); emsesp::EMSESP::mqtt_.set_publish_time_other(newSettings.publish_time_other);

View File

@@ -88,7 +88,7 @@ class MqttSettings {
uint16_t publish_time_boiler; uint16_t publish_time_boiler;
uint16_t publish_time_thermostat; uint16_t publish_time_thermostat;
uint16_t publish_time_solar; uint16_t publish_time_solar;
uint16_t publish_time_mixing; uint16_t publish_time_mixer;
uint16_t publish_time_other; uint16_t publish_time_other;
uint16_t publish_time_sensor; uint16_t publish_time_sensor;
uint8_t mqtt_format; // 1=single, 2=nested, 3=ha, 4=custom uint8_t mqtt_format; // 1=single, 2=nested, 3=ha, 4=custom

View File

@@ -233,12 +233,12 @@ void EMSESPShell::add_console_commands() {
Device_Ids.push_back(0x09); // Controllers - 0x09 Device_Ids.push_back(0x09); // Controllers - 0x09
Device_Ids.push_back(0x02); // Connect - 0x02 Device_Ids.push_back(0x02); // Connect - 0x02
Device_Ids.push_back(0x48); // Gateway - 0x48 Device_Ids.push_back(0x48); // Gateway - 0x48
Device_Ids.push_back(0x20); // Mixing Devices - 0x20 Device_Ids.push_back(0x20); // Mixer Devices - 0x20
Device_Ids.push_back(0x21); // Mixing Devices - 0x21 Device_Ids.push_back(0x21); // Mixer Devices - 0x21
Device_Ids.push_back(0x22); // Mixing Devices - 0x22 Device_Ids.push_back(0x22); // Mixer Devices - 0x22
Device_Ids.push_back(0x23); // Mixing Devices - 0x23 Device_Ids.push_back(0x23); // Mixer Devices - 0x23
Device_Ids.push_back(0x28); // Mixing Devices WW- 0x28 Device_Ids.push_back(0x28); // Mixer Devices WW- 0x28
Device_Ids.push_back(0x29); // Mixing Devices WW- 0x29 Device_Ids.push_back(0x29); // Mixer Devices WW- 0x29
Device_Ids.push_back(0x10); // Thermostats - 0x10 Device_Ids.push_back(0x10); // Thermostats - 0x10
Device_Ids.push_back(0x17); // Thermostats - 0x17 Device_Ids.push_back(0x17); // Thermostats - 0x17
Device_Ids.push_back(0x18); // Thermostat remote - 0x18 Device_Ids.push_back(0x18); // Thermostat remote - 0x18

View File

@@ -98,12 +98,12 @@
{163, DeviceType::SOLAR, F("SM100/MS100"), DeviceFlags::EMS_DEVICE_FLAG_SM100}, {163, DeviceType::SOLAR, F("SM100/MS100"), DeviceFlags::EMS_DEVICE_FLAG_SM100},
{164, DeviceType::SOLAR, F("SM200/MS200"), DeviceFlags::EMS_DEVICE_FLAG_SM100}, {164, DeviceType::SOLAR, F("SM200/MS200"), DeviceFlags::EMS_DEVICE_FLAG_SM100},
// Mixing Modules - 0x20-0x27 for HC, 0x28-0x29 for WWC // Mixer Modules - 0x20-0x27 for HC, 0x28-0x29 for WWC
{ 69, DeviceType::MIXING, F("MM10"), DeviceFlags::EMS_DEVICE_FLAG_MM10}, { 69, DeviceType::MIXER, F("MM10"), DeviceFlags::EMS_DEVICE_FLAG_MM10},
{102, DeviceType::MIXING, F("IPM"), DeviceFlags::EMS_DEVICE_FLAG_IPM}, {102, DeviceType::MIXER, F("IPM"), DeviceFlags::EMS_DEVICE_FLAG_IPM},
{159, DeviceType::MIXING, F("MM50"), DeviceFlags::EMS_DEVICE_FLAG_MMPLUS}, {159, DeviceType::MIXER, F("MM50"), DeviceFlags::EMS_DEVICE_FLAG_MMPLUS},
{160, DeviceType::MIXING, F("MM100"), DeviceFlags::EMS_DEVICE_FLAG_MMPLUS}, {160, DeviceType::MIXER, F("MM100"), DeviceFlags::EMS_DEVICE_FLAG_MMPLUS},
{161, DeviceType::MIXING, F("MM200"), DeviceFlags::EMS_DEVICE_FLAG_MMPLUS}, {161, DeviceType::MIXER, F("MM200"), DeviceFlags::EMS_DEVICE_FLAG_MMPLUS},
// Heat Pumps - 0x38 // Heat Pumps - 0x38
{200, DeviceType::HEATPUMP, F("HP Module"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, {200, DeviceType::HEATPUMP, F("HP Module"), DeviceFlags::EMS_DEVICE_FLAG_NONE},

View File

@@ -107,37 +107,37 @@ void Boiler::register_mqtt_ha_config(bool force) {
Mqtt::register_mqtt_ha_binary_sensor(F_(heatingActive), this->device_type(), "heating_active"); Mqtt::register_mqtt_ha_binary_sensor(F_(heatingActive), this->device_type(), "heating_active");
// main // main
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(serviceCodeNumber), this->device_type(), "serviceCodeNumber", nullptr, F_(iconpower)); Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(serviceCodeNumber), this->device_type(), "serviceCodeNumber", nullptr, F_(iconpower));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(selFlowTemp), this->device_type(), "selFlowTemp", F_(degrees), F_(iconcruise)); Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(selFlowTemp), this->device_type(), "selFlowTemp", F_(degrees), F_(iconcruise));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(selBurnPow), this->device_type(), "selBurnPow", F_(percent), F_(iconpercent)); Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(selBurnPow), this->device_type(), "selBurnPow", F_(percent), F_(iconpercent));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(curBurnPow), this->device_type(), "curBurnPow", F_(percent), F_(iconfire)); Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(curBurnPow), this->device_type(), "curBurnPow", F_(percent), F_(iconfire));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(pumpMod), this->device_type(), "pumpMod", F_(percent), F_(iconpercent)); Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(pumpMod), this->device_type(), "pumpMod", F_(percent), F_(iconpercent));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(pumpMod2), this->device_type(), "pumpMod2", F_(percent), F_(iconpercent)); Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(pumpMod2), this->device_type(), "pumpMod2", F_(percent), F_(iconpercent));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(outdoorTemp), this->device_type(), "outdoorTemp", F_(degrees), F_(iconexport)); Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(outdoorTemp), this->device_type(), "outdoorTemp", F_(degrees), F_(iconexport));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(curFlowTemp), this->device_type(), "curFlowTemp", F_(degrees), F_(icontemperature)); Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(curFlowTemp), this->device_type(), "curFlowTemp", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(retTemp), this->device_type(), "retTemp", F_(degrees), F_(icontemperature)); Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(retTemp), this->device_type(), "retTemp", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(switchTemp), this->device_type(), "switchTemp", F_(degrees), F_(icontemperature)); Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(switchTemp), this->device_type(), "switchTemp", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(sysPress), this->device_type(), "sysPress", F_(bar), nullptr); Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(sysPress), this->device_type(), "sysPress", F_(bar), nullptr);
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(boilTemp), this->device_type(), "boilTemp", F_(degrees), nullptr); Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(boilTemp), this->device_type(), "boilTemp", F_(degrees), nullptr);
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(burnGas), this->device_type(), "burnGas", nullptr, F_(iconfire)); Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(burnGas), this->device_type(), "burnGas", nullptr, F_(iconfire));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(flameCurr), this->device_type(), "flameCurr", F_(uA), F_(iconflash)); Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(flameCurr), this->device_type(), "flameCurr", F_(uA), F_(iconflash));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(heatPump), this->device_type(), "heatPump", nullptr, F_(iconwaterpump)); Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(heatPump), this->device_type(), "heatPump", nullptr, F_(iconwaterpump));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(fanWork), this->device_type(), "fanWork", nullptr, F_(iconfan)); Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(fanWork), this->device_type(), "fanWork", nullptr, F_(iconfan));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(ignWork), this->device_type(), "ignWork", nullptr, F_(iconflash)); Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(ignWork), this->device_type(), "ignWork", nullptr, F_(iconflash));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(exhaustTemp), this->device_type(), "exhaustTemp", F_(degrees), F_(icontemperature)); Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(exhaustTemp), this->device_type(), "exhaustTemp", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(heatingActivated), this->device_type(), "heatingActivated", nullptr, nullptr); Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(heatingActivated), this->device_type(), "heatingActivated", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(heatingTemp), this->device_type(), "heatingTemp", F_(degrees), F_(icontemperature)); Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(heatingTemp), this->device_type(), "heatingTemp", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(pumpModMax), this->device_type(), "pumpModMax", F_(percent), F_(iconpercent)); Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(pumpModMax), this->device_type(), "pumpModMax", F_(percent), F_(iconpercent));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(pumpModMin), this->device_type(), "pumpModMin", F_(percent), F_(iconpercent)); Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(pumpModMin), this->device_type(), "pumpModMin", F_(percent), F_(iconpercent));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(pumpDelay), this->device_type(), "pumpDelay", F_(min), nullptr); Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(pumpDelay), this->device_type(), "pumpDelay", F_(min), nullptr);
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(burnMinPeriod), this->device_type(), "burnMinPeriod", F_(min), nullptr); Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(burnMinPeriod), this->device_type(), "burnMinPeriod", F_(min), nullptr);
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(burnMinPower), this->device_type(), "burnMinPower", F_(percent), F_(iconpercent)); Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(burnMinPower), this->device_type(), "burnMinPower", F_(percent), F_(iconpercent));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(burnMaxPower), this->device_type(), "burnMaxPower", F_(percent), F_(iconpercent)); Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(burnMaxPower), this->device_type(), "burnMaxPower", F_(percent), F_(iconpercent));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(boilHystOn), this->device_type(), "boilHystOn", F_(degrees), F_(icontemperature)); Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(boilHystOn), this->device_type(), "boilHystOn", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(boilHystOff), this->device_type(), "boilHystOff", F_(degrees), F_(icontemperature)); Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(boilHystOff), this->device_type(), "boilHystOff", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(setFlowTemp), this->device_type(), "setFlowTemp", F_(degrees), F_(icontemperature)); Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(setFlowTemp), this->device_type(), "setFlowTemp", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(setBurnPow), this->device_type(), "setBurnPow", F_(percent), F_(iconpercent)); Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(setBurnPow), this->device_type(), "setBurnPow", F_(percent), F_(iconpercent));
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_main), F_(burnStarts), this->device_type(), "burnStarts", nullptr, nullptr); Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(burnStarts), this->device_type(), "burnStarts", nullptr, nullptr);
// ww // ww
Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_ww), F_(wWSelTemp), this->device_type(), "wWSelTemp", F_(degrees), F_(iconcruise)); Mqtt::register_mqtt_ha_sensor(nullptr, F_(mqtt_suffix_ww), F_(wWSelTemp), this->device_type(), "wWSelTemp", F_(degrees), F_(iconcruise));
@@ -618,7 +618,7 @@ void Boiler::publish_values(JsonObject & json, bool force) {
DynamicJsonDocument doc_main(EMSESP_MAX_JSON_SIZE_LARGE); DynamicJsonDocument doc_main(EMSESP_MAX_JSON_SIZE_LARGE);
JsonObject json_main = doc_main.to<JsonObject>(); JsonObject json_main = doc_main.to<JsonObject>();
if (export_values_main(json_main)) { if (export_values_main(json_main)) {
Mqtt::publish(F("boiler_data_main"), doc_main.as<JsonObject>()); Mqtt::publish(F("boiler_data"), doc_main.as<JsonObject>());
} }
DynamicJsonDocument doc_ww(EMSESP_MAX_JSON_SIZE_LARGE); DynamicJsonDocument doc_ww(EMSESP_MAX_JSON_SIZE_LARGE);
@@ -759,31 +759,6 @@ void Boiler::check_active() {
EMSESP::tap_water_active(b); // let EMS-ESP know, used in the Shower class EMSESP::tap_water_active(b); // let EMS-ESP know, used in the Shower class
} }
/*
// hot tap water, using flow to check instead of the burner power
// send these values back to the main EMSESP, so other classes (e.g. Shower) can use it
if (Helpers::hasValue(wWCurFlow_) && Helpers::hasValue(burnGas_) && (wWType_ > 0) && (wWType_ < 3)) {
tap_water_active_ = ((wWCurFlow_ != 0) && (burnGas_ != EMS_VALUE_BOOL_OFF));
EMSESP::tap_water_active(tap_water_active_);
}
// heating
// using a quick hack for checking the heating by looking at the Selected Flow Temp, but doesn't work for all boilers apparently
if (Helpers::hasValue(selFlowTemp_) && Helpers::hasValue(burnGas_)) {
heating_active_ = (!tap_water_active_ && ((selFlowTemp_ >= EMS_BOILER_SELFLOWTEMP_HEATING) && (burnGas_ != EMS_VALUE_BOOL_OFF)));
}
// see if the heating or hot tap water has changed, if so send
// last_boilerActive stores heating in bit 1 and tap water in bit 2
uint8_t latest_boilerState = (tap_water_active_ << 1) + heating_active_;
if (latest_boilerState != last_boilerState) {
last_boilerState = latest_boilerState;
static char s[10];
Mqtt::publish(F("tapwater_active"), Helpers::render_boolean(s, tap_water_active_));
static char s2[10];
Mqtt::publish(F("heating_active"), Helpers::render_boolean(s2, heating_active_));
}
*/
} }
// 0x33 // 0x33

View File

@@ -16,17 +16,17 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "mixing.h" #include "mixer.h"
namespace emsesp { namespace emsesp {
REGISTER_FACTORY(Mixing, EMSdevice::DeviceType::MIXING); REGISTER_FACTORY(Mixer, EMSdevice::DeviceType::MIXER);
uuid::log::Logger Mixing::logger_{F_(mixing), uuid::log::Facility::CONSOLE}; uuid::log::Logger Mixer::logger_{F_(mixer), uuid::log::Facility::CONSOLE};
Mixing::Mixing(uint8_t device_type, uint8_t device_id, uint8_t product_id, const std::string & version, const std::string & name, uint8_t flags, uint8_t brand) Mixer::Mixer(uint8_t device_type, uint8_t device_id, uint8_t product_id, const std::string & version, const std::string & name, uint8_t flags, uint8_t brand)
: EMSdevice(device_type, device_id, product_id, version, name, flags, brand) { : EMSdevice(device_type, device_id, product_id, version, name, flags, brand) {
LOG_DEBUG(F("Adding new Mixing module with device ID 0x%02X"), device_id); LOG_DEBUG(F("Adding new Mixer with device ID 0x%02X"), device_id);
if (flags == EMSdevice::EMS_DEVICE_FLAG_MMPLUS) { if (flags == EMSdevice::EMS_DEVICE_FLAG_MMPLUS) {
if (device_id <= 0x27) { if (device_id <= 0x27) {
@@ -56,7 +56,7 @@ Mixing::Mixing(uint8_t device_type, uint8_t device_id, uint8_t product_id, const
} }
// output json to web UI // output json to web UI
void Mixing::device_info_web(JsonArray & root) { void Mixer::device_info_web(JsonArray & root) {
if (type() == Type::NONE) { if (type() == Type::NONE) {
return; // don't have any values yet return; // don't have any values yet
} }
@@ -84,7 +84,7 @@ void Mixing::device_info_web(JsonArray & root) {
} }
// check to see if values have been updated // check to see if values have been updated
bool Mixing::updated_values() { bool Mixer::updated_values() {
if (changed_) { if (changed_) {
changed_ = false; changed_ = false;
return true; return true;
@@ -93,7 +93,7 @@ bool Mixing::updated_values() {
} }
// display all values into the shell console // display all values into the shell console
void Mixing::show_values(uuid::console::Shell & shell) { void Mixer::show_values(uuid::console::Shell & shell) {
EMSdevice::show_values(shell); // always call this to show header EMSdevice::show_values(shell); // always call this to show header
if (type() == Type::NONE) { if (type() == Type::NONE) {
@@ -125,7 +125,7 @@ void Mixing::show_values(uuid::console::Shell & shell) {
// publish values via MQTT // publish values via MQTT
// topic is mixing_data<id> // topic is mixing_data<id>
void Mixing::publish_values(JsonObject & json, bool force) { void Mixer::publish_values(JsonObject & json, bool force) {
// handle HA first // handle HA first
if (Mqtt::mqtt_format() == Mqtt::Format::HA) { if (Mqtt::mqtt_format() == Mqtt::Format::HA) {
register_mqtt_ha_config(force); register_mqtt_ha_config(force);
@@ -136,9 +136,11 @@ void Mixing::publish_values(JsonObject & json, bool force) {
JsonObject json = doc.to<JsonObject>(); JsonObject json = doc.to<JsonObject>();
if (export_values_format(Mqtt::mqtt_format(), json)) { if (export_values_format(Mqtt::mqtt_format(), json)) {
char topic[30]; char topic[30];
char s[5]; if (type() == Type::HC) {
strlcpy(topic, "mixing_data", 30); snprintf_P(topic, 30, PSTR("mixer_data_hc%d"),hc_);
strlcat(topic, Helpers::itoa(s, device_id() - 0x20 + 1), 30); // append device_id to topic } else {
snprintf_P(topic, 30, PSTR("mixer_data_wwc%d"),hc_);
}
Mqtt::publish(topic, doc.as<JsonObject>()); Mqtt::publish(topic, doc.as<JsonObject>());
} }
} else { } else {
@@ -148,7 +150,7 @@ void Mixing::publish_values(JsonObject & json, bool force) {
} }
// publish config topic for HA MQTT Discovery // publish config topic for HA MQTT Discovery
void Mixing::register_mqtt_ha_config(bool force) { void Mixer::register_mqtt_ha_config(bool force) {
if ((mqtt_ha_config_ && !force)) { if ((mqtt_ha_config_ && !force)) {
return; return;
} }
@@ -167,32 +169,32 @@ void Mixing::register_mqtt_ha_config(bool force) {
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_MEDIUM> doc; StaticJsonDocument<EMSESP_MAX_JSON_SIZE_MEDIUM> doc;
char name[20]; char name[20];
snprintf_P(name, sizeof(name), PSTR("Mixing %02X"), device_id() - 0x20 + 1); snprintf_P(name, sizeof(name), PSTR("Mixer %02X"), device_id() - 0x20 + 1);
doc["name"] = name; doc["name"] = name;
char uniq_id[20]; char uniq_id[20];
snprintf_P(uniq_id, sizeof(uniq_id), PSTR("mixing%02X"), device_id() - 0x20 + 1); snprintf_P(uniq_id, sizeof(uniq_id), PSTR("mixer%02X"), device_id() - 0x20 + 1);
doc["uniq_id"] = uniq_id; doc["uniq_id"] = uniq_id;
doc["ic"] = F("mdi:home-thermometer-outline"); doc["ic"] = F("mdi:home-thermometer-outline");
char stat_t[50]; char stat_t[50];
snprintf_P(stat_t, sizeof(stat_t), PSTR("%s/mixing_data"), System::hostname().c_str()); snprintf_P(stat_t, sizeof(stat_t), PSTR("%s/mixer_data"), System::hostname().c_str());
doc["stat_t"] = stat_t; doc["stat_t"] = stat_t;
doc["val_tpl"] = F("{{value_json.type}}"); // HA needs a single value. We take the type which is wwc or hc doc["val_tpl"] = F("{{value_json.type}}"); // HA needs a single value. We take the type which is wwc or hc
JsonObject dev = doc.createNestedObject("dev"); JsonObject dev = doc.createNestedObject("dev");
dev["name"] = F("EMS-ESP Mixing"); dev["name"] = F("EMS-ESP Mixer");
dev["sw"] = EMSESP_APP_VERSION; dev["sw"] = EMSESP_APP_VERSION;
dev["mf"] = this->brand_to_string(); dev["mf"] = this->brand_to_string();
dev["mdl"] = this->name(); dev["mdl"] = this->name();
JsonArray ids = dev.createNestedArray("ids"); JsonArray ids = dev.createNestedArray("ids");
ids.add("ems-esp-mixing"); ids.add("ems-esp-mixer");
std::string topic(100, '\0'); std::string topic(100, '\0');
if (this->type() == Type::HC) { if (this->type() == Type::HC) {
snprintf_P(&topic[0], topic.capacity() + 1, PSTR("homeassistant/climate/ems-esp/mixing_hc%d/config"), hc_); snprintf_P(&topic[0], topic.capacity() + 1, PSTR("homeassistant/climate/ems-esp/mixer_hc%d/config"), hc_);
Mqtt::publish_retain(topic, doc.as<JsonObject>(), true); // publish the config payload with retain flag Mqtt::publish_retain(topic, doc.as<JsonObject>(), true); // publish the config payload with retain flag
char hc_name[10]; char hc_name[10];
snprintf_P(hc_name, sizeof(hc_name), PSTR("hc%d"), hc_); snprintf_P(hc_name, sizeof(hc_name), PSTR("hc%d"), hc_);
@@ -202,7 +204,7 @@ void Mixing::register_mqtt_ha_config(bool force) {
Mqtt::register_mqtt_ha_sensor(hc_name, nullptr, F_(valveStatus), this->device_type(), "valveStatus", nullptr, nullptr); Mqtt::register_mqtt_ha_sensor(hc_name, nullptr, F_(valveStatus), this->device_type(), "valveStatus", nullptr, nullptr);
} else { } else {
// WWC // WWC
snprintf_P(&topic[0], topic.capacity() + 1, PSTR("homeassistant/climate/ems-esp/mixing_wwc%d/config"), hc_); snprintf_P(&topic[0], topic.capacity() + 1, PSTR("homeassistant/climate/ems-esp/mixer_wwc%d/config"), hc_);
Mqtt::publish_retain(topic, doc.as<JsonObject>(), true); // publish the config payload with retain flag Mqtt::publish_retain(topic, doc.as<JsonObject>(), true); // publish the config payload with retain flag
char wwc_name[10]; char wwc_name[10];
snprintf_P(wwc_name, sizeof(wwc_name), PSTR("wwc%d"), hc_); snprintf_P(wwc_name, sizeof(wwc_name), PSTR("wwc%d"), hc_);
@@ -214,13 +216,13 @@ void Mixing::register_mqtt_ha_config(bool force) {
mqtt_ha_config_ = true; // done mqtt_ha_config_ = true; // done
} }
bool Mixing::export_values(JsonObject & json) { bool Mixer::export_values(JsonObject & json) {
return export_values_format(Mqtt::Format::NESTED, json); return export_values_format(Mqtt::Format::NESTED, json);
} }
// creates JSON doc from values // creates JSON doc from values
// returns false if empty // returns false if empty
bool Mixing::export_values_format(uint8_t mqtt_format, JsonObject & json) { bool Mixer::export_values_format(uint8_t mqtt_format, JsonObject & json) {
// check if there is data for the mixing unit // check if there is data for the mixing unit
if (!Helpers::hasValue(status_)) { if (!Helpers::hasValue(status_)) {
return 0; return 0;
@@ -231,14 +233,14 @@ bool Mixing::export_values_format(uint8_t mqtt_format, JsonObject & json) {
if (this->type() == Type::HC) { if (this->type() == Type::HC) {
snprintf_P(hc_name, sizeof(hc_name), PSTR("hc%d"), hc_); snprintf_P(hc_name, sizeof(hc_name), PSTR("hc%d"), hc_);
if (mqtt_format == Mqtt::Format::NESTED) { if (mqtt_format == Mqtt::Format::SINGLE) {
json_hc = json.createNestedObject(hc_name); json_hc = json;
json["type"] = F("hc");
} else if (mqtt_format == Mqtt::Format::HA) { } else if (mqtt_format == Mqtt::Format::HA) {
json_hc = json.createNestedObject(hc_name); json_hc = json.createNestedObject(hc_name);
json_hc["type"] = F("hc"); json_hc["type"] = F("hc");
} else { } else {
json_hc = json; json_hc = json.createNestedObject(hc_name);
json["type"] = F("hc");
} }
if (Helpers::hasValue(flowTemp_)) { if (Helpers::hasValue(flowTemp_)) {
json_hc["flowTemp"] = (float)flowTemp_ / 10; json_hc["flowTemp"] = (float)flowTemp_ / 10;
@@ -259,14 +261,14 @@ bool Mixing::export_values_format(uint8_t mqtt_format, JsonObject & json) {
// WWC // WWC
snprintf_P(hc_name, sizeof(hc_name), PSTR("wwc%d"), hc_); snprintf_P(hc_name, sizeof(hc_name), PSTR("wwc%d"), hc_);
if (mqtt_format == Mqtt::Format::NESTED) { if (mqtt_format == Mqtt::Format::SINGLE) {
json_hc = json.createNestedObject(hc_name); json_hc = json;
json["type"] = F("wwc");
} else if (mqtt_format == Mqtt::Format::HA) { } else if (mqtt_format == Mqtt::Format::HA) {
json_hc = json.createNestedObject(hc_name); json_hc = json.createNestedObject(hc_name);
json_hc["type"] = F("wwc"); json_hc["type"] = F("wwc");
} else { } else {
json_hc = json; json_hc = json.createNestedObject(hc_name);
json["type"] = F("wwc");
} }
if (Helpers::hasValue(flowTemp_)) { if (Helpers::hasValue(flowTemp_)) {
json_hc["wwTemp"] = (float)flowTemp_ / 10; json_hc["wwTemp"] = (float)flowTemp_ / 10;
@@ -285,7 +287,7 @@ bool Mixing::export_values_format(uint8_t mqtt_format, JsonObject & json) {
// heating circuits 0x02D7, 0x02D8 etc... // heating circuits 0x02D7, 0x02D8 etc...
// e.g. A0 00 FF 00 01 D7 00 00 00 80 00 00 00 00 03 C5 // e.g. A0 00 FF 00 01 D7 00 00 00 80 00 00 00 00 03 C5
// A0 0B FF 00 01 D7 00 00 00 80 00 00 00 00 03 80 // A0 0B FF 00 01 D7 00 00 00 80 00 00 00 00 03 80
void Mixing::process_MMPLUSStatusMessage_HC(std::shared_ptr<const Telegram> telegram) { void Mixer::process_MMPLUSStatusMessage_HC(std::shared_ptr<const Telegram> telegram) {
type(Type::HC); type(Type::HC);
hc_ = telegram->type_id - 0x02D7 + 1; // determine which circuit this is hc_ = telegram->type_id - 0x02D7 + 1; // determine which circuit this is
changed_ |= telegram->read_value(flowTemp_, 3); // is * 10 changed_ |= telegram->read_value(flowTemp_, 3); // is * 10
@@ -294,10 +296,10 @@ void Mixing::process_MMPLUSStatusMessage_HC(std::shared_ptr<const Telegram> tele
changed_ |= telegram->read_value(status_, 2); // valve status changed_ |= telegram->read_value(status_, 2); // valve status
} }
// Mixing module warm water loading/DHW - 0x0331, 0x0332 // Mixer warm water loading/DHW - 0x0331, 0x0332
// e.g. A9 00 FF 00 02 32 02 6C 00 3C 00 3C 3C 46 02 03 03 00 3C // on 0x28 // e.g. A9 00 FF 00 02 32 02 6C 00 3C 00 3C 3C 46 02 03 03 00 3C // on 0x28
// A8 00 FF 00 02 31 02 35 00 3C 00 3C 3C 46 02 03 03 00 3C // in 0x29 // A8 00 FF 00 02 31 02 35 00 3C 00 3C 3C 46 02 03 03 00 3C // in 0x29
void Mixing::process_MMPLUSStatusMessage_WWC(std::shared_ptr<const Telegram> telegram) { void Mixer::process_MMPLUSStatusMessage_WWC(std::shared_ptr<const Telegram> telegram) {
type(Type::WWC); type(Type::WWC);
hc_ = telegram->type_id - 0x0331 + 1; // determine which circuit this is. There are max 2. hc_ = telegram->type_id - 0x0331 + 1; // determine which circuit this is. There are max 2.
changed_ |= telegram->read_value(flowTemp_, 0); // is * 10 changed_ |= telegram->read_value(flowTemp_, 0); // is * 10
@@ -305,10 +307,10 @@ void Mixing::process_MMPLUSStatusMessage_WWC(std::shared_ptr<const Telegram> tel
changed_ |= telegram->read_value(status_, 11); // temp status changed_ |= telegram->read_value(status_, 11); // temp status
} }
// Mixing IMP - 0x010C // Mixer IMP - 0x010C
// e.g. A0 00 FF 00 00 0C 01 00 00 00 00 00 54 // e.g. A0 00 FF 00 00 0C 01 00 00 00 00 00 54
// A1 00 FF 00 00 0C 02 04 00 01 1D 00 82 // A1 00 FF 00 00 0C 02 04 00 01 1D 00 82
void Mixing::process_IPMStatusMessage(std::shared_ptr<const Telegram> telegram) { void Mixer::process_IPMStatusMessage(std::shared_ptr<const Telegram> telegram) {
type(Type::HC); type(Type::HC);
hc_ = device_id() - 0x20 + 1; hc_ = device_id() - 0x20 + 1;
@@ -329,10 +331,10 @@ void Mixing::process_IPMStatusMessage(std::shared_ptr<const Telegram> telegram)
changed_ |= telegram->read_bitvalue(pumpStatus_, 1, 0); // pump is also in unmixed circuits changed_ |= telegram->read_bitvalue(pumpStatus_, 1, 0); // pump is also in unmixed circuits
} }
// Mixing on a MM10 - 0xAB // Mixer on a MM10 - 0xAB
// e.g. Mixing Module -> All, type 0xAB, telegram: 21 00 AB 00 2D 01 BE 64 04 01 00 (CRC=15) #data=7 // e.g. Mixer Module -> All, type 0xAB, telegram: 21 00 AB 00 2D 01 BE 64 04 01 00 (CRC=15) #data=7
// see also https://github.com/proddy/EMS-ESP/issues/386 // see also https://github.com/proddy/EMS-ESP/issues/386
void Mixing::process_MMStatusMessage(std::shared_ptr<const Telegram> telegram) { void Mixer::process_MMStatusMessage(std::shared_ptr<const Telegram> telegram) {
type(Type::HC); type(Type::HC);
// the heating circuit is determine by which device_id it is, 0x20 - 0x23 // the heating circuit is determine by which device_id it is, 0x20 - 0x23
@@ -348,17 +350,17 @@ void Mixing::process_MMStatusMessage(std::shared_ptr<const Telegram> telegram) {
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-parameter"
// Mixing on a MM10 - 0xAA // Mixer on a MM10 - 0xAA
// e.g. Thermostat -> Mixing Module, type 0xAA, telegram: 10 21 AA 00 FF 0C 0A 11 0A 32 xx // e.g. Thermostat -> Mixer Module, type 0xAA, telegram: 10 21 AA 00 FF 0C 0A 11 0A 32 xx
void Mixing::process_MMConfigMessage(std::shared_ptr<const Telegram> telegram) { void Mixer::process_MMConfigMessage(std::shared_ptr<const Telegram> telegram) {
hc_ = device_id() - 0x20 + 1; hc_ = device_id() - 0x20 + 1;
// pos 0: active FF = on // pos 0: active FF = on
// pos 1: valve runtime 0C = 120 sec in units of 10 sec // pos 1: valve runtime 0C = 120 sec in units of 10 sec
} }
// Mixing on a MM10 - 0xAC // Mixer on a MM10 - 0xAC
// e.g. Thermostat -> Mixing Module, type 0xAC, telegram: 10 21 AC 00 1E 64 01 AB // e.g. Thermostat -> Mixer Module, type 0xAC, telegram: 10 21 AC 00 1E 64 01 AB
void Mixing::process_MMSetMessage(std::shared_ptr<const Telegram> telegram) { void Mixer::process_MMSetMessage(std::shared_ptr<const Telegram> telegram) {
hc_ = device_id() - 0x20 + 1; hc_ = device_id() - 0x20 + 1;
// pos 0: flowtemp setpoint 1E = 30°C // pos 0: flowtemp setpoint 1E = 30°C
// pos 1: position in % // pos 1: position in %

View File

@@ -16,8 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef EMSESP_MIXING_H #ifndef EMSESP_MIXER_H
#define EMSESP_MIXING_H #define EMSESP_MIXER_H
#include <Arduino.h> #include <Arduino.h>
#include <ArduinoJson.h> #include <ArduinoJson.h>
@@ -32,9 +32,9 @@
namespace emsesp { namespace emsesp {
class Mixing : public EMSdevice { class Mixer : public EMSdevice {
public: public:
Mixing(uint8_t device_type, uint8_t device_id, uint8_t product_id, const std::string & version, const std::string & name, uint8_t flags, uint8_t brand); Mixer(uint8_t device_type, uint8_t device_id, uint8_t product_id, const std::string & version, const std::string & name, uint8_t flags, uint8_t brand);
virtual void show_values(uuid::console::Shell & shell); virtual void show_values(uuid::console::Shell & shell);
virtual void publish_values(JsonObject & json, bool force); virtual void publish_values(JsonObject & json, bool force);

View File

@@ -471,14 +471,14 @@ bool Thermostat::export_values_hc(uint8_t mqtt_format, JsonObject & rootThermost
has_data = true; has_data = true;
// if the MQTT format is 'nested' or 'ha' then create the parent object hc<n> // if the MQTT format is 'nested' or 'ha' then create the parent object hc<n>
if ((mqtt_format == Mqtt::Format::NESTED) || (mqtt_format == Mqtt::Format::HA)) { if (mqtt_format == Mqtt::Format::SINGLE) {
dataThermostat = rootThermostat;
} else {
char hc_name[10]; // hc{1-4} char hc_name[10]; // hc{1-4}
strlcpy(hc_name, "hc", 10); strlcpy(hc_name, "hc", 10);
char s[3]; char s[3];
strlcat(hc_name, Helpers::itoa(s, hc->hc_num()), 10); strlcat(hc_name, Helpers::itoa(s, hc->hc_num()), 10);
dataThermostat = rootThermostat.createNestedObject(hc_name); dataThermostat = rootThermostat.createNestedObject(hc_name);
} else {
dataThermostat = rootThermostat;
} }
// different logic on how temperature values are stored, depending on model // different logic on how temperature values are stored, depending on model
@@ -615,9 +615,7 @@ bool Thermostat::export_values_hc(uint8_t mqtt_format, JsonObject & rootThermost
// the topic will have the hc number appended // the topic will have the hc number appended
if (mqtt_format == Mqtt::Format::SINGLE) { if (mqtt_format == Mqtt::Format::SINGLE) {
char topic[30]; char topic[30];
char s[3]; snprintf_P(topic, 30, PSTR("thermostat_data_hc%d"),hc->hc_num());
strlcpy(topic, "thermostat_data", 30);
strlcat(topic, Helpers::itoa(s, hc->hc_num()), 30); // append hc to topic
Mqtt::publish(topic, rootThermostat); Mqtt::publish(topic, rootThermostat);
rootThermostat.clear(); // clear object rootThermostat.clear(); // clear object
} }

View File

@@ -73,8 +73,8 @@ std::string EMSdevice::device_type_2_device_name(const uint8_t device_type) {
return read_flash_string(F_(solar)); return read_flash_string(F_(solar));
break; break;
case DeviceType::MIXING: case DeviceType::MIXER:
return read_flash_string(F_(mixing)); return read_flash_string(F_(mixer));
break; break;
case DeviceType::DALLASSENSOR: case DeviceType::DALLASSENSOR:
@@ -117,11 +117,11 @@ uint8_t EMSdevice::device_name_2_device_type(const char * topic) {
return DeviceType::SOLAR; return DeviceType::SOLAR;
} }
if (!strcmp_P(topic, reinterpret_cast<PGM_P>(F_(mixing)))) { if (!strcmp_P(topic, reinterpret_cast<PGM_P>(F_(mixer)))) {
return DeviceType::MIXING; return DeviceType::MIXER;
} }
if (!strcmp_P(topic, reinterpret_cast<PGM_P>(F_(dallassensor)))) { if (!strcmp_P(topic, reinterpret_cast<PGM_P>(F_(sensor)))) {
return DeviceType::DALLASSENSOR; return DeviceType::DALLASSENSOR;
} }
@@ -143,27 +143,27 @@ std::string EMSdevice::device_type_name() const {
break; break;
case DeviceType::SOLAR: case DeviceType::SOLAR:
return read_flash_string(F("Solar Module")); return read_flash_string(F("Solar"));
break; break;
case DeviceType::CONNECT: case DeviceType::CONNECT:
return read_flash_string(F("Connect Module")); return read_flash_string(F("Connect"));
break; break;
case DeviceType::CONTROLLER: case DeviceType::CONTROLLER:
return read_flash_string(F("Controller")); return read_flash_string(F("Controller"));
break; break;
case DeviceType::MIXING: case DeviceType::MIXER:
return read_flash_string(F("Mixing Module")); return read_flash_string(F("Mixer"));
break; break;
case DeviceType::SWITCH: case DeviceType::SWITCH:
return read_flash_string(F("Switching Module")); return read_flash_string(F("Switch"));
break; break;
case DeviceType::GATEWAY: case DeviceType::GATEWAY:
return read_flash_string(F("Gateway Module")); return read_flash_string(F("Gateway"));
break; break;
default: default:

View File

@@ -223,7 +223,7 @@ class EMSdevice {
DALLASSENSOR, // for internal dallas sensors DALLASSENSOR, // for internal dallas sensors
BOILER, BOILER,
THERMOSTAT, THERMOSTAT,
MIXING, MIXER,
SOLAR, SOLAR,
HEATPUMP, HEATPUMP,
GATEWAY, GATEWAY,
@@ -250,7 +250,7 @@ class EMSdevice {
static constexpr uint8_t EMS_DEVICE_FLAG_SM100 = 2; static constexpr uint8_t EMS_DEVICE_FLAG_SM100 = 2;
static constexpr uint8_t EMS_DEVICE_FLAG_ISM = 3; static constexpr uint8_t EMS_DEVICE_FLAG_ISM = 3;
// Mixing Module // Mixer Module
static constexpr uint8_t EMS_DEVICE_FLAG_MMPLUS = 1; static constexpr uint8_t EMS_DEVICE_FLAG_MMPLUS = 1;
static constexpr uint8_t EMS_DEVICE_FLAG_MM10 = 2; static constexpr uint8_t EMS_DEVICE_FLAG_MM10 = 2;
static constexpr uint8_t EMS_DEVICE_FLAG_IPM = 3; static constexpr uint8_t EMS_DEVICE_FLAG_IPM = 3;

View File

@@ -277,12 +277,11 @@ void EMSESP::show_sensor_values(uuid::console::Shell & shell) {
return; return;
} }
char valuestr[8] = {0}; // for formatting temp
shell.printfln(F("Dallas temperature sensors:")); shell.printfln(F("Dallas temperature sensors:"));
uint8_t i = 1; uint8_t i = 1;
char s[7];
for (const auto & device : sensor_devices()) { for (const auto & device : sensor_devices()) {
shell.printfln(F(" Sensor %d, ID: %s, Temperature: %s °C"), i, device.to_string().c_str(), Helpers::render_value(valuestr, device.temperature_c, 10)); shell.printfln(F(" Sensor %d, ID: %s, Temperature: %s °C"), i++, device.to_string().c_str(), Helpers::render_value(s, device.temperature_c, 10));
i++;
} }
shell.println(); shell.println();
} }
@@ -293,7 +292,7 @@ void EMSESP::publish_all(bool force) {
publish_device_values(EMSdevice::DeviceType::BOILER, force); publish_device_values(EMSdevice::DeviceType::BOILER, force);
publish_device_values(EMSdevice::DeviceType::THERMOSTAT, force); publish_device_values(EMSdevice::DeviceType::THERMOSTAT, force);
publish_device_values(EMSdevice::DeviceType::SOLAR, force); publish_device_values(EMSdevice::DeviceType::SOLAR, force);
publish_device_values(EMSdevice::DeviceType::MIXING, force); publish_device_values(EMSdevice::DeviceType::MIXER, force);
publish_other_values(); publish_other_values();
publish_sensor_values(true); publish_sensor_values(true);
system_.send_heartbeat(); system_.send_heartbeat();
@@ -301,9 +300,9 @@ void EMSESP::publish_all(bool force) {
} }
// create json doc for the devices values and add to MQTT publish queue // create json doc for the devices values and add to MQTT publish queue
// special case for Mixing units, since we want to bundle all devices together into one payload // special case for Mixer units, since we want to bundle all devices together into one payload
void EMSESP::publish_device_values(uint8_t device_type, bool force) { void EMSESP::publish_device_values(uint8_t device_type, bool force) {
if (device_type == EMSdevice::DeviceType::MIXING && Mqtt::mqtt_format() != Mqtt::Format::SINGLE) { if (device_type == EMSdevice::DeviceType::MIXER && Mqtt::mqtt_format() != Mqtt::Format::SINGLE) {
DynamicJsonDocument doc(EMSESP_MAX_JSON_SIZE_LARGE); DynamicJsonDocument doc(EMSESP_MAX_JSON_SIZE_LARGE);
JsonObject json = doc.to<JsonObject>(); JsonObject json = doc.to<JsonObject>();
for (const auto & emsdevice : emsdevices) { for (const auto & emsdevice : emsdevices) {
@@ -312,7 +311,7 @@ void EMSESP::publish_device_values(uint8_t device_type, bool force) {
} }
} }
doc.shrinkToFit(); doc.shrinkToFit();
Mqtt::publish(F("mixing_data"), doc.as<JsonObject>()); Mqtt::publish("mixer_data", doc.as<JsonObject>());
return; return;
} }
@@ -327,7 +326,7 @@ void EMSESP::publish_device_values(uint8_t device_type, bool force) {
void EMSESP::publish_other_values() { void EMSESP::publish_other_values() {
for (const auto & emsdevice : emsdevices) { for (const auto & emsdevice : emsdevices) {
if (emsdevice && (emsdevice->device_type() != EMSdevice::DeviceType::BOILER) && (emsdevice->device_type() != EMSdevice::DeviceType::THERMOSTAT) if (emsdevice && (emsdevice->device_type() != EMSdevice::DeviceType::BOILER) && (emsdevice->device_type() != EMSdevice::DeviceType::THERMOSTAT)
&& (emsdevice->device_type() != EMSdevice::DeviceType::SOLAR) && (emsdevice->device_type() != EMSdevice::DeviceType::MIXING)) { && (emsdevice->device_type() != EMSdevice::DeviceType::SOLAR) && (emsdevice->device_type() != EMSdevice::DeviceType::MIXER)) {
JsonObject dummy; JsonObject dummy;
emsdevice->publish_values(dummy); emsdevice->publish_values(dummy);
} }
@@ -480,7 +479,7 @@ void EMSESP::process_UBADevices(std::shared_ptr<const Telegram> telegram) {
// when the version info is received, it will automagically add the device // when the version info is received, it will automagically add the device
// always skip modem device 0x0D, it does not reply to version request // always skip modem device 0x0D, it does not reply to version request
// see https://github.com/proddy/EMS-ESP/issues/460#issuecomment-709553012 // see https://github.com/proddy/EMS-ESP/issues/460#issuecomment-709553012
if ((device_id != EMSbus::ems_bus_id()) && !(EMSESP::device_exists(device_id)) && (device_id != 0x0D)) { if ((device_id != EMSbus::ems_bus_id()) && !(EMSESP::device_exists(device_id)) && (device_id != 0x0D) && (device_id != 0x0C)) {
LOG_DEBUG(F("New EMS device detected with ID 0x%02X. Requesting version information."), device_id); LOG_DEBUG(F("New EMS device detected with ID 0x%02X. Requesting version information."), device_id);
send_read_request(EMSdevice::EMS_TYPE_VERSION, device_id); send_read_request(EMSdevice::EMS_TYPE_VERSION, device_id);
} }
@@ -630,7 +629,7 @@ void EMSESP::show_devices(uuid::console::Shell & shell) {
shell.printfln(F("These EMS devices are currently active:")); shell.printfln(F("These EMS devices are currently active:"));
shell.println(); shell.println();
// for all device objects from emsdevice.h (UNKNOWN, SYSTEM, BOILER, THERMOSTAT, MIXING, SOLAR, HEATPUMP, GATEWAY, SWITCH, CONTROLLER, CONNECT) // for all device objects from emsdevice.h (UNKNOWN, SYSTEM, BOILER, THERMOSTAT, MIXER, SOLAR, HEATPUMP, GATEWAY, SWITCH, CONTROLLER, CONNECT)
// so we keep a consistent order // so we keep a consistent order
for (const auto & device_class : EMSFactory::device_handlers()) { for (const auto & device_class : EMSFactory::device_handlers()) {
// shell.printf(F("[factory ID: %d] "), device_class.first); // shell.printf(F("[factory ID: %d] "), device_class.first);
@@ -721,9 +720,9 @@ bool EMSESP::add_device(const uint8_t device_id, const uint8_t product_id, std::
return command_info(EMSdevice::DeviceType::BOILER, json); return command_info(EMSdevice::DeviceType::BOILER, json);
}); });
break; break;
case EMSdevice::DeviceType::MIXING: case EMSdevice::DeviceType::MIXER:
Command::add_with_json(device_p->device_type, F_(info), [&](const char * value, const int8_t id, JsonObject & json) { Command::add_with_json(device_p->device_type, F_(info), [&](const char * value, const int8_t id, JsonObject & json) {
return command_info(EMSdevice::DeviceType::MIXING, json); return command_info(EMSdevice::DeviceType::MIXER, json);
}); });
break; break;
case EMSdevice::DeviceType::SOLAR: case EMSdevice::DeviceType::SOLAR:

View File

@@ -87,13 +87,14 @@ MAKE_PSTR_WORD(boiler)
MAKE_PSTR_WORD(thermostat) MAKE_PSTR_WORD(thermostat)
MAKE_PSTR_WORD(switch) MAKE_PSTR_WORD(switch)
MAKE_PSTR_WORD(solar) MAKE_PSTR_WORD(solar)
MAKE_PSTR_WORD(mixing) MAKE_PSTR_WORD(mixer)
MAKE_PSTR_WORD(gateway) MAKE_PSTR_WORD(gateway)
MAKE_PSTR_WORD(controller) MAKE_PSTR_WORD(controller)
MAKE_PSTR_WORD(connect) MAKE_PSTR_WORD(connect)
MAKE_PSTR_WORD(heatpump) MAKE_PSTR_WORD(heatpump)
MAKE_PSTR_WORD(generic) MAKE_PSTR_WORD(generic)
MAKE_PSTR_WORD(dallassensor) MAKE_PSTR_WORD(dallassensor)
MAKE_PSTR_WORD(sensor)
MAKE_PSTR(1space, " ") MAKE_PSTR(1space, " ")
MAKE_PSTR(2spaces, " ") MAKE_PSTR(2spaces, " ")
@@ -160,7 +161,7 @@ MAKE_PSTR(wWCurTemp2, "Warm water current temperature (extern)")
MAKE_PSTR(wWCurFlow, "Warm water current tap water flow") MAKE_PSTR(wWCurFlow, "Warm water current tap water flow")
MAKE_PSTR(curFlowTemp, "Current flow temperature") MAKE_PSTR(curFlowTemp, "Current flow temperature")
MAKE_PSTR(retTemp, "Return temperature") MAKE_PSTR(retTemp, "Return temperature")
MAKE_PSTR(switchTemp, "Mixing switch temperature") MAKE_PSTR(switchTemp, "Mixer switch temperature")
MAKE_PSTR(sysPress, "System pressure") MAKE_PSTR(sysPress, "System pressure")
MAKE_PSTR(boilTemp, "Max temperature") MAKE_PSTR(boilTemp, "Max temperature")
MAKE_PSTR(wwStorageTemp1, "Warm water storage temperature (intern)") MAKE_PSTR(wwStorageTemp1, "Warm water storage temperature (intern)")
@@ -193,10 +194,12 @@ MAKE_PSTR(setFlowTemp, "Set flow temperature")
MAKE_PSTR(wWSetPumpPower, "Warm water pump set power") MAKE_PSTR(wWSetPumpPower, "Warm water pump set power")
MAKE_PSTR(wwMixTemperature, "Warm water mix temperature") MAKE_PSTR(wwMixTemperature, "Warm water mix temperature")
MAKE_PSTR(wwBufferTemperature, "Warm water buffer temperature") MAKE_PSTR(wwBufferTemperature, "Warm water buffer temperature")
MAKE_PSTR(wWStarts, "Warm water # starts") MAKE_PSTR(wWStarts, "Warm water starts")
MAKE_PSTR(wWWorkM, "Warm water active time") MAKE_PSTR(wWWorkM, "Warm water active time")
MAKE_PSTR(setBurnPow, "Burner set power") MAKE_PSTR(setBurnPow, "Burner set power")
MAKE_PSTR(burnStarts, "# starts") MAKE_PSTR(burnStarts, "Burner starts")
MAKE_PSTR(burnWorkMin, "Burner active time")
MAKE_PSTR(heatWorkMin, "Heating active time")
// solar // solar
MAKE_PSTR(collectorTemp, "Collector temperature (TS1)") MAKE_PSTR(collectorTemp, "Collector temperature (TS1)")
@@ -214,7 +217,7 @@ MAKE_PSTR(valveStatus, "Valve status")
MAKE_PSTR(tankHeated, "Tank heated") MAKE_PSTR(tankHeated, "Tank heated")
MAKE_PSTR(collectorShutdown, "Collector shutdown") MAKE_PSTR(collectorShutdown, "Collector shutdown")
// mixing // mixer
MAKE_PSTR(ww_hc, " Warm water circuit %d:") MAKE_PSTR(ww_hc, " Warm water circuit %d:")
MAKE_PSTR(wwTemp, "Current warm water temperature") MAKE_PSTR(wwTemp, "Current warm water temperature")
MAKE_PSTR(pumpStatus, "Current pump status") MAKE_PSTR(pumpStatus, "Current pump status")
@@ -281,5 +284,5 @@ MAKE_PSTR(iconthermostat, "mdi:home-thermometer-outline")
MAKE_PSTR(iconheatpump, "mdi:water-pump") MAKE_PSTR(iconheatpump, "mdi:water-pump")
// MQTT topic suffix // MQTT topic suffix
MAKE_PSTR(mqtt_suffix_main, "_main") // MAKE_PSTR(mqtt_suffix_main, "_main")
MAKE_PSTR(mqtt_suffix_ww, "_ww") MAKE_PSTR(mqtt_suffix_ww, "_ww")

View File

@@ -31,7 +31,7 @@ bool Mqtt::mqtt_retain_;
uint32_t Mqtt::publish_time_boiler_; uint32_t Mqtt::publish_time_boiler_;
uint32_t Mqtt::publish_time_thermostat_; uint32_t Mqtt::publish_time_thermostat_;
uint32_t Mqtt::publish_time_solar_; uint32_t Mqtt::publish_time_solar_;
uint32_t Mqtt::publish_time_mixing_; uint32_t Mqtt::publish_time_mixer_;
uint32_t Mqtt::publish_time_other_; uint32_t Mqtt::publish_time_other_;
uint32_t Mqtt::publish_time_sensor_; uint32_t Mqtt::publish_time_sensor_;
uint8_t Mqtt::mqtt_format_; uint8_t Mqtt::mqtt_format_;
@@ -138,9 +138,9 @@ void Mqtt::loop() {
EMSESP::publish_device_values(EMSdevice::DeviceType::SOLAR); EMSESP::publish_device_values(EMSdevice::DeviceType::SOLAR);
} }
if (publish_time_mixing_ && (currentMillis - last_publish_mixing_ > publish_time_mixing_)) { if (publish_time_mixer_ && (currentMillis - last_publish_mixer_ > publish_time_mixer_)) {
last_publish_mixing_ = currentMillis; last_publish_mixer_ = currentMillis;
EMSESP::publish_device_values(EMSdevice::DeviceType::MIXING); EMSESP::publish_device_values(EMSdevice::DeviceType::MIXER);
} }
if (publish_time_other_ && (currentMillis - last_publish_other_ > publish_time_other_)) { if (publish_time_other_ && (currentMillis - last_publish_other_ > publish_time_other_)) {
@@ -349,7 +349,7 @@ void Mqtt::start() {
publish_time_boiler_ = mqttSettings.publish_time_boiler * 1000; // convert to milliseconds publish_time_boiler_ = mqttSettings.publish_time_boiler * 1000; // convert to milliseconds
publish_time_thermostat_ = mqttSettings.publish_time_thermostat * 1000; publish_time_thermostat_ = mqttSettings.publish_time_thermostat * 1000;
publish_time_solar_ = mqttSettings.publish_time_solar * 1000; publish_time_solar_ = mqttSettings.publish_time_solar * 1000;
publish_time_mixing_ = mqttSettings.publish_time_mixing * 1000; publish_time_mixer_ = mqttSettings.publish_time_mixer * 1000;
publish_time_other_ = mqttSettings.publish_time_other * 1000; publish_time_other_ = mqttSettings.publish_time_other * 1000;
publish_time_sensor_ = mqttSettings.publish_time_sensor * 1000; publish_time_sensor_ = mqttSettings.publish_time_sensor * 1000;
mqtt_qos_ = mqttSettings.mqtt_qos; mqtt_qos_ = mqttSettings.mqtt_qos;
@@ -411,8 +411,8 @@ void Mqtt::set_publish_time_solar(uint16_t publish_time) {
publish_time_solar_ = publish_time * 1000; // convert to milliseconds publish_time_solar_ = publish_time * 1000; // convert to milliseconds
} }
void Mqtt::set_publish_time_mixing(uint16_t publish_time) { void Mqtt::set_publish_time_mixer(uint16_t publish_time) {
publish_time_mixing_ = publish_time * 1000; // convert to milliseconds publish_time_mixer_ = publish_time * 1000; // convert to milliseconds
} }
void Mqtt::set_publish_time_other(uint16_t publish_time) { void Mqtt::set_publish_time_other(uint16_t publish_time) {
@@ -436,8 +436,8 @@ bool Mqtt::get_publish_onchange(uint8_t device_type) {
if (!publish_time_solar_) { if (!publish_time_solar_) {
return true; return true;
} }
} else if (device_type == EMSdevice::DeviceType::MIXING) { } else if (device_type == EMSdevice::DeviceType::MIXER) {
if (!publish_time_mixing_) { if (!publish_time_mixer_) {
return true; return true;
} }
} else if (!publish_time_other_) { } else if (!publish_time_other_) {

View File

@@ -70,7 +70,7 @@ class Mqtt {
void set_publish_time_boiler(uint16_t publish_time); void set_publish_time_boiler(uint16_t publish_time);
void set_publish_time_thermostat(uint16_t publish_time); void set_publish_time_thermostat(uint16_t publish_time);
void set_publish_time_solar(uint16_t publish_time); void set_publish_time_solar(uint16_t publish_time);
void set_publish_time_mixing(uint16_t publish_time); void set_publish_time_mixer(uint16_t publish_time);
void set_publish_time_other(uint16_t publish_time); void set_publish_time_other(uint16_t publish_time);
void set_publish_time_sensor(uint16_t publish_time); void set_publish_time_sensor(uint16_t publish_time);
void set_qos(uint8_t mqtt_qos); void set_qos(uint8_t mqtt_qos);
@@ -210,7 +210,7 @@ class Mqtt {
uint32_t last_publish_boiler_ = 0; uint32_t last_publish_boiler_ = 0;
uint32_t last_publish_thermostat_ = 0; uint32_t last_publish_thermostat_ = 0;
uint32_t last_publish_solar_ = 0; uint32_t last_publish_solar_ = 0;
uint32_t last_publish_mixing_ = 0; uint32_t last_publish_mixer_ = 0;
uint32_t last_publish_other_ = 0; uint32_t last_publish_other_ = 0;
uint32_t last_publish_sensor_ = 0; uint32_t last_publish_sensor_ = 0;
@@ -222,7 +222,7 @@ class Mqtt {
static uint32_t publish_time_boiler_; static uint32_t publish_time_boiler_;
static uint32_t publish_time_thermostat_; static uint32_t publish_time_thermostat_;
static uint32_t publish_time_solar_; static uint32_t publish_time_solar_;
static uint32_t publish_time_mixing_; static uint32_t publish_time_mixer_;
static uint32_t publish_time_other_; static uint32_t publish_time_other_;
static uint32_t publish_time_sensor_; static uint32_t publish_time_sensor_;
static uint8_t mqtt_format_; static uint8_t mqtt_format_;

View File

@@ -888,7 +888,7 @@ bool System::command_info(const char * value, const int8_t id, JsonObject & json
node["publish_time_boiler"] = settings.publish_time_boiler; node["publish_time_boiler"] = settings.publish_time_boiler;
node["publish_time_thermostat"] = settings.publish_time_thermostat; node["publish_time_thermostat"] = settings.publish_time_thermostat;
node["publish_time_solar"] = settings.publish_time_solar; node["publish_time_solar"] = settings.publish_time_solar;
node["publish_time_mixing"] = settings.publish_time_mixing; node["publish_time_mixer"] = settings.publish_time_mixer;
node["publish_time_other"] = settings.publish_time_other; node["publish_time_other"] = settings.publish_time_other;
node["publish_time_sensor"] = settings.publish_time_sensor; node["publish_time_sensor"] = settings.publish_time_sensor;
node["mqtt_format"] = settings.mqtt_format; node["mqtt_format"] = settings.mqtt_format;
@@ -959,7 +959,7 @@ bool System::command_report(const char * value, const int8_t id, JsonObject & js
node["publish_time_boiler"] = settings.publish_time_boiler; node["publish_time_boiler"] = settings.publish_time_boiler;
node["publish_time_thermostat"] = settings.publish_time_thermostat; node["publish_time_thermostat"] = settings.publish_time_thermostat;
node["publish_time_solar"] = settings.publish_time_solar; node["publish_time_solar"] = settings.publish_time_solar;
node["publish_time_mixing"] = settings.publish_time_mixing; node["publish_time_mixer"] = settings.publish_time_mixer;
node["publish_time_other"] = settings.publish_time_other; node["publish_time_other"] = settings.publish_time_other;
node["publish_time_sensor"] = settings.publish_time_sensor; node["publish_time_sensor"] = settings.publish_time_sensor;
node["mqtt_format"] = settings.mqtt_format; node["mqtt_format"] = settings.mqtt_format;

View File

@@ -808,8 +808,8 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & command) {
EMSESP::txservice_.read_request(0x18, 0x08, 27); // no offset EMSESP::txservice_.read_request(0x18, 0x08, 27); // no offset
} }
if (command == "mixing") { if (command == "mixer") {
shell.printfln(F("Testing Mixing...")); shell.printfln(F("Testing Mixer..."));
// change MQTT format // change MQTT format
EMSESP::esp8266React.getMqttSettingsService()->updateWithoutPropagation([&](MqttSettings & mqttSettings) { EMSESP::esp8266React.getMqttSettingsService()->updateWithoutPropagation([&](MqttSettings & mqttSettings) {