Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terminator nl master #6

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
2186243
Remove external room temperature sensor capability.
TerminatorNL Feb 22, 2024
b4a4a37
Remove device name tag from sensor names for increased readability.
TerminatorNL Feb 22, 2024
136598c
Remove device name tag from sensor names for increased readability.
TerminatorNL Feb 22, 2024
300821b
Implement low temperature heating
TerminatorNL Feb 22, 2024
01855cc
Working POC of simulated room temperature using internal sensor. Cont…
TerminatorNL Feb 24, 2024
29e194f
Remove debugging features, allow sampling of averages.
TerminatorNL Feb 25, 2024
f5e0fb8
Properly display current temperature and simulation status
TerminatorNL Feb 25, 2024
2ce77ae
Merge branch 'master' of https://github.com/TerminatorNL/MHI-AC-Ctrl-…
Apr 2, 2024
d2783ca
I don't see a reason why this was undone, please open a seperate issu…
Apr 2, 2024
61089c6
Cosmetics
Apr 2, 2024
4ea6686
Change order for backwards compatibility
Apr 2, 2024
25fbd4d
re-add wrongly deleted simulating temperature
Apr 2, 2024
52e52bb
Cosmetics
Apr 2, 2024
b92f710
Undo removal of existing code
Apr 2, 2024
e3e1eb7
Update versioning
Apr 2, 2024
72ae6db
remove publish simulated room temp every loop
Apr 3, 2024
ced6c50
fix wrong location / merge conflict mistake
Apr 3, 2024
bf6553d
Add first time user documentation
Apr 4, 2024
c4958bd
Move code and update last_internal_sensor_timestamp
Apr 5, 2024
cf02da6
Change structure of ofset setting
Apr 5, 2024
db42f20
Allow high temp cooling (from vacant property mode)
Apr 5, 2024
c5e0483
Allow fine-grained temp setting
Apr 5, 2024
8f57b02
update readme
Apr 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions MHI-AC-Ctrl-core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,16 +131,16 @@ int MHI_AC_Ctrl_Core::loop(uint max_time_ms) {
static byte erropdataCnt = 0; // number of expected error operating data
static bool doubleframe = false;
static int frame = 1;
static byte MOSI_frame[33];
static byte MOSI_frame[33];
// sb0 sb1 sb2 db0 db1 db2 db3 db4 db5 db6 db7 db8 db9 db10 db11 db12 db13 db14 chkH chkL db15 db16 db17 db18 db19 db20 db21 db22 db23 db24 db25 db26 chk2L
static byte MISO_frame[] = { 0xA9, 0x00, 0x07, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x22 };

static uint call_counter = 0; // counts how often this loop was called
static unsigned long lastTroomInternalMillis = 0; // remember when Troom internal has changed

if (frameSize == 33)
MISO_frame[0] = 0xAA;


call_counter++;
int SCKMillis = millis(); // time of last SCK low level
while (millis() - SCKMillis < 5) { // wait for 5ms stable high signal to detect a frame start
Expand Down Expand Up @@ -269,13 +269,13 @@ static byte MOSI_frame[33];

if (frameSize == 33) { // Only for framesize 33 (WF-RAC)
checksum = calc_checksumFrame33(MOSI_frame);
if ( MOSI_frame[CBL2] != lowByte(checksum ) )
if (MOSI_frame[CBL2] != lowByte(checksum))
return err_msg_invalid_checksum;
}

if (new_datapacket_received) {

if (frameSize == 33) { // Only for framesize 33 (WF-RAC)
if (frameSize == 33 ) { // Only for framesize 33 (WF-RAC)
byte vanesLRtmp = (MOSI_frame[DB16] & 0x07) + ((MOSI_frame[DB17] & 0x01) << 4);
if (vanesLRtmp != status_vanesLR_old) { // Vanes Left Right
if ((vanesLRtmp & 0x10) != 0) // Vanes LR status swing
Expand Down Expand Up @@ -598,4 +598,4 @@ static byte MOSI_frame[33];
}
}
return call_counter;
}
}
9 changes: 5 additions & 4 deletions MHI-AC-Ctrl-core.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ class MHI_AC_Ctrl_Core {
byte new_VanesLR1 = 0;
byte new_3Dauto = 0;
byte frameSize = 20;

CallbackInterface_Status *m_cbiStatus;

public:
Expand All @@ -184,7 +184,8 @@ class MHI_AC_Ctrl_Core {
float get_troom_offset(); // get troom offset, only usefull when ENHANCED_RESOLUTION is used
void set_troom_offset(float offset); // set troom offset, only usefull when ENHANCED_RESOLUTION is used
void set_frame_size(byte framesize); // set framesize to 20 or 33
void set_3Dauto(AC3Dauto Dauto); // set the requested 3D auto mode
void set_vanesLR(uint vanesLR); // set the vanes vertical position
void set_3Dauto(AC3Dauto Dauto); // set the 3D auto mode on or off
void set_vanesLR(uint vanesLR); // set the vanes LR (vertical) position

};

};
27 changes: 25 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,23 @@
# MHI-AC-Ctrl-ESPHome
This project is a simple integration of the amazing work [absalom-muc](https://github.com/absalom-muc) has done with his project [MHI-AC-Ctrl](https://github.com/absalom-muc/MHI-AC-Ctrl).\
It's supposed to simplify the [Home Assistant](https://www.home-assistant.io/) setup, while giving you OTA and auto-discovery with virtually zero effort and no MQTT needed, powered by [ESPHome](https://esphome.io/).\
MHI-AC-Ctrl-core.\* files were forked directly, with no modification, whereas your WiFi credentials should go into the \*.yaml file, and mhi_ac_ctrl.h is the core of the integration.\
Just put all these files in your ESPHome folder, flash once, and you're good to go!
MHI-AC-Ctrl-core.\* files were forked directly, with no modification, whereas your WiFi credentials should go into the \*.yaml file, and mhi_ac_ctrl.h is the core of the integration.

# Installation
## Prerequisites:
- Home Assistant installed
- ESPHome plugin installed (https://esphome.io/guides/getting_started_hassio.html)
- ssh plugin (preferred) or file editor installed in Home Assistant

SSH to your Home Assistant system, navigate to /config/esphome and clone the git repo:
```bash
cd /config/esphome
git clone https://github.com/ginkage/MHI-AC-Ctrl-ESPHome.git .
cp lr_mhi_ac_ctrl.yaml first_ac.yaml
```

After that, you should have a first_ac.yaml. Verify the file (wifi credentials, and name of the unit for example) Login to the Home Assistant web interface and install the yaml file on your esp with esphome.


# Fan Modes Up/Down Left/Right
Most newer MHI units (the ones supporting the WF-RAC WiFi module) support fine grained vane control for Left/Right and Up/Down.
Expand All @@ -25,6 +40,14 @@ Has now 5 different fan modes but I'm not sure if the auto mode works proper, ke

# Changelog:

**v2.2** (2024-04)
- Add low temp heating from @Terminator-NL
- Add temp offset from @Terminator-NL
- Add webserver with authentication
- Made wifi credentials more nice
- Add defrost binary sensor
- Add high precision temperature setting

**v2.1** (2024-03)
- Breaking change: Cleaned up conf files
- Add restart button
Expand Down
5 changes: 4 additions & 1 deletion conf/large_framesize.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Version 2.1
# Version 2.2
globals:
- id: room_temp_api_timeout
type: int
Expand Down Expand Up @@ -27,6 +27,7 @@ binary_sensor:

binary_sensors:
- name: Defrost
- name: Simulating room temperature

sensor:
- platform: custom
Expand Down Expand Up @@ -109,6 +110,8 @@ sensor:
ESP_LOGD("main", "received 3DAuto off from AC");
id(fan_control_3Dauto).publish_state(false);
}
- name: Simulated room temperature
- name: Room temperature offset

text_sensor:
- platform: custom
Expand Down
5 changes: 4 additions & 1 deletion conf/legacy_framesize.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Version 2.1
# Version 2.2
globals:
- id: room_temp_api_timeout
type: int
Expand Down Expand Up @@ -27,6 +27,7 @@ binary_sensor:

binary_sensors:
- name: Defrost
- name: Simulating room temperature

sensor:
- platform: custom
Expand Down Expand Up @@ -72,6 +73,8 @@ sensor:
- name: Outdoor unit discharge pipe
- name: Outdoor unit discharge pipe super heat
- name: Protection error state
- name: Simulated room temperature
- name: Room temperature offset

text_sensor:
- platform: custom
Expand Down
27 changes: 23 additions & 4 deletions lr_mhi_ac_ctrl.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
# Version 2.1
# Version 2.2
substitutions:
# Unique device ID in HA
deviceid: "mhi_ac_ctrl"
# Unique device name in HA
devicename: "MHI-AC-Ctrl"
# The WiFi network to connect to
wifi_ssid: !secret wifi_ssid
# The WiFi password
wifi_password: !secret wifi_password
# Web auth username
username: !secret username
# Web auth password
password: !secret password

esphome:
name: ${deviceid}
Expand All @@ -25,19 +33,29 @@ packages:
# mhi-ac-ctrl: !include conf/legacy_framesize.yaml

wifi:
ssid: "**SSID**"
password: "**PASSWORD**"

ssid: ${wifi_ssid}
password: ${wifi_password}
ap:
ssid: ${devicename}

captive_portal:

web_server:
log: false
port: 80
auth:
username: ${username}
password: ${password}

logger:
level: DEBUG
baud_rate: 0

ota:

button:
- platform: safe_mode
name: Reboot to safe mode
- platform: restart
name: Restart
entity_category: diagnostic
Expand All @@ -64,6 +82,7 @@ api:
then:
- lambda: |-
return ((MhiAcCtrl*)id(${deviceid}))->set_room_temperature(value);

# Call the set_vanes service from HA to set the vane position
# Needed because the ESPHome Climate class does not support this natively
# Possible values: 1-4: static positions, 5: swing, 0: unknown
Expand Down
Loading