fix opentherm

This commit is contained in:
Alexey Pavlov 2021-11-07 17:56:28 +03:00
parent 3eb6c550e1
commit 71f1c1775f
2 changed files with 47 additions and 2 deletions

View File

@ -16,6 +16,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define USE_OPENTHERM
#ifdef USE_OPENTHERM
@ -467,8 +468,11 @@ uint8_t sns_opentherm_read_flags(char *data, uint32_t len)
// flag value, however, this command does not update the settings.
#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
"|" 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 = {
&sns_opentherm_boiler_setpoint_cmd,
@ -476,7 +480,8 @@ void (*const OpenThermCommands[])(void) PROGMEM = {
&sns_opentherm_save_settings_cmd,
&sns_opentherm_flags_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_boiler_setpoint_cmd(void)
@ -550,6 +555,17 @@ void sns_opentherm_set_hot_water_cmd(void)
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
\*********************************************************************************************/

View File

@ -16,6 +16,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define USE_OPENTHERM
#ifdef USE_OPENTHERM
@ -243,6 +244,14 @@ OpenThermCommand sns_opentherm_commands[] = {
.m_ot_make_request = sns_opentherm_get_generic_u16,
.m_ot_parse_response = sns_opentherm_parse_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 = {.notSupported = 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},
};
/////////////////////////////////// Process Slave Status Flags & Control //////////////////////////////////////////////////
@ -431,6 +440,26 @@ void sns_opentherm_tele_oem_diag(struct OpenThermCommandT *self)
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]: Boiler Boiler Lock-out Reset"));
self->m_flags.notSupported = true; // Disable future calls of this command
unsigned int data = 1; //1 : “BLOR”= Boiler Lock-out Reset command
return OpenTherm::buildRequest(OpenThermMessageType::WRITE_DATA, OpenThermMessageID::Command, data);
}
bool sns_opentherm_call_blor()
{
/*
OpenThermCommandT *cmd = &sns_opentherm_commands[sns_opentherm_current_command-1];
if (strcmp(cmd->m_command_name, "BLOR")) return false;
cmd->m_flags.notSupported = false;
return true;
*/
}
/////////////////////////////////// Generic Single Float /////////////////////////////////////////////////
unsigned long sns_opentherm_get_generic_float(struct OpenThermCommandT *self, struct OT_BOILER_STATUS_T *)
{