From fcd57082d62e07d780713b849dbac6a6756a84ae Mon Sep 17 00:00:00 2001 From: loredo Date: Sun, 8 Jul 2018 01:28:41 +0000 Subject: [PATCH] HP1000: add new attribute webhookFWinstances git-svn-id: https://svn.fhem.de/fhem/trunk@16958 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/50_HP1000.pm | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/fhem/FHEM/50_HP1000.pm b/fhem/FHEM/50_HP1000.pm index b005fab67..85fbb3be8 100755 --- a/fhem/FHEM/50_HP1000.pm +++ b/fhem/FHEM/50_HP1000.pm @@ -140,6 +140,9 @@ sub HP1000_Initialize($) { Log3 undef, 1, $ret if ($ret); } + my $webhookFWinstance = + join( ",", devspec2array('TYPE=FHEMWEB:FILTER=TEMPORARY!=1') ); + $hash->{GetFn} = "HP1000_Get"; $hash->{DefFn} = "HP1000_Define"; $hash->{UndefFn} = "HP1000_Undefine"; @@ -147,7 +150,7 @@ sub HP1000_Initialize($) { $hash->{parseParams} = 1; $hash->{AttrList} = -"disable:1,0 disabledForIntervals do_not_notify:1,0 wu_push:1,0 wu_indoorValues:1,0 wu_id wu_password wu_realtime:1,0 wu_dataValues extSrvPush_Url stateReadingsLang:en,de,at,ch,nl,fr,pl stateReadings stateReadingsFormat:0,1 " +"disable:1,0 disabledForIntervals do_not_notify:1,0 wu_push:1,0 wu_indoorValues:1,0 wu_id wu_password wu_realtime:1,0 wu_dataValues extSrvPush_Url stateReadingsLang:en,de,at,ch,nl,fr,pl webhookFWinstances:sortable-strict,$webhookFWinstance stateReadings stateReadingsFormat:0,1 " . $readingFnAttributes; my @wu; @@ -412,14 +415,8 @@ sub HP1000_CGI() { return ( "text/plain; charset=utf-8", "Booting up" ) unless ($init_done); - # incorrect FHEMWEB instance used - if ( AttrVal( $FW_wname, "webname", "fhem" ) ne "weatherstation" ) { - return ( "text/plain; charset=utf-8", - "incorrect FHEMWEB instance to receive data" ); - } - # data received - elsif ( $request =~ /^\/updateweatherstation\.(\w{3})\?(.+=.+)/ ) { + if ( $request =~ /^\/updateweatherstation\.(\w{3})\?(.+=.+)/ ) { $servertype = lc($1); $URI = $2; @@ -432,6 +429,14 @@ sub HP1000_CGI() { "No HP1000 device for webhook /updateweatherstation" ) unless ( IsDevice( $name, 'HP1000' ) ); + # incorrect FHEMWEB instance used + my @webhookFWinstances = split( ",", + AttrVal( $name, "webhookFWinstances", "weatherstation" ) ); + + return ( "text/plain; charset=utf-8", + "incorrect FHEMWEB instance to receive data" ) + unless ( $FW_wname ~~ @webhookFWinstances ); + # extract values from URI foreach my $pv ( split( "&", $URI ) ) { next if ( $pv eq "" ); @@ -1599,6 +1604,9 @@ sub HP1000_HistoryDb($$;$$$) {
  • readingFnAttributes

  • +
  • webhookFWinstances
  • + Explicitly specify allowed FHEMWEB instaces for data input (defaults to weatherstation) +
  • wu_id
  • Weather Underground (Wunderground) station ID @@ -1671,6 +1679,9 @@ sub HP1000_HistoryDb($$;$$$) {
  • readingFnAttributes

  • +
  • webhookFWinstances
  • + Explizite Angabe der FHEMWEB Instanzen, äber die Dateneingaben erlaubt sind (Standard ist weatherstation) +
  • wu_id
  • Weather Underground (Wunderground) Stations ID