Skip to content

Commit

Permalink
update 2.6R2
Browse files Browse the repository at this point in the history
mainly Fan with "Auto" implemented
  • Loading branch information
absalom-muc committed Aug 28, 2022
1 parent 3b6585d commit edd793e
Show file tree
Hide file tree
Showing 9 changed files with 110 additions and 133 deletions.
16 changes: 8 additions & 8 deletions SW-Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,16 @@ topic|r/w|value|comment
Power|r/w|"On", "Off"|
Mode|r/w|"Auto", "Dry", "Cool", "Fan", "Heat" and "Off"|"Off" is only supported when option [POWERON_WHEN_CHANGING_MODE](#behaviour-when-changing-ac-mode-supporth) is selected
Tsetpoint|r/w|18 ... 30|Target room temperature (float) in °C, resolution is 0.5°C
Fan|r/w|1 ... 4|Fan level <sup>1</sup>
Vanes|r/w|1,2,3,4,"Swing","?"|Vanes up/down position <sup>2</sup>
Troom|r/w|0 ... 35|Room temperature (float) in °C, resolution is 0.25°C <sup>3</sup>
Tds1820|r|-40 .. 85|Temperature (float) by the additional DS18x20 sensor in °C, resolution is 0.5°C <sup>4</sup>
Fan|r/w|1,2,3,4,"Auto"|Fan level
Vanes|r/w|1,2,3,4,"Swing","?"|Vanes up/down position <sup>1</sup>
Troom|r/w|0 ... 35|Room temperature (float) in °C, resolution is 0.25°C <sup>2</sup>
Tds1820|r|-40 .. 85|Temperature (float) by the additional DS18x20 sensor in °C, resolution is 0.5°C <sup>3</sup>
Errorcode|r|0 .. 255|error code (unsigned int)
ErrOpData|w||triggers the reading of last error operating data

<sup>1</sup> Fan auto is not supported via the SPI.
<sup>2</sup> When the last command was received via the infrared remote control then the Vanes status is unknown and the "?" is published.
<sup>3</sup> Please compare with section [Room temperature](#room-temperature) for writing.
<sup>4</sup> Only available when a DS18x20 is connected, please see the description in [Hardware.md](Hardware.md) and in section [External Temperature Sensor Settings](#external-temperature-sensor-settings-supporth).
<sup>1</sup> When the last command was received via the infrared remote control then the Vanes status is unknown and the "?" is published.
<sup>2</sup> Please compare with section [Room temperature](#room-temperature) for writing.
<sup>3</sup> Only available when a DS18x20 is connected, please see the description in [Hardware.md](Hardware.md) and in section [External Temperature Sensor Settings](#external-temperature-sensor-settings-supporth).

Additionally, the following program status topics are available:

Expand Down Expand Up @@ -177,6 +176,7 @@ if your framework prefers lower case. These topics and payloads are used for MQT
## Operating data ([MHI-AC-Ctrl-core.h](src/MHI-AC-Ctrl-core.h))
Currently the following operating data in double quotes are supported
```
{ 0xc0, 0x94}, // ? "unknown"
{ 0xc0, 0x02}, // 1 "MODE"
{ 0xc0, 0x05}, // 2 "SET-TEMP" [°C]
{ 0xc0, 0x80}, // 3 "RETURN-AIR" [°C]
Expand Down
4 changes: 1 addition & 3 deletions Troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ For finding a solution for your problem, you should use the log output via the s

## Known limitations
MHI-AC-Ctrl doesn't support all functions of the infrared remote control. This is because some functions are not reflected by the SPI payload (or I'm not aware of the according SPI codes):
- "auto" for the fan is not supported, only 1, 2, 3,4 for fan are supported
- Vanes left/right is not supported
- 3D is not supported
- Vanes up/down is supported, but with the limitation that if the last command was issued by the IR RC, then the vanes up/down status is not visible in MHI-AC-Ctrl

This should be considered especially when you use the IR RC in parallel to MHI-AC-Ctrl.
Expand Down Expand Up @@ -63,8 +63,6 @@ Please check this [section](#fire-pins-not-properly-connected)
The MQTT path for receiving the status is different from the MQTT path for setting values. Re-check that you use the set-path described in [SW-Configuration.md](https://github.com/absalom-muc/MHI-AC-Ctrl/blob/master/SW-Configuration.md#mqtt-status). Please pay attention to the case sensitivity.
## :fire: Last Vanes up/down status not visible in MHI-AC-Ctrl
That is no bug, but a restriction because the SPI unfortunately doesn't provide the Vanes status when the IR remote control was used for the last command.
## :fire: Fan auto not working
That is no bug, but a restriction because the SPI unfortunately doesn't support 'auto' for the Fan.

## :fire: Log shows errors, but it works nevertheless
With some ACs the SPI connection is fragile because of a different timing. However, this does not appear to be critical and is usually not noticed by the user.
Expand Down
4 changes: 4 additions & 0 deletions Version.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
MHI-AC-Ctrl by absalom-muc

**v2.6R2** (August 2022, draft version)
- final implementation for fan control incl. 'Auto', see [issue](https://github.com/absalom-muc/MHI-AC-Ctrl/issues/99). This is a breaking change, because in the past only the values 1, 2 , 3, 4 were supported for fan status and fan control. Now "Auto" was added.
- added temporary operating data "unknwon" to find out which functions are supported by SPI dependent on the indoor AC unit.

**v2.6R1** (August 2022, draft version)
- new implementation for fan control incl. 'Auto', see [issue](https://github.com/absalom-muc/MHI-AC-Ctrl/issues/99)

Expand Down
59 changes: 19 additions & 40 deletions src/MHI-AC-Ctrl-core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ void MHI_AC_Ctrl_Core::reset_old_values() { // used e.g. when MQTT connection t
status_power_old = 0xff;
status_mode_old = 0xff;
status_fan_old = 0xff;
status_fan2_old = 0xff;
status_vanes_old = 0xff;
status_troom_old = 0xfe;
status_tsetpoint_old = 0x00;
status_errorcode_old = 0xff;

// old operating data
op_0x94_old = 0xff;
op_mode_old = 0xff;
op_settemp_old = 0xff;
op_return_air_old = 0xff;
Expand Down Expand Up @@ -63,17 +63,8 @@ void MHI_AC_Ctrl_Core::set_tsetpoint(uint tsetpoint) {
new_Tsetpoint = 0b10000000 | tsetpoint;
}

void MHI_AC_Ctrl_Core::set_fan2(uint fan) {
new_Fan12 = 0b00001000 | fan;
}

void MHI_AC_Ctrl_Core::set_fan(uint fan) {
if (fan == 4) {
new_Fan1 = 0b00001010;
new_Fan6 = 0b00010000;
}
else
new_Fan1 = 0b00001000 | (fan - 1);
new_Fan = 0b00001000 | fan;
}

void MHI_AC_Ctrl_Core::set_vanes(uint vanes) {
Expand Down Expand Up @@ -148,21 +139,8 @@ int MHI_AC_Ctrl_Core::loop(int max_time_ms) {
MISO_frame[DB2] = new_Tsetpoint;
new_Tsetpoint = 0;

if(new_Fan1>0){
MISO_frame[DB1] = new_Fan1; // Abfrage auf new_Fan1>0 ???
new_Fan1 = 0;
}
if(new_Fan12>0){
MISO_frame[DB1] = new_Fan12; // Abfrage auf new_Fan21>0
new_Fan12 = 0;
}
if(new_Fan6>0){
MISO_frame[DB6] |= new_Fan6; // Abfrage auf new_Fan6>0
new_Fan6 = 0;
}
/*new_Fan1 = 0;
new_Fan12 = 0;
new_Fan6 = 0;*/
MISO_frame[DB1] = new_Fan;
new_Fan = 0;

MISO_frame[DB0] |= new_Vanes0;
MISO_frame[DB1] |= new_Vanes1;
Expand Down Expand Up @@ -230,23 +208,12 @@ int MHI_AC_Ctrl_Core::loop(int max_time_ms) {
m_cbiStatus->cbiStatusFunction(status_power, status_power_old);
}

uint fantmp;
if ((MOSI_frame[DB6] & 0x40) != 0) // Fan status
fantmp = 3;
else
fantmp = (MOSI_frame[DB1] & 0x03); // warum auf die untersten 2 bits beschränkt, warum nicht bit 2 mitnehmen???? entspricht aber dem Fan_1_2_3_4_Auto_IR.log
if (fantmp != status_fan_old) { // FAN mit IR-RC testen ohne andere wired RC, evtl. auch mit AC vorher mal stromlos machen
uint fantmp = MOSI_frame[DB1] & 0x07;
if (fantmp != status_fan_old) {
status_fan_old = fantmp;
m_cbiStatus->cbiStatusFunction(status_fan, status_fan_old);
}

uint fantmp2 = MOSI_frame[DB1] & 0x0f;
if (fantmp2 != status_fan2_old) {
status_fan2_old = fantmp2;
m_cbiStatus->cbiStatusFunction(status_fan2, status_fan2_old);
}


// Only updated when Vanes command via wired RC
uint vanestmp = (MOSI_frame[DB0] & 0xc0) + ((MOSI_frame[DB1] & 0xB0) >> 4);
if (vanestmp != status_vanes_old) {
Expand Down Expand Up @@ -280,6 +247,18 @@ int MHI_AC_Ctrl_Core::loop(int max_time_ms) {
bool MOSI_type_opdata = (MOSI_frame[DB10] & 0x30) == 0x10;

switch (MOSI_frame[DB9]) {
case 0x94: // opdata_0x94
if ((MOSI_frame[DB6] & 0x80) != 0) { //
if (MOSI_type_opdata) {
if ((MOSI_frame[DB10] != op_0x94_old)) {
op_0x94_old = (MOSI_frame[DB10]<<16)+(MOSI_frame[DB11]<<8)+MOSI_frame[DB12];
m_cbiStatus->cbiStatusFunction(opdata_0x94, op_0x94_old);
}
}
//else
// m_cbiStatus->cbiStatusFunction(erropdata_unknown, op_unknown_old); // noch nie gesehen, dass es auftaucht
}
break;
case 0x02:
if ((MOSI_frame[DB6] & 0x80) != 0) { // 1 MODE
if (MOSI_type_opdata) {
Expand Down Expand Up @@ -509,7 +488,7 @@ int MHI_AC_Ctrl_Core::loop(int max_time_ms) {
case 0xff: // default
break;
default: // unknown operating data
m_cbiStatus->cbiStatusFunction(opdata_unknwon, MOSI_frame[DB10] << 8 | MOSI_frame[DB9]);
m_cbiStatus->cbiStatusFunction(opdata_unknown, MOSI_frame[DB10] << 8 | MOSI_frame[DB9]);
Serial.printf("Unknown operating data, MOSI_frame[DB9]=%i MOSI_frame[D10]=%i\n", MOSI_frame[DB9], MOSI_frame[DB10]);
}
}
Expand Down
14 changes: 6 additions & 8 deletions src/MHI-AC-Ctrl-core.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

// comment out the data you are not interested, but at least leave the last dummy row
const byte opdata[][2] PROGMEM = {
//{ 0xc0, 0x94}, // ? "opdata_0x94", background is unknown.
{ 0xc0, 0x02}, // 1 "MODE"
{ 0xc0, 0x05}, // 2 "SET-TEMP" [°C]
{ 0xc0, 0x80}, // 3 "RETURN-AIR" [°C]
Expand Down Expand Up @@ -61,10 +62,10 @@ enum ACType { // Type enum
};

enum ACStatus { // Status enum
status_rssi = type_status, status_mqtt_lost, status_wifi_lost, status_connected, status_cmd, status_tds1820, status_fsck, status_fmosi, status_fmiso, status_power, status_mode, status_fan, status_fan2, status_vanes, status_troom, status_tsetpoint, status_errorcode,
opdata_mode = type_opdata, opdata_tsetpoint, opdata_return_air, opdata_outdoor, opdata_tho_r1, opdata_iu_fanspeed, opdata_thi_r1, opdata_thi_r2, opdata_thi_r3,
status_power = type_status, status_mode, status_fan, status_vanes, status_troom, status_tsetpoint, status_errorcode,
opdata_mode = type_opdata, opdata_0x94, opdata_tsetpoint, opdata_return_air, opdata_outdoor, opdata_tho_r1, opdata_iu_fanspeed, opdata_thi_r1, opdata_thi_r2, opdata_thi_r3,
opdata_ou_fanspeed, opdata_total_iu_run, opdata_total_comp_run, opdata_comp, opdata_ct, opdata_td,
opdata_tdsh, opdata_protection_no, opdata_defrost, opdata_ou_eev1, opdata_unknwon,
opdata_tdsh, opdata_protection_no, opdata_defrost, opdata_ou_eev1, opdata_unknown,
erropdata_mode = type_erropdata, erropdata_tsetpoint, erropdata_return_air, erropdata_thi_r1, erropdata_thi_r2, erropdata_thi_r3,
erropdata_iu_fanspeed, erropdata_total_iu_run, erropdata_outdoor, erropdata_tho_r1, erropdata_comp, erropdata_td, erropdata_ct, erropdata_ou_fanspeed,
erropdata_total_comp_run, erropdata_ou_eev1, erropdata_errorcode
Expand Down Expand Up @@ -92,13 +93,13 @@ class MHI_AC_Ctrl_Core {
byte status_power_old;
byte status_mode_old;
byte status_fan_old;
byte status_fan2_old;
byte status_vanes_old;
byte status_troom_old;
byte status_tsetpoint_old;
byte status_errorcode_old;

// old operating data
byte op_0x94_old;
byte op_mode_old;
byte op_settemp_old;
byte op_return_air_old;
Expand All @@ -123,9 +124,7 @@ class MHI_AC_Ctrl_Core {
byte new_Power = 0;
byte new_Mode = 0;
byte new_Tsetpoint = 0;
byte new_Fan1 = 0;
byte new_Fan12 = 0;
byte new_Fan6 = 0;
byte new_Fan = 0;
byte new_Vanes0 = 0;
byte new_Vanes1 = 0;
bool request_erropData = false;
Expand All @@ -146,7 +145,6 @@ class MHI_AC_Ctrl_Core {
void set_mode(ACMode mode); // change AC mode (e.g. heat, dry, cool etc.)
void set_tsetpoint(uint tsetpoint); // set the target temperature of the AC)
void set_fan(uint fan); // set the requested fan speed
void set_fan2(uint fan); // set the requested fan speed
void set_vanes(uint vanes); // set the vanes horizontal position (or swing)
void set_troom(byte temperature); // set the room temperature used by AC
void request_ErrOpData(); // request that the AC provides the error data
Expand Down
4 changes: 3 additions & 1 deletion src/MHI-AC-Ctrl.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@
#define TOPIC_POWER "Power"
#define TOPIC_MODE "Mode"
#define TOPIC_FAN "Fan"
#define TOPIC_FAN2 "Fan2"
#define TOPIC_VANES "Vanes"
#define TOPIC_TROOM "Troom"
#define TOPIC_TSETPOINT "Tsetpoint"
#define TOPIC_ERRORCODE "Errorcode"

#define TOPIC_UNKNOWN "unknown"
#define TOPIC_0X94 "OPDATA_0x94"
#define TOPIC_RETURNAIR "RETURN-AIR"
#define TOPIC_THI_R1 "THI-R1"
#define TOPIC_THI_R2 "THI-R2"
Expand Down Expand Up @@ -60,6 +61,7 @@
#define PAYLOAD_MODE_COOL "Cool"
#define PAYLOAD_MODE_FAN "Fan"
#define PAYLOAD_MODE_HEAT "Heat"
#define PAYLOAD_FAN_AUTO "Auto"
#define PAYLOAD_VANES_UNKNOWN "?"
#define PAYLOAD_VANES_SWING "Swing"
#define PAYLOAD_OP_DEFROST_ON "On"
Expand Down
Loading

0 comments on commit edd793e

Please sign in to comment.