2010-05-03 03:38:08 +00:00
|
|
|
#!/usr/bin/perl
|
2009-09-11 07:34:12 +00:00
|
|
|
##############################################
|
2010-05-03 03:38:08 +00:00
|
|
|
#
|
2009-09-11 07:34:12 +00:00
|
|
|
# VarDump for FHEM-Devices
|
2010-05-03 03:38:08 +00:00
|
|
|
#
|
|
|
|
##############################################
|
|
|
|
#
|
|
|
|
# Copyright notice
|
|
|
|
#
|
|
|
|
# (c) 2009 - 2010
|
|
|
|
# Copyright: Axel Rieger (fhem BEI anax PUNKT info)
|
|
|
|
# All rights reserved
|
|
|
|
#
|
|
|
|
# This script free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# The GNU General Public License can be found at
|
|
|
|
# http://www.gnu.org/copyleft/gpl.html.
|
|
|
|
# A copy is found in the textfile GPL.txt and important notices to the license
|
|
|
|
# from the author is found in LICENSE.txt distributed with these scripts.
|
|
|
|
#
|
|
|
|
# This script is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
2009-09-11 07:34:12 +00:00
|
|
|
##############################################
|
|
|
|
# Installation
|
|
|
|
# 99_dumpdef.pm ins FHEM-Verzeichis kopieren
|
|
|
|
# dann: "reload 99_dumpdef.pm"
|
|
|
|
##############################################
|
|
|
|
# Aufruf: dumpdef "DEVICE-NAME"
|
|
|
|
##############################################
|
|
|
|
# Aufruf: dumpdef <XXX>
|
|
|
|
# <MOD> = %modules
|
|
|
|
# <SEL> = %selectlist
|
2010-05-03 03:38:08 +00:00
|
|
|
# <VAL> = %value
|
2009-09-11 07:34:12 +00:00
|
|
|
# <CMD> = %cmds
|
|
|
|
# <DAT> = %data
|
|
|
|
##############################################
|
|
|
|
package main;
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
use POSIX;
|
|
|
|
use Data::Dumper;
|
2010-05-03 03:38:08 +00:00
|
|
|
use vars qw(%data);
|
|
|
|
use vars qw(%cmds);
|
|
|
|
use vars qw(%attr);
|
|
|
|
use vars qw(%defs);
|
|
|
|
use vars qw(%modules);
|
|
|
|
use vars qw(%selectlist);
|
2009-09-11 07:34:12 +00:00
|
|
|
sub Commanddumpdef($);
|
|
|
|
|
|
|
|
#####################################
|
|
|
|
sub
|
|
|
|
dumpdef_Initialize($)
|
|
|
|
{
|
|
|
|
my %lhash = ( Fn=>"Commanddumpdef",
|
|
|
|
Hlp=>"Dump <devspec> to FHEMWEB & LOG" );
|
|
|
|
$cmds{dumpdef} = \%lhash;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#####################################
|
|
|
|
sub Commanddumpdef($)
|
|
|
|
{
|
|
|
|
my ($cl, $d) = @_;
|
2010-05-03 03:38:08 +00:00
|
|
|
# $d = $a[1];
|
2009-09-11 07:34:12 +00:00
|
|
|
return "Usage: dumpdef <DeviceName>" if(!$d);
|
|
|
|
my($package, $filename, $line, $subroutine) = caller(3);
|
|
|
|
my $r = "CALLER => $package: $filename LINE: $line SUB: $subroutine \n";
|
|
|
|
$r .= "SUB-NAME: " .(caller(0))[3] . "\n";
|
2010-05-03 03:38:08 +00:00
|
|
|
$r .= "--------------------------------------------------------------------------------\n";
|
|
|
|
$Data::Dumper::Maxdepth = 4;
|
2009-09-11 07:34:12 +00:00
|
|
|
if($d eq "CMD") {$r .= Dumper(%cmds) . "\n"; return $r; }
|
|
|
|
if($d eq "DAT") {$r .= Dumper(%data) . "\n"; return $r; }
|
|
|
|
if($d eq "MOD") {$r .= Dumper(%modules) . "\n"; return $r; }
|
|
|
|
if($d eq "SEL") {$r .= Dumper(%selectlist) . "\n"; return $r; }
|
2010-05-03 03:38:08 +00:00
|
|
|
if($d eq "DEF") {$r .= Dumper(%defs) . "\n"; return $r; }
|
|
|
|
|
2009-09-11 07:34:12 +00:00
|
|
|
if(!defined($defs{$d})) {
|
|
|
|
return "Unkown Device";}
|
|
|
|
$r .= "DUMP-DEVICE: $d \n";
|
|
|
|
$r .= Dumper($defs{$d}) . "\n";
|
2010-05-03 03:38:08 +00:00
|
|
|
$r .= "--------------------------------------------------------------------------------\n";
|
2009-09-11 07:34:12 +00:00
|
|
|
$r .= "DUMP-DEVICE-ATTR \n";
|
|
|
|
$r .= Dumper($attr{$d}) . "\n";
|
2010-05-03 03:38:08 +00:00
|
|
|
$r .= "--------------------------------------------------------------------------------\n";
|
|
|
|
$r .= "DUMP-DEVICE-Module \n";
|
|
|
|
$r .= Dumper($modules{$defs{$d}{TYPE}}) . "\n";
|
2009-09-11 07:34:12 +00:00
|
|
|
return $r;
|
|
|
|
}
|
|
|
|
1;
|