# Mitsubishi Heavy Industries MHI air conditioning with WF-RAC binding development

**URL:** <https://community.openhab.org/t/mitsubishi-heavy-industries-mhi-air-conditioning-with-wf-rac-binding-development/154449>\
**Category:** Bindings\
**Tags:** mhi, mitsubishi, air-conditioning\
**Created:** [March 9, 2024, 10:37am UTC](https://community.openhab.org/t/mitsubishi-heavy-industries-mhi-air-conditioning-with-wf-rac-binding-development/154449 "2024-03-09T10:37:31Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![PrzemoF](https://community.openhab.org/letter_avatar_proxy/v4/letter/p/41988e/32.png) [@PrzemoF](https://community.openhab.org/u/PrzemoF)\
**Post date:** [March 9, 2024, 10:37am UTC](https://community.openhab.org/t/mitsubishi-heavy-industries-mhi-air-conditioning-with-wf-rac-binding-development/154449/1 "2024-03-09T10:37:31Z")

</div>

I’m going to port Mitsubishi Heavy Industries air conditioning code from HA. Is there a binding template that I could use?

So far I found this:

1. [Bindings | openHAB](https://www.openhab.org/docs/developer/bindings/)
2. [Developer Guide | openHAB](https://www.openhab.org/docs/developer/#develop-a-new-binding)

Creating skeleton from scratch using maven. Starting point: openhabian:

```sudo
git clone https://github.com/openhab/openhab-addons.git
$cd openhab-addons/bundles/
./create_openhab_binding_skeleton.sh <BindingIdInCamelCase> <Author> <GitHub Username>

```

Related topic: [MHI (Mitsubishi Heavy Industries) AC control through build in WF-RAC module](https://community.openhab.org/t/mhi-mitsubishi-heavy-industries-ac-control-through-build-in-wf-rac-module/149228)

Reference code from HA: [GitHub - jeatheak/Mitsubishi-WF-RAC-Integration: WF-RAC homeassistant integration](https://github.com/jeatheak/Mitsubishi-WF-RAC-Integration/tree/main)  
HA topic about MHI WF-RAC: [Mitsubishi Wifi Module WF-RAC (Smart M-Air) - Feature Requests - Home Assistant Community](https://community.home-assistant.io/t/mitsubishi-wifi-module-wf-rac-smart-m-air/411025)

---

<div class="post-metadata">

**Author:** ![hmerk](https://community.openhab.org/user_avatar/community.openhab.org/hmerk/32/56432_2.png) [@hmerk](https://community.openhab.org/u/hmerk)\
**Post date:** [March 9, 2024, 10:57am UTC](https://community.openhab.org/t/mitsubishi-heavy-industries-mhi-air-conditioning-with-wf-rac-binding-development/154449/2 "2024-03-09T10:57:43Z")

</div>

Either create an empty skeleton with the maven script or take a look at the intesis Binding, which was written for intesis/AirConWithMe WiFi adapters used in MHI and several other aircon devices.

---

<div class="post-metadata">

**Author:** ![peterhoeg](https://community.openhab.org/user_avatar/community.openhab.org/peterhoeg/32/74334_2.png) [@peterhoeg](https://community.openhab.org/u/peterhoeg)\
**Post date:** [March 14, 2024, 10:21am UTC](https://community.openhab.org/t/mitsubishi-heavy-industries-mhi-air-conditioning-with-wf-rac-binding-development/154449/3 "2024-03-14T10:21:22Z")

</div>

I know from experience that the Daikin AC binding worked very well: [Daikin - Bindings | openHAB](https://www.openhab.org/addons/bindings/daikin/)

I have not looked at the code, so I cannot comment on suitability from that angle.

---

<div class="post-metadata">

**Author:** ![PrzemoF](https://community.openhab.org/letter_avatar_proxy/v4/letter/p/41988e/32.png) [@PrzemoF](https://community.openhab.org/u/PrzemoF)\
**Post date:** [March 22, 2024, 7:28pm UTC](https://community.openhab.org/t/mitsubishi-heavy-industries-mhi-air-conditioning-with-wf-rac-binding-development/154449/4 "2024-03-22T19:28:29Z")

</div>

@[bartsnijder](https://community.openhab.org/u/bartsnijder) I feel you might be interested in this topic 🙂  
Nothing to test yet, but I’ll need your help once I have something ready for tests.

Is nagios something that can be leveraged? Those 4 IPs are my MHI AC units with RAC-WF modules. I have the Home Assistant code (using python zeroconf for discovery) and I’m working in that direction as well.

```auto
$ nmap -sV 192.168.1.0/24 -p 51443
Starting Nmap 7.93 ( https://nmap.org ) at 2024-03-22 20:24 CET
Nmap scan report for _gateway (192.168.1.2)
Host is up (0.0040s latency).

[..]
Nmap scan report for 192.168.1.110
Host is up (0.053s latency).

PORT STATE SERVICE VERSION
51443/tcp open nagios-nsca Nagios NSCA

Nmap scan report for 192.168.1.111
Host is up (0.079s latency).

PORT STATE SERVICE VERSION
51443/tcp open nagios-nsca Nagios NSCA

Nmap scan report for 192.168.1.112
Host is up (0.014s latency).

PORT STATE SERVICE VERSION
51443/tcp open nagios-nsca Nagios NSCA

Nmap scan report for 192.168.1.113
Host is up (0.048s latency).

PORT STATE SERVICE VERSION
51443/tcp open nagios-nsca Nagios NSCA

[..]
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 256 IP addresses (18 hosts up) scanned in 17.41 seconds

```

---

<div class="post-metadata">

**Author:** ![PrzemoF](https://community.openhab.org/letter_avatar_proxy/v4/letter/p/41988e/32.png) [@PrzemoF](https://community.openhab.org/u/PrzemoF)\
**Post date:** [March 22, 2024, 8:47pm UTC](https://community.openhab.org/t/mitsubishi-heavy-industries-mhi-air-conditioning-with-wf-rac-binding-development/154449/5 "2024-03-22T20:47:07Z")

</div>

I have discovery working for the RAC-WF 😍 Thanks for all heavy work done by authors of other bindings, obviously! All I had to do was put together a binding skeleton, copy over Daikin binding (and modify the naming, trim some stuff) and copy over the zeroconf discovery from MPD binding.

 ![image](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/9/c/9c98d84e14da0017feb8dcfb4bff78bce97a4bb7.png)

I’d appreciate help with naming - are there any rules I should stick to? I tried to use the best guess so the binding name is mhiaircon, but should it be just the brand name? Without the aircon part?

Edit:  
Update:

 ![image](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/5/8/5842c6249ae4b484bc2786d2e25a751526ba71fb.png)

---

<div class="post-metadata">

**Author:** ![bartsnijder](https://community.openhab.org/letter_avatar_proxy/v4/letter/b/b77776/32.png) [@bartsnijder](https://community.openhab.org/u/bartsnijder)\
**Post date:** [March 24, 2024, 1:12pm UTC](https://community.openhab.org/t/mitsubishi-heavy-industries-mhi-air-conditioning-with-wf-rac-binding-development/154449/6 "2024-03-24T13:12:28Z")

</div>

I missed the trigger (space between @ and bartsnijder :-))… Was by accident checking out how this was going. Good to see that there is good progress. Is anything open yet to try?

---

<div class="post-metadata">

**Author:** ![PrzemoF](https://community.openhab.org/letter_avatar_proxy/v4/letter/p/41988e/32.png) [@PrzemoF](https://community.openhab.org/u/PrzemoF)\
**Post date:** [March 24, 2024, 6:05pm UTC](https://community.openhab.org/t/mitsubishi-heavy-industries-mhi-air-conditioning-with-wf-rac-binding-development/154449/7 "2024-03-24T18:05:48Z")

</div>

Ohhh… my coding skills are hopefully better than the forum skills. If you like dirty code… Only the discovery works, the rest is just copy from Daikin binding, so obviously not working.  
The code is here:

> **[Files · mhi · Przemo Firszt / mhiaircon · GitLab](https://gitlab.com/PrzemoF/mhiaircon/-/tree/mhi?ref_type=heads)**
>
> GitLab.com

If you need detailed download/compilation/installation instruction let me know.

Edit: Rough guide here: [Amending existing binding code - what is the "right" way to install it? - #7 by PrzemoF](https://community.openhab.org/t/amending-existing-binding-code-what-is-the-right-way-to-install-it/145930/7)

---

<div class="post-metadata">

**Author:** ![Matt\_Jayne](https://community.openhab.org/user_avatar/community.openhab.org/matt_jayne/32/87074_2.png) [@Matt\_Jayne](https://community.openhab.org/u/Matt_Jayne)\
**Post date:** [June 4, 2024, 12:13pm UTC](https://community.openhab.org/t/mitsubishi-heavy-industries-mhi-air-conditioning-with-wf-rac-binding-development/154449/8 "2024-06-04T12:13:47Z")

</div>

Hi @PrzemoF

Shout if there’s anything i can help with. I’m not very familiar with openhab addon structure. (Ngl it looks very overwhelming from that gitlabs repo) If there’s specific elements of the home assistant python code you want translated I’m happy to lend a hand where i can.  
(I’ll try read up on openhab addon layouts but could be awhile, however happy to help write/translate python to java)

---

<div class="post-metadata">

**Author:** ![PrzemoF](https://community.openhab.org/letter_avatar_proxy/v4/letter/p/41988e/32.png) [@PrzemoF](https://community.openhab.org/u/PrzemoF)\
**Post date:** [June 4, 2024, 1:48pm UTC](https://community.openhab.org/t/mitsubishi-heavy-industries-mhi-air-conditioning-with-wf-rac-binding-development/154449/9 "2024-06-04T13:48:37Z")

</div>

Thank you - any help would be fantastic. OH is an elephant, it can be only eaten piece by piece. I don’t understand it as well 🙂 despite of amending denon binding and making mhiaircon binding from scratch. I can give you developer access to my gitlab if you want. All the code is here: [bundles/org.openhab.binding.mhiaircon · mhi · Przemo Firszt / mhiaircon · GitLab](https://gitlab.com/PrzemoF/mhiaircon/-/tree/mhi/bundles/org.openhab.binding.mhiaircon?ref_type=heads)

I can help with setting up the development environment on linux (compilation, ssh for easy copying of the jar, etc but I use vim…).

I’m trying to figure out what should happen after an item has been added. The progress is mediocre - I´m working on many non-OH items as well…

---

<div class="post-metadata">

**Author:** ![Matt\_Jayne](https://community.openhab.org/user_avatar/community.openhab.org/matt_jayne/32/87074_2.png) [@Matt\_Jayne](https://community.openhab.org/u/Matt_Jayne)\
**Post date:** [June 9, 2024, 12:59am UTC](https://community.openhab.org/t/mitsubishi-heavy-industries-mhi-air-conditioning-with-wf-rac-binding-development/154449/10 "2024-06-09T00:59:00Z")

</div>

> [@PrzemoF](#):
>
> help with setting up the development enviro

Thanks, my plan is to write it in “plain” java, almost like a library. So make one giant aircon object, store all the data and methods for sending/receiving commands and parsing responses. I’ve got the bulk of this setup using the home assistant python code as a guide for parsing etc.  
I’m away from home atm so can’t test but I think it’s pretty much drafted. However it’lll need a fair bit of debuging and some logging/error handling needed.

Then hoping someone on here can lend a hand in how we use this aircon object in openhab/how to map it to openhab.

Current test code is setup something like this:

AirCon aircon = new AirCon();  
aircon.setHostname = “192.168.x.x”;  
aircon.setPort = “5443”;  
aircon.setminRefreshRate = 1L; //max 1s intervals between commands;

//I assume openhab is setup to something like this periodically  
aircon.getAirconStats();

//Then I’d want to map openhab channels to specific methods/commands.  
ie On/off channel mapped to the below  
aircon.setOperation(true);  
aircon.send();

Imagine there’s some standard way you guy lock the .getAirconStats periodic run from running when user is updating/before updates have been sent over to external device.

However I’ll get to reading into all that once I’ve tested the “plain” java version. @PrzemoF Once i’ve got it tested on my unit I’ll give you a shout/make my repo public and we can work out how to integrate into openhab.

---

<div class="post-metadata">

**Author:** ![PrzemoF](https://community.openhab.org/letter_avatar_proxy/v4/letter/p/41988e/32.png) [@PrzemoF](https://community.openhab.org/u/PrzemoF)\
**Post date:** [June 30, 2024, 12:17pm UTC](https://community.openhab.org/t/mitsubishi-heavy-industries-mhi-air-conditioning-with-wf-rac-binding-development/154449/11 "2024-06-30T12:17:23Z")

</div>

You’re miles ahead of me in understanding what needs to be done and in writing java. I’m just piggybacking daikin binding and I’m planning to port the already existing python code (HA).

---

<div class="post-metadata">

**Author:** ![PrzemoF](https://community.openhab.org/letter_avatar_proxy/v4/letter/p/41988e/32.png) [@PrzemoF](https://community.openhab.org/u/PrzemoF)\
**Post date:** [July 29, 2024, 7:12pm UTC](https://community.openhab.org/t/mitsubishi-heavy-industries-mhi-air-conditioning-with-wf-rac-binding-development/154449/12 "2024-07-29T19:12:14Z")

</div>

As ugly as one can imagine, but I’m trying to make some progress. [bundles/org.openhab.binding.mhiaircon · mhi · Przemo Firszt / mhiaircon · GitLab](https://gitlab.com/PrzemoF/mhiaircon/-/tree/mhi/bundles/org.openhab.binding.mhiaircon?ref_type=heads)

---

<div class="post-metadata">

**Author:** ![apella12](https://community.openhab.org/user_avatar/community.openhab.org/apella12/32/117154_2.png) [@apella12](https://community.openhab.org/u/apella12)\
**Post date:** [July 30, 2024, 12:04am UTC](https://community.openhab.org/t/mitsubishi-heavy-industries-mhi-air-conditioning-with-wf-rac-binding-development/154449/13 "2024-07-30T00:04:30Z")

</div>

> [@PrzemoF](#):
>
> I’m just piggybacking daikin binding and I’m planning to port the already existing python code (HA).

I don’t know if it will help any, but there has been a “forum” binding for Midea AC devices. Lately I have been working on it to possibly become “official”. It was also originally derived from python code for HA. You are welcome to review any code that might help your efforts [here.](https://github.com/apella12/openhab-addons/tree/midea2)

---

<div class="post-metadata">

**Author:** ![PrzemoF](https://community.openhab.org/letter_avatar_proxy/v4/letter/p/41988e/32.png) [@PrzemoF](https://community.openhab.org/u/PrzemoF)\
**Post date:** [July 30, 2024, 6:40pm UTC](https://community.openhab.org/t/mitsubishi-heavy-industries-mhi-air-conditioning-with-wf-rac-binding-development/154449/14 "2024-07-30T18:40:14Z")

</div>

@apella12 Thanks! I’ll check that!  
I’m at the stage where the basic stuff works: discovery, settings, refresh time. Now the binding is trying to connect the unit on IP and port, but obviously the connection fails as it’s still trying to connect it as it was a Daikin unit.

```auto
20:35:27.620 [DEBUG] [hiaircon.internal.MHIairconWebTargets] - getRootCause
20:35:37.838 [TRACE] [internal.handler.MHIairconBaseHandler] - Polling for state
20:35:37.846 [DEBUG] [hiaircon.internal.MHIairconWebTargets] - invoke
20:35:37.853 [DEBUG] [hiaircon.internal.MHIairconWebTargets] - invoke synchronised
20:35:37.861 [DEBUG] [hiaircon.internal.MHIairconWebTargets] - executeUrl
20:35:37.868 [TRACE] [hiaircon.internal.MHIairconWebTargets] - Calling url: http://192.168.1.110/aircon/get_control_info
20:35:38.046 [DEBUG] [hiaircon.internal.MHIairconWebTargets] - HTTP request error on attempt #1: http://192.168.1.110/aircon/get_control_info java.net.ConnectException: Connection refused
20:35:38.555 [DEBUG] [hiaircon.internal.MHIairconWebTargets] - executeUrl
20:35:38.562 [TRACE] [hiaircon.internal.MHIairconWebTargets] - Calling url: http://192.168.1.110/aircon/get_control_info
20:35:38.661 [DEBUG] [hiaircon.internal.MHIairconWebTargets] - HTTP request error on attempt #2: http://192.168.1.110/aircon/get_control_info java.net.ConnectException: Connection refused
20:35:39.668 [DEBUG] [hiaircon.internal.MHIairconWebTargets] - executeUrl
20:35:39.676 [TRACE] [hiaircon.internal.MHIairconWebTargets] - Calling url: http://192.168.1.110/aircon/get_control_info
20:35:39.888 [DEBUG] [hiaircon.internal.MHIairconWebTargets] - HTTP request failed after 3 attempts: http://192.168.1.110/aircon/get_control_info
java.util.concurrent.ExecutionException: java.net.ConnectException: Connection refused

```

Please do not assess my coding skills by the binding. It’s a mess, trimmed and squashed, sprinkled with debug code. Nothing pretty.

---

<div class="post-metadata">

**Author:** ![apella12](https://community.openhab.org/user_avatar/community.openhab.org/apella12/32/117154_2.png) [@apella12](https://community.openhab.org/u/apella12)\
**Post date:** [July 30, 2024, 9:08pm UTC](https://community.openhab.org/t/mitsubishi-heavy-industries-mhi-air-conditioning-with-wf-rac-binding-development/154449/15 "2024-07-30T21:08:59Z")

</div>

> [@PrzemoF](#):
>
> Please do not assess my coding skills by the binding

No worries there I have no formal training myself 😉

Unfortunately, because of this I really can’t jump in and offer anything of value beyond that I do recognize some similar items in the code. I also see some differences that might be deal breakers.

The Midea binding uses a socket to write() a command (like a poll or power ON) and an input stream that collects the bytes sent back by the device. Code extract using IP and Port;

```auto
            // Open socket
            try {
                socket = new Socket();
                socket.setSoTimeout(config.getTimeout() * 1000);
                if (ipPort != null) {
                    int port = Integer.parseInt(ipPort);
                    socket.connect(new InetSocketAddress(ipAddress, port), config.getTimeout() * 1000);
                }

```

```auto
            // Create streams
            try {
                writer = new DataOutputStream(socket.getOutputStream());
                inputStream = socket.getInputStream();

```

Also, the V3 models use encryption so both the write() and read() have code/decode elements. The cloud application(s) for Midea provide the token and key used with the encryption.

Sorry, I can help more.

---

<div class="post-metadata">

**Author:** ![PrzemoF](https://community.openhab.org/letter_avatar_proxy/v4/letter/p/41988e/32.png) [@PrzemoF](https://community.openhab.org/u/PrzemoF)\
**Post date:** [August 4, 2024, 11:53am UTC](https://community.openhab.org/t/mitsubishi-heavy-industries-mhi-air-conditioning-with-wf-rac-binding-development/154449/16 "2024-08-04T11:53:06Z")

</div>

Status:

1. Discovery works (better than in the Mitsubishi android app 😃 )
2. Some limited communication with units, with parsing of the responses into a java structure
3. HA python parser converted to standalone code + some response string examples
4. No real information exchange yet, fake online status set  
 ![image](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/1/f/1fd53c8e2b04347a2cb00236ab6934fe57b5cd30.png)
5. Bunch of parameters in the config  
 ![image](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/5/0/508bfa6e1c463350b8f50c1fe2aed3777764df74.png)
6. Half-set power channel  
 ![image](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/1/6/16a147ebf01fc5eeedcba5976d7a699f63bc630b.png)  
The next step - [convert the standalone HA parser code](https://gitlab.com/PrzemoF/mhiaircon/-/blob/mhi/bundles/org.openhab.binding.mhiaircon/src/main/java/org/openhab/binding/mhiaircon/internal/ha_parser.py?ref_type=heads) into java and use the values to get real unit stats.
7. The code is still unworkable for other developers (really messy) as I’m still trimming the Daikin parts and learning how openhab works.

---

<div class="post-metadata">

**Author:** ![PrzemoF](https://community.openhab.org/letter_avatar_proxy/v4/letter/p/41988e/32.png) [@PrzemoF](https://community.openhab.org/u/PrzemoF)\
**Post date:** [August 4, 2024, 6:20pm UTC](https://community.openhab.org/t/mitsubishi-heavy-industries-mhi-air-conditioning-with-wf-rac-binding-development/154449/17 "2024-08-04T18:20:54Z")

</div>

Reading real values from the units:

```auto
20:19:41.214 [DEBUG] [hiaircon.internal.MHIairconWebTargets] - getAirconStat org.openhab.binding.mhiaircon.internal.MHIairconWebTargets$Result@16cc73e
20:19:41.221 [DEBUG] [ing.mhiaircon.internal.api.InfoParser] - MHI_AirconStats operation false
20:19:41.223 [DEBUG] [ing.mhiaircon.internal.api.InfoParser] - MHI_AirconStats presetTemp 26.5
20:19:41.225 [DEBUG] [ing.mhiaircon.internal.api.InfoParser] - MHI_AirconStats operationMode 1

```

---

<div class="post-metadata">

**Author:** ![PrzemoF](https://community.openhab.org/letter_avatar_proxy/v4/letter/p/41988e/32.png) [@PrzemoF](https://community.openhab.org/u/PrzemoF)\
**Post date:** [August 5, 2024, 1:53pm UTC](https://community.openhab.org/t/mitsubishi-heavy-industries-mhi-air-conditioning-with-wf-rac-binding-development/154449/18 "2024-08-05T13:53:40Z")

</div>

Read only mode: power, preset temp, indoor and outdoor temperatures work

```auto
15:50:04.575 [TRACE] [ng.mhiaircon.internal.api.ControlInfo] - info.power: false
15:50:04.578 [TRACE] [ng.mhiaircon.internal.api.ControlInfo] - info.presetTemp: Optional[26.0]
15:50:04.581 [TRACE] [ng.mhiaircon.internal.api.ControlInfo] - info.outdoorTemp: Optional[31.2]
15:50:04.584 [TRACE] [ng.mhiaircon.internal.api.ControlInfo] - info.indoorTemp: Optional[28.7]

```

HA uses a table for temperature conversion, but I decided to use polynomial curves. The significant discrepancies are only around the extreme values, that are probably inaccurate anyway. 🤓

---

<div class="post-metadata">

**Author:** ![PrzemoF](https://community.openhab.org/letter_avatar_proxy/v4/letter/p/41988e/32.png) [@PrzemoF](https://community.openhab.org/u/PrzemoF)\
**Post date:** [August 6, 2024, 9:44pm UTC](https://community.openhab.org/t/mitsubishi-heavy-industries-mhi-air-conditioning-with-wf-rac-binding-development/154449/19 "2024-08-06T21:44:07Z")

</div>

More stuff added, all read only

 ![image](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/a/9/a949efa5a087f5eed12497bfa2d78b2fd43db5b3.png)

---

<div class="post-metadata">

**Author:** ![PrzemoF](https://community.openhab.org/letter_avatar_proxy/v4/letter/p/41988e/32.png) [@PrzemoF](https://community.openhab.org/u/PrzemoF)\
**Post date:** [August 10, 2024, 1:26pm UTC](https://community.openhab.org/t/mitsubishi-heavy-industries-mhi-air-conditioning-with-wf-rac-binding-development/154449/20 "2024-08-10T13:26:40Z")

</div>

Wind direction up down and right left readable. Naming consistency to be improved. Due to some weird problems ([more here](https://community.openhab.org/t/problem-with-discovery-but-manual-creation-of-thing-works/157687/7)) the development is for now based on 4.1.3 and under name mhiairconditioning [Files · mhi-413 · Przemo Firszt / mhiaircon · GitLab](https://gitlab.com/PrzemoF/mhiaircon/-/tree/mhi-413?ref_type=heads)

[Next page](https://community.openhab.org/t/mitsubishi-heavy-industries-mhi-air-conditioning-with-wf-rac-binding-development/154449.md?page=2)
