2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 03:06:37 +00:00

added uncached readings for OWDevice, missing "payload" fixed in OWServer

git-svn-id: https://svn.fhem.de/fhem/trunk@2517 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
mfr69bs 2013-01-14 14:12:39 +00:00
parent 222028a0a5
commit ae180ffd0a
3 changed files with 13 additions and 5 deletions

View File

@ -50,6 +50,11 @@
- feature: new readingsFn modules: FS20 CUL_WS HMS CUL_EM CUL_TX EnOcean ZWave - feature: new readingsFn modules: FS20 CUL_WS HMS CUL_EM CUL_TX EnOcean ZWave
- feature: telnet client mode - feature: telnet client mode
- bugfix: FHEMWEB longpoll misses initial state change (HM: set_on vs. on) - bugfix: FHEMWEB longpoll misses initial state change (HM: set_on vs. on)
- change: 20_OWFS.pm, 21_OWTEMP modules flagged as "deprecated". These
modules will be removed in a future release. Use OWServer / OWDevice
instead. (M. Fischer)
- feature: a lot of new features and known 1-wire slaves to OWServer /
OWDevice added (M. Fischer)
- 2012-10-28 (5.3) - 2012-10-28 (5.3)
- feature: added functions trim, ltrim, rtrim, UntoggleDirect, - feature: added functions trim, ltrim, rtrim, UntoggleDirect,

View File

@ -266,6 +266,7 @@ OWServer_Dir($@)
my ($hash,$path)= @_; my ($hash,$path)= @_;
return undef unless(defined($hash->{fhem}{owserver})); return undef unless(defined($hash->{fhem}{owserver}));
$path= ($path) ? $path : "/";
return $hash->{fhem}{owserver}->dir($path); return $hash->{fhem}{owserver}->dir($path);
} }
@ -302,7 +303,7 @@ OWServer_Autocreate($)
my $owserver= $hash->{fhem}{owserver}; my $owserver= $hash->{fhem}{owserver};
my @dir= split(",", $owserver->dir()); my @dir= split(",", $owserver->dir("/"));
my @devices= grep { m/^\/[0-9a-f]{2}.[0-9a-f]{12}$/i } @dir; my @devices= grep { m/^\/[0-9a-f]{2}.[0-9a-f]{12}$/i } @dir;
my @defined = (); my @defined = ();
@ -375,7 +376,7 @@ OWServer_Get($@)
my $owserver= $hash->{fhem}{owserver}; my $owserver= $hash->{fhem}{owserver};
if($cmd eq "devices") { if($cmd eq "devices") {
my @dir= split(",", $owserver->dir()); my @dir= split(",", $owserver->dir("/"));
my @devices= grep { m/^\/[0-9a-f]{2}.[0-9a-f]{12}$/i } @dir; my @devices= grep { m/^\/[0-9a-f]{2}.[0-9a-f]{12}$/i } @dir;
my $ret; my $ret;
for my $device (@devices) { for my $device (@devices) {

View File

@ -349,7 +349,7 @@ OWDevice_Initialize($)
$hash->{UndefFn} = "OWDevice_Undef"; $hash->{UndefFn} = "OWDevice_Undef";
$hash->{AttrFn} = "OWDevice_Attr"; $hash->{AttrFn} = "OWDevice_Attr";
$hash->{AttrList} = "IODev trimvalues polls interfaces model loglevel:0,1,2,3,4,5 ". $hash->{AttrList} = "IODev uncached trimvalues polls interfaces model loglevel:0,1,2,3,4,5 ".
$readingFnAttributes; $readingFnAttributes;
} }
@ -401,6 +401,7 @@ OWDevice_ReadFromServer($$@)
no strict "refs"; no strict "refs";
my $ret; my $ret;
if($cmd eq "read") { if($cmd eq "read") {
unshift(@a,$dev);
$ret = &{$modules{$iohash->{TYPE}}{ReadFn}}($iohash, @a); $ret = &{$modules{$iohash->{TYPE}}{ReadFn}}($iohash, @a);
} }
if($cmd eq "dir") { if($cmd eq "dir") {
@ -421,7 +422,8 @@ OWDevice_ReadValue($$) {
my $address= $hash->{fhem}{address}; my $address= $hash->{fhem}{address};
my $interface= $hash->{fhem}{interfaces}; my $interface= $hash->{fhem}{interfaces};
my $value= OWDevice_ReadFromServer($hash,"read","/$address/$reading"); my $cache= (AttrVal($hash->{NAME},"uncached","")) ? "/uncached" : "";
my $value= OWDevice_ReadFromServer($hash,"read","$cache/$address/$reading");
#Debug "/$address/$reading => $value"; #Debug "/$address/$reading => $value";
if($interface ne "id") { if($interface ne "id") {
if(defined($value)) { if(defined($value)) {
@ -468,7 +470,7 @@ OWDevice_UpdateValues($) {
} }
if(@state) { if(@state) {
foreach my $reading (@state) { foreach my $reading (@state) {
my $value= OWDevice_ReadValue($hash,$reading); my $value= ReadingsVal($hash->{NAME},$reading,undef);
if(defined($value)) { if(defined($value)) {
$state .= "$reading: $value "; $state .= "$reading: $value ";
} else { } else {