Mitsubishi Wifi Module WF-RAC (Smart M-Air)

Hi,

A few weeks back I also did some research and testen with the java apk.
Now I have written a simple decoder and encoder for the WF-RAC module.
(the encoder is based on yours)

The above wf-rac responses and encoded code of yours did help me create a simple python method for receiving and sending successfully data to the Airco.

Now i’m trying to make a integration for it but have little time at the moment.

3 Likes

The trick (that worked for me) to get the encoder working is to convert the values of crc16ccitt() to signed integers:

data = [(256-a) * (-1) if a > 127 else a for a in data]
1 Like

It’s really great what you guys do, I really appreciate your efforts!

Yes indeed, I also appreciate the efforts!

This is great! Awesome!
I really like your structured approach of the program. And I like your elegant solution of setting the correct bits in the encoder.
When I have time I will try to have a look at the discovery method of the WF-RAC.

Oh man, I came across this post like two weeks ago, have been hacking away on python code on and off since then, and only just came back to find so much more activity than I expected! So awesome.

Re: the discovery, it’s pretty easy using the python ‘zeroconf’ module. This prints out the details of all my aircon devices:

def find_devices(timeout=2.0):
    from zeroconf import Zeroconf, ServiceStateChange, ServiceBrowser
    from typing import cast
    def on_service_state_change(
            zeroconf: Zeroconf, service_type: str, name: str, state_change: ServiceStateChange
    ) -> None:
        if state_change is ServiceStateChange.Added:
            info = zc.get_service_info(service_type, name)
            if info:
                addrs = ["%s:%d" % (addr, cast(int, info.port)) for addr in info.parsed_scoped_addresses()]
                print(f"Server: {info.server}")
                print("Weight: %d, priority: %d" % (info.weight, info.priority))
                print("Addresses: %s" % (' '.join(addrs)))
                print()

    zc = Zeroconf()
    browser = ServiceBrowser(zc, ['_beaver._tcp.local.'], handlers=[on_service_state_change])
    until = time.time() + timeout
    try:
        while time.time() < until:
            time.sleep(0.1)
    finally:
        zc.close()

I’m gonna try to find some time to get my current hacky script up on github in case it’s useful to others…

2 Likes

@jeatheak, both of our functions seem to contain distinct errors.
I have displayed the integer values for the base64 decoded command strings below.
The iOS app seems to add a value to the 2nd byte. I do not understand why this is happening when reading the Android decompiled code…

Mode:
{
    "Operation": true,
    "PresetTemp": 20.0,
    "OperationMode": 1,
    "AirFlow": 0,
    "WindDirectionUD": 2,
    "WindDirectionLR": 1,
    "Entrust": false,
    "CoolHotJudge": false,
    "ModelNr": 0,
    "Vacant": 0,
    "ErrorCode": "00"
}

mch:
AACrn6j/AAAAAAAQCwAAAAAAAf////85gwIAq5+o/wAAAAAAEAsAAAAAAAH/////GcE=
jeatheak:
AACrn6j/AAAIAAAQCgAAAAAAAf////+lMQAACRco/wAACAAAAAAAAAAAAAH/////2cE=
ios app:
AAern6j/AAAAAAAQCwAAAAAAAf////+A3wAACRco/wAAAAAAAAEAAAAAAAH/////1T4=
[00 [01 [02 [03 [04 [05 [06 [07 [08 [09 [10 [11 [12 [13 [14 [15 [16 [17 [18 [19 [20 [21 [22 [23 [24 [25 [26 [27 [28 [29 [30 [31 [32 [33 [34 [35 [36 [37 [38 [39 [40 [41 [42 [43 [44 [45 [46 [47 [48 [49 
000 000 171 159 168 255 000 000 000 000 000 016 011 000 000 000 000 000 001 255 255 255 255 057 131 002 000 171 159 168 255 000 000 000 000 000 016 011 000 000 000 000 000 001 255 255 255 255 025 193 	 	mch:
000 000 171 159 168 255 000 000 008 000 000 016 010 000 000 000 000 000 001 255 255 255 255 165 049 000 000 009 023 040 255 000 000 008 000 000 000 000 000 000 000 000 000 001 255 255 255 255 217 193 	 	jeatheak:
000 007 171 159 168 255 000 000 000 000 000 016 011 000 000 000 000 000 001 255 255 255 255 128 223 000 000 009 023 040 255 000 000 000 000 000 000 001 000 000 000 000 000 001 255 255 255 255 213 062 	 	ios app:

[00 [01 [02 [03 [04 [05 [06 [07 [08 [09 [10 [11 [12 [13 [14 [15 [16 [17 [18 [19 [20 [21 [22 [23 [24][00 [01 [02 [03 [04 [05 [06 [07 [08 [09 [10 [11 [12 [13 [14 [15 [16 [17 [18 [19 [20 [21 [22 [23 [24]
[ CommandByte                                                           [Variable          ][ CRC16][ RecieveByte                                                           [Variable          ][ CRC16]

@awesomerob, this is great! I was planning on having a look at this today, but you already did :slight_smile:
Perhaps we should look into working from a common repository, for example from jeatheak’s, since he seems to know how to write code.

Just want to say I’m really grateful for all the progress you guys are making!!!

Ok that’s weird. I also cannot find what the 2nd byte is doing. (mayby something with the atHomePressence)

Mayby I have this evening some time to look into it.
But the Airco at my home is accepting the values even without that byte so I hope it isn’t doing anything important :sweat_smile:

@mcheijink I Also added you as collaborator in my github repo
@awesomerob Do you have your github username for me? than I can add you also as collaborator.

I did make a new branch on the repo to start with the hassio integration but I have never make one so it will be a challenge :stuck_out_tongue:

1 Like

I am also curious to see the development of this.
I also have three of these units and would love to integrate them into Homeassistant.
Great work!

I have 2 units as well, hope you’ll manage to make integration possible. Great work.

My units are now ready to be used. So to me it is a brand new system.
If i can help with anything except for coding (Don’t have coding knowledge) let me know.

This is awesome. I’m about to install AC units in my home and I want Mitsubishi Heavy because I’m technically familiar with them. Something not working properly in HA is a major deal breaker for me these days so I’m hoping you guys can pull it off so I won’t have to resort to hacky solutions.

I’ve just installed a Mitsubishi AC unit (with WF-RAC of course) and I was very happy to find this thread because I would like to add it to my HA (I don’t like having a lot of apps and making it work within HA is… cool!).

Oh great to see this thread! Any chance of a HACS repo?

This would be awesome! I have two indoor units, can I help in any way?

Hi all,
I think we are going in the right direction with the interfacing from Python to the WF-RAC.
Does anyone that offered help, have experience with the integration in Home Assistant? That is where we could really use some help :slight_smile:

I once looked at HA integrations, and it made my head hurt! Might be worth looking to see if HACS integration is easier?

Hi,
This guy made an early integration but i cant get it to wok, i dont have much experience with home assistant

kababoom/Mitsubishi-WF-RAC-Integration at feat/add-integration (github.com)

At the moment I’m busy learning to make an integration of it but it is a lot of work and learning. And my son was born so at the moment i have little time to look into it.
I will try to work on it soon

Locally I have a simple integration running that reads the temperature only but can’t get the climate to work.

@Savage007 That code has no integration added. He only forked the code and made a loop in the code that runs seperatly from Homeassistent to reset his devices to certain settings. (the custom_component folder was already added in the feature branch I created)

Edit: As stated above I did create a feature branch in the git repo. There you can follow the code changes I made. When it is working I will merge it into the main branch. https://github.com/jeatheak/Mitsubishi-WF-RAC-Integration/tree/feat/add-integration

Edit2: I merged the branch into main. This is now the first test integration with only the temperature sensors https://github.com/jeatheak/Mitsubishi-WF-RAC-Integration