[Python] Control Mitsubishi MAC-557IF-E airconditioning

For heating/cooling related questions in Domoticz

Moderator: leecollings

artpol5
Posts: 3
Joined: Sunday 16 October 2016 10:19
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: [Perl] Control Mitsubishi MAC-557IF-E airconditioning

Post by artpol5 »

today I have add crontab:

Code: Select all

pi@raspberrypi:~$  perl /home/pi/domoticz/scripts/melcloud.pl report 
pi@raspberrypi:~$  perl /home/pi/domoticz/scripts/melcloud1.pl report
Can't locate config.pl in @INC (@INC contains: /etc/perl /usr/local/lib/arm-linux-gnueabihf/perl/5.20.2 /usr/local/share/perl/5.20.2 /usr/lib/arm-linux-gnueabihf/perl5/5.20 /usr/share/perl5 /usr/lib/arm-linux-gnueabihf/perl/5.20 /usr/share/perl/5.20 /usr/local/lib/site_perl .) at /home/pi/domoticz/scripts/melcloud1.pl line 49.
what is the problem ?
Xian
Posts: 3
Joined: Monday 28 December 2015 0:43
Target OS: Windows
Domoticz version:
Contact:

Re: [Perl] Control Mitsubishi MAC-557IF-E airconditioning

Post by Xian »

Hi everyone !

I have just installed the Domoticz. I have copied the two perl scripts and saved them in the scripts directory of domoticz. But there are nothing to see on the webpage. I have surely missed something, but I dont know what. Maybe some kind people can guide me further
steppi
Posts: 41
Joined: Saturday 30 January 2016 0:33
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: [Perl] Control Mitsubishi MAC-557IF-E airconditioning

Post by steppi »

Hello guys! I successfully installed the script on my raspberry - domoticz. Unfortunately I have a problem (as always happens), this is my situation:
On / Off Switch OK
Temperature of each Melcloud OK
Set Temp Melcloud NO! :(
(If I set a temperature, then I'm going to check on Melocoud app for iPhone or from https://app.melcloud.com site - unfortunately not recorded)
How can I fix? thank you!
jupil51
Posts: 1
Joined: Friday 04 November 2016 12:21
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: [Perl] Control Mitsubishi MAC-557IF-E airconditioning

Post by jupil51 »

Hi !

When i try the report, i have a litle.... problem !

Code: Select all

pi@Domorasp:~/domoticz/scripts$ ./melcloud.pl /report
'"' expected, at character offset 4 (before "Success: false, Erro...") at ./melcloud.pl line 271.
The configuration seems ok..

Code: Select all

pi@Domorasp:~/domoticz/scripts$ ./melcloud.pl /check
############################
# Check configuration:     #
############################
Connection to domoticz [OK]
Configuration MEL Cloud [DOMOTICZ]
Connection to MEL Cloud [OK]
the line 271 from melcloud.pl : my $decoded = JSON->new->utf8(0)->decode($_);

I try to change the room on melcloud without floor , but still the same.

I don t know where is the problem, if someone can help me..

Thanks !
AnkanG
Posts: 1
Joined: Thursday 10 November 2016 22:35
Target OS: Windows
Domoticz version:
Contact:

Re: [Perl] Control Mitsubishi MAC-557IF-E airconditioning

Post by AnkanG »

I also, can't get it to work, it's seems to be something wrong with the structure when parsing data from Melcloud

According to http://mgeek.fr/blog/un-peu-de-reverse- ... r-melcloud it should be
[x].Structure.Floors[y].Areas[z].Devices[a].ID
So I added some debug code to line 273 (Version 0.6)

foreach my $building (@$decoded) {
@devices = @{$building->{'Structure'}{'Floors'}};
debug("1: ".$building->{'Structure'});
debug("2: ".$building->{'Structure'}{'Floors'});
debug("3: ".$building->{'Structure'}{'Floors'}[0]{'Areas'});
debug("4: ".$building->{'Structure'}{'Floors'}[0]{'Areas'}[0]{'Devices'}[0]);
debug("5: ".$building->{'Structure'}{'Floors'}[0]{'Areas'}[0]{'Devices'}[0]{'DeviceID'});
debug("6: ".$building->{'Structure'}{'Floors'}[0]{'Areas'}[0]{'Devices'}[0]{'DeviceName'});

This is the output
C:\Melcloud>perl C:/Melcloud/melcloud.pl mode warm TV
1: HASH(0x3d97978)
2: ARRAY(0x40c97c0)
3: ARRAY(0x40c94d8)
4: HASH(0x44bd2a8)
5: 41902
6: TV

As you can see I get the ID and a correct name

When I change it to the other heat pump, which in my case is on another area in the same building
debug("5: ".$building->{'Structure'}{'Floors'}[0]{'Areas'}[1]{'Devices'}[0]{'DeviceID'});
debug("6: ".$building->{'Structure'}{'Floors'}[0]{'Areas'}[1]{'Devices'}[0]{'DeviceName'});

C:\Melcloud>perl C:/Melcloud/melcloud.pl mode warm TV
1: HASH(0x3efac90)
2: ARRAY(0x3efcb00)
3: ARRAY(0x3efb110)
4: HASH(0x3cf7408)
5: 52503
6: Trappa

A diffrent ID and the expected name

So I change the structure in Melcloud to this
Skärmklipp.JPG
Skärmklipp.JPG (36.49 KiB) Viewed 6561 times
and then runned the script
C:\Melcloud>perl C:/Melcloud/melcloud.pl mode warm TV
Update setMELDeviceMode : OK
Update setMELDevicePower : OK
miljume
Posts: 62
Joined: Thursday 03 December 2015 21:36
Target OS: Raspberry Pi / ODroid
Domoticz version: v3.8742
Contact:

Re: [Perl] Control Mitsubishi MAC-557IF-E airconditioning

Post by miljume »

Relly interesting plugin!

I am trying to adapt it to fit my heater but is unsure what to edit in the .pl script for controlling the device

I guess you need to edit both config.pl and the script?

For the fan control I added

Code: Select all

setMELDeviceFan($devicesInfos{$name}{'idx_fan'},$infosAirCon);
under "Arguments" and

Code: Select all

$devicesInfos{"Heater"}{"idx_fan"} = "109";
in config.pl for Device 1

The idx is mapped to the selector switch in Domoticz

Correct?

And I am also lacking information on how to control the fan vanes.
Is it the same principal that for the mode selector?

One more question, What's the difference between

Code: Select all

setDomDeviceStatus
and

Code: Select all

setMELDevicePower
Which one of them will I use to control On/Off for my heater?

Anyone that can point me in the right direction?
miljume
Posts: 62
Joined: Thursday 03 December 2015 21:36
Target OS: Raspberry Pi / ODroid
Domoticz version: v3.8742
Contact:

Re: [Perl] Control Mitsubishi MAC-557IF-E airconditioning

Post by miljume »

Some more problems I stubled upon

The script runs fine but doesnt update the temp sensor, I receive the following error

Code: Select all

Use of uninitialized value $result in concatenation (.) or string at ./melcloud.pl line 541.
At row 541 is the following

Code: Select all

debug("receive from domoticz: ".$result);
and above that row

Code: Select all

my $result = domSendJSON("type=command&param=udevice&idx=$idDomDevice&nvalue=0&svalue=$deviceInfos->{'RoomTemperature'}") if /(?:status\"\ :)+(.*?),/s;

Code: Select all

receive from domoticz: 
is also blank

Could it be this that makes the temp sensor not to update and how can I solve it?

It also seems that I can't update values from Domoticz and make them update MELCloud
For example when I change the mode from Warm to Cool it says "Update setMELDeviceMode : OK" but nothing changes

When I use the script with arguments everything updates OK

Any tips on why?

EDIT: I start to realize that there is no "automatic" connection Domoticz -> MELCloud through idx and that you need to use script commands for updating MELCloud. Is my assumption correct? In that case, how do I implement control from Domoticz to MELCloud (for selector and switch you could add script commands but what about setpoint for temperature?)
regis85
Posts: 1
Joined: Friday 20 January 2017 19:31
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: [Perl] Control Mitsubishi MAC-557IF-E airconditioning

Post by regis85 »

jupil51 wrote:Hi !

When i try the report, i have a litle.... problem !

Code: Select all

pi@Domorasp:~/domoticz/scripts$ ./melcloud.pl /report
'"' expected, at character offset 4 (before "Success: false, Erro...") at ./melcloud.pl line 271.
The configuration seems ok..

Code: Select all

pi@Domorasp:~/domoticz/scripts$ ./melcloud.pl /check
############################
# Check configuration:     #
############################
Connection to domoticz [OK]
Configuration MEL Cloud [DOMOTICZ]
Connection to MEL Cloud [OK]
the line 271 from melcloud.pl : my $decoded = JSON->new->utf8(0)->decode($_);

I try to change the room on melcloud without floor , but still the same.

I don t know where is the problem, if someone can help me..

Thanks !
Hi

Same issue with "mail.adresse\@mail.adresse" in dometicz MEL_login variables.
With "[email protected]" it work fine but I get new errors

Code: Select all

domoticz/scripts/perl $ perl melcloud.pl report
Use of uninitialized value $result in print at melcloud.pl line 538.
Use of uninitialized value $result in concatenation (.) or string at melcloud.pl line 539.
Use of uninitialized value $idx in concatenation (.) or string at melcloud.pl line 175.

Code: Select all

173      my ($idx) = @_;
174      my $result;
175      my $url = "http://$domIP:$domPORT/json.htm?type=devices&rid=".$idx;

Code: Select all

537      my $result = domSendJSON("type=command&param=udevice&idx=$idDomDevice&nvalue=0&svalue=$deviceInfos->{'RoomTemperature'}") if /(?:status\"\ :)+(.*?),/s;
538      debug("receive from domoticz: ".$result);
l539      return $result;
if someone can help us …
bagnico
Posts: 5
Joined: Friday 26 February 2016 23:28
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: [Perl] Control Mitsubishi MAC-557IF-E airconditioning

Post by bagnico »

Hello !

I made a script to control the device on domoticz, you just have to create a selector to call the script :

Image

Image

Code: Select all

#!/bin/bash
#
# Name : pac_mistubishi.sh
# Description : Envoi des commandes pour le contrôle de la pompe a chaleur
# Author : bagnico
##############################################################################################
# Usage
##############################################################################################
# 
# bash pac_mitubishi.sh $name $power $mode $temp $fanspeed $vanehorizontal $vanevertical 
#
# name = Nom utilise sur melcloud
# power = ON/OFF
# mode = 1=warm 2=dry 3=cool 7=vent 8=auto
# temp = temperature de consigne
# fanspeed = 0=auto / 1-5
# vanehorizontal = 0=auto / 1-5 / 12=move
# vanevertical = 0=auto / 1-5 / 7=move
#
#
##############################################################################################

name=$1
power=$2
mode=$3
temp=$4
fanspeed=$5
vaneh=$6
vanev=$7

if [[ "$power" = "OFF" && ! -z $name ]] ; then
	info=$(perl /home/pi/domoticz/scripts/perso/pac_melcloud.pl power off $name)
	echo "$info"
	cmd=`echo "$*"|sed 's/ /%20/g'`
	curl "http://127.0.0.1:8080/json.htm?type=command&param=addlogmessage&message=PAC%20$cmd"
	exit
fi

if [[ -z $name || -z $power || -z $mode || -z $temp || -z $fanspeed || -z $vaneh || -z $vanev ]] || [[ $power != "ON" && $power != "OFF" ]] ; then
	echo $power
	echo "ERROR !"
	echo "Usage : pac_mitubishi.sh name power mode temp fanspeed vanehorizontal vanevertical"
	cmd=`echo "$*"|sed 's/ /%20/g'`
	curl "http://127.0.0.1:8080/json.htm?type=command&param=addlogmessage&message=PAC%20ERROR%20PARAMETRE%20MANQUANT%20$cmd"
	exit
fi

if [ $mode = "1" ] ; then
	modeclim="warm"
elif [ $mode = "2" ] ; then
	modeclim="dry"
elif [ $mode = "3" ] ; then
	modeclim="cool"
elif [ $mode = "7" ] ; then
	modeclim = "vent"
elif [ $mode = "8" ] ; then
	modeclim="auto"
fi


if [ "$power" = "ON" ] ; then
	info=$(perl /home/pi/domoticz/scripts/perso/pac_melcloud.pl power on $name)
	echo "$info"

	if echo $info | grep -q '"OperationMode":'$mode ; then
		echo "MODE IDENTIQUE : $mode"
	else
		perl /home/pi/domoticz/scripts/perso/pac_melcloud.pl mode $modeclim $name
		echo "MODE $mode OK"
	fi

	if echo $info | grep -q '"SetTemperature":'$temp ; then
		echo "TEMPERATURE DEMANDEE IDENTIQUE : $temp"
	else
		perl /home/pi/domoticz/scripts/perso/pac_melcloud.pl temp $temp $name
		echo "TEMPERATURE DEMANDEE $temp OK"
	fi

	if echo $info | grep -q '"SetFanSpeed":'$fanspeed ; then
		echo "VITESSE VENTILATEUR DEMANDEE IDENTIQUE : $fanspeed"
	else
		perl /home/pi/domoticz/scripts/perso/pac_melcloud.pl fan $fanspeed $name
		echo "VITESSE VENTILATEUR DEMANDEE $fanspeed OK"
	fi

	if echo $info | grep -q '"VaneHorizontal":'$vaneh ; then
		echo "POSITION VANEHORIZONTAL DEMANDEE IDENTIQUE : $vaneh"
	else
		perl /home/pi/domoticz/scripts/perso/pac_melcloud.pl vanehorizontal $vaneh $name
		echo "POSITION VANEHORIZONTAL $vaneh OK"
	fi

	if echo $info | grep -q '"VaneVertical":'$vanev ; then
		echo "POSITION VANEHORIZONTAL DEMANDEE IDENTIQUE : $vanev"
	else
		perl /home/pi/domoticz/scripts/perso/pac_melcloud.pl vanevertical $vanev $name
		echo "POSITION VANEVERTICAL $vanev OK"
	fi

	cmd=`echo "$*"|sed 's/ /%20/g'`
	curl "http://127.0.0.1:8080/json.htm?type=command&param=addlogmessage&message=PAC%20$cmd"

else
	echo "ERROR !"
	echo "Usage : pac_mitubishi.sh name power mode temp fanspeed vanehorizontal vanevertical"
	cmd=`echo "$*"|sed 's/ /%20/g'`
	curl "http://127.0.0.1:8080/json.htm?type=command&param=addlogmessage&message=PAC%20ERROR%20$cmd"
fi
If the parameter is identical (warm...) the command is not send to accelerate the process.

Sorry for my poor english :lol:
gysmo38
Posts: 50
Joined: Saturday 01 February 2014 13:42
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: [Perl] Control Mitsubishi MAC-557IF-E airconditioning

Post by gysmo38 »

Hello,

Sorry for the delay.

I create a python plugin for manage MELCloud devices.

It is easier to use. You can find it on the Wiki: http://www.domoticz.com/wiki/Plugins/MELCloud.html

This is the first version. You can control Power, Mode, Fan, Temp from Domoticz.

If you change unit from remote, for now it only sync the power and mode state.

An update should come quickly to sync all states.

I hope you will enjoy it. You need to use beta version of Domoticz because python plugin is not yet in official release

Update: The version 0.2 is avaible on the wii page :)
MrOlivier
Posts: 3
Joined: Monday 17 April 2017 10:05
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: [Perl] Control Mitsubishi MAC-557IF-E airconditioning

Post by MrOlivier »

Hello,

I have a little problem with MELCloud plugin in my Raspberry.
0 device is find.
The debug says :

MELCloud Login success. Key ID:XXXXXXXXXXXXXXXXXXXXXXXXX
Find 0 devices in MELCloud
Calling message handler 'onHeartbeat'.

Normally I have one building and 2 devices.

Have you an idea ?
Thanks a lot for your help !

Olivier
Domotics V3.7345
MELCloud plugin Version: 0.2
Raspberry 3
gysmo38
Posts: 50
Joined: Saturday 01 February 2014 13:42
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: [Perl] Control Mitsubishi MAC-557IF-E airconditioning

Post by gysmo38 »

Hello,

I know what is the problem.

I devide the building in areas and put devices in area. My script only search in areas.

I will change my script to search in floors, areas and directly device.

I will send you an update when it is done.

Fred
gysmo38
Posts: 50
Joined: Saturday 01 February 2014 13:42
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: [Perl] Control Mitsubishi MAC-557IF-E airconditioning

Post by gysmo38 »

Hello,

I update the version on the Wiki page (http://www.domoticz.com/wiki/Plugins/ME ... stallation), I hope it will work for you now :)

Fred
MrOlivier
Posts: 3
Joined: Monday 17 April 2017 10:05
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: [Perl] Control Mitsubishi MAC-557IF-E airconditioning

Post by MrOlivier »

Thank you very much, it works much better ! :D

But Domoticz detects just one device.
I have PARENTS and ENFANTS and just PARENTS is detected.

And when I send a command with Domoticz, the other instructions have changed to default in the MELCloud application.
I don't know why.

Log :
(Climatisation) 'onHeartbeat' failed 'KeyError'.
(Climatisation) ----> Line 408 in /home/pi/domoticz/plugins/Melcloud/plugin.py, function onHeartbeat

Olivier

EDIT: Vertical fins of my devices can only be changed manually. I'm trying to test without these lines of code
MrOlivier
Posts: 3
Joined: Monday 17 April 2017 10:05
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: [Perl] Control Mitsubishi MAC-557IF-E airconditioning

Post by MrOlivier »

Ok now, all my devices are detected after isolating the code from the vertical and horizontal fins.
But I have an error on ligne 406 now. :?

(Climatisation) 'onHeartbeat' failed 'KeyError'.
(Climatisation) ----> Line 406 in /home/pi/domoticz/plugins/Melcloud/plugin.py, function onHeartbeat
Wob76
Posts: 110
Joined: Wednesday 19 April 2017 6:31
Target OS: Linux
Domoticz version:
Contact:

Re: [Perl] Control Mitsubishi MAC-557IF-E airconditioning

Post by Wob76 »

Hi,

Mitsubishi in Australia seem to use a variation of this controller (MAC-559IF-E) and a different site (http://app.melview.net). Any chance someone smarter than me can work out if this can be modified to work?

Thanks,
Wob76
gysmo38
Posts: 50
Joined: Saturday 01 February 2014 13:42
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: [Perl] Control Mitsubishi MAC-557IF-E airconditioning

Post by gysmo38 »

@MrOlivier : I made new test, it work for me. Maybe try to delete in hardware melcloud plugin and create it again. It should work.

@Wob76 : I can try if you want but I need an access to the website to made test. Let me known in PM.
Wob76
Posts: 110
Joined: Wednesday 19 April 2017 6:31
Target OS: Linux
Domoticz version:
Contact:

Re: [Perl] Control Mitsubishi MAC-557IF-E airconditioning

Post by Wob76 »

@gysmo38 : Seems I am not yet active enough to send a PM, so I'll wait to see if I can unlock that.

The site does have a "demonstration" login, not sure if that will give you the required access to test. Once I can PM I am happy to supply you with my details for testing.
tunnus
Posts: 1
Joined: Monday 08 May 2017 22:51
Target OS: -
Domoticz version:
Contact:

Re: [Perl] Control Mitsubishi MAC-557IF-E airconditioning

Post by tunnus »

gysmo38 wrote: I create a python plugin for manage MELCloud devices.

It is easier to use. You can find it on the Wiki: http://www.domoticz.com/wiki/Plugins/MELCloud.html
Hi! Any chance that someone would convert this script to support Vera?
italoc
Posts: 25
Joined: Monday 13 February 2017 13:57
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: [Perl] Control Mitsubishi MAC-557IF-E airconditioning

Post by italoc »

i'm using the perl script and work great, but i have a problem with SETTEMP virtual sensor, it's impossibile with this sensor to set a custom temperture

have some idea?

thanks
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest