From 2dff21b7cea674ba1e87e448f9ffe58de2e0f709 Mon Sep 17 00:00:00 2001 From: pahenning <> Date: Sat, 9 Feb 2013 09:59:43 +0000 Subject: [PATCH] git-svn-id: https://svn.fhem.de/fhem/trunk@2672 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/21_OWID.pm | 31 ++++++++++++++++++------------- fhem/FHEM/21_OWLCD.pm | 21 +++++++++++++-------- fhem/FHEM/21_OWMULTI.pm | 4 ++-- fhem/FHEM/21_OWSWITCH.pm | 4 ++-- fhem/FHEM/21_OWTHERM.pm | 2 +- 5 files changed, 36 insertions(+), 26 deletions(-) diff --git a/fhem/FHEM/21_OWID.pm b/fhem/FHEM/21_OWID.pm index 94a20b405..f226d444d 100644 --- a/fhem/FHEM/21_OWID.pm +++ b/fhem/FHEM/21_OWID.pm @@ -10,7 +10,7 @@ # ######################################################################################## # -# define OWID +# define OWID or OWID . # # where may be replaced by any name string # @@ -106,15 +106,14 @@ sub OWID_Define ($$) { if(int(@a) !=4 ); #-- check id - if( $a[2] =~ m/^[0-9|a-f|A-F]{2}$/ ) { - $fam = $a[2]; - } else { - return "OWID: $a[0] family id $a[2] invalid, specify a 2 digit value"; - } - if( $a[3] =~ m/^[0-9|a-f|A-F]{12}$/ ) { + if( ($a[2] =~ m/^[0-9|a-f|A-F]{2}$/) && ($a[3] =~ m/^[0-9|a-f|A-F]{12}$/)) { + $fam = $a[2]; $id = $a[3]; + } elsif( $a[2] =~ m/^0-9|a-f|A-F]{2}\.[0-9|a-f|A-F]{12}$/ ) { + $fam = substr($a[2],0,2); + $id = substr($a[2],3); } else { - return "OWID: $a[0] ID $a[3] invalid, specify a 12 digit value"; + return "OWID: $def is invalid, specify a 2 digit 12 digit or 2.12 digit value"; } #-- 1-Wire ROM identifier in the form "FF.XXXXXXXXXXXX.YY" @@ -213,24 +212,30 @@ sub OWID_Undef ($) {

OWID

FHEM module for 1-Wire devices that know only their unique ROM ID
-
Note:
This 1-Wire module so far works only with the OWX interface module. - Please define an OWX device first.

+
This 1-Wire module works with the OWX interface module or with the OWServer interface module + Please define an OWX device or OWServer device first.


Example


- define ROM1 OWX_ID OWCOUNT CE780F000000 + define ROM1 OWX_ID OWCOUNT 09.CE780F000000


Define

- define <name> OWID <id> + define <name> OWID <fam> <id> or
+ define <name> OWID <fam>.<id>

Define a 1-Wire device.

    +
  • + <fam> +
    2-character unique family id, see above +
  • <id>
    12-character unique ROM id of the converter device without family id and CRC - code
  • + code +

diff --git a/fhem/FHEM/21_OWLCD.pm b/fhem/FHEM/21_OWLCD.pm index 8175adce6..c40e15953 100644 --- a/fhem/FHEM/21_OWLCD.pm +++ b/fhem/FHEM/21_OWLCD.pm @@ -10,14 +10,14 @@ # ######################################################################################## # -# define OWLCD +# define OWLCD or FF. # # where may be replaced by any name string # # is a 12 character (6 byte) 1-Wire ROM ID # without Family ID, e.g. A2D90D000800 # -# get id => FAM_ID.ROM_ID.CRC +# get id => FF.ROM_ID.CRC # get present => 1 if device present, 0 if not # get gpio => current state of the gpio pins (15 = all off, 0 = all on) # get counter => four values (16 Bit) of the gpio counter @@ -148,8 +148,10 @@ sub OWLCD_Define ($$) { #-- check id if( $a[2] =~ m/^[0-9|a-f|A-F]{12}$/ ) { $id = $a[2]; + } elsif( $a[2] =~ m/^FF\.[0-9|a-f|A-F]{12}$/ ) { + $id = substr($a[2],3); } else { - return "OWLCD: $a[0] ID $a[2] invalid, specify a 12 digit value"; + return "OWLCD: $a[0] ID $a[2] invalid, specify a 12 digit or 2.12 digit value"; } #-- 1-Wire ROM identifier in the form "FF.XXXXXXXXXXXX.YY" @@ -164,7 +166,7 @@ sub OWLCD_Define ($$) { #-- Couple to I/O device AssignIoPort($hash); - if( !defined($hash->{IODev}->{NAME}) | !defined($hash->{IODev}) | !defined($hash->{IODev}->{PRESENT}) ){ + 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 ){ @@ -992,7 +994,9 @@ sub OWXLCD_Trans($) { $msg =~ s/Ö/\x5C/g; $msg =~ s/Ü/\x5E/g; $msg =~ s/ß/\xBE/g; - #--take out degree sign + #-- replace other special chars + $msg =~s/_/\xC4/g; + #--take out HTML degree sign if( $msg =~ m/.*\°\;.*/ ) { my @ma = split(/\°\;/,$msg); $msg = $ma[0]."\x80".$ma[1]; @@ -1053,7 +1057,7 @@ sub OWXLCD_SetMemory($$$) { =pod =begin html - +

OWLCD

FHEM module to commmunicate with the 1-Wire LCD controller @@ -1070,7 +1074,8 @@ sub OWXLCD_SetMemory($$$) {

Define

- define <name> OWLCD <id> + define <name> OWLCD <id> or
+ define <name> OWLCD FF.<id>

Define a 1-Wire LCD device.

  • @@ -1143,4 +1148,4 @@ sub OWXLCD_SetMemory($$$) {
=end html -=cut +=cut \ No newline at end of file diff --git a/fhem/FHEM/21_OWMULTI.pm b/fhem/FHEM/21_OWMULTI.pm index 6396cf861..b6d07669f 100644 --- a/fhem/FHEM/21_OWMULTI.pm +++ b/fhem/FHEM/21_OWMULTI.pm @@ -118,9 +118,9 @@ sub OWMULTI_Initialize ($) { #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 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"; + "VName VUnit VFunction". + $readingFnAttributes; } ######################################################################################## diff --git a/fhem/FHEM/21_OWSWITCH.pm b/fhem/FHEM/21_OWSWITCH.pm index 17ef0daa9..126794624 100644 --- a/fhem/FHEM/21_OWSWITCH.pm +++ b/fhem/FHEM/21_OWSWITCH.pm @@ -130,8 +130,8 @@ sub OWSWITCH_Initialize ($) { $hash->{SetFn} = "OWSWITCH_Set"; my $attlist = "IODev do_not_notify:0,1 showtime:0,1 model:DS2413,DS2406,DS2408 loglevel:0,1,2,3,4,5 ". - "event-on-update-reading event-on-change-reading ". - "stateS "; + "stateS ". + $readingFnAttributes; #-- correct list of attributes for( my $i=0;$i<8;$i++ ){ diff --git a/fhem/FHEM/21_OWTHERM.pm b/fhem/FHEM/21_OWTHERM.pm index b3c7f53bd..0cca8a60a 100755 --- a/fhem/FHEM/21_OWTHERM.pm +++ b/fhem/FHEM/21_OWTHERM.pm @@ -732,7 +732,7 @@ sub OWXTHERM_GetValues($) { my ($i,$j,$k,@data,$ow_thn,$ow_tln); my $change = 0; - #-- For default, perform the conversion NOT now + #-- For default, perform the conversion now my $con=1; #-- ID of the device