mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-03 10:46:53 +00:00
Multiple: Add FHEM::Meta support
git-svn-id: https://svn.fhem.de/fhem/trunk@18681 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
57bdb9ef6b
commit
c97c7d31e0
@ -25,6 +25,8 @@ sub RESIDENTS_Initialize($) {
|
||||
"disable:1,0 disabledForIntervals do_not_notify:1,0 "
|
||||
. "rgr_states:multiple-strict,home,gotosleep,asleep,awoken,absent,gone rgr_lang:EN,DE rgr_noDuration:0,1 rgr_showAllStates:0,1 rgr_wakeupDevice "
|
||||
. $readingFnAttributes;
|
||||
|
||||
return FHEM::Meta::Load( __FILE__, $hash );
|
||||
}
|
||||
|
||||
# module Fn ####################################################################
|
||||
|
@ -30,6 +30,8 @@ sub GUEST_Initialize($) {
|
||||
foreach (@RESIDENTStk_attr) {
|
||||
$hash->{AttrList} .= " " . $hash->{AttrPrefix} . $_;
|
||||
}
|
||||
|
||||
return FHEM::Meta::Load( __FILE__, $hash );
|
||||
}
|
||||
|
||||
1;
|
||||
|
@ -30,6 +30,8 @@ sub ROOMMATE_Initialize($) {
|
||||
foreach (@RESIDENTStk_attr) {
|
||||
$hash->{AttrList} .= " " . $hash->{AttrPrefix} . $_;
|
||||
}
|
||||
|
||||
return FHEM::Meta::Load( __FILE__, $hash );
|
||||
}
|
||||
|
||||
1;
|
||||
|
@ -10,6 +10,7 @@ use List::Util qw(sum);
|
||||
|
||||
use HttpUtils;
|
||||
use Unit;
|
||||
use FHEM::Meta;
|
||||
|
||||
# module hashes ###############################################################
|
||||
my %HP1000_pwsMapping = (
|
||||
@ -266,6 +267,8 @@ sub HP1000_Initialize($) {
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
return FHEM::Meta::Load( __FILE__, $hash );
|
||||
}
|
||||
|
||||
# regular Fn ##################################################################
|
||||
@ -285,6 +288,9 @@ sub HP1000_Define($$$) {
|
||||
. " (there can only be one instance as per restriction of the weather station itself)"
|
||||
if ( defined( $modules{HP1000}{defptr} ) && !defined( $hash->{OLDDEF} ) );
|
||||
|
||||
# Initialize the module and the device
|
||||
return $@ unless ( FHEM::Meta::SetInternals($hash) );
|
||||
|
||||
# check FHEMWEB instance when user first defines the device
|
||||
if ( $init_done && !defined( $hash->{OLDDEF} ) ) {
|
||||
my $FWports;
|
||||
|
@ -12,6 +12,7 @@ use utf8;
|
||||
use Encode qw(encode_utf8 decode_utf8);
|
||||
use Unit;
|
||||
use Data::Dumper;
|
||||
use FHEM::Meta;
|
||||
|
||||
# initialize ##################################################################
|
||||
sub Wunderground_Initialize($) {
|
||||
@ -293,6 +294,8 @@ sub Wunderground_Initialize($) {
|
||||
'wind_speed' => { rtype => 'kmph', formula_symbol => 'Ws' },
|
||||
'wind_speed_mph' => { rtype => 'mph', formula_symbol => 'Ws' }
|
||||
};
|
||||
|
||||
return FHEM::Meta::Load( __FILE__, $hash );
|
||||
}
|
||||
|
||||
# regular Fn ##################################################################
|
||||
@ -321,6 +324,9 @@ sub Wunderground_Define($$$) {
|
||||
$hash->{API_KEY} = @$a[2];
|
||||
$hash->{QUERY} = @$a[3];
|
||||
|
||||
# Initialize the module and the device
|
||||
return $@ unless ( FHEM::Meta::SetInternals($hash) );
|
||||
|
||||
$hash->{QUERY} = "pws:" . $hash->{QUERY}
|
||||
if ( $hash->{QUERY} =~ /^[A-Z]{3,}\d{1,}$/ );
|
||||
|
||||
|
@ -8,6 +8,7 @@ use Time::Local;
|
||||
use Encode qw(encode_utf8 decode_utf8);
|
||||
|
||||
use HttpUtils;
|
||||
use FHEM::Meta;
|
||||
|
||||
# initialize ##################################################################
|
||||
sub ENIGMA2_Initialize($) {
|
||||
@ -58,6 +59,8 @@ sub ENIGMA2_Initialize($) {
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
return FHEM::Meta::Load( __FILE__, $hash );
|
||||
}
|
||||
|
||||
# regular Fn ##################################################################
|
||||
@ -93,6 +96,9 @@ sub ENIGMA2_Define($$) {
|
||||
unless ( $interval =~ /^\d+$/ );
|
||||
$hash->{INTERVAL} = $interval;
|
||||
|
||||
# Initialize the device
|
||||
return $@ unless ( FHEM::Meta::SetInternals($hash) );
|
||||
|
||||
my $http_user = shift @$a;
|
||||
my $http_passwd = shift @$a;
|
||||
$hash->{URL} = "$http_user:$http_passwd@" . $hash->{URL}
|
||||
|
@ -36,6 +36,7 @@ use HttpUtils;
|
||||
use SetExtensions;
|
||||
use Unit;
|
||||
use utf8;
|
||||
use FHEM::Meta;
|
||||
|
||||
my %LaMetric2_sounds = (
|
||||
notifications => [
|
||||
@ -247,6 +248,8 @@ sub LaMetric2_Initialize($$) {
|
||||
|
||||
#$hash->{parseParams} = 1; # not possible due to legacy msg command schema
|
||||
$hash->{'.msgParams'} = { parseParams => 1, };
|
||||
|
||||
return FHEM::Meta::Load( __FILE__, $hash );
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
@ -266,9 +269,11 @@ sub LaMetric2_Define($$) {
|
||||
return "$apikey does not seem to be a valid key"
|
||||
if ( $apikey !~ /^([a-f0-9]{64})$/ );
|
||||
|
||||
# Initialize the device
|
||||
return $@ unless ( FHEM::Meta::SetInternals($hash) );
|
||||
|
||||
$hash->{HOST} = $host;
|
||||
$hash->{".API_KEY"} = $apikey;
|
||||
$hash->{VERSION} = "2.3.1";
|
||||
$hash->{INTERVAL} =
|
||||
$interval && looks_like_number($interval) ? $interval : 60;
|
||||
$hash->{PORT} = $port && looks_like_number($port) ? $port : 4343;
|
||||
@ -2687,4 +2692,38 @@ Leider keine deutsche Dokumentation vorhanden. Die englische Version gibt es hie
|
||||
</ul>
|
||||
|
||||
=end html_DE
|
||||
|
||||
=for :application/json;q=META.json 70_LaMetric2.pm
|
||||
{
|
||||
"version": "v2.3.2",
|
||||
"release_status": "stable",
|
||||
"author": [
|
||||
"Julian Pawlowski <julian.pawlowski@gmail.com>"
|
||||
],
|
||||
"x_fhem_maintainer": [
|
||||
"loredo"
|
||||
],
|
||||
"x_fhem_maintainer_github": [
|
||||
"jpawlowski"
|
||||
],
|
||||
"resources": {
|
||||
"license": [
|
||||
"https://fhem.de/#License"
|
||||
],
|
||||
"homepage": "https://fhem.de/",
|
||||
"bugtracker": {
|
||||
"web": "https://forum.fhem.de/index.php/board,53.0.html",
|
||||
"x_web_title": "Multimedia"
|
||||
},
|
||||
"repository": {
|
||||
"type": "svn",
|
||||
"url": "https://svn.fhem.de/fhem/",
|
||||
"x_branch_master": "trunk",
|
||||
"x_branch_dev": "trunk",
|
||||
"web": "https://svn.fhem.de/"
|
||||
}
|
||||
}
|
||||
}
|
||||
=end :application/json;q=META.json
|
||||
|
||||
=cut
|
||||
|
@ -9,6 +9,7 @@ use Time::HiRes qw(gettimeofday);
|
||||
use HttpUtils;
|
||||
use Color;
|
||||
use Encode;
|
||||
use FHEM::Meta;
|
||||
|
||||
# initialize ##################################################################
|
||||
sub PHTV_Initialize($) {
|
||||
@ -49,6 +50,7 @@ sub PHTV_Initialize($) {
|
||||
};
|
||||
|
||||
FHEM_colorpickerInit();
|
||||
return FHEM::Meta::Load( __FILE__, $hash );
|
||||
}
|
||||
|
||||
# regular Fn ##################################################################
|
||||
@ -73,6 +75,9 @@ sub PHTV_Define($$) {
|
||||
return $msg;
|
||||
}
|
||||
|
||||
# Initialize the module and the device
|
||||
return $@ unless ( FHEM::Meta::SetInternals($hash) );
|
||||
|
||||
$hash->{NOTIFYDEV} = "global";
|
||||
|
||||
my $address = $a[2];
|
||||
|
@ -9,6 +9,7 @@ use utf8;
|
||||
use Data::Dumper;
|
||||
use HttpUtils;
|
||||
use Encode;
|
||||
use FHEM::Meta;
|
||||
|
||||
# initialize ##################################################################
|
||||
sub Pushover_Initialize($$) {
|
||||
@ -23,6 +24,8 @@ sub Pushover_Initialize($$) {
|
||||
|
||||
#$hash->{parseParams} = 1; # not possible due to legacy msg command schema
|
||||
$hash->{'.msgParams'} = { parseParams => 1, };
|
||||
|
||||
return FHEM::Meta::Load( __FILE__, $hash );
|
||||
}
|
||||
|
||||
# regular Fn ##################################################################
|
||||
@ -44,6 +47,9 @@ sub Pushover_Define($$) {
|
||||
|
||||
if ( defined($token) && defined($user) ) {
|
||||
|
||||
# Initialize the device
|
||||
return $@ unless ( FHEM::Meta::SetInternals($hash) );
|
||||
|
||||
$hash->{APP_TOKEN} = $token;
|
||||
$hash->{USER_KEY} = $user;
|
||||
|
||||
|
@ -8,6 +8,7 @@ use vars qw(%data);
|
||||
use HttpUtils;
|
||||
use Encode;
|
||||
use Data::Dumper;
|
||||
use FHEM::Meta;
|
||||
|
||||
# initialize ##################################################################
|
||||
sub THINKINGCLEANER_Initialize($) {
|
||||
@ -56,6 +57,8 @@ sub THINKINGCLEANER_Initialize($) {
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
return FHEM::Meta::Load( __FILE__, $hash );
|
||||
}
|
||||
|
||||
# regular Fn ##################################################################
|
||||
@ -83,6 +86,9 @@ sub THINKINGCLEANER_Define($$$) {
|
||||
|
||||
$hash->{TYPE} = "THINKINGCLEANER";
|
||||
|
||||
# Initialize the device
|
||||
return $@ unless ( FHEM::Meta::SetInternals($hash) );
|
||||
|
||||
my $address = @$a[2];
|
||||
$hash->{DeviceName} = $address;
|
||||
|
||||
|
@ -4,6 +4,7 @@ package main;
|
||||
use strict;
|
||||
use warnings;
|
||||
use Data::Dumper;
|
||||
use FHEM::Meta;
|
||||
|
||||
# initialize ##################################################################
|
||||
sub msgConfig_Initialize($) {
|
||||
@ -144,6 +145,8 @@ sub msgConfig_Initialize($) {
|
||||
{
|
||||
addToAttrList($_);
|
||||
}
|
||||
|
||||
return FHEM::Meta::Load( __FILE__, $hash );
|
||||
}
|
||||
|
||||
# regular Fn ##################################################################
|
||||
@ -159,7 +162,12 @@ sub msgConfig_Define($$) {
|
||||
|
||||
return "Global configuration device already defined: "
|
||||
. $modules{$TYPE}{defptr}{NAME}
|
||||
if ( defined( $modules{$TYPE}{defptr} ) );
|
||||
if ( defined( $modules{$TYPE}{defptr} )
|
||||
&& $init_done
|
||||
&& !defined( $hash->{OLDDEF} ) );
|
||||
|
||||
# Initialize the device
|
||||
return $@ unless ( FHEM::Meta::SetInternals($hash) );
|
||||
|
||||
# create global unique device definition
|
||||
$modules{$TYPE}{defptr} = $hash;
|
||||
|
@ -8,6 +8,7 @@ use Time::Local;
|
||||
use UConv;
|
||||
|
||||
use HttpUtils;
|
||||
use FHEM::Meta;
|
||||
|
||||
# initialize ##################################################################
|
||||
sub GEOFANCY_Initialize($) {
|
||||
@ -16,6 +17,8 @@ sub GEOFANCY_Initialize($) {
|
||||
$hash->{UndefFn} = "GEOFANCY_Undefine";
|
||||
$hash->{SetFn} = "GEOFANCY_Set";
|
||||
$hash->{AttrList} = "devAlias disable:0,1 " . $readingFnAttributes;
|
||||
|
||||
return FHEM::Meta::Load( __FILE__, $hash );
|
||||
}
|
||||
|
||||
# regular Fn ##################################################################
|
||||
@ -28,6 +31,9 @@ sub GEOFANCY_Define($$) {
|
||||
my $name = $a[0];
|
||||
my $infix = $a[2];
|
||||
|
||||
# Initialize the device
|
||||
return $@ unless ( FHEM::Meta::SetInternals($hash) );
|
||||
|
||||
$hash->{fhem}{infix} = $infix;
|
||||
|
||||
GEOFANCY_addExtension( $name, "GEOFANCY_CGI", $infix );
|
||||
|
@ -6,6 +6,7 @@ use warnings;
|
||||
use Data::Dumper;
|
||||
|
||||
use Unit;
|
||||
use FHEM::Meta;
|
||||
our (@RESIDENTStk_attr);
|
||||
|
||||
# module variables ############################################################
|
||||
@ -73,6 +74,10 @@ sub RESIDENTStk_Define($$) {
|
||||
|| !defined( $a[2] )
|
||||
|| $a[2] =~ /^[A-Za-z\d._]+(?:,[A-Za-z\d._]*)*$/ );
|
||||
|
||||
# Initialize the module and the device
|
||||
return $@ unless ( FHEM::Meta::SetInternals($hash) );
|
||||
use version 0.77; our $VERSION = FHEM::Meta::Get( $hash, 'version' );
|
||||
|
||||
$hash->{MOD_INIT} = 1;
|
||||
$hash->{NOTIFYDEV} = "global";
|
||||
delete $hash->{RESIDENTGROUPS} if ( $hash->{RESIDENTGROUPS} );
|
||||
@ -1533,10 +1538,11 @@ sub RESIDENTStk_SetLocation(@) {
|
||||
|
||||
# update locationPresence
|
||||
# if ( $posBeaconUUID eq "" ) {
|
||||
readingsBulkUpdate( $hash, "locationPresence", "present" )
|
||||
if ( $trigger == 1 );
|
||||
readingsBulkUpdate( $hash, "locationPresence", "absent" )
|
||||
if ( $trigger == 0 );
|
||||
readingsBulkUpdate( $hash, "locationPresence", "present" )
|
||||
if ( $trigger == 1 );
|
||||
readingsBulkUpdate( $hash, "locationPresence", "absent" )
|
||||
if ( $trigger == 0 );
|
||||
|
||||
# }
|
||||
|
||||
# # update positionPresence
|
||||
|
Loading…
x
Reference in New Issue
Block a user