diff --git a/fhem/FHEM/47_OBIS.pm b/fhem/FHEM/47_OBIS.pm index 5ea10807b..87a9e0c93 100644 --- a/fhem/FHEM/47_OBIS.pm +++ b/fhem/FHEM/47_OBIS.pm @@ -77,10 +77,11 @@ sub OBIS_Initialize($) $hash->{DefFn} = "OBIS_Define"; $hash->{ParseFn} = "OBIS_Parse"; # $hash->{SetFn} = "OBIS_Set"; + $hash->{SetFn} = "myOBIS_Set"; $hash->{GetFn} = "OBIS_Get"; $hash->{UndefFn} = "OBIS_Undef"; $hash->{AttrFn} = "OBIS_Attr"; - $hash->{AttrList}= "do_not_notify:1,0 interval offset_feed offset_energy IODev channels directions alignTime pollingMode:on,off unitReadings:on,off ignoreUnknown:on,off valueBracket:first,second,both ". + $hash->{AttrList}= "do_not_notify:1,0 interval offset_feed offset_energy IODev channels directions alignTime pollingMode:on,off unitReadings:on,off ignoreUnknown:on,off valueBracket:first,second,both createPreValues:on,off ". $readingFnAttributes; } @@ -144,6 +145,7 @@ sub OBIS_Define($$) "VSM102" => ["/?!".chr(13).chr(10), 600, chr(6)."0".$hash->{helper}{SPEED}."0".chr(13).chr(10)], "E110" => ["/?!".chr(13).chr(10), 600, chr(6)."0".$hash->{helper}{SPEED}."0".chr(13).chr(10)], "E350USB" => ["/?!".chr(13).chr(10), 600, chr(6)."0".$hash->{helper}{SPEED}."0".chr(13).chr(10)], + "AS1440" => ["/2!".chr(13).chr(10), 600, chr(6)."0".$hash->{helper}{SPEED}."0".chr(13).chr(10)] ); if (!$devs{$type}) {return 'unknown meterType. Must be one of , SML, Standard, VSM102, E110'}; $devs{$type}[1] = $hash->{helper}{DEVICES}[1] // $devs{$type}[1]; @@ -354,6 +356,7 @@ sub OBIS_trySMLdecode($$) # $line2=$SML_specialities{"HEX2"}[1]->($data) } else { $data=~s/([A-F0-9]{2})/chr(hex($1))/eg; + $data=~s/[^!-~\s]//g; $line2="$data"; } @@ -455,6 +458,7 @@ sub OBIS_Parse($$) $channel=~s/:/\./; $channel=~s/-/\./; $channel=~s/\*/\./; +# Log 3,"Channel would be: $channel"; } if ($hash->{MeterType} eq "Unknown") {$hash->{MeterType}="Standard"} # if($rmsg=~/^([23456789]+)-.*/) { @@ -542,6 +546,7 @@ sub OBIS_Parse($$) } } if ($found==0) { +# Log 3,"Found a Channel-Attr"; $rmsg=~/^((?:\d{1,3}-\d{1,3}:)?(?:\d{1,3}|[CF]).\d{1,3}(?:.\d{1,3})?(?:\*\d{1,3})?)(?:\((.*?)\))?\((.*?)\)/; my $chan=$hash->{helper}{Channels}{$channel} //$hash->{helper}{Channels}{$1} // $OBIS_channels{$1} //$channel; my $chan1=$chan; @@ -631,6 +636,7 @@ sub OBIS_Attr(@) $hash->{helper}{Channels}=undef; } } + if ($aName eq "directions") { $hash->{helper}{directions}=eval $aVal; if ($@) { @@ -660,7 +666,9 @@ sub OBIS_Attr(@) InternalTimer($t, "GetUpdate", $hash, 0); } else {return "OBIS ($name): attr alignTime must be a Value >0"} } else { - return "OBIS ($name): attr alignTime is useless, if no interval is specified"; + if ($init_done) { + return "OBIS ($name): attr alignTime is useless, if no interval is specified"; + } } } if ($aName eq "pollingMode") @@ -809,16 +817,18 @@ sub OBIS_decodeTL($){

OBIS

+ =end html @@ -876,14 +885,16 @@ sub OBIS_decodeTL($){

OBIS

+ =end html_DE