mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-02-01 01:09:47 +00:00
MAX: add removeDevice for set
git-svn-id: https://svn.fhem.de/fhem/trunk@2151 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
0b966a5c70
commit
ae0a676435
@ -18,6 +18,7 @@ sub MAXLAN_SimpleWrite(@);
|
|||||||
sub MAXLAN_Poll($);
|
sub MAXLAN_Poll($);
|
||||||
sub MAXLAN_SendDeviceCmd($$);
|
sub MAXLAN_SendDeviceCmd($$);
|
||||||
sub MAXLAN_RequestConfiguration($$);
|
sub MAXLAN_RequestConfiguration($$);
|
||||||
|
sub MAXLAN_RemoveDevice($$);
|
||||||
|
|
||||||
my %device_types = (
|
my %device_types = (
|
||||||
0 => "Cube",
|
0 => "Cube",
|
||||||
@ -90,6 +91,7 @@ MAXLAN_Define($$)
|
|||||||
$hash->{INTERVAL} = @a > 3 ? $a[3] : $defaultPollInterval;
|
$hash->{INTERVAL} = @a > 3 ? $a[3] : $defaultPollInterval;
|
||||||
#This interface is shared with 14_CUL_MAX.pm
|
#This interface is shared with 14_CUL_MAX.pm
|
||||||
$hash->{SendDeviceCmd} = \&MAXLAN_SendDeviceCmd;
|
$hash->{SendDeviceCmd} = \&MAXLAN_SendDeviceCmd;
|
||||||
|
$hash->{RemoveDevice} = \&MAXLAN_RemoveDevice;
|
||||||
|
|
||||||
|
|
||||||
MAXLAN_Connect($hash);
|
MAXLAN_Connect($hash);
|
||||||
@ -429,6 +431,8 @@ MAXLAN_Parse($$)
|
|||||||
my ($len,$addr,$devicetype,$groupid,$firmware,$testresult,$serial) = unpack("CH6CCCCa[10]", $bindata);
|
my ($len,$addr,$devicetype,$groupid,$firmware,$testresult,$serial) = unpack("CH6CCCCa[10]", $bindata);
|
||||||
|
|
||||||
Dispatch($hash, "MAX,define,$addr,$device_types{$devicetype},$serial,$groupid", {RAWMSG => $rmsg});
|
Dispatch($hash, "MAX,define,$addr,$device_types{$devicetype},$serial,$groupid", {RAWMSG => $rmsg});
|
||||||
|
|
||||||
|
return "Invalid C: response, len does not match" if($len != length($bindata)-1);
|
||||||
#devicetype: Cube = 0, HeatingThermostat = 1, HeatingThermostatPlus = 2, WallMountedThermostat = 3, ShutterContact = 4, PushButton = 5
|
#devicetype: Cube = 0, HeatingThermostat = 1, HeatingThermostatPlus = 2, WallMountedThermostat = 3, ShutterContact = 4, PushButton = 5
|
||||||
#Seems that ShutterContact does not have any configdata
|
#Seems that ShutterContact does not have any configdata
|
||||||
if($devicetype == 0){#Cube
|
if($devicetype == 0){#Cube
|
||||||
@ -635,7 +639,7 @@ MAXLAN_SendDeviceCmd($$)
|
|||||||
return MAXLAN_ExpectAnswer($hash, "S:");
|
return MAXLAN_ExpectAnswer($hash, "S:");
|
||||||
}
|
}
|
||||||
|
|
||||||
#Resets the cube (what does that acutally do? Factory reset?)
|
#Resets the cube, i.e. does a factory reset. All pairings will be lost.
|
||||||
sub
|
sub
|
||||||
MAXLAN_RequestReset($)
|
MAXLAN_RequestReset($)
|
||||||
{
|
{
|
||||||
@ -644,6 +648,15 @@ MAXLAN_RequestReset($)
|
|||||||
MAXLAN_ExpectAnswer($hash, "A:");
|
MAXLAN_ExpectAnswer($hash, "A:");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#Remove the device from the cube, i.e. deletes the pairing
|
||||||
|
sub
|
||||||
|
MAXLAN_RemoveDevice($$)
|
||||||
|
{
|
||||||
|
my ($hash,$addr) = @_;
|
||||||
|
MAXLAN_Write($hash,"t:1,1,".encode_base64(pack("H6",$addr),""));
|
||||||
|
MAXLAN_ExpectAnswer($hash, "A:");
|
||||||
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|
||||||
=pod
|
=pod
|
||||||
|
@ -95,8 +95,10 @@ MAX_Set($@)
|
|||||||
$ctrlmode = 0; #auto
|
$ctrlmode = 0; #auto
|
||||||
#TODO: auto mode with temperature is also possible
|
#TODO: auto mode with temperature is also possible
|
||||||
} elsif($args[0] eq "eco") {
|
} elsif($args[0] eq "eco") {
|
||||||
|
return "No ecoTemperature defined" if(!exists($hash->{ecoTemperature}));
|
||||||
$temperature = $hash->{ecoTemperature};
|
$temperature = $hash->{ecoTemperature};
|
||||||
} elsif($args[0] eq "comfort") {
|
} elsif($args[0] eq "comfort") {
|
||||||
|
return "No comfortTemperature defined" if(!exists($hash->{comfortTemperature}));
|
||||||
$temperature = $hash->{comfortTemperature};
|
$temperature = $hash->{comfortTemperature};
|
||||||
} elsif($args[0] eq "on") {
|
} elsif($args[0] eq "on") {
|
||||||
$temperature = 30.5;
|
$temperature = 30.5;
|
||||||
@ -152,13 +154,15 @@ MAX_Set($@)
|
|||||||
my $payload = pack("CCCCCCH6C"."CCCCCCC",0x00,0x00,17,0x00,0x00,0x00,$hash->{addr},0x00,
|
my $payload = pack("CCCCCCH6C"."CCCCCCC",0x00,0x00,17,0x00,0x00,0x00,$hash->{addr},0x00,
|
||||||
$comfort,$eco,$max,$min,$offset,$windowOpenTemp,$windowOpenTime);
|
$comfort,$eco,$max,$min,$offset,$windowOpenTemp,$windowOpenTime);
|
||||||
return ($hash->{IODev}{SendDeviceCmd})->($hash->{IODev},$payload);
|
return ($hash->{IODev}{SendDeviceCmd})->($hash->{IODev},$payload);
|
||||||
|
}elsif($setting eq "removeDevice") {
|
||||||
|
return ($hash->{IODev}{RemoveDevice})->($hash->{IODev},$hash->{addr});
|
||||||
}else{
|
}else{
|
||||||
if($hash->{type} eq "HeatingThermostat") {
|
if($hash->{type} eq "HeatingThermostat") {
|
||||||
#Create numbers from 4.5 to 30.5
|
#Create numbers from 4.5 to 30.5
|
||||||
my $templist = join(",",map { $_/2 } (9..61));
|
my $templist = join(",",map { $_/2 } (9..61));
|
||||||
return "Unknown argument $setting, choose one of desiredTemperature:eco,comfort,$templist ecoTemperature comfortTemperature temperatureOffset maximumTemperature minimumTemperature windowOpenTemperature windowOpenDuration groupid";
|
return "Unknown argument $setting, choose one of desiredTemperature:eco,comfort,$templist ecoTemperature comfortTemperature temperatureOffset maximumTemperature minimumTemperature windowOpenTemperature windowOpenDuration groupid removeDevice";
|
||||||
} else {
|
} else {
|
||||||
return "Unknown argument $setting";
|
return "Unknown argument $setting, choose one of groupid removeDevice";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -326,6 +330,8 @@ MAX_Parse($$)
|
|||||||
<li>groupid <id><br>
|
<li>groupid <id><br>
|
||||||
For devices of type HeatingThermostat only.
|
For devices of type HeatingThermostat only.
|
||||||
Writes the given group id the device's memory. It is usually not necessary to change this.</li>
|
Writes the given group id the device's memory. It is usually not necessary to change this.</li>
|
||||||
|
<li>removeDevice<br>
|
||||||
|
Removes the device from the cube, i.e. deletes the pairing.</li>
|
||||||
<li>ecoTemperature <value><br>
|
<li>ecoTemperature <value><br>
|
||||||
For devices of type HeatingThermostat only. Writes the given eco temperature to the device's memory. It can be activated by pressing the rightmost physical button on the device.</li>
|
For devices of type HeatingThermostat only. Writes the given eco temperature to the device's memory. It can be activated by pressing the rightmost physical button on the device.</li>
|
||||||
<li>comfortTemperature <value><br>
|
<li>comfortTemperature <value><br>
|
||||||
|
Loading…
Reference in New Issue
Block a user