diff --git a/fhem/CHANGED b/fhem/CHANGED index 16e35542e..029507a67 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,7 @@ # 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. + - feature: state definition and split attribute added to 66_ECMD, + 67_ECMDDevice - FHEMWEB: JavaScripts and CssFiles attributes added - change: avoid updating weather information on get (59_Weather.pm) - change: removed noshutdown=0 for HTTP connections made in 57_Calendar.pm diff --git a/fhem/FHEM/66_ECMD.pm b/fhem/FHEM/66_ECMD.pm index 2e5bb71c0..8784dc3ef 100644 --- a/fhem/FHEM/66_ECMD.pm +++ b/fhem/FHEM/66_ECMD.pm @@ -64,7 +64,7 @@ ECMD_Initialize($) $hash->{GetFn} = "ECMD_Get"; $hash->{SetFn} = "ECMD_Set"; $hash->{AttrFn} = "ECMD_Attr"; - $hash->{AttrList}= "classdefs logTraffic:0,1,2,3,4,5 timeout"; + $hash->{AttrList}= "classdefs split logTraffic:0,1,2,3,4,5 timeout"; } ##################################### @@ -316,6 +316,12 @@ ECMD_EvalClassDef($$$) Log3 $hash, 5, "$name: parameters are $def"; $hash->{fhem}{classDefs}{$classname}{params}= $def; # + # state + # + } elsif($cmd eq "state") { + Log3 $hash, 5, "$name: state is determined as $def"; + $hash->{fhem}{classDefs}{$classname}{state}= $def; + # # reading # } elsif($cmd eq "reading") { @@ -487,6 +493,7 @@ sub ECMD_Read($) { my ($hash) = @_; my $buf = ECMD_SimpleRead($hash); + return unless(defined($buf)); return if($buf eq ""); ECMD_Log $hash, 5, "Spontaneously received " . dq($buf); @@ -631,6 +638,13 @@ ECMD_Write($$$)
  • classdefs
    A colon-separated list of <classname>=<filename>. The list is automatically updated if a class definition is added. You can directly set the attribute.
  • +
  • split
    + Some devices send several readings in one transmission. The split attribute defines the + separator to split such transmissions into separate messages. The regular expression for + matching a reading is then applied to each message in turn. After splitting, the separator + is not part of the single messages. + Example: attr myECMD \n splits foo 12\nbar off into + foo 12 and bar off.
  • logTraffic <loglevel>
    Enables logging of sent and received datagrams with the given loglevel. Control characters in the logged datagrams are escaped, i.e. a double backslash is shown for a single backslash, \n is shown for a line feed character, etc.
  • timeout <seconds>
    Time in seconds to wait for a reply from the physical ECMD device before FHEM assumes that something has gone wrong. The default is 3 seconds if this attribute is not set.