Page 3 of 8

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

Posted: Wednesday 19 October 2016 19:18
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 ?

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

Posted: Wednesday 19 October 2016 22:19
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

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

Posted: Wednesday 26 October 2016 0:41
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!

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

Posted: Friday 04 November 2016 12:28
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 !

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

Posted: Thursday 10 November 2016 22:53
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 6548 times
and then runned the script
C:\Melcloud>perl C:/Melcloud/melcloud.pl mode warm TV
Update setMELDeviceMode : OK
Update setMELDevicePower : OK

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

Posted: Tuesday 15 November 2016 15:46
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?

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

Posted: Tuesday 15 November 2016 20:26
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?)

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

Posted: Friday 20 January 2017 21:48
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 …

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

Posted: Saturday 04 February 2017 22:18
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:

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

Posted: Sunday 12 March 2017 23:44
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 :)

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

Posted: Monday 17 April 2017 10:31
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

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

Posted: Monday 17 April 2017 14:34
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

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

Posted: Monday 17 April 2017 15:48
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

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

Posted: Monday 17 April 2017 16:18
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

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

Posted: Monday 17 April 2017 16:45
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

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

Posted: Wednesday 19 April 2017 6:47
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

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

Posted: Sunday 23 April 2017 22:11
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.

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

Posted: Monday 24 April 2017 4:30
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.

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

Posted: Monday 08 May 2017 22:56
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?

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

Posted: Thursday 18 May 2017 14:11
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