50_HP1000: update commandref and make infix more flexible
git-svn-id: svn://svn.code.sf.net/p/fhem/code/trunk@9887 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
@@ -86,12 +86,12 @@ sub HP1000_Define($$) {
|
|||||||
return "Device already defined: " . $modules{HP1000}{defptr}{NAME}
|
return "Device already defined: " . $modules{HP1000}{defptr}{NAME}
|
||||||
if (defined($modules{HP1000}{defptr}));
|
if (defined($modules{HP1000}{defptr}));
|
||||||
|
|
||||||
$hash->{fhem}{infix} = "updateweatherstation.php";
|
$hash->{fhem}{infix} = "updateweatherstation";
|
||||||
|
|
||||||
# create global unique device definition
|
# create global unique device definition
|
||||||
$modules{HP1000}{defptr} = $hash;
|
$modules{HP1000}{defptr} = $hash;
|
||||||
|
|
||||||
HP1000_addExtension( $name, "HP1000_CGI", "updateweatherstation.php" );
|
HP1000_addExtension( $name, "HP1000_CGI", "updateweatherstation" );
|
||||||
|
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
@@ -128,16 +128,16 @@ sub HP1000_CGI() {
|
|||||||
my $webArgs;
|
my $webArgs;
|
||||||
|
|
||||||
# data received
|
# data received
|
||||||
if ( $request =~ m,^(/[^/]+?)(?:\&|\?)(.*)?$, ) {
|
if ( $request =~ /^\/updateweatherstation\.\w{3}\?(.+=.+)/ ) {
|
||||||
$link = $1;
|
$URI = $1;
|
||||||
$URI = $2;
|
|
||||||
|
|
||||||
# get device name
|
# get device name
|
||||||
$name = $data{FWEXT}{$link}{deviceName} if ( $data{FWEXT}{$link} );
|
$name = $data{FWEXT}{"/updateweatherstation"}{deviceName}
|
||||||
|
if (defined($data{FWEXT}{"/updateweatherstation"}));
|
||||||
|
|
||||||
# return error if no such device
|
# return error if no such device
|
||||||
return ( "text/plain; charset=utf-8",
|
return ( "text/plain; charset=utf-8",
|
||||||
"No HP1000 device for webhook $link" )
|
"No HP1000 device for webhook /updateweatherstation" )
|
||||||
unless ($name);
|
unless ($name);
|
||||||
|
|
||||||
# extract values from URI
|
# extract values from URI
|
||||||
@@ -200,8 +200,8 @@ sub HP1000_CGI() {
|
|||||||
$result .= " " if ($result ne "");
|
$result .= " " if ($result ne "");
|
||||||
$result .= "T:$v" if ($p eq "temperature");
|
$result .= "T:$v" if ($p eq "temperature");
|
||||||
$result .= "H:$v" if ($p eq "humidity");
|
$result .= "H:$v" if ($p eq "humidity");
|
||||||
$result .= "Tin:$v" if ($p eq "temperature_indoor");
|
$result .= "Ti:$v" if ($p eq "temperature_indoor");
|
||||||
$result .= "Hin:$v" if ($p eq "humidity_indoor");
|
$result .= "Hi:$v" if ($p eq "humidity_indoor");
|
||||||
$result .= "P:$v" if ($p eq "pressure");
|
$result .= "P:$v" if ($p eq "pressure");
|
||||||
$result .= "R:$v" if ($p eq "rain");
|
$result .= "R:$v" if ($p eq "rain");
|
||||||
$result .= "L:$v" if ($p eq "light");
|
$result .= "L:$v" if ($p eq "light");
|
||||||
@@ -232,17 +232,29 @@ sub HP1000_CGI() {
|
|||||||
<h3>
|
<h3>
|
||||||
HP1000
|
HP1000
|
||||||
</h3>
|
</h3>
|
||||||
<ul>
|
<div style="margin-left: 2em">
|
||||||
<li>Provides webhook receiver for weather station HP1000 of Fine Offset Electronics.<br>
|
<a name="HP1000define" id="HP10000define"></a> <b>Define</b>
|
||||||
|
<div style="margin-left: 2em">
|
||||||
|
<code>define <WeatherStation> HP1000 [<ID> <PASSWORD>]</code><br>
|
||||||
|
<br>
|
||||||
|
Provides webhook receiver for weather station HP1000 of Fine Offset Electronics.<br>
|
||||||
There needs to be a dedicated FHEMWEB instance with attribute webname set to "weatherstation".<br>
|
There needs to be a dedicated FHEMWEB instance with attribute webname set to "weatherstation".<br>
|
||||||
No other name will work as it's hardcoded in the HP1000 device itself!<br>
|
No other name will work as it's hardcoded in the HP1000 device itself!<br>
|
||||||
<br>
|
<br>
|
||||||
As the URI has a fixed coding as well there can only be one single HP1000 station per FHEM installation.<br>
|
As the URI has a fixed coding as well there can only be one single HP1000 station per FHEM installation.<br>
|
||||||
|
<br>
|
||||||
|
Example:<br>
|
||||||
|
<div style="margin-left: 2em">
|
||||||
|
<code># unprotected instance where ID and PASSWORD will be ignored<br>
|
||||||
|
define WeatherStation HP1000<br>
|
||||||
<br>
|
<br>
|
||||||
In your HP1000 device, make sure you use a DNS name as some revisions cannot handle IP addresses directly.<br>
|
# protected instance: Weather Station needs to be configured<br>
|
||||||
You also wanna set server type to PHP and the server port you configured in your FHEMWEB instance just mentioned above.
|
# to send this ID and PASSWORD for data to be accepted<br>
|
||||||
</li>
|
define WeatherStation HP1000 MyHouse SecretPassword</code>
|
||||||
</ul>
|
</div><br>
|
||||||
|
IMPORTANT: In your HP1000 device, make sure you use a DNS name as most revisions cannot handle IP addresses directly.<br>
|
||||||
|
</div><br>
|
||||||
|
</div>
|
||||||
|
|
||||||
=end html
|
=end html
|
||||||
|
|
||||||
@@ -254,17 +266,29 @@ sub HP1000_CGI() {
|
|||||||
<h3>
|
<h3>
|
||||||
HP1000
|
HP1000
|
||||||
</h3>
|
</h3>
|
||||||
<ul>
|
<div style="margin-left: 2em">
|
||||||
<li>Stellt einen Webhook für die HP1000 Wetterstation von Fine Offset Electronics bereit.<br>
|
<a name="HP1000define" id="HP10000define"></a> <b>Define</b>
|
||||||
|
<div style="margin-left: 2em">
|
||||||
|
<code>define <WeatherStation> HP1000 [<ID> <PASSWORD>]</code><br>
|
||||||
|
<br>
|
||||||
|
Stellt einen Webhook für die HP1000 Wetterstation von Fine Offset Electronics bereit.<br>
|
||||||
Es muss noch eine dedizierte FHEMWEB Instanz angelegt werden, wo das Attribut webname auf "weatherstation" gesetzt wurde.<br>
|
Es muss noch eine dedizierte FHEMWEB Instanz angelegt werden, wo das Attribut webname auf "weatherstation" gesetzt wurde.<br>
|
||||||
Kein anderer Name funktioniert, da dieser hard im HP1000 Ger%auml;t hinterlegt ist!<br>
|
Kein anderer Name funktioniert, da dieser hard im HP1000 Ger%auml;t hinterlegt ist!<br>
|
||||||
<br>
|
<br>
|
||||||
Da die URI ebenfalls fest kodiert ist, kann mit einer einzelnen FHEM Installation maximal eine HP1000 Station gleichzeitig verwendet werden.<br>
|
Da die URI ebenfalls fest kodiert ist, kann mit einer einzelnen FHEM Installation maximal eine HP1000 Station gleichzeitig verwendet werden.<br>
|
||||||
|
<br>
|
||||||
|
Beispiel:<br>
|
||||||
|
<div style="margin-left: 2em">
|
||||||
|
<code># ungeschützte Instanz bei der ID und PASSWORD ignoriert werden<br>
|
||||||
|
define WeatherStation HP1000<br>
|
||||||
<br>
|
<br>
|
||||||
Im HP1000 Gerä muss sichergestellt sein, dass ein DNS Name statt einer IP Adresse verwendet wird, da einige Revisionen damit nicht umgehen können.<br>
|
# geschützte Instanz: Die Wetterstation muss so konfiguriert sein, dass sie<br>
|
||||||
Der Server-Typ muss außerdem auf PHP gesetzt und der Port passend zur oben genannten FHEMWEB Instanz eingestellt sein.
|
# diese ID und PASSWORD sendet, damit Daten akzeptiert werden<br>
|
||||||
</li>
|
define WeatherStation HP1000 MyHouse SecretPassword</code>
|
||||||
</ul>
|
</div><br>
|
||||||
|
WICHTIG: Im HP1000 Gerä muss sichergestellt sein, dass ein DNS Name statt einer IP Adresse verwendet wird, da einige Revisionen damit nicht umgehen können.<br>
|
||||||
|
</div><br>
|
||||||
|
</div>
|
||||||
|
|
||||||
=end html_DE
|
=end html_DE
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user