From 56243ef720275790a85478d72b05c4b50f32520b Mon Sep 17 00:00:00 2001 From: Grzegorz Date: Sun, 3 Nov 2024 21:31:35 +0100 Subject: [PATCH] New features for MiElHVAC (#22423) * 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 f0973c84d4915e776f715c0749a593efc6f55953. * 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 * Improvements to remote temp, auto clear time for MiElHVAC * Added min = 1000ms and max 600000ms limit to remotetemp auto clear time function * Changed function name to use sam format as other * Added RemoteTemperatureSensor to the sensor * more improvements to auto clear time * Changed RemoteTemperatureSensor to RemoteTemperatureSensorState * Added RemoteTemperatureSensorAutoClearTime to the sensor output * New feature Timers for MiElHVAC * Added Timers to the sensor output: * TimerMode - none, on, off, on_and_off * TimerOn - display time to ON * TimerOnRemaining - display remaining time to ON * TimerOff - display time to OFF * TimerOffRemaining - display remaining time to OFF * New feature for Stage and more for MiElHVAC * Added to sensor output: * Added PrerunStage - on/off, report compressor prepare stage before start working * FanStage - off, quiet, 1, 2, 3 ,4 ,5, report current fan stage * ModeStage - manual(heat, dry, cool, fan_only, heat_isee, dry_isee, cool_isee), auto_fan, auto_heat, auto_cool, report current mode * Renamed Bytes to Settings for raw data * Renamed const UPDATE to SETTINGS * Moved SETTINGS const from miel_hvac_msg_settings to miel_hvac_data_settings * Renamed some functions name to get better code readable * Removed some empty lines * Refactor some structure of code to make more clean and better readable * remove duplicate settings request * New features for MiElHVAC * Changed PrerunStage to OperationStage * Updated map for OperationStage * Updated map for ModeStage * Changed map fan_only to fan * Cleanup --- .../tasmota_xdrv_driver/xdrv_44_miel_hvac.ino | 35 +++++++++++-------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/tasmota/tasmota_xdrv_driver/xdrv_44_miel_hvac.ino b/tasmota/tasmota_xdrv_driver/xdrv_44_miel_hvac.ino index 2635cfee5..fe414bd12 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_44_miel_hvac.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_44_miel_hvac.ino @@ -180,9 +180,12 @@ struct miel_hvac_data_status struct miel_hvac_data_stage { uint8_t _pad1[2]; - uint8_t prerun; -#define MIEL_HVAC_STAGE_PRERUN_OFF 0x00 -#define MIEL_HVAC_STAGE_PRERUN_ON 0x04 + uint8_t operation; +#define MIEL_HVAC_STAGE_OPERATION_NORMAL 0x00 +#define MIEL_HVAC_STAGE_OPERATION_UNKNOWN 0x01 +#define MIEL_HVAC_STAGE_OPERATION_DEFROST 0x02 +#define MIEL_HVAC_STAGE_OPERATION_STANDBY 0x03 +#define MIEL_HVAC_STAGE_OPERATION_PREHEAT 0x04 uint8_t fan; #define MIEL_HVAC_STAGE_FAN_OFF 0x00 #define MIEL_HVAC_STAGE_FAN_1 0x01 @@ -196,6 +199,7 @@ struct miel_hvac_data_stage #define MIEL_HVAC_STAGE_MODE_AUTO_FAN 0x01 #define MIEL_HVAC_STAGE_MODE_AUTO_HEAT 0x02 #define MIEL_HVAC_STAGE_MODE_AUTO_COOL 0x03 +#define MIEL_HVAC_STAGE_MODE_AUTO_LEADER 0x04 }; struct miel_hvac_data @@ -210,7 +214,7 @@ struct miel_hvac_data union { struct miel_hvac_data_settings settings; - struct miel_hvac_data_roomtemp roomtemp;; + struct miel_hvac_data_roomtemp roomtemp; struct miel_hvac_data_timers timers; struct miel_hvac_data_status status; struct miel_hvac_data_stage stage; @@ -243,7 +247,7 @@ CTASSERT(offsetof(struct miel_hvac_data, data.timers.offminutes) == 5); CTASSERT(offsetof(struct miel_hvac_data, data.timers.onminutesremaining) == 6); CTASSERT(offsetof(struct miel_hvac_data, data.timers.offminutesremaining) == 7); -CTASSERT(offsetof(struct miel_hvac_data, data.stage.prerun) == 3); +CTASSERT(offsetof(struct miel_hvac_data, data.stage.operation) == 3); CTASSERT(offsetof(struct miel_hvac_data, data.stage.fan) == 4); CTASSERT(offsetof(struct miel_hvac_data, data.stage.mode) == 5); @@ -403,7 +407,7 @@ static const struct miel_hvac_map miel_hvac_mode_map[] = { {MIEL_HVAC_SETTINGS_MODE_HEAT, "heat"}, {MIEL_HVAC_SETTINGS_MODE_DRY, "dry"}, {MIEL_HVAC_SETTINGS_MODE_COOL, "cool"}, - {MIEL_HVAC_SETTINGS_MODE_FAN, "fan_only"}, + {MIEL_HVAC_SETTINGS_MODE_FAN, "fan"}, {MIEL_HVAC_SETTINGS_MODE_AUTO, "auto"}, {MIEL_HVAC_SETTINGS_MODE_HEAT_ISEE, "heat_isee"}, {MIEL_HVAC_SETTINGS_MODE_DRY_ISEE, "dry_isee"}, @@ -469,9 +473,12 @@ static const struct miel_hvac_map miel_hvac_timer_mode_map[] = { {MIEL_HVAC_TIMER_MODE_BOTH, "on_and_off"}, }; -static const struct miel_hvac_map miel_hvac_stage_prerun_map[] = { - {MIEL_HVAC_STAGE_PRERUN_OFF, "off"}, - {MIEL_HVAC_STAGE_PRERUN_ON, "on"}, +static const struct miel_hvac_map miel_hvac_stage_operation_map[] = { + {MIEL_HVAC_STAGE_OPERATION_NORMAL, "normal"}, + {MIEL_HVAC_STAGE_OPERATION_UNKNOWN, "unknown"}, + {MIEL_HVAC_STAGE_OPERATION_DEFROST, "defrost"}, + {MIEL_HVAC_STAGE_OPERATION_STANDBY, "standby"}, + {MIEL_HVAC_STAGE_OPERATION_PREHEAT, "preheat"}, }; static const struct miel_hvac_map miel_hvac_stage_fan_map[] = { @@ -489,6 +496,7 @@ static const struct miel_hvac_map miel_hvac_stage_mode_map[] = { {MIEL_HVAC_STAGE_MODE_AUTO_FAN, "auto_fan"}, {MIEL_HVAC_STAGE_MODE_AUTO_HEAT, "auto_heat"}, {MIEL_HVAC_STAGE_MODE_AUTO_COOL, "auto_cool"}, + {MIEL_HVAC_STAGE_MODE_AUTO_LEADER, "auto_leader"}, }; enum miel_hvac_parser_state @@ -545,7 +553,6 @@ miel_hvac_update_settings_pending(struct miel_hvac_softc *sc) } static struct miel_hvac_softc *miel_hvac_sc = nullptr; - static void miel_hvac_input_connected(struct miel_hvac_softc *, const void *, size_t); static void miel_hvac_input_data(struct miel_hvac_softc *, const void *, size_t); static void miel_hvac_input_updated(struct miel_hvac_softc *, const void *, size_t); @@ -1078,7 +1085,7 @@ miel_hvac_cmnd_remotetemp(void) update->temp_old = miel_hvac_remotetemp_degc2old(degc); update->temp = (degc + MIEL_HVAC_REMOTETEMP_OFFSET) * MIEL_HVAC_REMOTETEMP_OLD_FACTOR; - remotetemp_last_call_time = control == MIEL_HVAC_REMOTETEMP_SET ? millis() : 0; + remotetemp_last_call_time = control == MIEL_HVAC_REMOTETEMP_SET ? millis() : 0; remotetemp_clear = control == MIEL_HVAC_REMOTETEMP_SET ? true : false; } @@ -1252,7 +1259,7 @@ miel_hvac_input_data(struct miel_hvac_softc *sc, const void *buf, size_t len) break; case MIEL_HVAC_DATA_T_ROOMTEMP: miel_hvac_input_sensor(sc, &sc->sc_roomtemp, d); - break; + break; case MIEL_HVAC_DATA_T_TIMERS: miel_hvac_input_sensor(sc, &sc->sc_timers, d); break; @@ -1516,10 +1523,10 @@ miel_hvac_sensor(struct miel_hvac_softc *sc) const struct miel_hvac_data_stage *stage = &sc->sc_stage.data.stage; char hex[(sizeof(sc->sc_stage) + 1) * 2]; - name = miel_hvac_map_byval(stage->prerun, miel_hvac_stage_prerun_map, nitems(miel_hvac_stage_prerun_map)); + name = miel_hvac_map_byval(stage->operation, miel_hvac_stage_operation_map, nitems(miel_hvac_stage_operation_map)); if (name != NULL) { - ResponseAppend_P(PSTR(",\"PrerunStage\":\"%s\""), name); + ResponseAppend_P(PSTR(",\"OperationStage\":\"%s\""), name); } name = miel_hvac_map_byval(stage->fan, miel_hvac_stage_fan_map, nitems(miel_hvac_stage_fan_map));