New feature Auto Clear Remote Temp for MiElHVAC (#22370)

* Add prohibit function for MiElHVAC

Add Prohibit functions:
* Power
* Temperature
* Mode
 and all combinations of this functions
Updated VaneV names for better identify

* Fixed Compressor and Operation for MiElHVAC

Changed Widevane position name from ISEE to AUTO sam as in MELCLoud

* Revert "Fixed Compressor and Operation for MiElHVAC"

This reverts commit f0973c84d4.

* New feature for MiElHVAC

* Added Compressor map
* Added Operation Power in Watts
* Added Operation Energy in kWh
* Changed Widevane position name from ISEE to AUTO, displays sam as in
* Changed all map value to lover case MELCloud

* New feature for MiElHVAC

* Add device operation time in minutes

* New feature Outdoor Temperature for MiElHVAC

* Add Outdoor Temperature

* New feature Compressor Frequency for MiElHVAC

* Added Outdoor Temperature
* Renamed internal properties due typo operating and oprating to operation

* New feature Auto Clear Remote Temp for MiElHVAC

* This PR add auto clear remote temperature function
* This funcion is call on first run and after 10 sec the remote temperature stop refresh its value
* Send manually Clear command is also available

* change function name, small corrections

* added auto clear time configurable using cmnd
This commit is contained in:
Grzegorz 2024-10-28 14:04:17 +01:00 committed by GitHub
parent ef3c061ecf
commit 27db263493
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 46 additions and 0 deletions

View File

@ -44,11 +44,15 @@
#define D_CMND_MIEL_HVAC_SETAIRDIRECTION "HVACSetAirDirection" #define D_CMND_MIEL_HVAC_SETAIRDIRECTION "HVACSetAirDirection"
#define D_CMND_MIEL_HVAC_SETPROHIBIT "HVACSetProhibit" #define D_CMND_MIEL_HVAC_SETPROHIBIT "HVACSetProhibit"
#define D_CMND_MIEL_HVAC_REMOTETEMP "HVACRemoteTemp" #define D_CMND_MIEL_HVAC_REMOTETEMP "HVACRemoteTemp"
#define D_CMND_MIEL_HVAC_REMOTETEMP_AUTO_CLEAR_TIME "HVACRemoteTempClearTime"
#include <TasmotaSerial.h> #include <TasmotaSerial.h>
/* from hvac */ /* from hvac */
bool temp_type = false; bool temp_type = false;
bool remotetemp_clear = true;
unsigned long remotetemp_auto_clear_time = 10000;
unsigned long remotetemp_last_call_time = 0;
struct miel_hvac_header { struct miel_hvac_header {
uint8_t start; uint8_t start;
@ -944,6 +948,39 @@ miel_hvac_remotetemp_degc2old(long degc)
MIEL_HVAC_REMOTETEMP_OLD_FACTOR); MIEL_HVAC_REMOTETEMP_OLD_FACTOR);
} }
static void
miel_hvac_auto_clear_remotetemp(void)
{
struct miel_hvac_softc *sc = miel_hvac_sc;
struct miel_hvac_msg_remotetemp *rt = &sc->sc_remotetemp;
uint8_t control = MIEL_HVAC_REMOTETEMP_CLR;
long degc = 0;
memset(rt, 0, sizeof(*rt));
rt->seven = 0x7;
rt->control = control;
rt->temp_old = miel_hvac_remotetemp_degc2old(degc);
rt->temp = (degc + MIEL_HVAC_REMOTETEMP_OFFSET) * MIEL_HVAC_REMOTETEMP_OLD_FACTOR;
remotetemp_clear = false;
}
static void
miel_hvac_cmnd_remotetemp_auto_clear_time(void)
{
if (XdrvMailbox.data_len == 0)
return;
unsigned long clear_time = strtoul(XdrvMailbox.data, nullptr, 10);
if (clear_time == 0) {
miel_hvac_respond_unsupported();
return;
}
remotetemp_auto_clear_time = clear_time;
ResponseCmndNumber(remotetemp_auto_clear_time);
}
static void static void
miel_hvac_cmnd_remotetemp(void) miel_hvac_cmnd_remotetemp(void)
{ {
@ -960,6 +997,8 @@ miel_hvac_cmnd_remotetemp(void)
degc = 0; degc = 0;
ResponseCmndChar_P("clear"); ResponseCmndChar_P("clear");
remotetemp_clear = false;
remotetemp_last_call_time = 0;
} else { } else {
degc = strtol(XdrvMailbox.data, nullptr, 0); degc = strtol(XdrvMailbox.data, nullptr, 0);
@ -970,6 +1009,8 @@ miel_hvac_cmnd_remotetemp(void)
degc = MIEL_HVAC_REMOTETEMP_MAX; degc = MIEL_HVAC_REMOTETEMP_MAX;
ResponseCmndNumber(degc); ResponseCmndNumber(degc);
remotetemp_clear = true;
remotetemp_last_call_time = millis();
} }
memset(rt, 0, sizeof(*rt)); memset(rt, 0, sizeof(*rt));
@ -1539,6 +1580,7 @@ static const char miel_hvac_cmnd_names[] PROGMEM =
"|" D_CMND_MIEL_HVAC_SETAIRDIRECTION "|" D_CMND_MIEL_HVAC_SETAIRDIRECTION
"|" D_CMND_MIEL_HVAC_SETPROHIBIT "|" D_CMND_MIEL_HVAC_SETPROHIBIT
"|" D_CMND_MIEL_HVAC_REMOTETEMP "|" D_CMND_MIEL_HVAC_REMOTETEMP
"|" D_CMND_MIEL_HVAC_REMOTETEMP_AUTO_CLEAR_TIME
#ifdef MIEL_HVAC_DEBUG #ifdef MIEL_HVAC_DEBUG
"|" "HVACRequest" "|" "HVACRequest"
#endif #endif
@ -1554,6 +1596,7 @@ static void (*const miel_hvac_cmnds[])(void) PROGMEM = {
&miel_hvac_cmnd_setairdirection, &miel_hvac_cmnd_setairdirection,
&miel_hvac_cmnd_setprohibit, &miel_hvac_cmnd_setprohibit,
&miel_hvac_cmnd_remotetemp, &miel_hvac_cmnd_remotetemp,
&miel_hvac_cmnd_remotetemp_auto_clear_time,
#ifdef MIEL_HVAC_DEBUG #ifdef MIEL_HVAC_DEBUG
&miel_hvac_cmnd_request, &miel_hvac_cmnd_request,
#endif #endif
@ -1592,6 +1635,9 @@ bool Xdrv44(uint32_t function) {
case FUNC_EVERY_100_MSECOND: case FUNC_EVERY_100_MSECOND:
case FUNC_EVERY_200_MSECOND: case FUNC_EVERY_200_MSECOND:
case FUNC_EVERY_SECOND: case FUNC_EVERY_SECOND:
if (remotetemp_clear && ((millis() - remotetemp_last_call_time) > remotetemp_auto_clear_time || remotetemp_last_call_time == 0)) {
miel_hvac_auto_clear_remotetemp();
}
break; break;
case FUNC_JSON_APPEND: case FUNC_JSON_APPEND: