|
From: <mc...@us...> - 2013-06-22 16:34:40
|
Revision: 1771
http://sourceforge.net/p/openautomation/code/1771
Author: mclb
Date: 2013-06-22 16:34:37 +0000 (Sat, 22 Jun 2013)
Log Message:
-----------
Die Plugins kommunizieren nun per GAs, nicht mehr ?\195?\188ber plugin_info. Somit kann man z.B. auch den Sonnenstand einer Wetterstation verwenden, und das Plugin berechne_sonnenstand weglassen.
Modified Paths:
--------------
wiregate/plugin/generic/berechne_sonnenstand.pl
wiregate/plugin/generic/beschattung_doit.pl
wiregate/plugin/generic/beschattung_freigabe.pl
Modified: wiregate/plugin/generic/berechne_sonnenstand.pl
===================================================================
--- wiregate/plugin/generic/berechne_sonnenstand.pl 2013-06-20 13:49:20 UTC (rev 1770)
+++ wiregate/plugin/generic/berechne_sonnenstand.pl 2013-06-22 16:34:37 UTC (rev 1771)
@@ -10,6 +10,7 @@
#
# \xC4nderungshistorie:
# 20130506 - mclb - Erstellung
+# 20130617 - mclb - Azimuth und Elevation werden nun zus\xE4tzlich auf GAs geschrieben.
#
#############################################################################
#
@@ -49,44 +50,54 @@
my $gv_azimuth;
my $gv_elevation;
+my $gv_gaAzimuth;
+my $gv_gaElevation;
# Read config file in conf.d
my $confFile = '/etc/wiregate/plugin/generic/conf.d/'.basename($plugname,'.pl').'.conf';
if (! -f $confFile)
{
- plugin_log($plugname, " no conf file [$confFile] found.");
+ plugin_log($plugname, "0.1 - no conf file [$confFile] found.") if ($show_debug > 0);
return "no conf file [$confFile] found.";
}
else
{
- plugin_log($plugname, " reading conf file [$confFile].") if( $show_debug > 1);
+ plugin_log($plugname, "0.2 - reading conf file [$confFile].") if ($show_debug > 0);
open(CONF, $confFile);
my @lines = <CONF>;
close($confFile);
my $result = eval("@lines");
if( $show_debug > 1 )
{
- ($result) and plugin_log($plugname, "conf file [$confFile] returned result[$result]");
+ ($result) and plugin_log($plugname, "0.3 - conf file [$confFile] returned result[$result]");
}
if ($@)
{
- plugin_log($plugname, "conf file [$confFile] returned:") if( $show_debug > 1 );
+ plugin_log($plugname, "0.4 - conf file [$confFile] returned:") if ($show_debug > 0);
my @parts = split(/\n/, $@);
if( $show_debug > 1 )
{
- plugin_log($plugname, "--> $_") foreach (@parts);
+ plugin_log($plugname, "0.5 - --> $_") foreach (@parts);
}
}
}
# Ruf mich alle 5 Minuten selbst auf und berechne Azimuth und Elevation neu
-$plugin_info{$plugname.'_cycle'} = 60;
+$plugin_info{$plugname.'_cycle'} = 300;
($gv_azimuth, $gv_elevation) = berechneSonnenstand($gv_lat, $gv_lon, $gv_elev);
-$plugin_info{'azimuth'} = $gv_azimuth;
-$plugin_info{'elevation'} = $gv_elevation;
+plugin_log($plugname, '1 - Azimuth alt: '.$plugin_info{'azimuth'}.', Azimuth neu: '.$gv_azimuth) if ($show_debug > 0);
+plugin_log($plugname, '2 - Elevation alt: '.$plugin_info{'elevation'}.', Elevation neu: '.$gv_elevation) if ($show_debug > 0);
+if ($gv_azimuth ne $plugin_info{'azimuth'} or $gv_elevation ne $plugin_info{'elevation'}) {
+ $plugin_info{'azimuth'} = $gv_azimuth;
+ $plugin_info{'elevation'} = $gv_elevation;
+
+ if ($gv_gaAzimuth ne '') { knx_write($gv_gaAzimuth, $gv_azimuth); }
+ if ($gv_gaElevation ne '') { knx_write($gv_gaElevation, $gv_elevation); }
+}
+
return 'Sonnenstand erfolgreich berechnet!';
####################################################
Modified: wiregate/plugin/generic/beschattung_doit.pl
===================================================================
--- wiregate/plugin/generic/beschattung_doit.pl 2013-06-20 13:49:20 UTC (rev 1770)
+++ wiregate/plugin/generic/beschattung_doit.pl 2013-06-22 16:34:37 UTC (rev 1771)
@@ -30,6 +30,8 @@
# 20120920 - mclb - Winter-Modus (Aktivierbar \xFCber eigene GA; Im Winter-Modus k\xF6nnen die Lamellen an eine andere Stelle zur Beschattung gefahren werden)
# 20120925 - mclb - Beschattung temperaturabh\xE4ngig aktivieren/deaktivieren
# 20130506 - mclb - Aufteilen in 2 Plugins - 1. Freigabe, 2. Ausf\xFChrung
+# 20130620 - mclb - Azimuth und Elevation werden jetzt \xFCber GAs empfangen, nicht mehr direkt vom plugin_info gelesen.
+# Somit er\xFCbrigt sich auch der zyklische Aufruf jede Minute.
#
#############################################################################
#
@@ -110,47 +112,45 @@
my $show_debug = 0; # switches debug information that will be shown in the log
my $gv_gaWinter = "";
my $gv_gaFreigabe = "";
+my $gv_gaAzimuth = "";
+my $gv_gaElevation = "";
my @gt_raffstores;
# Read config file in conf.d
my $confFile = '/etc/wiregate/plugin/generic/conf.d/'.basename($plugname,'.pl').'.conf';
-if (! -f $confFile)
-{
- plugin_log($plugname, " no conf file [$confFile] found.");
+if (! -f $confFile) {
+ plugin_log($plugname, "0.1 - no conf file [$confFile] found.") if ($show_debug > 0);
return "no conf file [$confFile] found.";
-}
-else
-{
- plugin_log($plugname, " reading conf file [$confFile].") if( $show_debug > 1);
+} else {
+ plugin_log($plugname, "0.2 - reading conf file [$confFile].") if($show_debug > 0);
open(CONF, $confFile);
my @lines = <CONF>;
close($confFile);
my $result = eval("@lines");
if( $show_debug > 1 )
{
- ($result) and plugin_log($plugname, "conf file [$confFile] returned result[$result]");
+ ($result) and plugin_log($plugname, "0.3 - conf file [$confFile] returned result[$result]");
}
if ($@)
{
- plugin_log($plugname, "conf file [$confFile] returned:") if( $show_debug > 1 );
+ plugin_log($plugname, "0.4 - conf file [$confFile] returned:") if($show_debug > 0);
my @parts = split(/\n/, $@);
if( $show_debug > 1 )
{
- plugin_log($plugname, "--> $_") foreach (@parts);
+ plugin_log($plugname, "0.5 - --> $_") foreach (@parts);
}
}
}
-# Ruf mich alle 60 Sekunden selbst auf, damit ich pr\xFCfen kann, ob die Helligkeit \xFCber-/unterschritten wurde
-$plugin_info{$plugname.'_cycle'} = 60;
+# Ruf mich garnicht zyklisch auf, nur wenn sich auf einer meiner abbonierten GAs etwas tut
+$plugin_info{$plugname.'_cycle'} = 0;
# Ruf mich auf, wenn zwischen Sommer- und Winter-Modus gewechselt wird
-if ($gv_gaWinter ne '') {
- $plugin_subscribe{$gv_gaWinter}{$plugname} = 1;
-}
+if ($gv_gaWinter ne '') { $plugin_subscribe{$gv_gaWinter}{$plugname} = 1; }
# Ruf mich auf, wenn sich die Freigabe \xE4ndert
-if ($gv_gaFreigabe ne '') {
- $plugin_subscribe{$gv_gaFreigabe}{$plugname} = 1;
-}
+if ($gv_gaFreigabe ne '') { $plugin_subscribe{$gv_gaFreigabe}{$plugname} = 1; }
+# Ruf mich auf, wenn sich der Sonnenstand \xE4ndert
+if ($gv_gaAzimuth ne '') { $plugin_subscribe{$gv_gaAzimuth}{$plugname} = 1; }
+if ($gv_gaElevation ne '') { $plugin_subscribe{$gv_gaElevation}{$plugname} = 1; }
# Ruf mich auf, wenn sich an der Sperr-GA eines Raffstores etwas \xE4ndert
# Ruf mich auf, wenn sich der Fenster-Status \xE4ndert
foreach $gs_raffstore (@gt_raffstores) {
@@ -236,14 +236,24 @@
}
} elsif ($gv_event eq EVENT_BUS) {
if ($msg{'apci'} eq "A_GroupValue_Write" and $msg{'dst'} eq $gv_gaFreigabe) {
- plugin_log($plugname, '20 - Freigabe = '.$msg{'value'});
+ plugin_log($plugname, '1 - Freigabe = '.$msg{'value'}) if ($show_debug > 0);
$plugin_info{$plugname.'_freigabe'} = $msg{'value'};
} elsif ($msg{'apci'} eq "A_GroupValue_Write" and $msg{'dst'} eq $gv_gaWinter) {
# Umschalten zwischen Sommer- und Wintermodus
+ plugin_log($plugname, '2 - Write Winter-Modus = '.$msg{'value'}) if ($show_debug > 0);
$plugin_info{$plugname.'_winterModus'} = $msg{'value'};
} elsif ($msg{'apci'} eq "A_GroupValue_Read" and $msg{'dst'} eq $gv_gaWinter) {
- # R\xFCckmeldung, ob gerade Sommer- oder Wintermodus aktiv ist
+ # Schreibe den Sommer-Winter-Modus Wert auf den Bus
+ plugin_log($plugname, '3 - Read Winter-Modus = '.$msg{'value'}) if ($show_debug > 0);
knx_write($gv_gaWinter,$plugin_info{$plugname.'_winterModus'});
+ } elsif ($msg{'apci'} eq "A_GroupValue_Write" and $msg{'dst'} eq $gv_gaAzimuth) {
+ # Neuer Azimuth-Wert
+ plugin_log($plugname, '4 - Azimuth = '.$msg{'value'}) if ($show_debug > 0);
+ $plugin_info{$plugname.'_azimuth'} = $msg{'value'};
+ } elsif ($msg{'apci'} eq "A_GroupValue_Write" and $msg{'dst'} eq $gv_gaElevation) {
+ # Neuer Elevation-Wert
+ plugin_log($plugname, '5 - Elevation = '.$msg{'value'}) if ($show_debug > 0);
+ $plugin_info{$plugname.'_elevation'} = $msg{'value'};
} else {
for ($gv_index=0; $gv_index < @gt_raffstores; $gv_index++) {
# Muss mittels for-Schleife (und nicht foreach) gemacht werden, weil ich die Werte in der Schleife updaten muss.
@@ -258,7 +268,9 @@
knx_write($gs_raffstore->{gaSperre}, $gs_raffstore->{sperre});
}
if ($msg{'apci'} eq "A_GroupValue_Write" and $msg{'dst'} eq $gs_raffstore->{gaFensterStatus}) {
+ plugin_log($plugname, '6 - Fenster-Status = '.$msg{'value'}) if ($show_debug > 0);
if ($msg{'value'} == 0) {
+ plugin_log($plugname, '6a - Fenster-Status AUTOMATIK_AUS') if ($show_debug > 0);
# Wird ein Fenster ge\xF6ffnet, dann Raffstore nach oben und Automatik aus
$gs_raffstore->{automatik} = AUTOMATIK_AUS;
$gv_rolloPos = knx_read($gs_raffstore->{gaRolloPosRM}, 5.001);
@@ -272,6 +284,7 @@
}
}
} elsif ($msg{'value'} == 1) {
+ plugin_log($plugname, '6b - Fenster-Status AUTOMATIK_EIN') if ($show_debug > 0);
# Wird ein Fenster geschlossen, dann Automatik aus
$gs_raffstore->{automatik} = AUTOMATIK_EIN;
}
@@ -282,29 +295,28 @@
$gt_raffstores[$gv_index] = $gs_raffstore;
}
}
-} elsif ($gv_event eq EVENT_SOCKET) {
-} elsif ($gv_event eq EVENT_CYCLE) {
+
# Beschattungs-Automatik
- plugin_log($plugname,'10 - Cycle-Aufruf, Sperre = '.$plugin_info{$plugname.'_sperre'}.', Freigabe = '.$plugin_info{$plugname.'_freigabe'}) if ($show_debug > 0);
+ plugin_log($plugname,'7 - Cycle-Aufruf, Sperre = '.$plugin_info{$plugname.'_sperre'}.', Freigabe = '.$plugin_info{$plugname.'_freigabe'}) if ($show_debug > 0);
if ($plugin_info{$plugname.'_sperre'} == SPERRE_INAKTIV) {
- plugin_log($plugname,'11 - Beschattung') if ($show_debug > 0);
- plugin_log($plugname,'11a - Freigabe = '.$plugin_info{$plugname.'_freigabe'}) if ($show_debug > 0);
+ plugin_log($plugname,'8 - Beschattung') if ($show_debug > 0);
+ plugin_log($plugname,'9 - Freigabe = '.$plugin_info{$plugname.'_freigabe'}) if ($show_debug > 0);
# Automatik l\xE4uft grunds\xE4tzlich
foreach $gs_raffstore (@gt_raffstores) {
- plugin_log($plugname,'12 - Aktiv = '.$gs_raffstore->{aktiv}.', Sperre = '.$gs_raffstore->{sperre}.', Automatik = '.$gs_raffstore->{automatik}) if ($show_debug > 0);
+ plugin_log($plugname,'10 - Raffstore = '.$gs_raffstore->{id}.', Aktiv = '.$gs_raffstore->{aktiv}.', Sperre = '.$gs_raffstore->{sperre}.', Automatik = '.$gs_raffstore->{automatik}) if ($show_debug > 0);
if ($gs_raffstore->{aktiv} eq AKTIV and
$gs_raffstore->{sperre} == SPERRE_INAKTIV and
$gs_raffstore->{automatik} eq AUTOMATIK_EIN) {
- plugin_log($plugname,'13 - Beschattung aktiv; Freigabe = '.$plugin_info{$plugname.'_freigabe'}) if ($show_debug > 0);
+ plugin_log($plugname,'11 - Beschattung aktiv; Freigabe = '.$plugin_info{$plugname.'_freigabe'}) if ($show_debug > 0);
# Automatik ist aktiv -> also mach nun deine Arbeit
if ($plugin_info{$plugname.'_freigabe'} eq FREIGABE_AUS) {
# Freigabe ist aufgrund der Helligkeit nicht notwendig -> Raffstore nach oben!
- plugin_log($plugname,'14 - Freigabe AUS -> Raffstores nach oben') if ($show_debug > 0);
+ plugin_log($plugname,'12 - Freigabe AUS -> Raffstores nach oben') if ($show_debug > 0);
# Raffstores hoch
$gv_rolloPos = knx_read($gs_raffstore->{gaRolloPosRM}, 5.001);
@@ -318,7 +330,7 @@
}
}
} else {
- plugin_log($plugname,'15 - Freigabe EIN -> Ausrichtungsabh\xE4ngig beschatten; Ausrichtung = '.$gs_raffstore->{ausrichtung}) if ($show_debug > 0);
+ plugin_log($plugname,'13 - Freigabe EIN -> Ausrichtungsabh\xE4ngig beschatten; Ausrichtung = '.$gs_raffstore->{ausrichtung}) if ($show_debug > 0);
if (exists($gs_raffstore->{ausrichtung})) {
#Startwinkel berechnen
@@ -344,7 +356,7 @@
exists $gs_raffstore->{maxTemperatur} and
exists $gs_raffstore->{valueTemperatur} ) {
- plugin_log($plugname,'15a - minTemperatur = '.$gs_raffstore->{minTemperatur}.', maxTemperatur = '.$gs_raffstore->{maxTemperatur}.', valueTemperatur = '.$gs_raffstore->{valueTemperatur}) if ($show_debug > 0);
+ plugin_log($plugname,'14 - minTemperatur = '.$gs_raffstore->{minTemperatur}.', maxTemperatur = '.$gs_raffstore->{maxTemperatur}.', valueTemperatur = '.$gs_raffstore->{valueTemperatur}) if ($show_debug > 0);
if ($gs_raffstore->{valueTemperatur} < $gs_raffstore->{minTemperatur}) {
$gs_raffstore->{temperaturFreigabe} = TEMPFREIGABE_AUS;
@@ -357,12 +369,12 @@
$gs_raffstore->{temperaturFreigabe} = TEMPFREIGABE_EIN;
}
- plugin_log($plugname,'16 - StartWinkel = '.$gv_startWinkel.', EndWinkel = '.$gv_endWinkel.', Azimuth = '.$plugin_info{'azimuth'}) if ($show_debug > 0);
- plugin_log($plugname,'16a - TemperaturFreigabe = '.$gs_raffstore->{temperaturFreigabe}) if ($show_debug > 0);
+ plugin_log($plugname,'15 - StartWinkel = '.$gv_startWinkel.', EndWinkel = '.$gv_endWinkel.', Azimuth = '.$plugin_info{$plugname.'_azimuth'}) if ($show_debug > 0);
+ plugin_log($plugname,'16 - TemperaturFreigabe = '.$gs_raffstore->{temperaturFreigabe}) if ($show_debug > 0);
# Aktuelle Sonnenposition verwenden um zu bestimmen, ob der Raffstore gerade beschattet werden muss
- if ($plugin_info{'azimuth'} >= $gv_startWinkel and
- $plugin_info{'azimuth'} <= $gv_endWinkel and
+ if ($plugin_info{$plugname.'_azimuth'} >= $gv_startWinkel and
+ $plugin_info{$plugname.'_azimuth'} <= $gv_endWinkel and
$gs_raffstore->{temperaturFreigabe} eq TEMPFREIGABE_EIN) {
# Beschattung aufgrund der Ausrichtung und Raumtemperatur
@@ -370,10 +382,13 @@
# Raffstore runter
$gv_rolloPos = knx_read($gs_raffstore->{gaRolloPosRM}, 5.001);
if ($plugin_info{$plugname.'_winterModus'} == 1) {
+ plugin_log($plugname,'17 - WinterModus = 1 - rolloBeschattungspos = '.$gs_raffstore->{rolloBeschattungsposWinter}) if ($show_debug > 0);
$gv_rolloBeschattungspos = $gs_raffstore->{rolloBeschattungsposWinter};
} else {
+ plugin_log($plugname,'18 - WinterModus = 0 - rolloBeschattungspos = '.$gs_raffstore->{rolloBeschattungspos}) if ($show_debug > 0);
$gv_rolloBeschattungspos = $gs_raffstore->{rolloBeschattungspos};
}
+ plugin_log($plugname,'19 - rolloPos = '.$gv_rolloPos.', rolloBeschattungsPos = '.$gv_rolloBeschattungspos) if ($show_debug > 0);
if ($gv_rolloPos != $gv_rolloBeschattungspos) {
knx_write($gs_raffstore->{gaRolloPos}, $gv_rolloBeschattungspos, 5.001);
}
@@ -392,7 +407,7 @@
} else {
$gv_lamellePosNeu = (90 - $plugin_info{$plugname.'_elevation'})/90*100;
# Faktor f\xFCr die Abweichung der Sonne von der Ausrichtung des Fensters miteinbeziehen
- $gv_lamellePosNeu = $gv_lamellePosNeu * (1 - (abs($plugin_info{'azimuth'} - $gs_raffstore->{ausrichtung}) * 0.01));
+ $gv_lamellePosNeu = $gv_lamellePosNeu * (1 - (abs($plugin_info{$plugname.'_azimuth'} - $gs_raffstore->{ausrichtung}) * 0.01));
# Der Wert f\xFCr den Lamellenwinkel muss immer zwischen 0 und 100 sein! Alles dar\xFCber hinaus wird fix auf 0 bzw. 100 gesetzt.
if ($gv_lamellePosNeu < 0) { $gv_lamellePosNeu = 0; }
if ($gv_lamellePosNeu > 100) { $gv_lamellePosNeu = 100; }
@@ -422,6 +437,8 @@
}
}
}
+} elsif ($gv_event eq EVENT_SOCKET) {
+} elsif ($gv_event eq EVENT_CYCLE) {
}
# Dynamische Werte der Raffstore-Definition im plugin_info merken
Modified: wiregate/plugin/generic/beschattung_freigabe.pl
===================================================================
--- wiregate/plugin/generic/beschattung_freigabe.pl 2013-06-20 13:49:20 UTC (rev 1770)
+++ wiregate/plugin/generic/beschattung_freigabe.pl 2013-06-22 16:34:37 UTC (rev 1771)
@@ -8,6 +8,8 @@
#
# \xC4nderungshistorie:
# 20130506 - mclb - Erstellung
+# 20130617 - mclb - Sonnenstand wird nun mittels GAs erhalten
+# Somit k\xF6nnen nun die Werte z.B. einer Wetterstation verwendet werden.
#
#############################################################################
#
@@ -62,32 +64,34 @@
my $gv_gaHelligkeit = "";
my $gv_gaSperre = "";
my $gv_gaFreigabe = "";
+my $gv_gaAzimuth = "";
+my $gv_gaElevation = "";
# Read config file in conf.d
my $confFile = '/etc/wiregate/plugin/generic/conf.d/'.basename($plugname,'.pl').'.conf';
if (! -f $confFile)
{
- plugin_log($plugname, " no conf file [$confFile] found.");
+ plugin_log($plugname, "0.1 - no conf file [$confFile] found.") if ($show_debug > 0);
return "no conf file [$confFile] found.";
}
else
{
- plugin_log($plugname, " reading conf file [$confFile].") if( $show_debug > 0);
+ plugin_log($plugname, "0.2 - reading conf file [$confFile].") if ($show_debug > 0);
open(CONF, $confFile);
my @lines = <CONF>;
close($confFile);
my $result = eval("@lines");
if( $show_debug > 0 )
{
- ($result) and plugin_log($plugname, "conf file [$confFile] returned result[$result]");
+ ($result) and plugin_log($plugname, "0.3 - conf file [$confFile] returned result[$result]");
}
if ($@)
{
- plugin_log($plugname, "conf file [$confFile] returned:") if( $show_debug > 0 );
+ plugin_log($plugname, "0.4 - conf file [$confFile] returned:") if ($show_debug > 0);
my @parts = split(/\n/, $@);
if( $show_debug > 0 )
{
- plugin_log($plugname, "--> $_") foreach (@parts);
+ plugin_log($plugname, "0.5 - --> $_") foreach (@parts);
}
}
}
@@ -95,13 +99,12 @@
# Ruf mich alle 60 Sekunden selbst auf, damit ich pr\xFCfen kann, ob die Helligkeit \xFCber-/unterschritten wurde
$plugin_info{$plugname.'_cycle'} = 60;
# Ruf mich auf, wenn sich die Helligkeit \xE4ndert, damit ich meine Helligkeits-Variable setzen kann
-if ($gv_gaHelligkeit ne '') {
- $plugin_subscribe{$gv_gaHelligkeit}{$plugname} = 1;
-}
+if ($gv_gaHelligkeit ne '') { $plugin_subscribe{$gv_gaHelligkeit}{$plugname} = 1; }
# Ruf mich auf, wenn die Automatik gesperre oder freigegeben wird
-if ($gv_gaSperre ne '') {
- $plugin_subscribe{$gv_gaSperre}{$plugname} = 1;
-}
+if ($gv_gaSperre ne '') { $plugin_subscribe{$gv_gaSperre}{$plugname} = 1; }
+# Ruf mich auf, wenn sich der Sonnenstand \xE4ndert
+if ($gv_gaAzimuth ne '') { $plugin_subscribe{$gv_gaAzimuth}{$plugname} = 1; }
+if ($gv_gaElevation ne '') { $plugin_subscribe{$gv_gaElevation}{$plugname} = 1; }
# Aus welchem Grund l\xE4uft das Plugin gerade
my $gv_event=undef;
@@ -117,7 +120,7 @@
$gv_event = EVENT_CYCLE; # Zyklus
}
-plugin_log($plugname, "0 - Event: ".$gv_event) if ($show_debug > 0);
+plugin_log($plugname, "1 - Event: ".$gv_event) if ($show_debug > 0);
if ($gv_event eq EVENT_RESTART) {
# Default nicht beschatten, falls der Wert noch nicht existiert
@@ -156,15 +159,19 @@
$plugin_info{$plugname.'_beschattungEinTime'} = $gv_zeitpunkt;
}
} elsif ($gv_event eq EVENT_BUS) {
- if ($msg{'apci'} eq "A_GroupValue_Write" and $msg{'dst'} eq $gv_gaHelligkeit) {
+ if ($msg{'apci'} eq "A_GroupValue_Write" and $msg{'dst'} eq $gv_gaAzimuth) {
+ $plugin_info{$plugname.'_azimuth'} = $msg{'value'};
+ } elsif ($msg{'apci'} eq "A_GroupValue_Write" and $msg{'dst'} eq $gv_gaElevation) {
+ $plugin_info{$plugname.'_elevation'} = $msg{'value'};
+ } elsif ($msg{'apci'} eq "A_GroupValue_Write" and $msg{'dst'} eq $gv_gaHelligkeit) {
# Aufruf durch Helligkeits-Telegramm
$gv_helligkeit = $msg{'value'};
# Azimuth und Elevation einlesen, damit ich bestimmen kann, ob beschattet werden muss, oder nicht.
- $gv_elevation = $plugin_info{'elevation'};
- $gv_azimuth = $plugin_info{'azimuth'};
+ $gv_azimuth = $plugin_info{$plugname.'_azimuth'};
+ $gv_elevation = $plugin_info{$plugname.'_elevation'};
- plugin_log($plugname, "1 - Elevation: ".$gv_elevation." , Helligkeit: ".$gv_helligkeit) if ($show_debug > 0);
+ plugin_log($plugname, "2 - Elevation: ".$gv_elevation." , Helligkeit: ".$gv_helligkeit) if ($show_debug > 0);
# Pr\xFCfen, ob das Telegramm etwas am aktuellen Status \xE4ndert und ggf. merken
if ($gv_elevation > 0 and $gv_elevation <= 10 and $gv_helligkeit >= 10000) { $gv_beschattungEin = 'J'; }
@@ -182,7 +189,7 @@
if ($gv_elevation > 40 and $gv_elevation <= 50 and $gv_helligkeit < 50000) { $gv_beschattungEin = 'N'; }
if ($gv_elevation > 50 and $gv_elevation <= 90 and $gv_helligkeit < 75000) { $gv_beschattungEin = 'N'; }
- plugin_log($plugname, "2 - Beschattung ein: ".$gv_beschattungEin) if ($show_debug > 0);
+ plugin_log($plugname, "3 - Beschattung ein: ".$gv_beschattungEin) if ($show_debug > 0);
# Abh\xE4ngig vom letzten g\xFCltigen Wert den neuen beschattungEin setzen
if ($gv_beschattungEin eq 'J' and $plugin_info{$plugname.'_beschattungEin'} eq BESCHATTUNG_AUS) {
@@ -204,8 +211,8 @@
# Aufruf durch Zyklus
$plugin_info{$plugname.'_beschattungFreigabeOld'} = $plugin_info{$plugname.'_beschattungFreigabe'};
- $gv_azimuth = $plugin_info{'azimuth'};
- $gv_elevation = $plugin_info{'elevation'};
+ $gv_azimuth = $plugin_info{$plugname.'_azimuth'};
+ $gv_elevation = $plugin_info{$plugname.'_elevation'};
# Pr\xFCfen, ob die Beschattung aktiviert oder deaktiviert werden muss
if ($plugin_info{$plugname.'_beschattungEin'} eq BESCHATTUNG_EIN and
@@ -215,10 +222,10 @@
($gv_sekunden, $gv_minuten, $gv_stunden, $gv_monatstag, $gv_monat, $gv_jahr, $gv_wochentag, $gv_jahrestag, $gv_sommerzeit) = localtime(time);
$gv_zeitpunkt = $gv_minuten + ($gv_stunden*60);
$gv_zeitdifferenz = $gv_zeitpunkt - $plugin_info{$plugname.'_beschattungEinTime'};
- plugin_log($plugname, "3a - Zeit neu: ".$gv_zeitpunkt.", Zeit alt: ".$plugin_info{$plugname.'_beschattungEinTime'}.", Differenz: ".$gv_zeitdifferenz) if ($show_debug > 0);
+ plugin_log($plugname, "4 - Zeit neu: ".$gv_zeitpunkt.", Zeit alt: ".$plugin_info{$plugname.'_beschattungEinTime'}.", Differenz: ".$gv_zeitdifferenz) if ($show_debug > 0);
if ($gv_zeitdifferenz > 5) {
$plugin_info{$plugname.'_beschattungFreigabe'} = FREIGABE_EIN;
- knw_write($gv_gaFreigabe, 1);
+ knx_write($gv_gaFreigabe, 1);
}
} elsif ( ($plugin_info{$plugname.'_beschattungEin'} eq BESCHATTUNG_AUS or
$plugin_info{$plugname.'_sperre'} == 1) and
@@ -227,10 +234,10 @@
($gv_sekunden, $gv_minuten, $gv_stunden, $gv_monatstag, $gv_monat, $gv_jahr, $gv_wochentag, $gv_jahrestag, $gv_sommerzeit) = localtime(time);
$gv_zeitpunkt = $gv_minuten + ($gv_stunden*60);
$gv_zeitdifferenz = $gv_zeitpunkt - $plugin_info{$plugname.'_beschattungEinTime'};
- plugin_log($plugname, "3b - Zeit neu: ".$gv_zeitpunkt.", Zeit alt: ".$plugin_info{$plugname.'_beschattungEinTime'}.", Differenz: ".$gv_zeitdifferenz) if ($show_debug > 0);
+ plugin_log($plugname, "5 - Zeit neu: ".$gv_zeitpunkt.", Zeit alt: ".$plugin_info{$plugname.'_beschattungEinTime'}.", Differenz: ".$gv_zeitdifferenz) if ($show_debug > 0);
if ($gv_zeitdifferenz > 15) {
$plugin_info{$plugname.'_beschattungFreigabe'} = FREIGABE_AUS;
- knw_write($gv_gaFreigabe, 0);
+ knx_write($gv_gaFreigabe, 0);
}
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|