mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
10_OWServer: autoselecting OWNet module
git-svn-id: https://svn.fhem.de/fhem/trunk@16435 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
0e1c28dfa2
commit
1568d52c0c
@ -1,12 +1,13 @@
|
|||||||
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
# 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.
|
# Do not insert empty lines here, update check depends on it.
|
||||||
|
- change: 10_OWServer: autoselecting OWNet module
|
||||||
- bugfix: 72_FB_CALLLIST: allow newlines in mapping attributes values
|
- bugfix: 72_FB_CALLLIST: allow newlines in mapping attributes values
|
||||||
- feature: 74_XiaomiBTLESens: add new set command resetBatteryTimestamp
|
- feature: 74_XiaomiBTLESens: add new set command resetBatteryTimestamp
|
||||||
- bugfix: 93_DbRep: some perl warnings fixed
|
- bugfix: 93_DbRep: some perl warnings fixed
|
||||||
- fhem.pl: restoreDir restructured (Forum #85801)
|
- fhem.pl: restoreDir restructured (Forum #85801)
|
||||||
- added: 88_xs1Bridge: added blacklist function
|
- added: 88_xs1Bridge: added blacklist function
|
||||||
- feature: 93_DbLog: V3.9.0, syntax of attribute excludeDevs enhanced
|
- feature: 93_DbLog: V3.9.0, syntax of attribute excludeDevs enhanced
|
||||||
- update: 39_Talk2Fhem: Timephrases added, bugfixes and some changes
|
- update: 39_Talk2Fhem: Timephrases added, bugfixes and some changes
|
||||||
- bugfix: 74_AMADCommBridge: fix Commandref
|
- bugfix: 74_AMADCommBridge: fix Commandref
|
||||||
- bugfix: 82_LGTV_WebOS: fix litte typos fix eval bug
|
- bugfix: 82_LGTV_WebOS: fix litte typos fix eval bug
|
||||||
- update: 21_HEOS: fix Use of uninitialized value {repeat}
|
- update: 21_HEOS: fix Use of uninitialized value {repeat}
|
||||||
@ -17,8 +18,8 @@
|
|||||||
and herold.at (austrian)
|
and herold.at (austrian)
|
||||||
- change: 93_DbRep: V7.14.4, increased timeout of special function
|
- change: 93_DbRep: V7.14.4, increased timeout of special function
|
||||||
- feature: 74_Unifi: added set updateClient, encrypt user and password
|
- feature: 74_Unifi: added set updateClient, encrypt user and password
|
||||||
- change: 49_TBot_List: deleteonly lists / internal changes
|
- change: 49_TBot_List: deleteonly lists / internal changes
|
||||||
- change: 50_TelegramBot: more silent cmds, caption formatting,several fixes
|
- change: 50_TelegramBot: more silent cmds, caption formatting,several fixes
|
||||||
- change: lib/OWNet.pm: updated to latest version from
|
- change: lib/OWNet.pm: updated to latest version from
|
||||||
https://sourceforge.net/p/owfs/code/ci/master/tree/module/
|
https://sourceforge.net/p/owfs/code/ci/master/tree/module/
|
||||||
ownet/perl5/OWNet/lib/OWNet.pm
|
ownet/perl5/OWNet/lib/OWNet.pm
|
||||||
|
@ -31,7 +31,10 @@ use warnings;
|
|||||||
# this must be the latest OWNet from
|
# this must be the latest OWNet from
|
||||||
# http://owfs.cvs.sourceforge.net/viewvc/owfs/owfs/module/ownet/perl5/OWNet/lib/OWNet.pm
|
# http://owfs.cvs.sourceforge.net/viewvc/owfs/owfs/module/ownet/perl5/OWNet/lib/OWNet.pm
|
||||||
# the version at CPAN is outdated and malfunctioning as at 2012-12-19
|
# the version at CPAN is outdated and malfunctioning as at 2012-12-19
|
||||||
use lib::OWNet;
|
|
||||||
|
#use constant OWNet_version_default => "2.8p17";
|
||||||
|
use constant OWNet_version_default => "3.1p5";
|
||||||
|
use vars qw($OWNet_version);
|
||||||
|
|
||||||
use vars qw(%owfamily);
|
use vars qw(%owfamily);
|
||||||
# 1-Wire devices (order by family code)
|
# 1-Wire devices (order by family code)
|
||||||
@ -139,6 +142,7 @@ OWServer_Define($$)
|
|||||||
|
|
||||||
$hash->{NOTIFYDEV} = "global";
|
$hash->{NOTIFYDEV} = "global";
|
||||||
|
|
||||||
|
$hash->{OWNET_VERSION}= OWServer_loadOWNet($hash);
|
||||||
|
|
||||||
if( $init_done ) {
|
if( $init_done ) {
|
||||||
OWServer_OpenDev($hash);
|
OWServer_OpenDev($hash);
|
||||||
@ -170,6 +174,58 @@ OWServer_Undef($$)
|
|||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#####################################
|
||||||
|
sub OWServer_loadOWNet($) {
|
||||||
|
|
||||||
|
my ($hash) = @_;
|
||||||
|
my $name = $hash->{NAME};
|
||||||
|
|
||||||
|
if(defined($OWNet_version)) {
|
||||||
|
Log3 $name, 3, "$name: owserver version not checked, using currently loaded OWNet version $OWNet_version";
|
||||||
|
return $OWNet_version;
|
||||||
|
}
|
||||||
|
|
||||||
|
$OWNet_version= OWNet_version_default;
|
||||||
|
my $libfilename= "lib/OWNet-" . $OWNet_version . "/OWNet.pm";
|
||||||
|
Log3 $name, 5, "$name: loading OWNet version $OWNet_version...";
|
||||||
|
require $libfilename;
|
||||||
|
Log3 $name, 3, "$name: OWNet version $OWNet_version loaded.";
|
||||||
|
|
||||||
|
my $owserver= OWServer_OpenDev($hash);
|
||||||
|
if(defined($owserver)) {
|
||||||
|
my $version= $owserver->read("/system/configuration/version");
|
||||||
|
Log3 $name, 3, "$name: owserver version $version found.";
|
||||||
|
$hash->{OWSERVER_VERSION}= $version;
|
||||||
|
if($OWNet_version eq $version) {
|
||||||
|
Log3 $name, 3, "$name: matching OWNet version already loaded.";
|
||||||
|
return $OWNet_version;
|
||||||
|
}
|
||||||
|
my $libfilename= "lib/OWNet-" . $version . "/OWNet.pm";
|
||||||
|
Log3 $name, 5, "$name: looking for OWNet version $version in $libfilename...";
|
||||||
|
if(-r $attr{global}{modpath}."/FHEM/$libfilename") {
|
||||||
|
# we temporarily disable the subroutine warning
|
||||||
|
my $handler= $SIG{__WARN__};
|
||||||
|
$SIG{__WARN__} = sub {
|
||||||
|
my $warning= shift;
|
||||||
|
warn $warning unless $warning =~ /Subroutine .* redefined at/;
|
||||||
|
};
|
||||||
|
Log3 $name, 5, "$name: loading OWNet version $version...";
|
||||||
|
require $libfilename;
|
||||||
|
$SIG{__WARN__}= $handler;
|
||||||
|
$OWNet_version= $version;
|
||||||
|
Log3 $name, 3, "$name: OWNet version $OWNet_version loaded.";
|
||||||
|
return $OWNet_version;
|
||||||
|
} else {
|
||||||
|
Log3 $name, 3, "$name: no matching OWNet version found, using default OWNet version $OWNet_version.";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Log3 $name, 2, "$name: could not connect to owserver, using default OWNet version $OWNet_version";
|
||||||
|
return $OWNet_version;
|
||||||
|
}
|
||||||
|
# we should not get here
|
||||||
|
return undef;
|
||||||
|
}
|
||||||
|
|
||||||
#####################################
|
#####################################
|
||||||
sub
|
sub
|
||||||
OWServer_CloseDev($)
|
OWServer_CloseDev($)
|
||||||
@ -190,6 +246,7 @@ OWServer_OpenDev($)
|
|||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
|
|
||||||
OWServer_CloseDev($hash);
|
OWServer_CloseDev($hash);
|
||||||
|
|
||||||
my $protocol= $hash->{fhem}{protocol};
|
my $protocol= $hash->{fhem}{protocol};
|
||||||
Log3 $name, 3, "$name: Opening connection to OWServer $protocol...";
|
Log3 $name, 3, "$name: Opening connection to OWServer $protocol...";
|
||||||
my $owserver= OWNet->new($protocol);
|
my $owserver= OWNet->new($protocol);
|
||||||
@ -562,21 +619,35 @@ OWServer_Set($@)
|
|||||||
<code>define <name> OWServer <protocol></code>
|
<code>define <name> OWServer <protocol></code>
|
||||||
<br><br>
|
<br><br>
|
||||||
|
|
||||||
Defines a logical OWServer device. OWServer is the server component of the
|
Defines a logical OWServer device which connects to an owserver.
|
||||||
<a href="http://owfs.org">1-Wire Filesystem</a>. It serves as abstraction layer
|
owserver is the server component of the
|
||||||
|
<a href="http://owfs.org">owfs 1-Wire Filesystem</a>. It serves as abstraction layer
|
||||||
for any 1-wire devices on a host. <protocol> has
|
for any 1-wire devices on a host. <protocol> has
|
||||||
format <hostname>:<port>. For details see
|
format <hostname>:<port>.
|
||||||
|
For details see
|
||||||
<a href="http://owfs.org/index.php?page=owserver_protocol">owserver documentation</a>.
|
<a href="http://owfs.org/index.php?page=owserver_protocol">owserver documentation</a>.
|
||||||
<p>
|
<p>
|
||||||
You need <a href="http://owfs.cvs.sourceforge.net/viewvc/owfs/owfs/module/ownet/perl5/OWNet/lib/OWNet.pm">OWNet.pm from owfs.org on Sourceforge</a>, which is normally deployed with FHEM. As at 2012-12-23 the OWNet module
|
The OWServer device uses
|
||||||
on CPAN has an issue which renders it useless for remote connections.
|
<a href="http://owfs.cvs.sourceforge.net/viewvc/owfs/owfs/module/ownet/perl5/OWNet/lib/OWNet.pm">OWNet.pm from Sourceforge</a>
|
||||||
|
to connect to the owserver.
|
||||||
|
Currently, OWNet modules for versions 2.8p17 and 3.1p5 are deployed with FHEM.
|
||||||
|
The OWServer device autodetects the owserver version and chooses a matching
|
||||||
|
OWNet module from this list. If no matching OWNet module is found,
|
||||||
|
the default version 3.1p5 is used. The nightmare situation of two
|
||||||
|
OWServer devices connecting to owserver instances with different versions is
|
||||||
|
not handled correctly. The server and module versions are stored in the
|
||||||
|
internals of the OWServer device for your reference.
|
||||||
<p>
|
<p>
|
||||||
The ow* version 2.9 packages provided with Debian Jessie in combination with OWNet.pm as deployed with FHEM have issues.
|
The ow* version 3.1p5 packages provided with Debian Stretch and
|
||||||
For Debian Jessie please either unzip
|
the ow* version 2.8p17 packages provided with Debian Jessie are fine.
|
||||||
|
The ow* version 2.9 packages provided with Debian Jessie in combination with OWNet.pm as
|
||||||
|
deployed with FHEM might have issues.
|
||||||
|
For Debian Jessie you could unzip
|
||||||
<a href="http://forum.fhem.de/index.php?action=dlattach;topic=12219.0;attach=2463">owfs_2.8p17-1_all.zip</a> and install
|
<a href="http://forum.fhem.de/index.php?action=dlattach;topic=12219.0;attach=2463">owfs_2.8p17-1_all.zip</a> and install
|
||||||
owserver, dependencies and what else you require with <code>dpkg -i <package>.deb</code> or use the latest OWNet.pm from Sourceforge.
|
owserver, dependencies and what else you require with <code>dpkg -i <package>.deb</code>.
|
||||||
<p>
|
<p>
|
||||||
The ow* version 3.1 packages provided with Debian Stretch are fine.
|
Please report issues related to versions in the
|
||||||
|
<a href="https://forum.fhem.de/index.php/board,26.0.html">1Wire board of the FHEM Forum</a>.
|
||||||
<p>
|
<p>
|
||||||
A typical working configuration file <code>/etc/owfs.conf</code> looks as follows:<p>
|
A typical working configuration file <code>/etc/owfs.conf</code> looks as follows:<p>
|
||||||
<code>
|
<code>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user