packages, add README.md

This commit is contained in:
Marko Oldenburg 2019-06-05 10:49:04 +02:00
parent 1fc170203b
commit 8c1e2d2b39

View File

@ -34,6 +34,7 @@ package main;
use strict; use strict;
use warnings; use warnings;
use FHEM::Meta;
my $version = "2.4.7"; my $version = "2.4.7";
@ -41,12 +42,12 @@ sub XiaomiBTLESens_Initialize($) {
my ($hash) = @_; my ($hash) = @_;
$hash->{SetFn} = "XiaomiBTLESens::Set"; $hash->{SetFn} = "FHEM::XiaomiBTLESens::Set";
$hash->{GetFn} = "XiaomiBTLESens::Get"; $hash->{GetFn} = "FHEM::XiaomiBTLESens::Get";
$hash->{DefFn} = "XiaomiBTLESens::Define"; $hash->{DefFn} = "FHEM::XiaomiBTLESens::Define";
$hash->{NotifyFn} = "XiaomiBTLESens::Notify"; $hash->{NotifyFn} = "FHEM::XiaomiBTLESens::Notify";
$hash->{UndefFn} = "XiaomiBTLESens::Undef"; $hash->{UndefFn} = "FHEM::XiaomiBTLESens::Undef";
$hash->{AttrFn} = "XiaomiBTLESens::Attr"; $hash->{AttrFn} = "FHEM::XiaomiBTLESens::Attr";
$hash->{AttrList} = $hash->{AttrList} =
"interval " "interval "
. "disable:1 " . "disable:1 "
@ -70,6 +71,8 @@ sub XiaomiBTLESens_Initialize($) {
my $hash = $modules{XiaomiBTLESens}{defptr}{$d}; my $hash = $modules{XiaomiBTLESens}{defptr}{$d};
$hash->{VERSION} = $version; $hash->{VERSION} = $version;
} }
return FHEM::Meta::InitMod( __FILE__, $hash );
} }
package XiaomiBTLESens; package XiaomiBTLESens;
@ -79,6 +82,7 @@ my $missingModul = "";
use strict; use strict;
use warnings; use warnings;
use POSIX; use POSIX;
use FHEM::Meta;
use GPUtils qw(GP_Import) use GPUtils qw(GP_Import)
; # wird für den Import der FHEM Funktionen aus der fhem.pl benötigt ; # wird für den Import der FHEM Funktionen aus der fhem.pl benötigt
@ -152,6 +156,7 @@ sub Define($$) {
my ( $hash, $def ) = @_; my ( $hash, $def ) = @_;
my @a = split( "[ \t][ \t]*", $def ); my @a = split( "[ \t][ \t]*", $def );
return $@ unless ( FHEM::Meta::SetInternals($hash) );
return "too few parameters: define <name> XiaomiBTLESens <BTMAC>" return "too few parameters: define <name> XiaomiBTLESens <BTMAC>"
if ( @a != 3 ); if ( @a != 3 );
return return
@ -394,7 +399,7 @@ sub stateRequestTimer($) {
stateRequest($hash); stateRequest($hash);
InternalTimer( gettimeofday() + $hash->{INTERVAL} + int( rand(300) ), InternalTimer( gettimeofday() + $hash->{INTERVAL} + int( rand(300) ),
"XiaomiBTLESens::stateRequestTimer", $hash ); "FHEM::XiaomiBTLESens::stateRequestTimer", $hash );
Log3 $name, 4, Log3 $name, 4,
"XiaomiBTLESens ($name) - stateRequestTimer: Call Request Timer"; "XiaomiBTLESens ($name) - stateRequestTimer: Call Request Timer";
@ -493,11 +498,11 @@ sub CreateParamGatttool($@) {
if ( $mod eq 'read' ) { if ( $mod eq 'read' ) {
$hash->{helper}{RUNNING_PID} = BlockingCall( $hash->{helper}{RUNNING_PID} = BlockingCall(
"XiaomiBTLESens::ExecGatttool_Run", "FHEM::XiaomiBTLESens::ExecGatttool_Run",
$name . "|" . $mac . "|" . $mod . "|" . $handle, $name . "|" . $mac . "|" . $mod . "|" . $handle,
"XiaomiBTLESens::ExecGatttool_Done", "FHEM::XiaomiBTLESens::ExecGatttool_Done",
90, 90,
"XiaomiBTLESens::ExecGatttool_Aborted", "FHEM::XiaomiBTLESens::ExecGatttool_Aborted",
$hash $hash
) unless ( exists( $hash->{helper}{RUNNING_PID} ) ); ) unless ( exists( $hash->{helper}{RUNNING_PID} ) );
@ -509,16 +514,16 @@ sub CreateParamGatttool($@) {
} }
elsif ( $mod eq 'write' ) { elsif ( $mod eq 'write' ) {
$hash->{helper}{RUNNING_PID} = BlockingCall( $hash->{helper}{RUNNING_PID} = BlockingCall(
"XiaomiBTLESens::ExecGatttool_Run", "FHEM::XiaomiBTLESens::ExecGatttool_Run",
$name . "|" $name . "|"
. $mac . "|" . $mac . "|"
. $mod . "|" . $mod . "|"
. $handle . "|" . $handle . "|"
. $value . "|" . $value . "|"
. $XiaomiModels{ AttrVal( $name, 'model', '' ) }{wdatalisten}, . $XiaomiModels{ AttrVal( $name, 'model', '' ) }{wdatalisten},
"XiaomiBTLESens::ExecGatttool_Done", "FHEM::XiaomiBTLESens::ExecGatttool_Done",
90, 90,
"XiaomiBTLESens::ExecGatttool_Aborted", "FHEM::XiaomiBTLESens::ExecGatttool_Aborted",
$hash $hash
) unless ( exists( $hash->{helper}{RUNNING_PID} ) ); ) unless ( exists( $hash->{helper}{RUNNING_PID} ) );
@ -1292,4 +1297,50 @@ sub CometBlueBTLE_CmdlinePreventGrepFalsePositive($) {
=end html_DE =end html_DE
=for :application/json;q=META.json 74_XiaomiBTLESens.pm
{
"abstract": "Modul to retrieves data from a Xiaomi BTLE Sensors",
"x_lang": {
"de": {
"abstract": "Modul um Daten vom Xiaomi BTLE Sensoren aus zu lesen"
}
},
"keywords": [
"fhem-mod-device",
"fhem-core",
"Flower",
"BTLE",
"Xiaomi",
"Sensor",
"Bluetooth LE"
],
"release_status": "stable",
"license": "GPL_2",
"author": [
"Marko Oldenburg <leongaultier@gmail.com>"
],
"x_fhem_maintainer": [
"CoolTux"
],
"x_fhem_maintainer_github": [
"LeonGaultier"
],
"prereqs": {
"runtime": {
"requires": {
"FHEM": 5.00918799,
"perl": 5.016,
"Meta": 0,
"Blocking": 0,
"JSON": 0
},
"recommends": {
},
"suggests": {
}
}
}
}
=end :application/json;q=META.json
=cut =cut