Hoi
Ja, das denke ich auch.
Code: Alles auswählen
watch -n 1 ./app/plugin_status.pl
Code: Alles auswählen
#############################################################################
# Plugin StateSave
# V0.5 2011-09-18
# Copyright: Christian Mayer (mail at ChristianMayer.de)
# License: GPL (v3)
#
# Plugin to remember states on the bus if over power failures
#
# TODO: DPT is currently required - but it should be optional
#############################################################################
# COMPILE_PLUGIN
#############################################################################
# Configuration:
# The %states hash defines the global names to use in the plugins in the form of
# $plugin_info{'Global_...'}
# as well as the KNX GA
# Syntax:
# 'Global_Name' => [ 'KNX GA', 'Initial Value', 'DPT (optional)', 'cachetime (optional)' ],
my %states = (
'Global_Sperre_HTH' => [ 'x/y/z', 0, 1 , 86400],
'Global_Sperre_Rollladen' => [ 'x/y/z', 0, 1 ],
.....
'Global_Status_Trockner' => [ 'x/y/z', 0, 7],
);
my $reset_states = 0; # set to 1 to reset the states, run script and change to 0 again
my $show_debug = 0; # switches debug information that will be shown in the log
#############################################################################
# Do NOT change anything below!
#############################################################################
#############################################################################
# Initialisation
for my $this_state ( keys %states )
{
# Initialise global variable an the bus
if( $reset_states or not exists $plugin_info{ $this_state } )
{
$plugin_info{ $this_state } = $states{ $this_state }[1];
knx_write( $states{ $this_state }[0], $plugin_info{ $this_state }, $states{ $this_state }[2] );
}
# subscribe GA
$plugin_subscribe{ $states{ $this_state }[0] }{ $plugname } = 1;
}
# No cycling, run only on request
$plugin_info{$plugname.'_cycle'} = 0;
my $ret_val = '';
#############################################################################
# Handle the bus traffic
# Early exit during a response messeage - it's usually from us...
if( $msg{'apci'} eq 'A_GroupValue_Response' )
{
return;
}
# a linear search isn't smart but OK for only a few states:
for my $this_state ( keys %states )
{
my $GA = $states{ $this_state }[0];
my $DPT = $states{ $this_state }[2];
my $cache = $states{ $this_state }[3] || 0;
if( $msg{'dst'} eq $GA )
{
$ret_val .= $GA . '[' . $DPT . ']:';
if( $msg{'apci'} eq 'A_GroupValue_Read' )
{
$ret_val .= 'read <- "' . $plugin_info{ $this_state } . '";';
knx_write( $GA, $plugin_info{ $this_state }, $DPT, 1 ); # send response
}
elsif($msg{'apci'} eq 'A_GroupValue_Write')
{
# read from eibd cache, so we'll the cast for free:
my $v = knx_read( $GA, $cache, $DPT );
$ret_val .= 'write: "' . $plugin_info{ $this_state } . '" -> "' . $v . '";';
$plugin_info{ $this_state } = $v;
}
}
}
if( $show_debug ) { return $ret_val; }
return;
Code: Alles auswählen
my $max = 25;
print(sprintf("%-*s %-6s %-19s %s\n", $max, 'name', 'cycle', 'last call', 'last result'));
for my $key (sort keys %plugins) {
my $cycle = $plugins{$key}{'cycle'};
if (!$cycle) {
$cycle = 0;
}
print(sprintf("%-*s %-6d %-19s %s\n", $max, $key, $cycle,
strftime("%Y-%m-%d %H:%M:%S", localtime($plugins{$key}{'last'})),
$plugins{$key}{'result'}));
}
Nur 'ne Frage. Es würde vieles vereinfachen ....wiregate-plugin-Container mit nginx, php und mysql
#1Beitrag von jensgulow » Di Okt 01, 2019 7:29 am
Der Titel verät bereits meinen Wunsch. Ich habe mir den Standard-Container installiert. Es ist schon mühsam die einzelnen weiteren Komponenten hier hinein zu bekommen. Daher die Frage nach einem "erweiterten" wiregate-plugins Container. Mit den o.g. zusätzlichen Komponenten würde er im Prinzip fast alles abdecken, was ich mit dem wiregate so veranstaltet habe.
Code: Alles auswählen
root@2789b584310b:/# ./app/plugin_status_new.pl
max = 33
name cycle last call last result
StateSave.pl 0 2019-10-04 20:35:31
Status_HTH.pl 0 2019-10-04 19:47:34 1 Handtuch-Heizkoerper an: HTH OG
Status_Lampen_EG.pl 0 2019-10-04 20:27:36 3 Lampen an: Kueche Decke,Esstisch Decke,EG Treppe OG
Status_Lampen_KG.pl 0 2019-10-04 20:01:26 1 Lampe an: UG Treppe EG
Status_Lampen_OG.pl 0 2019-10-04 20:35:06 1 Lampe an: Johanna Decke
advent.pl 43200 2019-10-04 08:58:05 0
apixuweather.pl 600 2019-10-04 20:28:16
chumby_wecker_verarbeitung.pl 59 2019-10-04 20:35:13
emx_sonne.pl 86399 2019-10-04 03:11:14 86399
hth_zeitschalter.pl 300 2019-10-04 20:31:54
saunaTemp.pl 0 2019-10-04 20:33:49
steuerung_trockner_fb_dect_200.pl 60 2019-10-04 20:34:49
steuerung_wama_fb_dect_200.pl 60 2019-10-04 20:35:31 Waschmaschine waescht
windspeed.pl 0 2019-10-04 20:35:22 2.65 m/s, 7.95 km/h, Beaufort: 2
Da der Logikprozessor vermutlich sehr intensiv genutzt wird/wurde? Lohnt es sich diese Anpassung in der Knowledge Base zu beschreiben?tger977 hat geschrieben: ↑Do Aug 29, 2019 9:32 pmAlso bei mir waren diese Zeilen nur im Logikprozessor in der subroutine für das prowl/NMA Modul drin und auch nur dafür nötig. Da ich beides nicht nutze passiert da bei mir sonst gar nichts und sollte damit für alle anderen Logiken unkritisch sein!Robosoc hat geschrieben: ↑Di Aug 27, 2019 9:25 pm Die Fehler habe ich mir erstmal weggesprengt, indem ich die folgenden Zeilen in der .pl-Datei mit der Raute unwirksam gemacht habe:
# use LWP::UserAgent;
# use URI::Escape;
Das führt mit Sicherheit früher oder später zu Ausführungsproblemen meiner Logiken, aber zumindest bei dem Thema UserAgent habe ich eine Idee, wann auf dieses Subroutinen zugeriffen werden und deaktivere entsprechend die Logiken, die das Triggern.
Jemand eine Idee, wann URI::Escape benötigt wird?
Code: Alles auswählen
2019-11-16 20:47:03 Can't locate Net/SMTP/SSL.pm in @INC (you may need to install the Net::SMTP::SSL module) (@INC contains: /usr/share/bcusdk /app /etc/perl /usr/local/lib/arm-linux-gnueabihf/perl/5.24.1 /usr/local/share/perl/5.24.1 /usr/lib/arm-linux-gnueabihf/perl5/5.24 /usr/share/perl5 /usr/lib/arm-linux-gnueabihf/perl/5.24 /usr/share/perl/5.24/usr/local/lib/site_perl /usr/lib/arm-linux-gnueabihf/perl-base
So gehts:bluegaspode hat geschrieben: ↑Sa Nov 16, 2019 8:53 pm So - alle Plugins laufen durch Anpassungen inzwischen, bis auf das letzte störrische:
https://github.com/OpenAutomationProjec ... gateway.pl