Mitsubishi AC with Wemos D1 Mini Pro

Hi folks,

I’m trying to connect my Mitsubishi AC unit (a Mr. Slim SLZ-KA12NA) into Home Assistant with MQTT support. I’m brand new to all of this (Home Assistant, MQTT, Arduino etc), and I’m struggling to determine what my next step should be to get this working. Any advice would be greatly appreciated.

Here is what I have done so far:

** Install Hass.io on a Rasberry Pi 3 B+
** Include the Mosquitto broker add-on within Hass.io .
** Using SwiCago/HeatPump as a guide, I have built out a Wemos D1 Mini Pro with a pigtail that connects to the CN105 connector on the AC’s board. The Wemos D1 Min iPro has power through the CN105), and is it is successfully connecting to WiFi.
** I’m using usernames / passwords in MQTT, and in the MQTT log I am seeing the following two lines repeated over and over:"

1553252841: |-- mosquitto_auth_acl_check(…, client id not available, <> heatpump/timers,
MOSQ_ACL_WRITE)
1553252841: |-- aclcheck(<>, heatpump/timers, 2) CACHEDAUTH: 0

** In the Arduino IDE I used “Heampump” as my sketch, supported by mitsubishi_heatpump_matt_esp8266 as my library (both also sourced from SwiCago/Heatpump). It complies and uploads fine to the Wemos D1 mini without any issues.

Where I am stuck:

** I’m not confident that I am using the correct sketch / library from SwiCago/Heatpump, and there are several there to choose from. Could someone tell me which files to use?

** I’m also confused as to what configuration I should be adding to my configuration.yaml file. I believe there was also a recent breakage, I’m running the latest version of Home Assistant. Can anyone direct me to an example of the code?

Thanks in advance, I appreciate it!

2 Likes

Hi Skipjack and welcome to the community!

First let me say that if you are new to all of this then you really dived in at the deep end on this project…good on you!

Don’t be too disappointed if this one takes a while to get working is all I would say.

All your steps so far look like they are right to me. The fact that Mosquitto seems to be talking to - “heatpump/timers” is a good sign.

The “mosquitto_auth_acl_check(…, client id not available” may be that your wemos is not setup with MQTT username and password. You can most likely set that up by finding the IP of the wemos and logging in to the web interface to set that up in the MQTT setup area. That depends on there being a web interface and how good the web interface is though? All that is setup in the sketch you have flashed to the wemos.

I am myself at the early stages of setting my Mitsubishi AC’s up in the same way as you are. I am waiting on a few bits of hardware at this point but they should all be here in a week or so.

The link to SwiCago/Heatpump may be useful to others who are interested in this project. Also if they are really interested Hadley, the guy who actually set the project up has a website.

I was unaware (from my reading so far) that you could use a Wemos D1 mini to communicate with the mitsubishi? Where did you find that information?

I was following the plan (from SwiCago) to use ESP-01 modules and the ESP-01 breakout with prewired level shifters and regulator but I may change my mind if the Wemos D1 mini is working for you?

Anyway once you get the Wemos talking with the mitsuibishi the HA integration can be found in the integrations folder at SwiCago/Heatpump. So you are going to have to set it up as a custom component within HA to communicate through the wemos to the mitsubishi AC.

Anyway, I will leave it at that for now so have a bit more of a read yourself and see if you can figure it out. Please post your progress or problems as they arise and I’ll get back to you then.

Cheers wellsy!

2 Likes

Hi Wellsy,

Thanks for the fast response, and that’s a big help - thank you. It will take me some time to grind through all of that, but in the meantime…

– I saw that @ScottD made a reference to a Wemos D1 Mini in his post here, and then on the SwiCago/HeatPump page in the issues section there is a post titled Please list your unit types that work. IN that, unixko shows a picture of his Wemos D1 Mini setup. I wanted as simple a setup as possible, and I didn’t want to deal with the 5V adapter or the usb-to-serial adapter that I would have needed to program the ESP-01, so I went down the Wemos path instead.

If you look at his picture, the cables are connected the same way as in the circuit diagram picture in the Demo Circuit section of the SwiCago/HeatPump page. I used the same Revolectrix Cellpro-JST-PA-Battery-Pigtail-10-5-Position cable. I also bought a small dipole antenna that connects to the Wemos D1 Mini, but have found that I don’t need it. Even with the Wemos being inside of the sheet-metal box that holds / protects the AC’s circuit board (which sits in my ceiling as I have a cassette-type unit), it’s getting a great WiFi signal without it.

I’ll get working on those other tips you gave me, and let you know how I get on. I’m not sure I fully understand, but will try and grind through it.

Thanks!

Replying because I am about to go through this. I have my pigtails, waiting for the wemos d1 minis to arrive. I too thought this easier than supplying 3v3 to the microprocessor.

From what I can tell you’ll need this file in custom components https://github.com/SwiCago/HeatPump/blob/master/integrations/home-assistant.io/custom_components/mitsubishi_mqtt/climate.py

(specifically in the directory custom_components/mitsubishi_mqtt/)

Add this to configuration.yaml https://github.com/SwiCago/HeatPump/tree/master/integrations/home-assistant.io

and flash this to your wemos https://github.com/SwiCago/HeatPump/tree/master/examples/mitsubishi_heatpump_mqtt_esp8266_esp32

That’s my understanding anyway!

2 Likes

Thanks for adding your information to this post nickrout.

On the strength of your post and having a spare wemos D1 mini on hand I thought I may as well try flashing it earlier this afternoon.

I am using Arduino IDE and I have downloaded the library and setup ready to flash a Wemos D1 mini but I get:

C:\Users\Steve\Documents\Arduino\arduino-1.8.5\portable\sketchbook\HP_cntrl_esp8266\mitsubishi_heatpump_mqtt_esp8266_esp32\mitsubishi_heatpump_mqtt_esp8266_esp32.ino:9:22: fatal error: HeatPump.h: No such file or directory

 #include <HeatPump.h>

                      ^

compilation terminated.

I tried looking for a heatpump library and found HeatpumpIR by Tony Arte so I Installed that but still fails looking for HeatPump.h.

Do you have any idea where I may find that library?

I have also posted an issue here

PS: I am fairly new to the world of flashing devices but have a good grasp of flashing tasmota onto sonoff devices with Arduino IDE. The support/documentation was very useful to get that sorted. Documentation on this project is scarce I think?

Sorry I should have added you’ll need the library too, in here https://github.com/SwiCago/HeatPump/tree/master/src

Hey guys,

My system is up and working. What made the difference was:

– Adding the climate.py file to the custom_components/mitsubishi_mqtt/ directory, and
– Adding the ‘climate’ section to the configuration.yaml file.

Both of the these changes were as per @nickrout’s post above. Below is a picture of what it looks like in my Overview page. All of the buttons / etc work.

image

Ok - so I’m still very much in newbie mode. Can anyone give me some advice as to … If I have several AC units (all same type) throughout the house, how can I add these to my config as individual units so that I can configure them? It occurs to me that the only thing that makes my currently working AC unit ‘unique’ is that in the mitsubishi_heatpump_mqq_esp8266_esp32.h library that I uploaded with the sketch to the current Wemos D1 Mini, that I gave it a unique ‘client_id’ name, and that on my wifi network I have assigned a static IP to that particular Wemos D1 Mini. Obviously I could do the same for each additional Wemos D1 Mini, but how is this accounted for in the config?

I’m going to solder up the remaining units later tonight. I’ll post a picture in case that helps anyone determine the correct cable mapping quickly.

Thanks!

2 Likes

Great news, glad I could help. A complete howto would be great for others to follow.

As to distinguish different units, I would think that changing this file will be needed https://github.com/SwiCago/HeatPump/blob/master/examples/mitsubishi_heatpump_mqtt_esp8266_esp32/mitsubishi_heatpump_mqtt_esp8266_esp32.h

Change heatpump in the mqtt topics (line 18 and onwards) to, say, heatpump2. (I think this is what is needed). Also I think you will need to change line 17 to a different unique ID.

And also add another unit to configuration.yaml referring to heatpump2 rather than heatpump.

It would be nice to refactor the .h file so it only needs to change in one place, and introduce mqtt discovery. I might look into that when I get my gear.

1 Like

Cheers nickrout!
I’ll have another go at flashing the wemos again tomorrow.

Great news Skipjack!
And already on to your second unit…too easy!

A how to guide would be wonderful! Especially if it was to become a part of the documentation for an official component found amongst the other climate components and not remain a custom component.

Hey guys,

The second unit works. Zero drama - it was just as per @nickrout’s suggestion above.

Here’s the pic of the cabling. You’ll see that the connector has one additional cable (black) that doesn’t join to any pin on the Wemos, and so I just snip it at the connector end.

I’ll start work on a how-to guide. Maybe you guys can edit it and post it?

Skip.

1 Like

Flashed 2X wemos D1 mini succesfully just now: Mosquitto connects successfully:

1553433762: New client connected from MyIp as heatpump-controller-2 (c1, k15, u'WTF').                                                          

1553433773: New connection from MyIp on port 1883.                                                                                              

1553433773: New client connected from MyIp  as heatpump-controller-1 (c1, k15, u'WTF')..

Looking forward to my leads arriving so I can connect them.
Did you just leave yours inside the box where the CN105 connector is?
That was going to be my plan…just checking where you put yours?

PS: FYI…There is no web interface to administer the heatpump-controller.

Awsome, congrats.

Yes same for me, no web interface. I don’t understand all the files in the SwiCago package though, so maybe that’s an option and I’m just not using it.

For mine I put it inside the box, and then fully closed the box. I have two different types of units, a cassette in-ceiling type (that has a sheet-metal box inside the ceiling), as well as a wall-mounted unit.

  • Finding the CN105 on the wall-mount was a bit tricky and I had to look up the service manual, as there are circuit boards tucked away in different places behind covers / doors.

  • Be careful in those boxes, as there is live high voltage in there. Make sure you turn off the circuit breaker at the panel before trying to install it. Have a thought too as to how long you will make the pigtail wires, as you don’t want your board getting anywhere near the high voltage (or shorting anything else on the board in general). My ceiling-type was hard to get in to - because of how they installed it into the roof. My box has two screws, which when out let you take one full side of the box off. In my case that then gives me a small ‘slit’ that I can use to get access to the board. Not big enough to get my hand into through. It almost needed a really long set of tweazers to get the plug into the CN105. I prefer to have it inside the box and then close it back up, because there is all sorts of dust (etc) getting pushed around in the roof cavity, and that will absolutely cause problems with the board if it’s not protected.

I have WiFi dipole antennas that I bought with my Wemos D1s, and I’m glad I did. I had to use one in the wall-mount unit (and there’s space to store it vertically, which is ideal). The in-roof unit is close to an access point and didn’t need one (which is not what I expected - I would have through the fully-enclosed metal box, combined with the D1’s tiny antenna would have killed the signal).

Skip.

I am not sure why anyone was expecting a web server, perhaps I missed something that led to that expectation?

Anyway there is what appears to be a sample webserver in the examples directory https://github.com/SwiCago/HeatPump/tree/master/examples/HP_cntrl_Fancy_web

But I thought we were all using Home Assistant to control it anyway?

Probably just me as I’m used to tasmota devices…up to sonoff27 here.
I feel like a web interface (like the tasmota console) could be adapted to assist with reading communication packets for developing further functionality?
Snippet from one of my tasmota consoles…imagine if incoming and outgoing packets were displayed for developers on this project?

08:42:10 MQT: stat/wemosD2/POWER2 = OFF
08:42:10 RUL: POWER2#STATE=0 performs "backlog publish cmnd/sonoff16/Event Movement_RUMPUS"
08:42:10 MQT: cmnd/sonoff16/Event = Movement_RUMPUS
08:42:11 MQT: stat/wemosD2/RESULT = {"POWER4":"ON"}
08:42:11 MQT: stat/wemosD2/POWER4 = ON
08:42:19 MQT: stat/wemosD2/RESULT = {"POWER2":"ON"}
08:42:19 MQT: stat/wemosD2/POWER2 = ON
08:44:31 MQT: tele/wemosD2/STATE = {"Time":"2019-03-25T08:44:31","Uptime":"16T16:44:11","Vcc":3.032,"POWER1":"ON","POWER2":"ON","POWER3":"ON","POWER4":"ON","POWER5":"ON","POWER6":"ON","Wifi":{"AP":1,"SSId":"Bugwire","RSSI":100,"APMac":"E0:3F:49:72:B8:E0"}}
08:44:31 MQT: tele/wemosD2/SENSOR = {"Time":"2019-03-25T08:44:31","Switch2":"OFF","Switch4":"OFF"}
08:49:31 MQT: tele/wemosD2/STATE = {"Time":"2019-03-25T08:49:31","Uptime":"16T16:49:11","Vcc":3.032,"POWER1":"ON","POWER2":"ON","POWER3":"ON","POWER4":"ON","POWER5":"ON","POWER6":"ON","Wifi":{"AP":1,"SSId":"Bugwire","RSSI":100,"APMac":"E0:3F:49:72:B8:E0"}}
08:49:31 MQT: tele/wemosD2/SENSOR = {"Time":"2019-03-25T08:49:31","Switch2":"OFF","Switch4":"OFF"}
08:54:31 MQT: tele/wemosD2/STATE = {"Time":"2019-03-25T08:54:31","Uptime":"16T16:54:11","Vcc":3.032,"POWER1":"ON","POWER2":"ON","POWER3":"ON","POWER4":"ON","POWER5":"ON","POWER6":"ON","Wifi":{"AP":1,"SSId":"Bugwire","RSSI":100,"APMac":"E0:3F:49:72:B8:E0"}}
08:54:31 MQT: tele/wemosD2/SENSOR = {"Time":"2019-03-25T08:54:31","Switch2":"OFF","Switch4":"OFF"}
08:57:35 MQT: stat/wemosD2/RESULT = {"POWER4":"OFF"}
08:57:35 MQT: stat/wemosD2/POWER4 = OFF
08:57:35 RUL: POWER4#STATE=0 performs "backlog publish cmnd/sonoff13/Event Movement_Patio"
08:57:35 MQT: cmnd/sonoff13/Event = Movement_Patio
08:57:38 MQT: stat/wemosD2/RESULT = {"POWER4":"ON"}

https://github.com/SwiCago/HeatPump/issues/39

Yes I think getting some debugging info would be helpful. For example my Mitsubishi units are floor mounted split systems. The vanes have quite different options to wall mounted units.

I’d love to get the library into esphome.

I cant believe it!
My cables arrived today (finally) and I cant believe it but mine are wrong pitch…the pitch on the CN105 appears to be 2.00mm while the cables that arrived are 2.54mm pitch.

Where did you order yours from skip?

UPDATE: I did manage to get hold of a plug (with a short tails) salvaged from a electronics repair place here in Beenleigh.
Installed that but having troubles with the code atm.

Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity_platform.py", line 352, in _async_add_entity
    await entity.async_update_ha_state()
  File "/usr/src/app/homeassistant/helpers/entity.py", line 231, in async_update_ha_state
    state = self.state
  File "/usr/src/app/homeassistant/components/climate/__init__.py", line 197, in state
    if self.current_operation:
  File "/config/custom_components/mitsubishi_mqtt/climate.py", line 172, in current_operation
    return me_to_ha[self._current_operation]
KeyError: None
2019-03-26 07:11:56 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity.py", line 231, in async_update_ha_state
    state = self.state
  File "/usr/src/app/homeassistant/components/climate/__init__.py", line 197, in state
    if self.current_operation:
  File "/config/custom_components/mitsubishi_mqtt/climate.py", line 172, in current_operation
    return me_to_ha[self._current_operation]
KeyError: None
2019-03-26 07:12:21 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity.py", line 231, in async_update_ha_state
    state = self.state
  File "/usr/src/app/homeassistant/components/climate/__init__.py", line 197, in state
    if self.current_operation:
  File "/config/custom_components/mitsubishi_mqtt/climate.py", line 172, in current_operation
    return me_to_ha[self._current_operation]
KeyError: None
2019-03-26 07:13:21 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity.py", line 231, in async_update_ha_state
    state = self.state
  File "/usr/src/app/homeassistant/components/climate/__init__.py", line 197, in state
    if self.current_operation:
  File "/config/custom_components/mitsubishi_mqtt/climate.py", line 172, in current_operation
    return me_to_ha[self._current_operation]
KeyError: None

What version of HA are you running?
Are you using the Master branch which is sorted for 0.89 (Breaking Changes)?
Trying it with 0.89.2 and the above Traceback is in the log.
My usual version is 0.81.6 and it had major errors so I tried it in 0.89.2 and 0.90.0 both show less errors but refuse to show a climate entity id. Had enough for today.

Revolectrix

http://www.store.revolectrix.com/Products/Cellpro-4s-Charge-Adapters/Cellpro-Battery-Pigtail-10-5-Position

Cheers! How much did they charge you to send them?
I found mine on Bangood and they were free shipping…false economy…should have followed the advice!

I’ll answer. They sent four to me in NZ (because I am bound to bugger up two of them), Cost was

Subtotal 7.96
Shipping Cost (Int’l First Class (10-14 days)) 3.02
Total $10.98

It took a lot less than 10-14 days too!