|
From: <hu...@us...> - 2012-07-13 07:54:24
|
Revision: 917
http://openautomation.svn.sourceforge.net/openautomation/?rev=917&view=rev
Author: hubermi
Date: 2012-07-13 07:54:14 +0000 (Fri, 13 Jul 2012)
Log Message:
-----------
Neue Version ETA_PU von haegar80
Modified Paths:
--------------
wiregate/plugin/generic/ETA_PU.pl
Modified: wiregate/plugin/generic/ETA_PU.pl
===================================================================
--- wiregate/plugin/generic/ETA_PU.pl 2012-07-10 15:37:42 UTC (rev 916)
+++ wiregate/plugin/generic/ETA_PU.pl 2012-07-13 07:54:14 UTC (rev 917)
@@ -1,5 +1,5 @@
# Plugin: Schnittstelle zum Pelletskessel ETA-PU
-# Version 1.0
+# Version 1.1
# License: GPL (v3)
# Dieses Plugin dient als Schnittstelle zwischen KNX und dem ETA Heizkessel PU (Pellets Unit).
@@ -11,7 +11,6 @@
# CAN-BUS-URI können in der XML-Datei für die Menüstruktur entnommen werden:
# http://ip:port/user/menu
-
# Aktuell werden folgende Features unterstützt:
# 1. Lesen von festgelegten Kesseldaten in einem festgelegten Intervall (aktuell 1 Minute):
# - Schreiben der Kesselwerte auf KNX-Gruppenadressen
@@ -51,9 +50,9 @@
# Kontaktaufnahme bitte über das knx-user-forum.de
-
## Beginn Definitionen ##
my $IP_PU = "192.168.10.11:8080";
+my $TimeoutSek = 5;
my $ResVariables = "/user/vars";
my $ResSingleVariable = "/user/var";
my $ResErrors = "/user/errors";
@@ -65,7 +64,6 @@
my $GA_AnzahlFehler = "10/0/4";
my $DPT_GA_AnzahlFehler = "5.010";
-
# Mapping ETA can-bus-uri zu Gruppenadressen für Werte aus string Rückgaben
my %string_GA_URI_mapping = (
'10/0/0' => '112/10021/0/0/12000', # Kessel - Kesselstatus (Text)
@@ -253,15 +251,13 @@
## Ende Definitionen ##
#Module laden
-use strict;
use warnings;
use LWP::UserAgent;
use XML::Parser;
-use IO::File;
# Plugin alle 1 Minuten aufrufen
-$plugin_info{$plugname.'_cycle'} = 60*1;
+$plugin_info{$plugname.'_cycle'} = 60*2;
#Letzte Laufzeit protokollieren
update_rrd("LaufzeitPlugin_".$plugname,"",$plugin_info{$plugname.'_runtime'});
@@ -274,9 +270,10 @@
# ETA Variablenset anlegen, wenn Plugin durch Speichern aufgerufen
my $SetVar;
-if ((stat('/etc/wiregate/plugin/generic/' . $plugname))[9] > time()-10) {
+# Code vor PL30
+#if ((stat('/etc/wiregate/plugin/generic/' . $plugname))[9] > time()-10) {
# Code nach PL30
-#if = ($plugin_info{$plugname.'_lastsaved'} > $plugin_info{$plugname.'_last'} or $plugin_info{$plugname.'_lastSetVariable'} == 0) {
+if ($plugin_info{$plugname.'_lastsaved'} > $plugin_info{$plugname.'_last'} or $plugin_info{$plugname.'_lastSetVariable'} == 0) {
$SetVar = 1;
}
@@ -436,14 +433,8 @@
my ($type, $url) = @_;
my $request = HTTP::Request->new($type => $url);
my $ua = LWP::UserAgent->new;
+ $ua->timeout($TimeoutSek);
my $response = $ua->request($request);
- #unless ($response->is_success) {
- # die $response->status_line;
- #}
- if ($url =~ m|http://localhost:|) {
- # Sleep to allow testing with nc -l 8080 -w 1
- sleep 1;
- }
if ($response->content eq undef) {
return 'Abfrage '.$type.' - '.$url.' fehlgeschlagen' ;
}
@@ -509,14 +500,8 @@
sub post_request {
my ($url, %form) = @_;
my $ua = LWP::UserAgent->new;
+ $ua->timeout($TimeoutSek);
my $response = $ua->post($url, \%form);
- #unless ($response->is_success) {
- # die $response->status_line;
- #
- if ($url =~ m|http://localhost:|) {
- # Sleep to allow testing with nc -l 8080 -w 1
- sleep 1;
- }
return $response->content;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|