MQTT JSON Mitsubishi Heatpump

I have just checked again, and I haven’t any Fahrenheit conversion in my code.

Did some more test, tried to send different temperatures in the Set topic - it returned with 10 in all cases, except when it’s 0.

OK, thanks Nanna and Moxified!

My main mistake was that I thought i could configure wifi settings from the web initially (ESP starting up as AP), I simply missed the SSID and stuff in the header file.
With Wifi Analyzer on my android phone, I still see the AI-THINKER AP though, so I somehow need to remove it from the ESP, since it doesn’t seam to work correctly anyway (gives out dhcp to clients, but no web page).

I see that heatpump-controller-1 connects to mosquitto, so now I guess I will await the cable - cannot wait too long though (-I want this working now), so if it does not arrive soon, I guess I’ll have to make my own (not so posh!).

Yeah, sounds like you are still running the stock firmware. You need to blow that away and replace it with arduino bootloader only. I’m not familiar with that microcontroller but here is a video that supposedly steps you through programming that board with arduino IDE. I didn’t watch it though so no promises :slight_smile: https://youtu.be/utKpl1Z4nEM?t=46s

@Nanna_Agesen I’m not sure what could be going on to be honest. Are you watching the debug topic? It’s possible the version of Swicago’s library is slightly different than the one I’m running in production. If you can send a value with no debug error and the HP returns a new temp, it seems like it is “working” just not as expected. Might make sense to flash the pure original mqtt example and try it.

I tried the original, and it has the same behavior.

I was tumbling through both the user and service manual on my unit MSZ-FD25 - I can be afraid the function is not supported.

It just looks odd that it in fact are setting operation to false when I publish 0

Found it! :sunny:

Should’ve read the code… :slight_smile: There’s a line commented out in WIFIConnect() - WiFi.mode(WIFI_STA);
Uncommenting it, made the AP go away. It seams that the wifi settings is saved somewhere in flash, so the mode probably needs to be set when changing sketch (firmware). I guess this board was running in dual mode in a previous life.

Since I have the MSZ-GE35 remote temp will probably not be available either, if it is not working on the FD25. However, I am currently using a zwave ZXT-120 to control my HP using IR, and has made OH rules for temperature management, so OH is starting/stopping the HP as appropriate, and I intend to keep this, since it works so well. With this setup, I can hopefully also have better control of vane and fan speed, than the ZXT-120.

I think that was my conclusion if I’m not able to get the remoteTemp working.

But is there any difference between turning OFF the HP and the operation=false?

At first I was unsure if the HP was using ON/OFF regulating to reach the setpoint, but I have an energy meter attached to the unit, and I can see if I cool at the lowest level compared to raise the Setpoint 4 degrees I halve the energy consumption - So the HP has to be regulating steppless

I use the HP in our server room, and it’s unlike I ever want it to turn off, I just need to regulate the Setpoint temperature in the event my Solar plant is having excess production of energy.

Well that stinks that it isn’t supported. I contemplated that for a brief moment and dismissed it as a possible reason.

Yes.

“Power” is the master power state of the unit.
“Operating” is wether or not the unit is actively doing “work”

In other words, the power will be on/off for if the system is turned on/off. Operating is if the unit needs to do work. If the power is on and the setpoint isn’t satisfied, it will be operating=true. If the power is on and the setpoint is satisfied, it will be operating=false. If the power is off, no matter the setpoing, the HP won’t do anything (and it will say operating=false).

Thank of operating=true as working, operating=false as ready to work if needed (assuming power is on).

Easy way to see it in action would be to turn the unit on and set it to AC with a setpoint well below the room’s temp. You will see Power=ON, Operating=True. The unit is powered on AND cooling. Then change the setpoint to be above the room temp. The unit will stay with Power=ON but switch to Operating=false. The unit is powered on still but NO LONGER cooling. If you then change the setpoint below the room’s temp, it will return to operating=true.

Hopefully that explains it. I never can tell if my explanations make sense so I give 5 different explanations and ramble for a while for good measure :slight_smile:

@vespaman, glad you found it. I know it’s a copout but I really don’t know that board and it sounds like it differs from esp8266 based boards I’m used to a lot more than I thought. IR control of HP is a big task. I looked at that concept briefly prior to finding SwiCago’s library and basically it seems like the remote has to be super smart and remember all the current settings and whatnot and send every setting with each button press. Looked like a big undertaking for a microcontroller project to keep track of all of that info and program in all the proper IR stuff. Glad you have it working! This should give you solid control of fan and vane. You might find that it works so well you will want to replace the zwave stuff :wink:

So this weekend, I soldered my posh pre built cable onto the Wemo Mini D1, connected it onto the Mitsubishi, and - it works super! Everything is reliable, and instant. :slight_smile: Forgot to remove the Fahrenheit stuff, so I had to bring it back to the lab, but apart from this no obstacles at all.

Thank you very much - my ZXT-120 will soon be looking for another home!

Won’t likely be the last time you bring it back to the lab. They are reliable but if you are anything like me you meddle with stuff :slight_smile:

Enjoy!

Hi,

Where did you by our prebuilt cable, @vespaman ?

I don’t know where vespaman got theirs but this one was referenced by the library’s architect as working properly: http://www.usastore.revolectrix.com/Products_2/Cellpro-4s-Charge-Adapters_2/Cellpro-JST-PA-Battery-Pigtail-10-5-Position

I remember all the careful work to make my pigtails… I wish those had been found a year ago :disappointed_relieved:

1 Like

Yes this was the one!
Along with a Wemos Mini D1, that is all that you need - simplest solution ever! :smile:
And it works like a dream, not one failure since installation!

1 Like

Hi, Moxified
your code works perfect with my AC and openhab.
but i have a problem with overiding temperature read form the AC unit with a remote value given by an arduio based sensor linked and working in openhab network.
maybe a i need to create a rule to send via mqtt the real temperature value?
i did a lot of tries but without success.
could you explain me better how to do?
thanks
Andrea

Yeah. I have a rule that does this. I’ll try to post more details tomorrow. Today is busy.

Below is a stripped down version of my Remote Temp rule.

Basically, you need to send a temperature every 5 minutes to the HP or it will revert to using its internal temp sensor. In the rule, I have a 5 minute cron. Even if nothing changes, it will send the temp again which will tell the HP to continue using the temp.

Additionally, it is set to monitor the current temp of said thermostats as well as power state of the HP’s. If you turn a HP on, you want the rule to trigger immediately so that it will get the current room temp instead of waiting up to 5 minutes. Secondly, every time the thermostat changes, you want an instant update to the HP of the new temp.

I don’t bother to differentiate which thermostat or HP changes. I simply check if the HP is on… if so, send the current temp to it from its applicable source.

The last little bit that I recommend but you can see I don’t do on my theater HP… have a built in heartbeat for the thermostat. If your remote temp source somehow fails and you don’t check for it, you would continue sending the last known temperature to the HP indefinitely. That could cause the HP to over cool or over heat drastically.

Lastly, I left 2 of my 5 HP examples here. The first one uses a zwave thermostat, the second one uses an arduino with dht22 over MQTT. I rarely use that HP and I’m always in the room so I never built in a heartbeat… I should though.

Hopefully this helps.

rule "HP RemoteTemp" //allows HP's to use wall mounted thermostats if available as room temp
    when
        Item FirstFloorThermostatCurrentTemperature changed or
        Item Num_C_Theater_RMT changed or
        Item Living_HP_Power changed from OFF to ON or
        Item Theater_HP_Power changed from OFF to ON or
        Time cron "0 */5 * * * ?" //every 5 minutes
    then
        logInfo("HP RemoteTemp", "Rule Triggered")
        if (FirstFloorThermostatComm.state != ON) { //Is Livingroom Thermostat responsive
			if (Living_HP_Power.state == ON) {
                logInfo("HP RemoteTemp", "updating LR HP remote temp")
				Living_HP_RemoteTemp.sendCommand(FirstFloorThermostatCurrentTemperature.state.toString)
			}
		} else logInfo("HP RemoteTemp", "LR Thermostat Comm error, defaulting to internal")
        if (Theater_HP_Power.state == ON) { //Theater HP
            logInfo("HP RemoteTemp", "updating Theater HP remote temp")
			Theater_HP_RemoteTemp.sendCommand(Num_C_Theater_RMT.state.toString)
		}
end

I finally bought the ready made cable with pigtales for connecting and installed the ESP8266 in the heatpump.
Used a ESP-01 and it works like a charm with the modifications done by Moxified on the code.

Thanks for all hard work @Moxified and good questions from @Nanna_Agesen.

My heatpump: MSZ-SF35VE

Thanks
Vegard

For temp value there are another way.
In place of using MAP use a Jscript and place it in Transformation Folder like this one :
(Don’t forget to install Javascript Transformation First)

(function(i) {
var ToJson = '{“remoteTemp”: ’ + String(i) + ‘}’;
return ToJson;
})(input)

And call it with this :

{ mqtt=">[broker:home/livingroom/heatpump/set:command:*:JS(ACRemoteTemp.js)]" }

You must create a JS For Each Transformation, but it’s more easy with this solution.

(If you must repeat an action more of two make a script :wink: )

Olivier

This really only “applies” when you’ll have to repeat a process yourself multiple times. The time it would take a non-developer like me to find something like var ToJson and understand how it works would take 100 times longer than the 3 minutes in excel it took to create my maps which work fine. Sure your solution might be faster for the computer too but not enough to make a difference for me :slight_smile:

That being said, thanks for adding the solution. Far more elegant than mine!

I could be wrong but I think you could have issues with that for remote temp. I found inconsistency (I think it was mobile app vs basicui iirc) in decimal places. Either way, the heat pump only wanted a 2 digit integer. Your code would pass the decimal places on assuming ‘i’ wasn’t forced to an integer someplace else. This could be fixed in the arduino code I suppose but just a thought. Certainly correct me if I’m incorrect here.

Moxified,

I’m also new on OpenHab and I’ve searched for my personnal use, and yes that take a few time more than write it with hand :wink:. But reusable at volontee.

It’s also a solution for a lot of people wanted to send JSON to a MQTT brokker.

For your case you can also set the step by degree in place of 0.1 in sitemap or adjust also the script.

(function(i) {
var ToJson = '{“remoteTemp”: ’ + String(Math.trunc(i)) + ‘}’;
return ToJson;
})(input)

So 55.1 = 55 or 55.9 = 55

Olivier

So, I was thinking about testing the MQTT v2 binding some day, and I suspect the biggest hurdle for me will be the Mitsubishi MQTT set-up workig. So, I figured I should ask here, if anyone has done the job already, and in this would be willing to share their things/items?