mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 06:39:11 +00:00
98_weekprofile: new HMCCU support
git-svn-id: https://svn.fhem.de/fhem/trunk@19318 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
13217a75fb
commit
9a0c6281f9
@ -1,5 +1,6 @@
|
|||||||
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
||||||
# Do not insert empty lines here, update check depends on it.
|
# Do not insert empty lines here, update check depends on it.
|
||||||
|
- feature: 98_weekprofile: HMCCU support
|
||||||
- change: 10_MYSENSORS_DEVICE: enhance support for SetExtensions;
|
- change: 10_MYSENSORS_DEVICE: enhance support for SetExtensions;
|
||||||
separate readings for heatrbeat, smartSleep & NACK
|
separate readings for heatrbeat, smartSleep & NACK
|
||||||
- bugfix: 73_GardenaSmartBridge: fix undefined_value Error
|
- bugfix: 73_GardenaSmartBridge: fix undefined_value Error
|
||||||
|
@ -49,14 +49,23 @@ $DEV_READINGS{"Fri"}{"CUL_HM"} = "6_tempListFri";
|
|||||||
$DEV_READINGS{"Sat"}{"CUL_HM"} = "0_tempListSat";
|
$DEV_READINGS{"Sat"}{"CUL_HM"} = "0_tempListSat";
|
||||||
$DEV_READINGS{"Sun"}{"CUL_HM"} = "1_tempListSun";
|
$DEV_READINGS{"Sun"}{"CUL_HM"} = "1_tempListSun";
|
||||||
|
|
||||||
# HMCCUDEV
|
# HMCCUDEV HMIP
|
||||||
$DEV_READINGS{"Mon"}{"HMCCUDEV"} = "MONDAY";
|
$DEV_READINGS{"Mon"}{"HMCCU_IP"} = "MONDAY";
|
||||||
$DEV_READINGS{"Tue"}{"HMCCUDEV"} = "TUESDAY";
|
$DEV_READINGS{"Tue"}{"HMCCU_IP"} = "TUESDAY";
|
||||||
$DEV_READINGS{"Wed"}{"HMCCUDEV"} = "WEDNESDAY";
|
$DEV_READINGS{"Wed"}{"HMCCU_IP"} = "WEDNESDAY";
|
||||||
$DEV_READINGS{"Thu"}{"HMCCUDEV"} = "THURSDAY";
|
$DEV_READINGS{"Thu"}{"HMCCU_IP"} = "THURSDAY";
|
||||||
$DEV_READINGS{"Fri"}{"HMCCUDEV"} = "FRIDAY";
|
$DEV_READINGS{"Fri"}{"HMCCU_IP"} = "FRIDAY";
|
||||||
$DEV_READINGS{"Sat"}{"HMCCUDEV"} = "SATURDAY";
|
$DEV_READINGS{"Sat"}{"HMCCU_IP"} = "SATURDAY";
|
||||||
$DEV_READINGS{"Sun"}{"HMCCUDEV"} = "SUNDAY";
|
$DEV_READINGS{"Sun"}{"HMCCU_IP"} = "SUNDAY";
|
||||||
|
|
||||||
|
# HMCCUDEV HM
|
||||||
|
$DEV_READINGS{"Mon"}{"HMCCU_HM"} = "MONDAY";
|
||||||
|
$DEV_READINGS{"Tue"}{"HMCCU_HM"} = "TUESDAY";
|
||||||
|
$DEV_READINGS{"Wed"}{"HMCCU_HM"} = "WEDNESDAY";
|
||||||
|
$DEV_READINGS{"Thu"}{"HMCCU_HM"} = "THURSDAY";
|
||||||
|
$DEV_READINGS{"Fri"}{"HMCCU_HM"} = "FRIDAY";
|
||||||
|
$DEV_READINGS{"Sat"}{"HMCCU_HM"} = "SATURDAY";
|
||||||
|
$DEV_READINGS{"Sun"}{"HMCCU_HM"} = "SUNDAY";
|
||||||
|
|
||||||
sub weekprofile_findPRF($$$$);
|
sub weekprofile_findPRF($$$$);
|
||||||
|
|
||||||
@ -110,6 +119,8 @@ sub weekprofile_getDeviceType($$;$)
|
|||||||
}
|
}
|
||||||
|
|
||||||
my $type = undef;
|
my $type = undef;
|
||||||
|
|
||||||
|
Log3 $me, 5, "$me(getDeviceType): type: $devHash->{TYPE}";
|
||||||
|
|
||||||
if ($devHash->{TYPE} =~ /CUL_HM/){
|
if ($devHash->{TYPE} =~ /CUL_HM/){
|
||||||
my $model = AttrVal($device,"model","");
|
my $model = AttrVal($device,"model","");
|
||||||
@ -142,13 +153,18 @@ sub weekprofile_getDeviceType($$;$)
|
|||||||
elsif ( ($devHash->{TYPE} =~ /MAX/) && ($devHash->{type} =~ /.*Thermostat.*/) ){
|
elsif ( ($devHash->{TYPE} =~ /MAX/) && ($devHash->{type} =~ /.*Thermostat.*/) ){
|
||||||
$type = "MAX";
|
$type = "MAX";
|
||||||
}
|
}
|
||||||
|
elsif ( $devHash->{TYPE} =~ /HMCCUDEV/ || $devHash->{TYPE} =~ /dummyHM/){
|
||||||
|
my $model = $devHash->{ccutype};
|
||||||
|
Log3 $me, 5, "$me(getDeviceType): $devHash->{NAME}, $model";
|
||||||
|
$type = "HMCCU_IP" if ( $model =~ m/HmIP.*/ );
|
||||||
|
$type = "HMCCU_HM" if ( $model =~ m/HM-.*/ );
|
||||||
|
}
|
||||||
elsif ($devHash->{TYPE} =~ /dummy/){
|
elsif ($devHash->{TYPE} =~ /dummy/){
|
||||||
|
Log3 $me, 5, "$me(getDeviceType): dummy $device";
|
||||||
$type = "MAX" if ($device =~ m/.*MAX.*FAKE.*/); #dummy (FAKE WT) with name MAX inside for testing
|
$type = "MAX" if ($device =~ m/.*MAX.*FAKE.*/); #dummy (FAKE WT) with name MAX inside for testing
|
||||||
$type = "CUL_HM" if ($device =~ m/.*CUL_HM.*FAKE.*/); #dummy (FAKE WT) with name CUL_HM inside for testing
|
$type = "CUL_HM" if ($device =~ m/.*CUL_HM.*FAKE.*/); #dummy (FAKE WT) with name CUL_HM inside for testing
|
||||||
}
|
$type = "HMCCU_IP"if ($device =~ m/.*HMCCU_IP.*FAKE.*/); #dummy (FAKE WT) with name HMCCU_IP inside for testing
|
||||||
elsif ( $devHash->{TYPE} =~ /HMCCUDEV/){
|
$type = "HMCCU_HM"if ($device =~ m/.*HMCCU_HM.*FAKE.*/); #dummy (FAKE WT) with name HMCCU_HM inside for testing
|
||||||
my $model = $devHash->{ccutype};
|
|
||||||
$type = "HMCCUDEV" if ( $model =~ /HmIP-eTRV-2/ );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $type if ($sndrcv eq "RCV");
|
return $type if ($sndrcv eq "RCV");
|
||||||
@ -176,6 +192,8 @@ sub weekprofile_readDayProfile($@)
|
|||||||
$type = weekprofile_getDeviceType($me,$device) if (!defined($type));
|
$type = weekprofile_getDeviceType($me,$device) if (!defined($type));
|
||||||
return if (!defined($type));
|
return if (!defined($type));
|
||||||
|
|
||||||
|
Log3 $me, 5, "$me(readDayProfile): read from type $type";
|
||||||
|
|
||||||
my $reading = $DEV_READINGS{$day}{$type};
|
my $reading = $DEV_READINGS{$day}{$type};
|
||||||
|
|
||||||
#Log3 $me, 5, "$me(ReadDayProfile): $reading";
|
#Log3 $me, 5, "$me(ReadDayProfile): $reading";
|
||||||
@ -203,16 +221,20 @@ sub weekprofile_readDayProfile($@)
|
|||||||
push(@temps, $timeTemp[$i+1]);
|
push(@temps, $timeTemp[$i+1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elsif ($type eq "HMCCUDEV"){
|
elsif ($type =~ /HMCCU.*/){
|
||||||
my $lastTime = "";
|
my $lastTime = "";
|
||||||
|
|
||||||
for (my $i = 1; $i < 14; $i+=1){
|
for (my $i = 1; $i < 14; $i+=1){
|
||||||
my $prfTemp = ReadingsVal($device, "R-1.P1_TEMPERATURE_" . $reading . "_$i", "");
|
my $prfTime = ReadingsVal($device, "R-1.P1_ENDTIME_$reading"."_$i", "");
|
||||||
my $prfTime = ReadingsVal($device, "R-1.P1_ENDTIME_" . $reading . "_$i", "");
|
my $prfTemp = ReadingsVal($device, "R-1.P1_TEMPERATURE_$reading"."_$i", "");
|
||||||
|
|
||||||
|
$prfTime = ReadingsVal($device, "R-ENDTIME_$reading"."_$i", "") if (!$prfTime);
|
||||||
|
$prfTemp = ReadingsVal($device, "R-TEMPERATURE_$reading"."_$i", "") if (!$prfTemp);
|
||||||
|
|
||||||
|
Log3 $me, 5, "$me(readDayProfile): $reading"."_$i $prfTime $prfTemp";
|
||||||
|
|
||||||
$prfTime = weekprofile_minutesToTime($prfTime);
|
$prfTime = weekprofile_minutesToTime($prfTime);
|
||||||
|
|
||||||
if ($lastTime ne $prfTime){
|
if ($lastTime ne "24:00"){
|
||||||
$lastTime = $prfTime;
|
$lastTime = $prfTime;
|
||||||
|
|
||||||
push(@temps, $prfTemp);
|
push(@temps, $prfTemp);
|
||||||
@ -220,9 +242,12 @@ sub weekprofile_readDayProfile($@)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
Log3 $me, 3, "$me(readDayProfile): unsupported device type $type";
|
||||||
|
}
|
||||||
|
|
||||||
for(my $i = 0; $i < scalar(@temps); $i+=1){
|
for(my $i = 0; $i < scalar(@temps); $i+=1){
|
||||||
Log3 $me, 4, "$me(ReadDayProfile): temp $i $temps[$i]";
|
Log3 $me, 4, "$me(ReadDayProfile): temp $i $temps[$i]";
|
||||||
$temps[$i] =~s/[^\d.]//g; #only numbers
|
$temps[$i] =~s/[^\d.]//g; #only numbers
|
||||||
my $tempON = myAttrVal($me, "tempON", undef);
|
my $tempON = myAttrVal($me, "tempON", undef);
|
||||||
my $tempOFF = myAttrVal($me, "tempOFF", undef);
|
my $tempOFF = myAttrVal($me, "tempOFF", undef);
|
||||||
@ -345,11 +370,11 @@ sub weekprofile_sendDevProfile(@)
|
|||||||
|
|
||||||
#replace variables with values
|
#replace variables with values
|
||||||
foreach my $day (@dayToTransfer){
|
foreach my $day (@dayToTransfer){
|
||||||
my $tmpCnt = scalar(@{$prfData->{$day}->{"temp"}});
|
my $tmpCnt = scalar(@{$prfData->{$day}->{"temp"}});
|
||||||
for (my $i = 0; $i < $tmpCnt; $i++) {
|
for (my $i = 0; $i < $tmpCnt; $i++) {
|
||||||
$prfData->{$day}->{"temp"}[$i] = $tempON if ($prfData->{$day}->{"temp"}[$i] =~/on/i);
|
$prfData->{$day}->{"temp"}[$i] = $tempON if ($prfData->{$day}->{"temp"}[$i] =~/on/i);
|
||||||
$prfData->{$day}->{"temp"}[$i] = $tempOFF if ($prfData->{$day}->{"temp"}[$i] =~/off/i);
|
$prfData->{$day}->{"temp"}[$i] = $tempOFF if ($prfData->{$day}->{"temp"}[$i] =~/off/i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
my $cmd;
|
my $cmd;
|
||||||
@ -382,7 +407,7 @@ sub weekprofile_sendDevProfile(@)
|
|||||||
$cmd .= ($k < $dayCnt-1) ? "; ": "";
|
$cmd .= ($k < $dayCnt-1) ? "; ": "";
|
||||||
$k++;
|
$k++;
|
||||||
}
|
}
|
||||||
} elsif ($type eq "HMCCUDEV"){
|
} elsif ($type eq "HMCCU_IP"){
|
||||||
my $k=0;
|
my $k=0;
|
||||||
my $dayCnt = scalar(@dayToTransfer);
|
my $dayCnt = scalar(@dayToTransfer);
|
||||||
$cmd .= "set $device config 1";
|
$cmd .= "set $device config 1";
|
||||||
@ -397,8 +422,22 @@ sub weekprofile_sendDevProfile(@)
|
|||||||
$cmd .= " " . $dpTemp . "_" . ($i + 1) . "=" . $prfData->{$day}->{"temp"}[$i];
|
$cmd .= " " . $dpTemp . "_" . ($i + 1) . "=" . $prfData->{$day}->{"temp"}[$i];
|
||||||
$cmd .= " " . $dpTime . "_" . ($i + 1) . "=" . weekprofile_timeToMinutes($prfData->{$day}->{"time"}[$i]);
|
$cmd .= " " . $dpTime . "_" . ($i + 1) . "=" . weekprofile_timeToMinutes($prfData->{$day}->{"time"}[$i]);
|
||||||
}
|
}
|
||||||
|
$k++;
|
||||||
#$cmd .= ($k < $dayCnt-1) ? "; ": "";
|
}
|
||||||
|
} elsif ($type eq "HMCCU_HM"){
|
||||||
|
my $k=0;
|
||||||
|
my $dayCnt = scalar(@dayToTransfer);
|
||||||
|
$cmd .= "set $device config";
|
||||||
|
foreach my $day (@dayToTransfer){
|
||||||
|
my $reading = $DEV_READINGS{$day}{$type};
|
||||||
|
my $dpTime = "ENDTIME_$reading";
|
||||||
|
my $dpTemp = "TEMPERATURE_$reading";
|
||||||
|
|
||||||
|
my $tmpCnt = scalar(@{$prfData->{$day}->{"temp"}});
|
||||||
|
for (my $i = 0; $i < $tmpCnt; $i++) {
|
||||||
|
$cmd .= " " . $dpTemp . "_" . ($i + 1) . "=" . $prfData->{$day}->{"temp"}[$i];
|
||||||
|
$cmd .= " " . $dpTime . "_" . ($i + 1) . "=" . weekprofile_timeToMinutes($prfData->{$day}->{"time"}[$i]);
|
||||||
|
}
|
||||||
$k++;
|
$k++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user