mirror of
https://github.com/arendst/Tasmota.git
synced 2025-04-26 15:57:16 +00:00
Merge pull request #14078 from avp-avp/development
Add OpenTherm Boiler Lockout Reset command
This commit is contained in:
commit
00c937953b
@ -467,8 +467,11 @@ uint8_t sns_opentherm_read_flags(char *data, uint32_t len)
|
|||||||
// flag value, however, this command does not update the settings.
|
// flag value, however, this command does not update the settings.
|
||||||
#define D_CMND_SET_HOT_WATER_ENABLED "dhw"
|
#define D_CMND_SET_HOT_WATER_ENABLED "dhw"
|
||||||
|
|
||||||
|
// BLOR - Reset boiler
|
||||||
|
#define D_CMND_BLLOR "blor"
|
||||||
|
|
||||||
const char kOpenThermCommands[] PROGMEM = D_PRFX_OTHERM "|" D_CMND_OTHERM_BOILER_SETPOINT "|" D_CMND_OTHERM_DHW_SETPOINT
|
const char kOpenThermCommands[] PROGMEM = D_PRFX_OTHERM "|" D_CMND_OTHERM_BOILER_SETPOINT "|" D_CMND_OTHERM_DHW_SETPOINT
|
||||||
"|" D_CMND_OTHERM_SAVE_SETTINGS "|" D_CMND_OTHERM_FLAGS "|" D_CMND_SET_CENTRAL_HEATING_ENABLED "|" D_CMND_SET_HOT_WATER_ENABLED;
|
"|" D_CMND_OTHERM_SAVE_SETTINGS "|" D_CMND_OTHERM_FLAGS "|" D_CMND_SET_CENTRAL_HEATING_ENABLED "|" D_CMND_SET_HOT_WATER_ENABLED "|" D_CMND_BLLOR;
|
||||||
|
|
||||||
void (*const OpenThermCommands[])(void) PROGMEM = {
|
void (*const OpenThermCommands[])(void) PROGMEM = {
|
||||||
&sns_opentherm_boiler_setpoint_cmd,
|
&sns_opentherm_boiler_setpoint_cmd,
|
||||||
@ -476,7 +479,8 @@ void (*const OpenThermCommands[])(void) PROGMEM = {
|
|||||||
&sns_opentherm_save_settings_cmd,
|
&sns_opentherm_save_settings_cmd,
|
||||||
&sns_opentherm_flags_cmd,
|
&sns_opentherm_flags_cmd,
|
||||||
&sns_opentherm_set_central_heating_cmd,
|
&sns_opentherm_set_central_heating_cmd,
|
||||||
&sns_opentherm_set_hot_water_cmd};
|
&sns_opentherm_set_hot_water_cmd,
|
||||||
|
&sns_opentherm_blor_cmd,};
|
||||||
|
|
||||||
void sns_opentherm_cmd(void) { }
|
void sns_opentherm_cmd(void) { }
|
||||||
void sns_opentherm_boiler_setpoint_cmd(void)
|
void sns_opentherm_boiler_setpoint_cmd(void)
|
||||||
@ -550,6 +554,17 @@ void sns_opentherm_set_hot_water_cmd(void)
|
|||||||
ResponseCmndNumber(sns_ot_boiler_status.m_enableHotWater ? 1 : 0);
|
ResponseCmndNumber(sns_ot_boiler_status.m_enableHotWater ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void sns_opentherm_blor_cmd(void)
|
||||||
|
{
|
||||||
|
bool query = strlen(XdrvMailbox.data) == 0;
|
||||||
|
bool retval = false;
|
||||||
|
if (!query)
|
||||||
|
{
|
||||||
|
if (atoi(XdrvMailbox.data)) retval = sns_opentherm_call_blor();
|
||||||
|
}
|
||||||
|
ResponseCmndNumber(retval);
|
||||||
|
}
|
||||||
|
|
||||||
/*********************************************************************************************\
|
/*********************************************************************************************\
|
||||||
* Interface
|
* Interface
|
||||||
\*********************************************************************************************/
|
\*********************************************************************************************/
|
||||||
|
@ -32,6 +32,7 @@ typedef union {
|
|||||||
uint8_t notSupported : 1; // If set, boiler does not support this command
|
uint8_t notSupported : 1; // If set, boiler does not support this command
|
||||||
uint8_t supported : 1; // Set if at least one response were successfull
|
uint8_t supported : 1; // Set if at least one response were successfull
|
||||||
uint8_t retryCount : 2; // Retry counter before notSupported flag being set
|
uint8_t retryCount : 2; // Retry counter before notSupported flag being set
|
||||||
|
uint8_t skip : 1; // Only manual call
|
||||||
};
|
};
|
||||||
} OpenThermParamFlags;
|
} OpenThermParamFlags;
|
||||||
|
|
||||||
@ -243,7 +244,16 @@ OpenThermCommand sns_opentherm_commands[] = {
|
|||||||
.m_ot_make_request = sns_opentherm_get_generic_u16,
|
.m_ot_make_request = sns_opentherm_get_generic_u16,
|
||||||
.m_ot_parse_response = sns_opentherm_parse_generic_u16,
|
.m_ot_parse_response = sns_opentherm_parse_generic_u16,
|
||||||
.m_ot_appent_telemetry = sns_opentherm_tele_generic_u16},
|
.m_ot_appent_telemetry = sns_opentherm_tele_generic_u16},
|
||||||
|
{// Boiler Lock-out Reset command
|
||||||
|
.m_command_name = "BLOR",
|
||||||
|
.m_command_code = (uint8_t)OpenThermMessageID::Command,
|
||||||
|
.m_flags = {.skip = 1},
|
||||||
|
.m_results = {{.m_u8 = 0}, {.m_u8 = 0}},
|
||||||
|
.m_ot_make_request = sns_opentherm_send_blor,
|
||||||
|
.m_ot_parse_response = sns_opentherm_parse_generic_u16,
|
||||||
|
.m_ot_appent_telemetry = sns_opentherm_tele_u8_u8},
|
||||||
};
|
};
|
||||||
|
#define SNS_OT_COMMANDS_COUNT (sizeof(sns_opentherm_commands) / sizeof(OpenThermCommand))
|
||||||
|
|
||||||
/////////////////////////////////// Process Slave Status Flags & Control //////////////////////////////////////////////////
|
/////////////////////////////////// Process Slave Status Flags & Control //////////////////////////////////////////////////
|
||||||
unsigned long sns_opentherm_set_slave_flags(struct OpenThermCommandT *self, struct OT_BOILER_STATUS_T *status)
|
unsigned long sns_opentherm_set_slave_flags(struct OpenThermCommandT *self, struct OT_BOILER_STATUS_T *status)
|
||||||
@ -431,6 +441,32 @@ void sns_opentherm_tele_oem_diag(struct OpenThermCommandT *self)
|
|||||||
ResponseAppend_P(PSTR("%d"), (int)self->m_results[0].m_u16);
|
ResponseAppend_P(PSTR("%d"), (int)self->m_results[0].m_u16);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////// Boiler Boiler Lock-out Reset //////////////////////////////////////////////////
|
||||||
|
unsigned long sns_opentherm_send_blor(struct OpenThermCommandT *self, struct OT_BOILER_STATUS_T *status)
|
||||||
|
{
|
||||||
|
AddLog(LOG_LEVEL_ERROR, PSTR("[OTH]: Call Boiler Lock-out Reset"));
|
||||||
|
|
||||||
|
self->m_flags.skip = true; // Disable future calls of this command
|
||||||
|
|
||||||
|
unsigned int data = 1; //1 : “BLOR”= Boiler Lock-out Reset command
|
||||||
|
data <<= 8;
|
||||||
|
return OpenTherm::buildRequest(OpenThermMessageType::OPTH_WRITE_DATA, OpenThermMessageID::Command, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool sns_opentherm_call_blor()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < SNS_OT_COMMANDS_COUNT; ++i)
|
||||||
|
{
|
||||||
|
struct OpenThermCommandT *cmd = &sns_opentherm_commands[i];
|
||||||
|
if (!strcmp(cmd->m_command_name, "BLOR") && cmd->m_flags.skip) {
|
||||||
|
cmd->m_flags.skip = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/////////////////////////////////// Generic Single Float /////////////////////////////////////////////////
|
/////////////////////////////////// Generic Single Float /////////////////////////////////////////////////
|
||||||
unsigned long sns_opentherm_get_generic_float(struct OpenThermCommandT *self, struct OT_BOILER_STATUS_T *)
|
unsigned long sns_opentherm_get_generic_float(struct OpenThermCommandT *self, struct OT_BOILER_STATUS_T *)
|
||||||
{
|
{
|
||||||
@ -488,7 +524,6 @@ void sns_opentherm_parse_boiler_temperature(struct OpenThermCommandT *self, stru
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#define SNS_OT_COMMANDS_COUNT (sizeof(sns_opentherm_commands) / sizeof(OpenThermCommand))
|
|
||||||
int sns_opentherm_current_command = SNS_OT_COMMANDS_COUNT;
|
int sns_opentherm_current_command = SNS_OT_COMMANDS_COUNT;
|
||||||
|
|
||||||
unsigned long sns_opentherm_get_next_request(struct OT_BOILER_STATUS_T *boilerStatus)
|
unsigned long sns_opentherm_get_next_request(struct OT_BOILER_STATUS_T *boilerStatus)
|
||||||
@ -552,7 +587,7 @@ void sns_opentherm_dump_telemetry()
|
|||||||
for (int i = 0; i < SNS_OT_COMMANDS_COUNT; ++i)
|
for (int i = 0; i < SNS_OT_COMMANDS_COUNT; ++i)
|
||||||
{
|
{
|
||||||
struct OpenThermCommandT *cmd = &sns_opentherm_commands[i];
|
struct OpenThermCommandT *cmd = &sns_opentherm_commands[i];
|
||||||
if (!cmd->m_flags.supported)
|
if (!cmd->m_flags.supported || cmd->m_flags.skip)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -568,7 +603,9 @@ void sns_opentherm_protocol_reset()
|
|||||||
for (int i = 0; i < SNS_OT_COMMANDS_COUNT; ++i)
|
for (int i = 0; i < SNS_OT_COMMANDS_COUNT; ++i)
|
||||||
{
|
{
|
||||||
struct OpenThermCommandT *cmd = &sns_opentherm_commands[i];
|
struct OpenThermCommandT *cmd = &sns_opentherm_commands[i];
|
||||||
|
int skip = cmd->m_flags.skip;
|
||||||
cmd->m_flags.m_flags = 0;
|
cmd->m_flags.m_flags = 0;
|
||||||
|
cmd->m_flags.skip = skip;
|
||||||
memset(cmd->m_results, 0, sizeof(OpenThermCommandT::m_results));
|
memset(cmd->m_results, 0, sizeof(OpenThermCommandT::m_results));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user