mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-07 19:04:20 +00:00
38_netatmo.pm: added autocreate command, documentation changes
git-svn-id: https://svn.fhem.de/fhem/trunk@7697 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
72f470a864
commit
c7a70e6fa1
@ -29,7 +29,7 @@ netatmo_Initialize($)
|
|||||||
$hash->{NOTIFYDEV} = "global";
|
$hash->{NOTIFYDEV} = "global";
|
||||||
$hash->{NotifyFn} = "netatmo_Notify";
|
$hash->{NotifyFn} = "netatmo_Notify";
|
||||||
$hash->{UndefFn} = "netatmo_Undefine";
|
$hash->{UndefFn} = "netatmo_Undefine";
|
||||||
#$hash->{SetFn} = "netatmo_Set";
|
$hash->{SetFn} = "netatmo_Set";
|
||||||
$hash->{GetFn} = "netatmo_Get";
|
$hash->{GetFn} = "netatmo_Get";
|
||||||
$hash->{AttrFn} = "netatmo_Attr";
|
$hash->{AttrFn} = "netatmo_Attr";
|
||||||
$hash->{AttrList} = "IODev ".
|
$hash->{AttrList} = "IODev ".
|
||||||
@ -210,7 +210,13 @@ netatmo_Set($$@)
|
|||||||
{
|
{
|
||||||
my ($hash, $name, $cmd) = @_;
|
my ($hash, $name, $cmd) = @_;
|
||||||
|
|
||||||
my $list = "";
|
my $list = "autocreate:noArgs";
|
||||||
|
|
||||||
|
if( $cmd eq "autocreate" ) {
|
||||||
|
return netatmo_autocreate($hash, 1 );
|
||||||
|
return undef;
|
||||||
|
}
|
||||||
|
|
||||||
return "Unknown argument $cmd, choose one of $list";
|
return "Unknown argument $cmd, choose one of $list";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -596,19 +602,21 @@ netatmo_dispatch($$$)
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub
|
sub
|
||||||
netatmo_autocreate($)
|
netatmo_autocreate($;$)
|
||||||
{
|
{
|
||||||
my($hash) = @_;
|
my($hash,$force) = @_;
|
||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
|
|
||||||
if( !$hash->{helper}{devices} ) {
|
if( !$hash->{helper}{devices} ) {
|
||||||
netatmo_getDevices($hash);
|
netatmo_getDevices($hash);
|
||||||
return undef;
|
return undef if( !$force );
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach my $d (keys %defs) {
|
if( !$force ) {
|
||||||
next if($defs{$d}{TYPE} ne "autocreate");
|
foreach my $d (keys %defs) {
|
||||||
return undef if(AttrVal($defs{$d}{NAME},"disable",undef));
|
next if($defs{$d}{TYPE} ne "autocreate");
|
||||||
|
return undef if(AttrVal($defs{$d}{NAME},"disable",undef));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
my $autocreated = 0;
|
my $autocreated = 0;
|
||||||
@ -646,6 +654,8 @@ netatmo_autocreate($)
|
|||||||
}
|
}
|
||||||
|
|
||||||
CommandSave(undef,undef) if( $autocreated && AttrVal( "autocreate", "autosave", 1 ) );
|
CommandSave(undef,undef) if( $autocreated && AttrVal( "autocreate", "autosave", 1 ) );
|
||||||
|
|
||||||
|
return "created $autocreated devices";
|
||||||
}
|
}
|
||||||
|
|
||||||
sub
|
sub
|
||||||
@ -1068,7 +1078,7 @@ netatmo_Attr($$$)
|
|||||||
<a name="netatmo"></a>
|
<a name="netatmo"></a>
|
||||||
<h3>netatmo</h3>
|
<h3>netatmo</h3>
|
||||||
<ul>
|
<ul>
|
||||||
xxx<br><br>
|
A Fhem module for netatmo weatherstations.<br><br>
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
<ul>
|
<ul>
|
||||||
@ -1079,12 +1089,12 @@ netatmo_Attr($$$)
|
|||||||
<b>Define</b>
|
<b>Define</b>
|
||||||
<ul>
|
<ul>
|
||||||
<code>define <name> netatmo <device></code><br>
|
<code>define <name> netatmo <device></code><br>
|
||||||
<code>define <name> netatmo PUBLIC <device> <latitude> <longitude> [<radius>]</code><br>
|
|
||||||
<code>define <name> netatmo [ACCOUNT] <username> <password> <client_id> <client_secret></code><br>
|
<code>define <name> netatmo [ACCOUNT] <username> <password> <client_id> <client_secret></code><br>
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
Defines a netatmo device.<br><br>
|
Defines a netatmo device.<br><br>
|
||||||
If a netatmo device of the account type is created all fhem devices for the netatmo devices are automaticaly created.
|
If a netatmo device of the account type is created all fhem devices for the netatmo devices are automaticaly created
|
||||||
|
(if autocreate is not disabled).
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
@ -1100,9 +1110,18 @@ netatmo_Attr($$$)
|
|||||||
<ul>
|
<ul>
|
||||||
</ul><br>
|
</ul><br>
|
||||||
|
|
||||||
|
<a name="netatmo_Set"></a>
|
||||||
|
<b>Set</b>
|
||||||
|
<ul>
|
||||||
|
<li>autocreate<br>
|
||||||
|
Create fhem devices for all netatmo devices.</li>
|
||||||
|
</ul><br>
|
||||||
|
|
||||||
<a name="netatmo_Get"></a>
|
<a name="netatmo_Get"></a>
|
||||||
<b>Get</b>
|
<b>Get</b>
|
||||||
<ul>
|
<ul>
|
||||||
|
<li>devices<br>
|
||||||
|
list the netatmo devices for this account</li>
|
||||||
<li>update<br>
|
<li>update<br>
|
||||||
trigger an update</li>
|
trigger an update</li>
|
||||||
<li>public [<station>] [<address>] <args><br>
|
<li>public [<station>] [<address>] <args><br>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user