mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-10 09:16:53 +00:00
git-svn-id: https://svn.fhem.de/fhem/trunk@1700 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
83374af515
commit
7c38334e4b
@ -9,7 +9,7 @@
|
||||
# Internally these interfaces are vastly different, read the corresponding Wiki pages
|
||||
# http://fhemwiki.de/wiki/Interfaces_f%C3%BCr_1-Wire
|
||||
#
|
||||
# Version 2.03 - July, 2012
|
||||
# Version 2.04 - July, 2012
|
||||
#
|
||||
# Prof. Dr. Peter A. Henning, 2012
|
||||
#
|
||||
@ -82,8 +82,7 @@ my %attrs = (
|
||||
);
|
||||
|
||||
#-- some globals needed for the 1-Wire module
|
||||
my $owx_serport;
|
||||
my $owx_cuno;
|
||||
my $owx_hwdevice;
|
||||
#-- baud rate serial interface
|
||||
my $owx_baud=9600;
|
||||
#-- Debugging 0,1,2,3
|
||||
@ -105,7 +104,6 @@ my $owx_LastDiscrepancy = 0;
|
||||
my $owx_LastFamilyDiscrepancy = 0;
|
||||
my $owx_LastDeviceFlag = 0;
|
||||
|
||||
|
||||
########################################################################################
|
||||
#
|
||||
# The following subroutines are independent of the bus interface
|
||||
@ -121,7 +119,7 @@ my $owx_LastDeviceFlag = 0;
|
||||
sub OWX_Initialize ($) {
|
||||
my ($hash) = @_;
|
||||
#-- Provider
|
||||
$hash->{Clients} = ":OWAD:OWCOUNT:OWID:OWLCD:OWSWITCH:OWTEMP:";
|
||||
$hash->{Clients} = ":OWAD:OWCOUNT:OWID:OWLCD:OWSWITCH:OWTHERM:";
|
||||
|
||||
#-- Normal Devices
|
||||
$hash->{DefFn} = "OWX_Define";
|
||||
@ -197,6 +195,10 @@ sub OWX_Alarms ($) {
|
||||
sub OWX_Complex ($$$$) {
|
||||
my ($hash,$owx_dev,$data,$numread) =@_;
|
||||
|
||||
#-- get the interface
|
||||
$owx_interface = $hash->{INTERFACE};
|
||||
$owx_hwdevice = $hash->{HWDEVICE};
|
||||
|
||||
#-- here we treat the directly connected serial interfaces
|
||||
if( ($owx_interface eq "DS2480") || ($owx_interface eq "DS9097") ){
|
||||
return OWX_Complex_SER($hash,$owx_dev,$data,$numread);
|
||||
@ -340,30 +342,36 @@ sub OWX_Define ($$) {
|
||||
if ( $dev =~ m/.*USB.*/){
|
||||
#-- Second step in case of serial device: open the serial device to test it
|
||||
my $msg = "OWX: Serial device $dev";
|
||||
$owx_serport = new Device::SerialPort ($dev);
|
||||
if($owx_serport){
|
||||
$owx_hwdevice = new Device::SerialPort ($dev);
|
||||
if($owx_hwdevice){
|
||||
Log 1,$msg." defined";
|
||||
}else{
|
||||
Log 1, $msg." not defined";
|
||||
return "OWX: Can't open serial device $dev: $!"
|
||||
}
|
||||
$owx_serport->reset_error();
|
||||
$owx_serport->baudrate(9600);
|
||||
$owx_serport->databits(8);
|
||||
$owx_serport->parity('none');
|
||||
$owx_serport->stopbits(1);
|
||||
$owx_serport->handshake('none');
|
||||
$owx_serport->write_settings;
|
||||
$owx_hwdevice->reset_error();
|
||||
$owx_hwdevice->baudrate(9600);
|
||||
$owx_hwdevice->databits(8);
|
||||
$owx_hwdevice->parity('none');
|
||||
$owx_hwdevice->stopbits(1);
|
||||
$owx_hwdevice->handshake('none');
|
||||
$owx_hwdevice->write_settings;
|
||||
#-- store with OWX device
|
||||
$hash->{INTERFACE} = "serial";
|
||||
$hash->{HWDEVICE} = $owx_hwdevice;
|
||||
#-- sleeping for some time
|
||||
select(undef,undef,undef,0.1);
|
||||
} else {
|
||||
#-- Second step in case of CUNO: See if we can open it
|
||||
my $msg = "OWX: CUNO device $dev";
|
||||
$owx_cuno = $main::defs{$dev};
|
||||
if($owx_cuno){
|
||||
$owx_hwdevice = $main::defs{$dev};
|
||||
if($owx_hwdevice){
|
||||
Log 1,$msg." defined";
|
||||
#-- store with OWX device
|
||||
$hash->{INTERFACE} = "CUNO";
|
||||
$hash->{HWDEVICE} = $owx_hwdevice;
|
||||
#-- reset the 1-Wire system in CUNO
|
||||
CUL_SimpleWrite($owx_cuno, "Oi");
|
||||
CUL_SimpleWrite($owx_hwdevice, "Oi");
|
||||
}else{
|
||||
Log 1, $msg." not defined";
|
||||
return "OWX: Can't open cuno device $dev: $!"
|
||||
@ -390,7 +398,6 @@ sub OWX_Define ($$) {
|
||||
my $oid = $init_done;
|
||||
$hash->{PRESENT} = 1;
|
||||
$hash->{STATE} = "Initialized";
|
||||
$hash->{INTERFACE} = $owx_interface;
|
||||
$init_done = 1;
|
||||
|
||||
#-- Intiate first alarm detection and eventually conversion in a minute or so
|
||||
@ -423,8 +430,12 @@ sub OWX_Detect ($) {
|
||||
|
||||
my ($i,$j,$k,$l,$res,$ret,$ress);
|
||||
|
||||
#-- get the interface
|
||||
$owx_interface = $hash->{INTERFACE};
|
||||
$owx_hwdevice = $hash->{HWDEVICE};
|
||||
|
||||
#-- here we treat the directly connected serial interfaces
|
||||
if($owx_serport){
|
||||
if($owx_interface eq "serial"){
|
||||
#-- timing byte for DS2480
|
||||
OWX_Query_2480($hash,"\xC1");
|
||||
|
||||
@ -462,29 +473,31 @@ sub OWX_Detect ($) {
|
||||
select(undef,undef,undef,0.5);
|
||||
}
|
||||
if( $ret == 0 ){
|
||||
$owx_interface=undef;
|
||||
$ress = "OWX: No 1-Wire bus interface detected, answer was ";
|
||||
for($i=0;$i<length($res);$i++){
|
||||
$j=int(ord(substr($res,$i,1))/16);
|
||||
$k=ord(substr($res,$i,1))%16;
|
||||
$ress.=sprintf "0x%1x%1x ",$j,$k;
|
||||
}
|
||||
Log 1, $ress;
|
||||
return $ret;
|
||||
}
|
||||
#-- here we treat the network-connected CUNO
|
||||
} else {
|
||||
Log 1,"ORM";
|
||||
CUL_SimpleWrite($owx_cuno, "ORm");
|
||||
my $ob = DevIo_SimpleRead($owx_cuno);
|
||||
CUL_SimpleWrite($owx_hwdevice, "ORm");
|
||||
my $ob = DevIo_SimpleRead($owx_hwdevice);
|
||||
if( $ob =~ m/OK.*/){
|
||||
Log 1, "OWX: 1-Wire bus interface DS2482 detected in $owx_cuno->{NAME}";
|
||||
$owx_interface="CUNO";
|
||||
$ress="OWX: 1-Wire bus interface DS2482 detected in $owx_hwdevice->{NAME}";
|
||||
$ret=1;
|
||||
} else {
|
||||
Log 1, "OWX: 1-Wire bus interface in $owx_cuno->{NAME} could not be addressed";
|
||||
$owx_interface=undef;
|
||||
$ress="OWX: 1-Wire bus interface in $owx_hwdevice->{NAME} could not be addressed";
|
||||
$ret=0;
|
||||
}
|
||||
}
|
||||
#-- store with OWX device
|
||||
$hash->{INTERFACE} = $owx_interface;
|
||||
Log 1, $ress;
|
||||
return $ret;
|
||||
}
|
||||
|
||||
@ -504,22 +517,26 @@ sub OWX_Discover ($) {
|
||||
my ($hash) = @_;
|
||||
my $res;
|
||||
|
||||
#-- get the interface
|
||||
$owx_interface = $hash->{INTERFACE};
|
||||
$owx_hwdevice = $hash->{HWDEVICE};
|
||||
|
||||
#-- Discover all devices on the 1-Wire bus
|
||||
@owx_devs=();
|
||||
my @owx_names=();
|
||||
#-- directly connected interface
|
||||
if( $owx_serport ){
|
||||
if( $owx_interface =~ m/DS.*/ ){
|
||||
$res = OWX_First_SER($hash,"discover");
|
||||
while( $owx_LastDeviceFlag==0 && $res!=0 ){
|
||||
$res = $res & OWX_Next_SER($hash,"discover");
|
||||
}
|
||||
#-- Ask the cuno
|
||||
}else {
|
||||
CUL_SimpleWrite($owx_cuno, "OCf");
|
||||
CUL_SimpleWrite($owx_hwdevice, "OCf");
|
||||
#-- sleeping for some time
|
||||
select(undef,undef,undef,3);
|
||||
CUL_SimpleWrite($owx_cuno, "Oc");
|
||||
my $ob = DevIo_SimpleRead($owx_cuno);
|
||||
CUL_SimpleWrite($owx_hwdevice, "Oc");
|
||||
my $ob = DevIo_SimpleRead($owx_hwdevice);
|
||||
if( $ob ){
|
||||
foreach my $dx (split(/\n/,$ob)){
|
||||
$dx =~ s/\d+\://;
|
||||
@ -533,9 +550,9 @@ sub OWX_Discover ($) {
|
||||
}
|
||||
}
|
||||
}
|
||||
#-- Check, which of these is already defined in the cfg file
|
||||
#-- Go through all devices found on this bus
|
||||
foreach my $owx_dev (@owx_devs) {
|
||||
#-- two pieces of the ROM ID found on the bus
|
||||
#-- three pieces of the ROM ID found on the bus
|
||||
my $owx_rnf = substr($owx_dev,3,12);
|
||||
my $owx_f = substr($owx_dev,0,2);
|
||||
my $owx_crc = substr($owx_dev,15,3);
|
||||
@ -552,7 +569,7 @@ sub OWX_Discover ($) {
|
||||
my $id_fhem = substr($main::defs{$fhem_dev}{ROM_ID},0,15);
|
||||
#-- skip interface device
|
||||
next if( length($id_fhem) != 15 );
|
||||
#-- testing if present in defined devices
|
||||
#-- testing if equal to the one found here
|
||||
# even with improper family
|
||||
# Log 1, " FHEM-Device = ".substr($id_fhem,3,12)." OWX discovered device ".substr($id_owx,3,12);
|
||||
if( substr($id_fhem,3,12) eq substr($id_owx,3,12) ) {
|
||||
@ -604,7 +621,7 @@ sub OWX_Discover ($) {
|
||||
#-- yes, it is on the bus and therefore present
|
||||
push(@owx_names,$name);
|
||||
$main::defs{$name}{PRESENT}=1;
|
||||
#-- default room
|
||||
#-- THIS IODev, default room
|
||||
CommandAttr (undef,"$name IODev $hash->{NAME}");
|
||||
CommandAttr (undef,"$name room OWX");
|
||||
#-- replace the ROM ID by the proper value
|
||||
@ -612,8 +629,7 @@ sub OWX_Discover ($) {
|
||||
}
|
||||
}
|
||||
|
||||
#-- final step: Undefine all 1-Wire devices which are not on the bus
|
||||
# TODO: IF WE HAVE MULTIPLE IO Devices ???
|
||||
#-- final step: Undefine all 1-Wire devices which are not on this bus but have this IODev
|
||||
foreach my $fhem_dev (sort keys %main::defs) {
|
||||
#-- skip if malformed device
|
||||
#next if( !defined($main::defs{$fhem_dev}{NAME}) );
|
||||
@ -621,6 +637,8 @@ sub OWX_Discover ($) {
|
||||
next if( substr($main::defs{$fhem_dev}{TYPE},0,2) ne "OW");
|
||||
#-- skip if the device is present.
|
||||
next if( $main::defs{$fhem_dev}{PRESENT} == 1);
|
||||
#-- skip if different IODev
|
||||
next if( $main::defs{$fhem_dev}{IODev}{NAME} ne $hash->{NAME} );
|
||||
Log 1, "OWX: Deleting unused 1-Wire device $main::defs{$fhem_dev}{NAME} of type $main::defs{$fhem_dev}{TYPE}";
|
||||
CommandDelete(undef,$main::defs{$fhem_dev}{NAME});
|
||||
}
|
||||
@ -707,6 +725,10 @@ sub OWX_Kick($) {
|
||||
sub OWX_Reset ($) {
|
||||
my ($hash)=@_;
|
||||
|
||||
#-- get the interface
|
||||
$owx_interface = $hash->{INTERFACE};
|
||||
$owx_hwdevice = $hash->{HWDEVICE};
|
||||
|
||||
if( $owx_interface eq "DS2480" ){
|
||||
return OWX_Reset_2480($hash);
|
||||
}elsif( $owx_interface eq "DS9097" ){
|
||||
@ -799,6 +821,11 @@ sub OWX_Undef ($$) {
|
||||
sub OWX_Verify ($$) {
|
||||
my ($hash,$dev) = @_;
|
||||
my $i;
|
||||
|
||||
#-- get the interface
|
||||
$owx_interface = $hash->{INTERFACE};
|
||||
$owx_hwdevice = $hash->{HWDEVICE};
|
||||
|
||||
#-- directly connected interface
|
||||
if( ($owx_interface eq "DS2480") || ($owx_interface eq "DS9097") ){
|
||||
return OWX_Verify_SER($hash,$dev)
|
||||
@ -1185,8 +1212,8 @@ sub OWX_Query_2480 ($$) {
|
||||
my ($i,$j,$k);
|
||||
my $dev = $hash->{DeviceName};
|
||||
|
||||
$owx_serport->baudrate($owx_baud);
|
||||
$owx_serport->write_settings;
|
||||
$owx_hwdevice->baudrate($owx_baud);
|
||||
$owx_hwdevice->write_settings;
|
||||
|
||||
if( $owx_debug > 2){
|
||||
my $res = "OWX: Sending out ";
|
||||
@ -1198,14 +1225,14 @@ sub OWX_Query_2480 ($$) {
|
||||
Log 3, $res;
|
||||
}
|
||||
|
||||
my $count_out = $owx_serport->write($cmd);
|
||||
my $count_out = $owx_hwdevice->write($cmd);
|
||||
|
||||
Log 1, "OWX: Write incomplete $count_out ne ".(length($cmd))."" if ( $count_out != length($cmd) );
|
||||
#-- sleeping for some time
|
||||
select(undef,undef,undef,0.04);
|
||||
|
||||
#-- read the data
|
||||
my ($count_in, $string_in) = $owx_serport->read(48);
|
||||
my ($count_in, $string_in) = $owx_hwdevice->read(48);
|
||||
|
||||
if( $owx_debug > 2){
|
||||
my $res = "OWX: Receiving ";
|
||||
@ -1220,7 +1247,7 @@ sub OWX_Query_2480 ($$) {
|
||||
#-- sleeping for some time
|
||||
select(undef,undef,undef,0.04);
|
||||
|
||||
#$owx_serport->close();
|
||||
#$owx_hwdevice->close();
|
||||
return($string_in);
|
||||
}
|
||||
|
||||
@ -1468,8 +1495,8 @@ sub OWX_Query_9097 ($$) {
|
||||
my ($i,$j,$k);
|
||||
my $dev = $hash->{DeviceName};
|
||||
|
||||
$owx_serport->baudrate($owx_baud);
|
||||
$owx_serport->write_settings;
|
||||
$owx_hwdevice->baudrate($owx_baud);
|
||||
$owx_hwdevice->write_settings;
|
||||
|
||||
if( $owx_debug > 2){
|
||||
my $res = "OWX: Sending out ";
|
||||
@ -1481,14 +1508,14 @@ sub OWX_Query_9097 ($$) {
|
||||
Log 3, $res;
|
||||
}
|
||||
|
||||
my $count_out = $owx_serport->write($cmd);
|
||||
my $count_out = $owx_hwdevice->write($cmd);
|
||||
|
||||
Log 1, "OWX: Write incomplete $count_out ne ".(length($cmd))."" if ( $count_out != length($cmd) );
|
||||
#-- sleeping for some time
|
||||
select(undef,undef,undef,0.01);
|
||||
|
||||
#-- read the data
|
||||
my ($count_in, $string_in) = $owx_serport->read(48);
|
||||
my ($count_in, $string_in) = $owx_hwdevice->read(48);
|
||||
|
||||
if( $owx_debug > 2){
|
||||
my $res = "OWX: Receiving ";
|
||||
@ -1503,7 +1530,7 @@ sub OWX_Query_9097 ($$) {
|
||||
#-- sleeping for some time
|
||||
select(undef,undef,undef,0.01);
|
||||
|
||||
#$owx_serport->close();
|
||||
#$owx_hwdevice->close();
|
||||
return($string_in);
|
||||
}
|
||||
|
||||
@ -1800,8 +1827,8 @@ sub OWX_Complex_CUNO ($$$$) {
|
||||
$select=sprintf("Om%s%s%s%s%s%s%s%s",@owx_ROM_ID);
|
||||
Log 3,"OWX: Sending match ROM to CUNO ".$select
|
||||
if( $owx_debug > 1);
|
||||
CUL_SimpleWrite($owx_cuno, $select);
|
||||
my $ob = DevIo_SimpleRead($owx_cuno);
|
||||
CUL_SimpleWrite($owx_hwdevice, $select);
|
||||
my $ob = DevIo_SimpleRead($owx_hwdevice);
|
||||
#-- padding first 9 bytes into result string, since we have this
|
||||
# in the serial interfaces as well
|
||||
$res .= "000000000";
|
||||
@ -1836,8 +1863,8 @@ sub OWX_Receive_CUNO ($$) {
|
||||
|
||||
for(
|
||||
my $i=0;$i<$numread;$i++){
|
||||
CUL_SimpleWrite($owx_cuno, "OrB");
|
||||
my $ob = DevIo_SimpleRead($owx_cuno);
|
||||
CUL_SimpleWrite($owx_hwdevice, "OrB");
|
||||
my $ob = DevIo_SimpleRead($owx_hwdevice);
|
||||
#-- process results
|
||||
if( !(defined($ob)) ){
|
||||
return "";
|
||||
@ -1870,8 +1897,8 @@ sub OWX_Receive_CUNO ($$) {
|
||||
########################################################################################
|
||||
|
||||
sub OWX_Reset_CUNO ($) {
|
||||
CUL_SimpleWrite($owx_cuno, "ORb");
|
||||
my $ob = DevIo_SimpleRead($owx_cuno);
|
||||
CUL_SimpleWrite($owx_hwdevice, "ORb");
|
||||
my $ob = DevIo_SimpleRead($owx_hwdevice);
|
||||
if( substr($ob,0,4) eq "OK:1" ){
|
||||
return 1;
|
||||
}else{
|
||||
@ -1901,7 +1928,7 @@ sub OWX_Send_CUNO ($$) {
|
||||
$k=ord(substr($data,$i,1))%16;
|
||||
$res =sprintf "OwB%1x%1x ",$j,$k;
|
||||
$res2.=sprintf "0x%1x%1x ",$j,$k;
|
||||
CUL_SimpleWrite($owx_cuno, $res);
|
||||
CUL_SimpleWrite($owx_hwdevice, $res);
|
||||
}
|
||||
Log 3,"OWX: Send to CUNO $res2"
|
||||
if( $owx_debug > 1);
|
||||
@ -1923,11 +1950,11 @@ sub OWX_Verify_CUNO ($$) {
|
||||
my $i;
|
||||
|
||||
#-- Ask the cuno
|
||||
CUL_SimpleWrite($owx_cuno, "OCf");
|
||||
CUL_SimpleWrite($owx_hwdevice, "OCf");
|
||||
#-- sleeping for some time
|
||||
select(undef,undef,undef,3);
|
||||
CUL_SimpleWrite($owx_cuno, "Oc");
|
||||
my $ob = DevIo_SimpleRead($owx_cuno);
|
||||
CUL_SimpleWrite($owx_hwdevice, "Oc");
|
||||
my $ob = DevIo_SimpleRead($owx_hwdevice);
|
||||
if( $ob ){
|
||||
foreach my $dx (split(/\n/,$ob)){
|
||||
$dx =~ s/\d+\://;
|
||||
|
171
fhem/contrib/1-Wire/21_OWTEMP.pm → fhem/contrib/1-Wire/21_OWTHERM.pm
Normal file → Executable file
171
fhem/contrib/1-Wire/21_OWTEMP.pm → fhem/contrib/1-Wire/21_OWTHERM.pm
Normal file → Executable file
@ -1,6 +1,6 @@
|
||||
########################################################################################
|
||||
#
|
||||
# OWTEMP.pm
|
||||
# OWTHERM.pm
|
||||
#
|
||||
# FHEM module to commmunicate with 1-Wire temperature sensors DS1820, DS18S20, DS18B20, DS1822
|
||||
#
|
||||
@ -19,7 +19,7 @@
|
||||
#
|
||||
# Setup bus device in fhem.cfg as
|
||||
#
|
||||
# define <name> OWTEMP [<model>] <ROM_ID> [interval]
|
||||
# define <name> OWTHERM [<model>] <ROM_ID> [interval]
|
||||
#
|
||||
# where <name> may be replaced by any name string
|
||||
#
|
||||
@ -109,23 +109,23 @@ my %updates = (
|
||||
#
|
||||
# The following subroutines are independent of the bus interface
|
||||
#
|
||||
# Prefix = OWTEMP
|
||||
# Prefix = OWTHERM
|
||||
#
|
||||
########################################################################################
|
||||
#
|
||||
# OWTEMP_Initialize
|
||||
# OWTHERM_Initialize
|
||||
#
|
||||
# Parameter hash = hash of device addressed
|
||||
#
|
||||
########################################################################################
|
||||
|
||||
sub OWTEMP_Initialize ($) {
|
||||
sub OWTHERM_Initialize ($) {
|
||||
my ($hash) = @_;
|
||||
|
||||
$hash->{DefFn} = "OWTEMP_Define";
|
||||
$hash->{UndefFn} = "OWTEMP_Undef";
|
||||
$hash->{GetFn} = "OWTEMP_Get";
|
||||
$hash->{SetFn} = "OWTEMP_Set";
|
||||
$hash->{DefFn} = "OWTHERM_Define";
|
||||
$hash->{UndefFn} = "OWTHERM_Undef";
|
||||
$hash->{GetFn} = "OWTHERM_Get";
|
||||
$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 ".
|
||||
@ -136,17 +136,17 @@ sub OWTEMP_Initialize ($) {
|
||||
|
||||
########################################################################################
|
||||
#
|
||||
# OWTEMP_Define - Implements DefFn function
|
||||
# OWTHERM_Define - Implements DefFn function
|
||||
#
|
||||
# Parameter hash = hash of device addressed, def = definition string
|
||||
#
|
||||
########################################################################################
|
||||
|
||||
sub OWTEMP_Define ($$) {
|
||||
sub OWTHERM_Define ($$) {
|
||||
my ($hash, $def) = @_;
|
||||
|
||||
# define <name> OWTEMP [<model>] <id> [interval]
|
||||
# e.g.: define flow OWTEMP 525715020000 300
|
||||
# define <name> OWTHERM [<model>] <id> [interval]
|
||||
# e.g.: define flow OWTHERM 525715020000 300
|
||||
my @a = split("[ \t][ \t]*", $def);
|
||||
|
||||
my ($name,$model,$fam,$id,$crc,$interval,$ret);
|
||||
@ -158,28 +158,28 @@ sub OWTEMP_Define ($$) {
|
||||
$ret = "";
|
||||
|
||||
#-- check syntax
|
||||
return "OWTEMP: Wrong syntax, must be define <name> OWTEMP [<model>] <id> [interval]"
|
||||
return "OWTHERM: Wrong syntax, must be define <name> OWTHERM [<model>] <id> [interval]"
|
||||
if(int(@a) < 2 || int(@a) > 6);
|
||||
|
||||
#-- check if this is an old style definition, e.g. <model> is missing
|
||||
my $a2 = $a[2];
|
||||
my $a3 = defined($a[3]) ? $a[3] : "";
|
||||
if( ($a2 eq "none") || ($a3 eq "none") ) {
|
||||
return "OWTEMP: ID = none is obsolete now, please redefine";
|
||||
return "OWTHERM: ID = none is obsolete now, please redefine";
|
||||
} elsif( $a2 =~ m/^[0-9|a-f|A-F]{12}$/ ) {
|
||||
$model = "DS1820";
|
||||
$id = $a[2];
|
||||
if(int(@a)>=4) { $interval = $a[3]; }
|
||||
Log 1, "OWTEMP: Parameter [alarminterval] is obsolete now - must be set with I/O-Device"
|
||||
Log 1, "OWTHERM: Parameter [alarminterval] is obsolete now - must be set with I/O-Device"
|
||||
if(int(@a) == 5);
|
||||
} elsif( $a3 =~ m/^[0-9|a-f|A-F]{12}$/ ) {
|
||||
$model = $a[2];
|
||||
$id = $a[3];
|
||||
if(int(@a)>=5) { $interval = $a[4]; }
|
||||
Log 1, "OWTEMP: Parameter [alarminterval] is obsolete now - must be set with I/O-Device"
|
||||
Log 1, "OWTHERM: Parameter [alarminterval] is obsolete now - must be set with I/O-Device"
|
||||
if(int(@a) == 6);
|
||||
} else {
|
||||
return "OWTEMP: $a[0] ID $a[2] invalid, specify a 12 digit value";
|
||||
return "OWTHERM: $a[0] ID $a[2] invalid, specify a 12 digit value";
|
||||
}
|
||||
|
||||
#-- 1-Wire ROM identifier in the form "FF.XXXXXXXXXXXX.YY"
|
||||
@ -192,7 +192,7 @@ sub OWTEMP_Define ($$) {
|
||||
}elsif( $model eq "DS18B20" ){
|
||||
$fam = "28";
|
||||
}else{
|
||||
return "OWTEMP: Wrong 1-Wire device model $model";
|
||||
return "OWTHERM: 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";
|
||||
@ -207,30 +207,30 @@ sub OWTEMP_Define ($$) {
|
||||
|
||||
#-- Couple to I/O device
|
||||
AssignIoPort($hash);
|
||||
Log 3, "OWTEMP: Warning, no 1-Wire I/O device found for $name."
|
||||
Log 3, "OWTHERM: Warning, no 1-Wire I/O device found for $name."
|
||||
if(!defined($hash->{IODev}->{NAME}));
|
||||
$modules{OWTEMP}{defptr}{$id} = $hash;
|
||||
$modules{OWTHERM}{defptr}{$id} = $hash;
|
||||
$hash->{STATE} = "Defined";
|
||||
Log 3, "OWTEMP: Device $name defined.";
|
||||
Log 3, "OWTHERM: Device $name defined.";
|
||||
|
||||
#-- Start timer for initialization in a few seconds
|
||||
InternalTimer(time()+1, "OWTEMP_InitializeDevice", $hash, 0);
|
||||
InternalTimer(time()+1, "OWTHERM_InitializeDevice", $hash, 0);
|
||||
|
||||
#-- Start timer for updates
|
||||
InternalTimer(time()+$hash->{INTERVAL}, "OWTEMP_GetValues", $hash, 0);
|
||||
InternalTimer(time()+$hash->{INTERVAL}, "OWTHERM_GetValues", $hash, 0);
|
||||
|
||||
return undef;
|
||||
}
|
||||
|
||||
########################################################################################
|
||||
#
|
||||
# OWTEMP_InitializeDevice - delayed setting of initial readings and channel names
|
||||
# OWTHERM_InitializeDevice - delayed setting of initial readings and channel names
|
||||
#
|
||||
# Parameter hash = hash of device addressed
|
||||
#
|
||||
########################################################################################
|
||||
|
||||
sub OWTEMP_InitializeDevice($) {
|
||||
sub OWTHERM_InitializeDevice($) {
|
||||
my ($hash) = @_;
|
||||
|
||||
my $name = $hash->{NAME};
|
||||
@ -248,18 +248,18 @@ sub OWTEMP_InitializeDevice($) {
|
||||
$owg_th = 70.0;
|
||||
|
||||
#-- Initialize all the display stuff
|
||||
OWTEMP_FormatValues($hash);
|
||||
OWTHERM_FormatValues($hash);
|
||||
}
|
||||
|
||||
########################################################################################
|
||||
#
|
||||
# OWTEMP_FormatValues - put together various format strings
|
||||
# OWTHERM_FormatValues - put together various format strings
|
||||
#
|
||||
# Parameter hash = hash of device addressed, fs = format string
|
||||
#
|
||||
########################################################################################
|
||||
|
||||
sub OWTEMP_FormatValues($) {
|
||||
sub OWTHERM_FormatValues($) {
|
||||
my ($hash) = @_;
|
||||
|
||||
my $name = $hash->{NAME};
|
||||
@ -286,7 +286,7 @@ sub OWTEMP_FormatValues($) {
|
||||
$factor = 1.8;
|
||||
} else {
|
||||
$abbr="?";
|
||||
Log 1, "OWTEMP_FormatValues: unknown unit $unit";
|
||||
Log 1, "OWTHERM_FormatValues: unknown unit $unit";
|
||||
}
|
||||
#-- these values are rather coplex to obtain, therefore save them in the hash
|
||||
$hash->{READINGS}{"temperature"}{UNIT} = $unit;
|
||||
@ -341,13 +341,13 @@ sub OWTEMP_FormatValues($) {
|
||||
|
||||
########################################################################################
|
||||
#
|
||||
# OWTEMP_Get - Implements GetFn function
|
||||
# OWTHERM_Get - Implements GetFn function
|
||||
#
|
||||
# Parameter hash = hash of device addressed, a = argument array
|
||||
#
|
||||
########################################################################################
|
||||
|
||||
sub OWTEMP_Get($@) {
|
||||
sub OWTHERM_Get($@) {
|
||||
my ($hash, @a) = @_;
|
||||
|
||||
my $reading = $a[1];
|
||||
@ -357,11 +357,11 @@ sub OWTEMP_Get($@) {
|
||||
my $ret = "";
|
||||
|
||||
#-- check syntax
|
||||
return "OWTEMP: Get argument is missing @a"
|
||||
return "OWTHERM: Get argument is missing @a"
|
||||
if(int(@a) != 2);
|
||||
|
||||
#-- check argument
|
||||
return "OWTEMP: Get with unknown argument $a[1], choose one of ".join(",", sort keys %gets)
|
||||
return "OWTHERM: Get with unknown argument $a[1], choose one of ".join(",", sort keys %gets)
|
||||
if(!defined($gets{$a[1]}));
|
||||
|
||||
#-- get id
|
||||
@ -383,7 +383,7 @@ sub OWTEMP_Get($@) {
|
||||
$hash->{PRESENT} = $value;
|
||||
return "$a[0] $reading => $value";
|
||||
} else {
|
||||
return "OWTEMP: Verification not yet implemented for interface $interface";
|
||||
return "OWTHERM: Verification not yet implemented for interface $interface";
|
||||
}
|
||||
}
|
||||
|
||||
@ -399,28 +399,28 @@ sub OWTEMP_Get($@) {
|
||||
#-- OWX interface
|
||||
if( $interface eq "OWX" ){
|
||||
#-- not different from getting all values ..
|
||||
$ret = OWXTEMP_GetValues($hash);
|
||||
$ret = OWXTHERM_GetValues($hash);
|
||||
#-- OWFS interface
|
||||
}elsif( $interface eq "OWFS" ){
|
||||
$ret = OWFSTEMP_GetValues($hash);
|
||||
$ret = OWFSTHERM_GetValues($hash);
|
||||
#-- Unknown interface
|
||||
}else{
|
||||
return "OWTEMP: Get with wrong IODev type $interface";
|
||||
return "OWTHERM: Get with wrong IODev type $interface";
|
||||
}
|
||||
|
||||
#-- process results
|
||||
if( defined($ret) ){
|
||||
return "OWTEMP: Could not get values from device $name, return was $ret";
|
||||
return "OWTHERM: Could not get values from device $name, return was $ret";
|
||||
}
|
||||
$hash->{PRESENT} = 1;
|
||||
OWTEMP_FormatValues($hash);
|
||||
OWTHERM_FormatValues($hash);
|
||||
|
||||
#-- return the special reading
|
||||
if ($reading eq "temperature") {
|
||||
return "OWTEMP: $name.temperature => ".
|
||||
return "OWTHERM: $name.temperature => ".
|
||||
$hash->{READINGS}{"temperature"}{VAL};
|
||||
} elsif ($reading eq "alarm") {
|
||||
return "OWTEMP: $name.alarm => L ".$hash->{READINGS}{"tempLow"}{VAL}.
|
||||
return "OWTHERM: $name.alarm => L ".$hash->{READINGS}{"tempLow"}{VAL}.
|
||||
" H ".$hash->{READINGS}{"tempHigh"}{VAL};
|
||||
}
|
||||
return undef;
|
||||
@ -428,13 +428,13 @@ sub OWTEMP_Get($@) {
|
||||
|
||||
#######################################################################################
|
||||
#
|
||||
# OWTEMP_GetValues - Updates the readings from device
|
||||
# OWTHERM_GetValues - Updates the readings from device
|
||||
#
|
||||
# Parameter hash = hash of device addressed
|
||||
#
|
||||
########################################################################################
|
||||
|
||||
sub OWTEMP_GetValues($@) {
|
||||
sub OWTHERM_GetValues($@) {
|
||||
my $hash = shift;
|
||||
|
||||
my $name = $hash->{NAME};
|
||||
@ -443,7 +443,7 @@ sub OWTEMP_GetValues($@) {
|
||||
|
||||
#-- restart timer for updates
|
||||
RemoveInternalTimer($hash);
|
||||
InternalTimer(time()+$hash->{INTERVAL}, "OWTEMP_GetValues", $hash, 1);
|
||||
InternalTimer(time()+$hash->{INTERVAL}, "OWTHERM_GetValues", $hash, 1);
|
||||
|
||||
#-- reset presence
|
||||
$hash->{PRESENT} = 0;
|
||||
@ -451,19 +451,19 @@ sub OWTEMP_GetValues($@) {
|
||||
#-- Get values according to interface type
|
||||
my $interface= $hash->{IODev}->{TYPE};
|
||||
if( $interface eq "OWX" ){
|
||||
$ret = OWXTEMP_GetValues($hash);
|
||||
$ret = OWXTHERM_GetValues($hash);
|
||||
}elsif( $interface eq "OWFS" ){
|
||||
$ret = OWFSTEMP_GetValues($hash);
|
||||
$ret = OWFSTHERM_GetValues($hash);
|
||||
}else{
|
||||
return "OWTEMP: GetValues with wrong IODev type $interface";
|
||||
return "OWTHERM: GetValues with wrong IODev type $interface";
|
||||
}
|
||||
|
||||
#-- process results
|
||||
if( defined($ret) ){
|
||||
return "OWTEMP: Could not get values from device $name";
|
||||
return "OWTHERM: Could not get values from device $name";
|
||||
}
|
||||
$hash->{PRESENT} = 1;
|
||||
$value=OWTEMP_FormatValues($hash);
|
||||
$value=OWTHERM_FormatValues($hash);
|
||||
#--logging
|
||||
Log 5, $value;
|
||||
$hash->{CHANGED}[0] = $value;
|
||||
@ -475,23 +475,23 @@ sub OWTEMP_GetValues($@) {
|
||||
|
||||
#######################################################################################
|
||||
#
|
||||
# OWTEMP_Set - Set one value for device
|
||||
# OWTHERM_Set - Set one value for device
|
||||
#
|
||||
# Parameter hash = hash of device addressed
|
||||
# a = argument string
|
||||
#
|
||||
########################################################################################
|
||||
|
||||
sub OWTEMP_Set($@) {
|
||||
sub OWTHERM_Set($@) {
|
||||
my ($hash, @a) = @_;
|
||||
|
||||
#-- for the selector: which values are possible
|
||||
return join(" ", sort keys %sets) if(@a == 2);
|
||||
#-- check syntax
|
||||
return "OWTEMP: Set needs one parameter"
|
||||
return "OWTHERM: Set needs one parameter"
|
||||
if(int(@a) != 3);
|
||||
#-- check argument
|
||||
return "OWTEMP: Set with unknown argument $a[1], choose one of ".join(",", sort keys %sets)
|
||||
return "OWTHERM: Set with unknown argument $a[1], choose one of ".join(",", sort keys %sets)
|
||||
if(!defined($sets{$a[1]}));
|
||||
|
||||
#-- define vars
|
||||
@ -504,12 +504,12 @@ sub OWTEMP_Set($@) {
|
||||
#-- set new timer interval
|
||||
if($key eq "interval") {
|
||||
# check value
|
||||
return "OWTEMP: Set with short interval, must be > 1"
|
||||
return "OWTHERM: Set with short interval, must be > 1"
|
||||
if(int($value) < 1);
|
||||
# update timer
|
||||
$hash->{INTERVAL} = $value;
|
||||
RemoveInternalTimer($hash);
|
||||
InternalTimer(gettimeofday()+$hash->{INTERVAL}, "OWTEMP_GetValues", $hash, 1);
|
||||
InternalTimer(gettimeofday()+$hash->{INTERVAL}, "OWTHERM_GetValues", $hash, 1);
|
||||
return undef;
|
||||
}
|
||||
|
||||
@ -521,7 +521,7 @@ sub OWTEMP_Set($@) {
|
||||
#-- find upper and lower boundaries for given offset/factor
|
||||
my $mmin = (-55+$offset)*$factor;
|
||||
my $mmax = (125+$offset)*$factor;
|
||||
return sprintf("OWTEMP: Set with wrong value $value for $key, range is [%3.1f,%3.1f]",$mmin,$mmax)
|
||||
return sprintf("OWTHERM: Set with wrong value $value for $key, range is [%3.1f,%3.1f]",$mmin,$mmax)
|
||||
if($value < $mmin || $value > $mmax);
|
||||
|
||||
#-- seems to be ok, put into the device
|
||||
@ -529,36 +529,37 @@ sub OWTEMP_Set($@) {
|
||||
|
||||
#-- OWX interface
|
||||
if( $interface eq "OWX" ){
|
||||
$ret = OWXTEMP_SetValues($hash,@a);
|
||||
return $ret
|
||||
if(defined($ret));
|
||||
$ret = OWXTHERM_SetValues($hash,@a);
|
||||
$ret = OWXTHERM_GetValues($hash);
|
||||
#-- OWFS interface
|
||||
}elsif( $interface eq "OWFS" ){
|
||||
$ret = OWFSTEMP_SetValues($hash,@a);
|
||||
$ret = OWFSTHERM_SetValues($hash,@a);
|
||||
$ret = OWFSTHERM_GetValues($hash);
|
||||
return $ret
|
||||
if(defined($ret));
|
||||
} else {
|
||||
return "OWTEMP: Set with wrong IODev type $interface";
|
||||
return "OWTHERM: Set with wrong IODev type $interface";
|
||||
}
|
||||
OWTEMP_FormatValues($hash);
|
||||
#-- careful: globals may come from a different device
|
||||
OWTHERM_FormatValues($hash);
|
||||
|
||||
Log 4, "OWTEMP: Set $hash->{NAME} $key $value";
|
||||
Log 4, "OWTHERM: Set $hash->{NAME} $key $value";
|
||||
|
||||
return undef;
|
||||
}
|
||||
|
||||
########################################################################################
|
||||
#
|
||||
# OWTEMP_Undef - Implements UndefFn function
|
||||
# OWTHERM_Undef - Implements UndefFn function
|
||||
#
|
||||
# Parameter hash = hash of device addressed
|
||||
#
|
||||
########################################################################################
|
||||
|
||||
sub OWTEMP_Undef ($) {
|
||||
sub OWTHERM_Undef ($) {
|
||||
my ($hash) = @_;
|
||||
|
||||
delete($modules{OWTEMP}{defptr}{$hash->{OW_ID}});
|
||||
delete($modules{OWTHERM}{defptr}{$hash->{OW_ID}});
|
||||
RemoveInternalTimer($hash);
|
||||
return undef;
|
||||
}
|
||||
@ -568,17 +569,17 @@ sub OWTEMP_Undef ($) {
|
||||
# The following subroutines in alphabetical order are only for a 1-Wire bus connected
|
||||
# via OWFS
|
||||
#
|
||||
# Prefix = OWFSTEMP
|
||||
# Prefix = OWFSTHERM
|
||||
#
|
||||
########################################################################################
|
||||
#
|
||||
# OWFSTEMP_GetValues - Get reading from one device
|
||||
# OWFSTHERM_GetValues - Get reading from one device
|
||||
#
|
||||
# Parameter hash = hash of device addressed
|
||||
#
|
||||
########################################################################################
|
||||
|
||||
sub OWFSTEMP_GetValues($)
|
||||
sub OWFSTHERM_GetValues($)
|
||||
{
|
||||
my ($hash) = @_;
|
||||
|
||||
@ -600,14 +601,14 @@ sub OWFSTEMP_GetValues($)
|
||||
|
||||
#######################################################################################
|
||||
#
|
||||
# OWFSTEMP_SetValues - Implements SetFn function
|
||||
# OWFSTHERM_SetValues - Implements SetFn function
|
||||
#
|
||||
# Parameter hash = hash of device addressed
|
||||
# a = argument array
|
||||
#
|
||||
########################################################################################
|
||||
|
||||
sub OWFSTEMP_SetValues($@) {
|
||||
sub OWFSTHERM_SetValues($@) {
|
||||
my ($hash, @a) = @_;
|
||||
|
||||
#-- define vars
|
||||
@ -622,17 +623,17 @@ sub OWFSTEMP_SetValues($@) {
|
||||
# The following subroutines in alphabetical order are only for a 1-Wire bus connected
|
||||
# directly to the FHEM server
|
||||
#
|
||||
# Prefix = OWXTEMP
|
||||
# Prefix = OWXTHERM
|
||||
#
|
||||
########################################################################################
|
||||
#
|
||||
# OWXTEMP_GetValues - Get reading from one device
|
||||
# OWXTHERM_GetValues - Get reading from one device
|
||||
#
|
||||
# Parameter hash = hash of device addressed
|
||||
#
|
||||
########################################################################################
|
||||
|
||||
sub OWXTEMP_GetValues($) {
|
||||
sub OWXTHERM_GetValues($) {
|
||||
|
||||
my ($hash) = @_;
|
||||
|
||||
@ -657,7 +658,7 @@ sub OWXTEMP_GetValues($) {
|
||||
OWX_Reset($master);
|
||||
#-- issue the match ROM command \x55 and the start conversion command
|
||||
if( OWX_Complex($master,$owx_dev,"\x44",0) eq 0 ){
|
||||
return "OWXTEMP: Device $owx_dev not accessible";
|
||||
return "OWXTHERM: Device $owx_dev not accessible";
|
||||
}
|
||||
#-- conversion needs some 950 ms - but we may also do it in shorter time !
|
||||
select(undef,undef,undef,1.0);
|
||||
@ -668,13 +669,13 @@ sub OWXTEMP_GetValues($) {
|
||||
#-- issue the match ROM command \x55 and the read scratchpad command \xBE
|
||||
#-- reading 9 + 1 + 8 data bytes and 1 CRC byte = 19 bytes
|
||||
my $res=OWX_Complex($master,$owx_dev,"\xBE",9);
|
||||
#Log 1,"OWXTEMP: data length from reading device is ".length($res)." bytes";
|
||||
#Log 1,"OWXTHERM: data length from reading device is ".length($res)." bytes";
|
||||
#-- process results
|
||||
if( $res eq 0 ){
|
||||
return "OWXTEMP: Device $owx_dev not accessible in 2nd step";
|
||||
return "OWXTHERM: Device $owx_dev not accessible in 2nd step";
|
||||
}
|
||||
|
||||
#my $res2 = "====> OWXTEMP Received ";
|
||||
#my $res2 = "====> OWXTHERM Received ";
|
||||
#for(my $i=0;$i<19;$i++){
|
||||
# my $j=int(ord(substr($res,$i,1))/16);
|
||||
# my $k=ord(substr($res,$i,1))%16;
|
||||
@ -711,7 +712,7 @@ sub OWXTEMP_GetValues($) {
|
||||
$owg_tl = ord($data[13]) > 127 ? 128-ord($data[13]) : ord($data[13]);
|
||||
return undef;
|
||||
} else {
|
||||
return "OWXTEMP: Device $owx_dev returns invalid data";
|
||||
return "OWXTHERM: Device $owx_dev returns invalid data";
|
||||
}
|
||||
} elsif ( ($hash->{OW_FAMILY} eq "22") || ($hash->{OW_FAMILY} eq "28") ) {
|
||||
if ( (@data == 19) && (ord($data[17])>0) ){
|
||||
@ -734,23 +735,23 @@ sub OWXTEMP_GetValues($) {
|
||||
$owg_tl = ord($data[13]) > 127 ? 128-ord($data[13]) : ord($data[13]);
|
||||
return undef;
|
||||
} else {
|
||||
return "OWXTEMP: Device $owx_dev returns invalid data";
|
||||
return "OWXTHERM: Device $owx_dev returns invalid data";
|
||||
}
|
||||
} else {
|
||||
return "OWXTEMP: Unknown device family $hash->{OW_FAMILY}\n";
|
||||
return "OWXTHERM: Unknown device family $hash->{OW_FAMILY}\n";
|
||||
}
|
||||
}
|
||||
|
||||
#######################################################################################
|
||||
#
|
||||
# OWXTEMP_SetValues - Implements SetFn function
|
||||
# OWXTHERM_SetValues - Implements SetFn function
|
||||
#
|
||||
# Parameter hash = hash of device addressed
|
||||
# a = argument array
|
||||
#
|
||||
########################################################################################
|
||||
|
||||
sub OWXTEMP_SetValues($@) {
|
||||
sub OWXTHERM_SetValues($@) {
|
||||
my ($hash, @a) = @_;
|
||||
|
||||
my ($i,$j,$k);
|
||||
@ -785,7 +786,7 @@ sub OWXTEMP_SetValues($@) {
|
||||
my $res=OWX_Complex($master,$owx_dev,$select,0);
|
||||
|
||||
if( $res eq 0 ){
|
||||
return "OWXTEMP: Device $owx_dev not accessible";
|
||||
return "OWXTHERM: Device $owx_dev not accessible";
|
||||
}
|
||||
|
||||
DoTrigger($name, undef) if($init_done);
|
@ -530,23 +530,23 @@
|
||||
</ul>
|
||||
</ul>
|
||||
<!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
|
||||
<a name="OWTEMP"></a>
|
||||
<h3>OWTEMP</h3>
|
||||
<a name="OWTHERM"></a>
|
||||
<h3>OWTHERM</h3>
|
||||
<ul>FHEM module to commmunicate with 1-Wire bus digital thermometer devices<br /><br />
|
||||
Note:<br /> This is the only 1-Wire module which so far works with both the OWFS and the
|
||||
OWX interface module. Please define an <a href="#OWFS">OWFS</a> device or an <a
|
||||
href="#OWX">OWX</a> device first. <br />
|
||||
<br /><b>Example</b><br />
|
||||
<ul>
|
||||
<code>define OWX_T OWTEMP DS18B20 E8D09B030000 300</code>
|
||||
<code>define OWX_T OWTHERM DS18B20 E8D09B030000 300</code>
|
||||
<br />
|
||||
<code>attr OWX_T tempUnit Kelvin</code>
|
||||
<br />
|
||||
</ul><br />
|
||||
<a name="OWTEMPdefine"></a>
|
||||
<a name="OWTHERMdefine"></a>
|
||||
<b>Define</b>
|
||||
<ul>
|
||||
<code>define <name> OWTEMP [<model>] <id>
|
||||
<code>define <name> OWTHERM [<model>] <id>
|
||||
[<interval>]</code>
|
||||
<br /><br /> Define a 1-Wire digital thermometer device.<br /><br />
|
||||
<li>
|
||||
@ -566,73 +566,73 @@
|
||||
<code><interval></code>
|
||||
<br /> Temperature measurement interval in seconds. The default is 300 seconds. </li>
|
||||
<br /> Example: <br />
|
||||
<code>define Temp1 OWTEMP 14B598010800 300 </code><br />
|
||||
<code>define Temp1 OWTHERM 14B598010800 300 </code><br />
|
||||
</ul>
|
||||
<br />
|
||||
<a name="OWTEMPset">
|
||||
<a name="OWTHERMset">
|
||||
<b>Set</b></a>
|
||||
<ul>
|
||||
<li><a name="owtemp_interval">
|
||||
<li><a name="owtherm_interval">
|
||||
<code>set <name> interval <int></code></a><br /> Temperature
|
||||
measurement intervall in seconds. The default is 300 seconds.</li>
|
||||
<li><a name="owtemp_tempHigh">
|
||||
<li><a name="owtherm_tempHigh">
|
||||
<code>set <name> tempHigh <float></code></a>
|
||||
<br /> The high alarm temperature (on the temperature scale chosen by the
|
||||
attribute value) </li>
|
||||
<li><a name="owtemp_tempLow">
|
||||
<li><a name="owtherm_tempLow">
|
||||
<code>set <name> tempLow <float></code></a>
|
||||
<br /> The low alarm temperature (on the temperature scale chosen by the
|
||||
attribute value) </li>
|
||||
</ul>
|
||||
<br />
|
||||
<a name="OWTEMPget">
|
||||
<a name="OWTHERMget">
|
||||
<b>Get</b></a>
|
||||
<ul>
|
||||
<li><a name="owtemp_id">
|
||||
<li><a name="owtherm_id">
|
||||
<code>get <name> id</code></a>
|
||||
<br /> Returns the full 1-Wire device id OW_FAMILY.ROM_ID.CRC </li>
|
||||
<li><a name="owtemp_present">
|
||||
<li><a name="owtherm_present">
|
||||
<code>get <name> present</code></a>
|
||||
<br /> Returns 1 if this 1-Wire device is present, otherwise 0. </li>
|
||||
<li><a name="owtemp_interval2">
|
||||
<li><a name="owtherm_interval2">
|
||||
<code>get <name> interval</code></a><br />Returns temperature
|
||||
measurement interval in seconds.</li>
|
||||
<li><a name="owtemp_temperature">
|
||||
<li><a name="owtherm_temperature">
|
||||
<code>get <name> temperature</code></a><br />Obtain the temperature. </li>
|
||||
<li><a name="owtemp_alarm">
|
||||
<li><a name="owtherm_alarm">
|
||||
<code>get <name> alarm</code></a><br />Obtain the alarm temperature
|
||||
values. </li>
|
||||
</ul>
|
||||
<br />
|
||||
<a name="OWTEMPattr">
|
||||
<a name="OWTHERMattr">
|
||||
<b>Attributes</b></a>
|
||||
<ul>
|
||||
<li><a name="owtemp_stateAL"><code>attr <name> stateAL <string></code>
|
||||
<li><a name="owtherm_stateAL"><code>attr <name> stateAL <string></code>
|
||||
</a>
|
||||
<br />character string for denoting low alarm condition, default is red down
|
||||
triangle, e.g. the code <span style="color:red">&#x25BE;</span>
|
||||
leading to the sign <span style="color:red">▾</span>
|
||||
</li>
|
||||
<li><a name="owtemp_stateAH"><code>attr <name> stateAH <string></code>
|
||||
<li><a name="owtherm_stateAH"><code>attr <name> stateAH <string></code>
|
||||
</a>
|
||||
<br />character string for denoting high alarm condition, default is red upward
|
||||
triangle, e.g. the code <span style="color:red">&#x25B4;</span>
|
||||
leading to the sign <span style="color:red">▴</span>
|
||||
</li>
|
||||
<li><a name="owtemp_tempOffset"><code>attr <name> tempOffset
|
||||
<li><a name="owtherm_tempOffset"><code>attr <name> tempOffset
|
||||
<float></code>
|
||||
</a>
|
||||
<br />temperature offset in °C added to the raw temperature reading. </li>
|
||||
<li><a name="owtemp_tempUnit"><code>attr <name> tempUnit
|
||||
<li><a name="owtherm_tempUnit"><code>attr <name> tempUnit
|
||||
Celsius|Kelvin|Fahrenheit|C|K|F</code>
|
||||
</a>
|
||||
<br />unit of measurement (temperature scale), default is Celsius = °C </li>
|
||||
<li><a name="owtemp_tempHigh2">
|
||||
<li><a name="owtherm_tempHigh2">
|
||||
<code>attr <name> tempHigh <float></code>
|
||||
</a>
|
||||
<br /> high alarm temperature (on the temperature scale chosen by the attribute
|
||||
value). </li>
|
||||
<li><a name="owtemp_tempLow2">
|
||||
<li><a name="owtherm_tempLow2">
|
||||
<code>attr <name> tempLow <float></code>
|
||||
</a>
|
||||
<br /> low alarm temperature (on the temperature scale chosen by the attribute
|
||||
|
Loading…
x
Reference in New Issue
Block a user