mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-07 19:04:20 +00:00
77_SMAEM: V3.1.0, extend error handling in define
git-svn-id: https://svn.fhem.de/fhem/trunk@16201 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
266ab799a6
commit
6b03072f77
@ -1,5 +1,6 @@
|
|||||||
# 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: 77_SMAEM: V3.1.0, extend error handling in define
|
||||||
-bugfix: 73_ElectricityCalculator: Min dt for calc. reduced from 30 to 1 s
|
-bugfix: 73_ElectricityCalculator: Min dt for calc. reduced from 30 to 1 s
|
||||||
- feature: 93_DbRep: V7.11.0, "repairSQLite" to repair a corrupted SQLite DB
|
- feature: 93_DbRep: V7.11.0, "repairSQLite" to repair a corrupted SQLite DB
|
||||||
- bugfix: 88_xs1Bridge: code changeover + safety connection check
|
- bugfix: 88_xs1Bridge: code changeover + safety connection check
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#################################################################################################
|
#################################################################################################
|
||||||
# Versions History done by DS_Starter
|
# Versions History done by DS_Starter
|
||||||
#
|
#
|
||||||
|
# 3.1.0 12.02.2018 extend error handling in define
|
||||||
# 3.0.1 26.11.2017 use abort cause of BlockingCall
|
# 3.0.1 26.11.2017 use abort cause of BlockingCall
|
||||||
# 3.0.0 29.09.2017 make SMAEM ready for multimeter usage
|
# 3.0.0 29.09.2017 make SMAEM ready for multimeter usage
|
||||||
# 2.9.1 29.05.2017 DbLog_splitFn added, some function names adapted
|
# 2.9.1 29.05.2017 DbLog_splitFn added, some function names adapted
|
||||||
@ -52,7 +53,7 @@ use bignum;
|
|||||||
use IO::Socket::Multicast;
|
use IO::Socket::Multicast;
|
||||||
use Blocking;
|
use Blocking;
|
||||||
|
|
||||||
my $SMAEMVersion = "3.0.1";
|
my $SMAEMVersion = "3.1.0";
|
||||||
|
|
||||||
###############################################################
|
###############################################################
|
||||||
# SMAEM Initialize
|
# SMAEM Initialize
|
||||||
@ -83,6 +84,7 @@ sub SMAEM_Define($$) {
|
|||||||
my ($hash, $def) = @_;
|
my ($hash, $def) = @_;
|
||||||
my $name= $hash->{NAME};
|
my $name= $hash->{NAME};
|
||||||
my ($success, $gridin_sum, $gridout_sum);
|
my ($success, $gridin_sum, $gridout_sum);
|
||||||
|
my $socket;
|
||||||
|
|
||||||
$hash->{INTERVAL} = 60 ;
|
$hash->{INTERVAL} = 60 ;
|
||||||
$hash->{VERSION} = $SMAEMVersion;
|
$hash->{VERSION} = $SMAEMVersion;
|
||||||
@ -90,12 +92,19 @@ sub SMAEM_Define($$) {
|
|||||||
$hash->{HELPER}{STARTTIME} = time();
|
$hash->{HELPER}{STARTTIME} = time();
|
||||||
|
|
||||||
Log3 $hash, 3, "SMAEM $name - Opening multicast socket...";
|
Log3 $hash, 3, "SMAEM $name - Opening multicast socket...";
|
||||||
my $socket = IO::Socket::Multicast->new(
|
eval {
|
||||||
|
$socket = IO::Socket::Multicast->new(
|
||||||
Proto => 'udp',
|
Proto => 'udp',
|
||||||
LocalPort => '9522',
|
LocalPort => '9522',
|
||||||
ReuseAddr => '1',
|
ReuseAddr => '1',
|
||||||
ReusePort => defined(&ReusePort) ? 1 : 0,
|
ReusePort => defined(&ReusePort) ? 1 : 0,
|
||||||
) or return "Can't bind : $@";
|
); };
|
||||||
|
if($@) {
|
||||||
|
Log3 $hash, 1, "SMAEM $name - Can't bind: $@";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Log3 $hash, 3, "SMAEM $name - Multicast socket opened";
|
||||||
|
|
||||||
$socket->mcast_add('239.12.255.254');
|
$socket->mcast_add('239.12.255.254');
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user