2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-07 12:58:13 +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:
nasseeder1 2018-02-17 15:01:35 +00:00
parent 266ab799a6
commit 6b03072f77
2 changed files with 13 additions and 3 deletions

View File

@ -1,5 +1,6 @@
# 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.
- change: 77_SMAEM: V3.1.0, extend error handling in define
-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
- bugfix: 88_xs1Bridge: code changeover + safety connection check

View File

@ -26,6 +26,7 @@
#################################################################################################
# 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.0 29.09.2017 make SMAEM ready for multimeter usage
# 2.9.1 29.05.2017 DbLog_splitFn added, some function names adapted
@ -52,7 +53,7 @@ use bignum;
use IO::Socket::Multicast;
use Blocking;
my $SMAEMVersion = "3.0.1";
my $SMAEMVersion = "3.1.0";
###############################################################
# SMAEM Initialize
@ -83,6 +84,7 @@ sub SMAEM_Define($$) {
my ($hash, $def) = @_;
my $name= $hash->{NAME};
my ($success, $gridin_sum, $gridout_sum);
my $socket;
$hash->{INTERVAL} = 60 ;
$hash->{VERSION} = $SMAEMVersion;
@ -90,12 +92,19 @@ sub SMAEM_Define($$) {
$hash->{HELPER}{STARTTIME} = time();
Log3 $hash, 3, "SMAEM $name - Opening multicast socket...";
my $socket = IO::Socket::Multicast->new(
eval {
$socket = IO::Socket::Multicast->new(
Proto => 'udp',
LocalPort => '9522',
ReuseAddr => '1',
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');