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 (36.49 KiB) Viewed 6556 times
and then runned the script
C:\Melcloud>perl C:/Melcloud/melcloud.pl mode warm TV
Update setMELDeviceMode : OK
Update setMELDevicePower : OK