MAX: split common data into MaxCommon.pm

git-svn-id: https://svn.fhem.de/fhem/trunk@2667 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
mgehre 2013-02-08 19:44:12 +00:00
parent d350712d63
commit 555d6d0fd5
4 changed files with 59 additions and 50 deletions

View File

@ -7,8 +7,8 @@ use strict;
use warnings;
use MIME::Base64;
use POSIX;
use MaxCommon;
require "10_MAX.pm";
our %msgCmd2Id;
our %device_types;

View File

@ -11,6 +11,7 @@ package main;
use strict;
use warnings;
use MIME::Base64;
use MaxCommon;
sub MAX_Define($$);
sub MAX_Undef($$);
@ -22,19 +23,6 @@ sub MAX_DateTime2Internal($);
my @ctrl_modes = ( "auto", "manual", "temporary", "boost" );
use vars qw(%device_types);
use vars qw(%msgId2Cmd);
use vars qw(%msgCmd2Id);
%device_types = (
0 => "Cube",
1 => "HeatingThermostat",
2 => "HeatingThermostatPlus",
3 => "WallMountedThermostat",
4 => "ShutterContact",
5 => "PushButton"
);
my %boost_durations = (0 => 0, 1 => 5, 2 => 10, 3 => 15, 4 => 20, 5 => 25, 6 => 30, 7 => 60);
my %boost_durationsInv = reverse %boost_durations;
@ -64,41 +52,6 @@ my %readingDef = ( #min/max/default
"valveOffset" => [ \&validValveposition, 00 ],
);
%msgId2Cmd = (
"00" => "PairPing",
"01" => "PairPong",
"02" => "Ack",
"03" => "TimeInformation",
"10" => "ConfigWeekProfile",
"11" => "ConfigTemperatures", #like eco/comfort etc
"12" => "ConfigValve",
"20" => "AddLinkPartner",
"21" => "RemoveLinkPartner",
"22" => "SetGroupId",
"23" => "RemoveGroupId",
"30" => "ShutterContactState",
"40" => "SetTemperature", #to thermostat
"42" => "WallThermostatState", #by WallMountedThermostat
#Sending this without payload to thermostat sets desiredTempeerature to the comfort/eco temperature
#We don't use it, we just do SetTemperature
"43" => "SetComfortTemperature",
"44" => "SetEcoTemperature",
"50" => "PushButtonState",
"60" => "ThermostatState", #by HeatingThermostat
"82" => "SetDisplayActualTemperature",
"F1" => "WakeUp",
"F0" => "Reset",
);
%msgCmd2Id = reverse %msgId2Cmd;
my %interfaces = (
"Cube" => undef,
"HeatingThermostat" => "thermostat;battery;temperature",

View File

@ -5,7 +5,7 @@ package main;
use strict;
use warnings;
require "10_MAX.pm";
use MaxCommon;
our %msgId2Cmd;
our %msgCmd2Id;

56
fhem/FHEM/MaxCommon.pm Normal file
View File

@ -0,0 +1,56 @@
package MaxCommon;
#use vars qw(%device_types);
#use vars qw(%msgId2Cmd);
#use vars qw(%msgCmd2Id);
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(%device_types %msgId2Cmd %msgCmd2Id);
#@EXPORT_OK = qw($Zeitstempel @Logdaten Besteller_ermitteln);
%device_types = (
0 => "Cube",
1 => "HeatingThermostat",
2 => "HeatingThermostatPlus",
3 => "WallMountedThermostat",
4 => "ShutterContact",
5 => "PushButton"
);
%msgId2Cmd = (
"00" => "PairPing",
"01" => "PairPong",
"02" => "Ack",
"03" => "TimeInformation",
"10" => "ConfigWeekProfile",
"11" => "ConfigTemperatures", #like eco/comfort etc
"12" => "ConfigValve",
"20" => "AddLinkPartner",
"21" => "RemoveLinkPartner",
"22" => "SetGroupId",
"23" => "RemoveGroupId",
"30" => "ShutterContactState",
"40" => "SetTemperature", #to thermostat
"42" => "WallThermostatState", #by WallMountedThermostat
#Sending this without payload to thermostat sets desiredTempeerature to the comfort/eco temperature
#We don't use it, we just do SetTemperature
"43" => "SetComfortTemperature",
"44" => "SetEcoTemperature",
"50" => "PushButtonState",
"60" => "ThermostatState", #by HeatingThermostat
"82" => "SetDisplayActualTemperature",
"F1" => "WakeUp",
"F0" => "Reset",
);
%msgCmd2Id = reverse %msgId2Cmd;
1;