mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-03 23:06:37 +00:00
git-svn-id: https://svn.fhem.de/fhem/trunk@2444 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
8da9caa370
commit
391805371f
@ -336,7 +336,7 @@ sub OWX_Complex ($$$$) {
|
||||
}elsif( ($owx_interface eq "DS2480") || ($owx_interface eq "DS9097") ){
|
||||
return OWX_Complex_SER($hash,$owx_dev,$data,$numread);
|
||||
|
||||
#-- here we treat the network-connected CUNO
|
||||
#-- here we treat the CUNO/COC devices
|
||||
}elsif( $owx_interface eq "CUNO" ){
|
||||
return OWX_Complex_CUNO($hash,$owx_dev,$data,$numread);
|
||||
|
||||
@ -2041,7 +2041,8 @@ sub OWX_Complex_CUNO ($$$$) {
|
||||
#-- has receive part
|
||||
if( $numread > 0 ){
|
||||
#$numread += length($data);
|
||||
Log 1,"CUNO is expected to deliver $numread bytes";
|
||||
Log 3,"CUNO is expected to deliver $numread bytes"
|
||||
if( $owx_debug > 1);
|
||||
$res.=OWX_Receive_CUNO($hash,$numread);
|
||||
}
|
||||
Log 3,"OWX: returned from CUNO $res"
|
||||
@ -2133,7 +2134,7 @@ sub OWX_Receive_CUNO ($$) {
|
||||
#-- 18 bytes received from CUNO
|
||||
}elsif( length($ob) == 18 ){
|
||||
|
||||
my $res = "OWX: Receiving from CUNO: $ob\n";
|
||||
my $res = "OWX: Receiving 18 bytes from CUNO: $ob\n";
|
||||
for(my $i=0;$i<length($ob);$i++){
|
||||
my $j=int(ord(substr($ob,$i,1))/16);
|
||||
my $k=ord(substr($ob,$i,1))%16;
|
||||
|
@ -203,20 +203,32 @@ sub OWAD_Define ($$) {
|
||||
}
|
||||
|
||||
#-- 1-Wire ROM identifier in the form "FF.XXXXXXXXXXXX.YY"
|
||||
# determine CRC Code - only if this is a direct interface
|
||||
$crc = defined($hash->{IODev}->{INTERFACE}) ? sprintf("%02x",OWX_CRC("20.".$id."00")) : "00";
|
||||
# FF = family id follows from the model
|
||||
# YY must be determined from id
|
||||
if( $model eq "DS2450" ){
|
||||
$fam = "20";
|
||||
CommandAttr (undef,"$name model DS2450");
|
||||
}else{
|
||||
return "OWMULTI: Wrong 1-Wire device model $model";
|
||||
}
|
||||
|
||||
#-- determine CRC Code - only if this is a direct interface
|
||||
$crc = defined($hash->{IODev}->{INTERFACE}) ? sprintf("%02x",OWX_CRC($fam.".".$id."00")) : "00";
|
||||
|
||||
#-- Define device internals
|
||||
$hash->{ROM_ID} = "20.".$id.$crc;
|
||||
$hash->{ROM_ID} = $fam.".".$id.$crc;
|
||||
$hash->{OW_ID} = $id;
|
||||
$hash->{OW_FAMILY} = "20";
|
||||
$hash->{OW_FAMILY} = $fam;
|
||||
$hash->{PRESENT} = 0;
|
||||
$hash->{INTERVAL} = $interval;
|
||||
|
||||
#-- Couple to I/O device
|
||||
AssignIoPort($hash);
|
||||
if( !defined($hash->{IODev}->{NAME}) | !defined($hash->{IODev}) | ($hash->{IODev}->{PRESENT} != 1) ){
|
||||
return "OWAD: Warning, no 1-Wire I/O device found for $name.";
|
||||
if( !defined($hash->{IODev}->{NAME}) | !defined($hash->{IODev}) | !defined($hash->{IODev}->{PRESENT}) ){
|
||||
return "OWSWITCH: Warning, no 1-Wire I/O device found for $name.";
|
||||
}
|
||||
if( $hash->{IODev}->{PRESENT} != 1 ){
|
||||
return "OWSWITCH: Warning, 1-Wire I/O device ".$hash->{IODev}->{NAME}." not present for $name.";
|
||||
}
|
||||
$modules{OWAD}{defptr}{$id} = $hash;
|
||||
#--
|
||||
|
@ -186,20 +186,32 @@ sub OWCOUNT_Define ($$) {
|
||||
}
|
||||
|
||||
#-- 1-Wire ROM identifier in the form "FF.XXXXXXXXXXXX.YY"
|
||||
# FF = family id follows from the model
|
||||
# YY must be determined from id
|
||||
if( $model eq "DS2423" ){
|
||||
$fam = "1D";
|
||||
CommandAttr (undef,"$name model DS2423");
|
||||
}else{
|
||||
return "OWMULTI: Wrong 1-Wire device model $model";
|
||||
}
|
||||
|
||||
# determine CRC Code - only if this is a direct interface
|
||||
$crc = defined($hash->{IODev}->{INTERFACE}) ? sprintf("%02x",OWX_CRC("1D.".$id."00")) : "00";
|
||||
$crc = defined($hash->{IODev}->{INTERFACE}) ? sprintf("%02x",OWX_CRC($fam.".".$id."00")) : "00";
|
||||
|
||||
#-- Define device internals
|
||||
$hash->{ROM_ID} = "1D.".$id.$crc;
|
||||
$hash->{ROM_ID} = $fam.".".$id.$crc;
|
||||
$hash->{OW_ID} = $id;
|
||||
$hash->{OW_FAMILY} = "1D";
|
||||
$hash->{OW_FAMILY} = $fam;
|
||||
$hash->{PRESENT} = 0;
|
||||
$hash->{INTERVAL} = $interval;
|
||||
|
||||
#-- Couple to I/O device
|
||||
AssignIoPort($hash);
|
||||
if( !defined($hash->{IODev}->{NAME}) | !defined($hash->{IODev}) | ($hash->{IODev}->{PRESENT} != 1) ){
|
||||
return "OWCOUNT: Warning, no 1-Wire I/O device found for $name.";
|
||||
if( !defined($hash->{IODev}->{NAME}) | !defined($hash->{IODev}) | !defined($hash->{IODev}->{PRESENT}) ){
|
||||
return "OWSWITCH: Warning, no 1-Wire I/O device found for $name.";
|
||||
}
|
||||
if( $hash->{IODev}->{PRESENT} != 1 ){
|
||||
return "OWSWITCH: Warning, 1-Wire I/O device ".$hash->{IODev}->{NAME}." not present for $name.";
|
||||
}
|
||||
$modules{OWCOUNT}{defptr}{$id} = $hash;
|
||||
#--
|
||||
@ -210,7 +222,7 @@ sub OWCOUNT_Define ($$) {
|
||||
my $interface= $hash->{IODev}->{TYPE};
|
||||
|
||||
#-- Start timer for initialization in a few seconds
|
||||
InternalTimer(time()+10, "OWCOUNT_InitializeDevice", $hash, 0);
|
||||
InternalTimer(time()+5, "OWCOUNT_InitializeDevice", $hash, 0);
|
||||
|
||||
#-- Start timer for updates
|
||||
InternalTimer(time()+$hash->{INTERVAL}, "OWCOUNT_GetValues", $hash, 0);
|
||||
@ -286,8 +298,6 @@ sub OWCOUNT_InitializeDevice($) {
|
||||
if ($unarr[0].$runit eq "kWh/h" );
|
||||
$hash->{READINGS}{"$owg_rate[$i]"}{UNITABBR} = "kW"
|
||||
if ($unarr[1].$runit eq "kWh/h" );
|
||||
#Log 1,"OWCOUNT InitializeDevice with period $period and UNITABBR = ".$hash->{READINGS}{"$owg_rate[$i]"}{UNITABBR};
|
||||
|
||||
}
|
||||
|
||||
#-- set status according to interface type
|
||||
@ -348,7 +358,7 @@ sub OWCOUNT_FormatValues($) {
|
||||
$period = $hash->{READINGS}{"$owg_channel[$i]"}{PERIOD};
|
||||
$runit = $hash->{READINGS}{"$owg_rate[$i]"}{UNITABBR};
|
||||
|
||||
#-- skip som thing if undefined
|
||||
#-- skip some thing if undefined
|
||||
if( $owg_val[$i] eq ""){
|
||||
$svalue .= $owg_channel[$i].": ???";
|
||||
}else{
|
||||
@ -443,10 +453,10 @@ sub OWCOUNT_FormatValues($) {
|
||||
#-- string buildup for return value and STATE
|
||||
#-- 1 decimal
|
||||
if( $factor == 1.0 ){
|
||||
$svalue .= sprintf( "%s: %5.1f %s (%5.2f %s)", $owg_channel[$i], $vval,$unit,$vrate,$runit);
|
||||
$svalue .= sprintf( "%s: %5.1f %s / %5.2f %s", $owg_channel[$i], $vval,$unit,$vrate,$runit);
|
||||
#-- 3 decimals
|
||||
} else {
|
||||
$svalue .= sprintf( "%s: %5.3f %s (%5.2f %s)", $owg_channel[$i], $vval,$unit,$vrate,$runit);
|
||||
$svalue .= sprintf( "%s: %5.3f %s / %5.2f %s", $owg_channel[$i], $vval,$unit,$vrate,$runit);
|
||||
}
|
||||
}
|
||||
readingsBulkUpdate($hash,"$owg_channel[$i]",$vval);
|
||||
|
@ -77,7 +77,7 @@ sub OWID_Initialize ($) {
|
||||
$hash->{UndefFn} = "OWID_Undef";
|
||||
$hash->{GetFn} = "OWID_Get";
|
||||
$hash->{SetFn} = undef;
|
||||
my $attlist = "IODev do_not_notify:0,1 showtime:0,1 loglevel:0,1,2,3,4,5 ";
|
||||
my $attlist = "IODev do_not_notify:0,1 showtime:0,1 model loglevel:0,1,2,3,4,5 ";
|
||||
$hash->{AttrList} = $attlist;
|
||||
}
|
||||
|
||||
@ -129,8 +129,11 @@ sub OWID_Define ($$) {
|
||||
|
||||
#-- Couple to I/O device
|
||||
AssignIoPort($hash);
|
||||
if( !defined($hash->{IODev}->{NAME}) | !defined($hash->{IODev}) | ($hash->{IODev}->{PRESENT} != 1) ){
|
||||
return "OWID: Warning, no 1-Wire I/O device found for $name.";
|
||||
if( !defined($hash->{IODev}->{NAME}) | !defined($hash->{IODev}) | !defined($hash->{IODev}->{PRESENT}) ){
|
||||
return "OWSWITCH: Warning, no 1-Wire I/O device found for $name.";
|
||||
}
|
||||
if( $hash->{IODev}->{PRESENT} != 1 ){
|
||||
return "OWSWITCH: Warning, 1-Wire I/O device ".$hash->{IODev}->{NAME}." not present for $name.";
|
||||
}
|
||||
$modules{OWID}{defptr}{$id} = $hash;
|
||||
#--
|
||||
|
@ -164,8 +164,11 @@ sub OWLCD_Define ($$) {
|
||||
|
||||
#-- Couple to I/O device
|
||||
AssignIoPort($hash);
|
||||
if( !defined($hash->{IODev}->{NAME}) | !defined($hash->{IODev}) | ($hash->{IODev}->{PRESENT} != 1) ){
|
||||
return "OWLCD: Warning, no 1-Wire I/O device found for $name.";
|
||||
if( !defined($hash->{IODev}->{NAME}) | !defined($hash->{IODev}) | !defined($hash->{IODev}->{PRESENT}) ){
|
||||
return "OWSWITCH: Warning, no 1-Wire I/O device found for $name.";
|
||||
}
|
||||
if( $hash->{IODev}->{PRESENT} != 1 ){
|
||||
return "OWSWITCH: Warning, 1-Wire I/O device ".$hash->{IODev}->{NAME}." not present for $name.";
|
||||
}
|
||||
$modules{OWLCD}{defptr}{$id} = $hash;
|
||||
|
||||
|
@ -117,7 +117,7 @@ sub OWMULTI_Initialize ($) {
|
||||
$hash->{SetFn} = "OWMULTI_Set";
|
||||
#tempOffset = a temperature offset added to the temperature reading for correction
|
||||
#tempUnit = a unit of measure: C/F/K
|
||||
$hash->{AttrList}= "IODev do_not_notify:0,1 showtime:0,1 loglevel:0,1,2,3,4,5 ".
|
||||
$hash->{AttrList}= "IODev do_not_notify:0,1 showtime:0,1 model:DS2438 loglevel:0,1,2,3,4,5 ".
|
||||
"event-on-update-reading event-on-change-reading ".
|
||||
"tempOffset tempUnit:C,Celsius,F,Fahrenheit,K,Kelvin ".
|
||||
"VName VUnit VFunction";
|
||||
@ -176,10 +176,12 @@ sub OWMULTI_Define ($$) {
|
||||
# YY must be determined from id
|
||||
if( $model eq "DS2438" ){
|
||||
$fam = "26";
|
||||
CommandAttr (undef,"$name model DS2438");
|
||||
}else{
|
||||
return "OWMULTI: Wrong 1-Wire device model $model";
|
||||
}
|
||||
# determine CRC Code - only if this is a direct interface
|
||||
|
||||
#-- determine CRC Code - only if this is a direct interface
|
||||
$crc = defined($hash->{IODev}->{INTERFACE}) ? sprintf("%02x",OWX_CRC($fam.".".$id."00")) : "00";
|
||||
|
||||
#-- define device internals
|
||||
@ -191,8 +193,11 @@ sub OWMULTI_Define ($$) {
|
||||
|
||||
#-- Couple to I/O device
|
||||
AssignIoPort($hash);
|
||||
if( !defined($hash->{IODev}->{NAME}) | !defined($hash->{IODev}) | ($hash->{IODev}->{PRESENT} != 1) ){
|
||||
return "OWMULTI: Warning, no 1-Wire I/O device found for $name.";
|
||||
if( !defined($hash->{IODev}->{NAME}) | !defined($hash->{IODev}) | !defined($hash->{IODev}->{PRESENT}) ){
|
||||
return "OWSWITCH: Warning, no 1-Wire I/O device found for $name.";
|
||||
}
|
||||
if( $hash->{IODev}->{PRESENT} != 1 ){
|
||||
return "OWSWITCH: Warning, 1-Wire I/O device ".$hash->{IODev}->{NAME}." not present for $name.";
|
||||
}
|
||||
$modules{OWMULTI}{defptr}{$id} = $hash;
|
||||
#--
|
||||
|
@ -182,7 +182,7 @@ sub OWSWITCH_Define ($$) {
|
||||
} else {
|
||||
return "OWSWITCH: $a[0] ID $a[2] invalid, specify a 12 digit value";
|
||||
}
|
||||
#-- 1-Wire ROM identifier in the form "FF.XXXXXXXXXXXX.YY"
|
||||
#-- 1-Wire ROM identifier in the form "FF.XXXXXXXXXXXX.YY"
|
||||
# FF = family id follows from the model
|
||||
# YY must be determined from id
|
||||
if( $model eq "DS2413" ){
|
||||
@ -197,9 +197,7 @@ sub OWSWITCH_Define ($$) {
|
||||
}else{
|
||||
return "OWSWITCH: Wrong 1-Wire device model $model";
|
||||
}
|
||||
|
||||
#-- 1-Wire ROM identifier in the form "FF.XXXXXXXXXXXX.YY"
|
||||
# determine CRC Code - only if this is a direct interface
|
||||
#-- determine CRC Code - only if this is a direct interface
|
||||
$crc = defined($hash->{IODev}->{INTERFACE}) ? sprintf("%02x",OWX_CRC($fam.".".$id."00")) : "00";
|
||||
|
||||
#-- Define device internals
|
||||
@ -211,9 +209,12 @@ sub OWSWITCH_Define ($$) {
|
||||
|
||||
#-- Couple to I/O device
|
||||
AssignIoPort($hash);
|
||||
if( !defined($hash->{IODev}->{NAME}) | !defined($hash->{IODev}) | ($hash->{IODev}->{PRESENT} != 1) ){
|
||||
if( !defined($hash->{IODev}->{NAME}) | !defined($hash->{IODev}) | !defined($hash->{IODev}->{PRESENT}) ){
|
||||
return "OWSWITCH: Warning, no 1-Wire I/O device found for $name.";
|
||||
}
|
||||
if( $hash->{IODev}->{PRESENT} != 1 ){
|
||||
return "OWSWITCH: Warning, 1-Wire I/O device ".$hash->{IODev}->{NAME}." not present for $name.";
|
||||
}
|
||||
$modules{OWSWITCH}{defptr}{$id} = $hash;
|
||||
#--
|
||||
readingsSingleUpdate($hash,"state","defined",1);
|
||||
|
@ -120,7 +120,7 @@ sub OWTHERM_Initialize ($) {
|
||||
$hash->{SetFn} = "OWTHERM_Set";
|
||||
#tempOffset = a temperature offset added to the temperature reading for correction
|
||||
#tempUnit = a unit of measure: C/F/K
|
||||
$hash->{AttrList}= "IODev do_not_notify:0,1 showtime:0,1 loglevel:0,1,2,3,4,5 ".
|
||||
$hash->{AttrList}= "IODev do_not_notify:0,1 showtime:0,1 model:DS1820,DS18B20,DS1822 loglevel:0,1,2,3,4,5 ".
|
||||
"event-on-update-reading event-on-change-reading ".
|
||||
"stateAL stateAH ".
|
||||
"tempOffset tempUnit:C,Celsius,F,Fahrenheit,K,Kelvin ".
|
||||
@ -180,14 +180,17 @@ sub OWTHERM_Define ($$) {
|
||||
# YY must be determined from id
|
||||
if( $model eq "DS1820" ){
|
||||
$fam = "10";
|
||||
CommandAttr (undef,"$name model DS1820");
|
||||
}elsif( $model eq "DS1822" ){
|
||||
$fam = "22";
|
||||
CommandAttr (undef,"$name model DS1822");
|
||||
}elsif( $model eq "DS18B20" ){
|
||||
$fam = "28";
|
||||
CommandAttr (undef,"$name model DS18B20");
|
||||
}else{
|
||||
return "OWTHERM: Wrong 1-Wire device model $model";
|
||||
}
|
||||
# determine CRC Code - only if this is a direct interface
|
||||
#-- determine CRC Code - only if this is a direct interface
|
||||
$crc = defined($hash->{IODev}->{INTERFACE}) ? sprintf("%02x",OWX_CRC($fam.".".$id."00")) : "00";
|
||||
|
||||
#-- define device internals
|
||||
@ -200,8 +203,11 @@ sub OWTHERM_Define ($$) {
|
||||
|
||||
#-- Couple to I/O device, exit if not possible
|
||||
AssignIoPort($hash);
|
||||
if( !defined($hash->{IODev}->{NAME}) | !defined($hash->{IODev}) | ($hash->{IODev}->{PRESENT} != 1) ){
|
||||
return "OWTHERM: Warning, no 1-Wire I/O device found for $name.";
|
||||
if( !defined($hash->{IODev}->{NAME}) | !defined($hash->{IODev}) | !defined($hash->{IODev}->{PRESENT}) ){
|
||||
return "OWSWITCH: Warning, no 1-Wire I/O device found for $name.";
|
||||
}
|
||||
if( $hash->{IODev}->{PRESENT} != 1 ){
|
||||
return "OWSWITCH: Warning, 1-Wire I/O device ".$hash->{IODev}->{NAME}." not present for $name.";
|
||||
}
|
||||
$modules{OWTHERM}{defptr}{$id} = $hash;
|
||||
#--
|
||||
|
Loading…
x
Reference in New Issue
Block a user