mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-10 03:06:37 +00:00
MAX: unify duplicate definitions
git-svn-id: https://svn.fhem.de/fhem/trunk@2289 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
659203c3a5
commit
9a1e0aa007
@ -8,6 +8,10 @@ use warnings;
|
||||
use MIME::Base64;
|
||||
use POSIX;
|
||||
|
||||
require "10_MAX.pm";
|
||||
our %msgCmd2Id;
|
||||
our %device_types;
|
||||
|
||||
sub MAXLAN_Parse($$);
|
||||
sub MAXLAN_Read($);
|
||||
sub MAXLAN_Write(@);
|
||||
@ -18,15 +22,6 @@ sub MAXLAN_SendDeviceCmd($$);
|
||||
sub MAXLAN_RequestConfiguration($$);
|
||||
sub MAXLAN_RemoveDevice($$);
|
||||
|
||||
my %device_types = (
|
||||
0 => "Cube",
|
||||
1 => "HeatingThermostat",
|
||||
2 => "HeatingThermostatPlus",
|
||||
3 => "WallMountedThermostat",
|
||||
4 => "ShutterContact",
|
||||
5 => "PushButton"
|
||||
);
|
||||
|
||||
my @boost_durations = (0, 5, 10, 15, 20, 25, 30, 60);
|
||||
|
||||
my $reconnect_interval = 2; #seconds
|
||||
|
@ -17,7 +17,11 @@ sub MAX_DateTime2Internal($);
|
||||
|
||||
my @ctrl_modes = ( "auto", "manual", "temporary", "boost" );
|
||||
|
||||
my %device_types = (
|
||||
use vars qw(%device_types);
|
||||
use vars qw(%msgId2Cmd);
|
||||
use vars qw(%msgCmd2Id);
|
||||
|
||||
%device_types = (
|
||||
0 => "Cube",
|
||||
1 => "HeatingThermostat",
|
||||
2 => "HeatingThermostatPlus",
|
||||
@ -26,6 +30,25 @@ my %device_types = (
|
||||
5 => "PushButton"
|
||||
);
|
||||
|
||||
%msgId2Cmd = (
|
||||
"00" => "PairPing",
|
||||
"01" => "PairPong",
|
||||
"02" => "Ack",
|
||||
"03" => "TimeInformation",
|
||||
"11" => "ConfigTemperatures", #like boost/eco/comfort etc
|
||||
"30" => "ShutterContactState",
|
||||
"42" => "WallThermostatState", #by WallMountedThermostat
|
||||
"60" => "ThermostatState", #by HeatingThermostat
|
||||
"40" => "SetTemperature", #to thermostat
|
||||
"20" => "AddLinkPartner",
|
||||
"21" => "RemoveLinkPartner",
|
||||
"22" => "SetGroupId",
|
||||
"23" => "RemoveGroupId",
|
||||
"F1" => "WakeUp",
|
||||
"F0" => "Reset",
|
||||
);
|
||||
%msgCmd2Id = reverse %msgId2Cmd;
|
||||
|
||||
my %interfaces = (
|
||||
"Cube" => undef,
|
||||
"HeatingThermostat" => "thermostat;battery;temperature",
|
||||
|
@ -5,6 +5,11 @@ package main;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
require "10_MAX.pm";
|
||||
|
||||
our %msgId2Cmd;
|
||||
our %msgCmd2Id;
|
||||
our %device_types;
|
||||
|
||||
sub CUL_MAX_SendDeviceCmd($$);
|
||||
sub CUL_MAX_Send(@);
|
||||
@ -20,16 +25,6 @@ my $timeBroadcastInterval = 6*60*60; #= 6 hours, the same time that the cube use
|
||||
|
||||
my $resendRetries = 10; #how often resend before giving up?
|
||||
|
||||
#TODO: this is duplicated in MAXLAN
|
||||
my %device_types = (
|
||||
0 => "Cube",
|
||||
1 => "HeatingThermostat",
|
||||
2 => "HeatingThermostatPlus",
|
||||
3 => "WallMountedThermostat",
|
||||
4 => "ShutterContact",
|
||||
5 => "PushButton"
|
||||
);
|
||||
|
||||
sub
|
||||
CUL_MAX_Initialize($)
|
||||
{
|
||||
@ -112,32 +107,6 @@ CUL_MAX_Set($@)
|
||||
return undef;
|
||||
}
|
||||
|
||||
###################################
|
||||
my %msgTypes = ( #Receiving:
|
||||
"00" => "PairPing",
|
||||
"01" => "PairPong",
|
||||
"02" => "Ack",
|
||||
"03" => "TimeInformation",
|
||||
"11" => "ConfigTemperatures", #like boost/eco/comfort etc
|
||||
"30" => "ShutterContactState",
|
||||
"42" => "WallThermostatState", #by WallMountedThermostat
|
||||
"60" => "ThermostatState", #by HeatingThermostat
|
||||
"40" => "SetTemperature", #to thermostat
|
||||
"20" => "AddLinkPartner",
|
||||
"21" => "RemoveLinkPartner",
|
||||
"22" => "SetGroupId",
|
||||
"23" => "RemoveGroupId",
|
||||
"F1" => "WakeUp",
|
||||
"F0" => "Reset",
|
||||
);
|
||||
my %sendTypes = (#Sending:
|
||||
"PairPong" => "01",
|
||||
"TimeInformation" => "03",
|
||||
#"40" => "SetTemperature",
|
||||
#"11" => "SetConfiguration",
|
||||
#"F1" => "WakeUp",
|
||||
);
|
||||
|
||||
#Array of all packet that we wait to be ack'ed
|
||||
my @waitForAck = ();
|
||||
|
||||
@ -163,9 +132,9 @@ CUL_MAX_Parse($$)
|
||||
#convert adresses to lower case
|
||||
$src = lc($src);
|
||||
$dst = lc($dst);
|
||||
my $msgType = exists($msgTypes{$msgTypeRaw}) ? $msgTypes{$msgTypeRaw} : $msgTypeRaw;
|
||||
my $msgType = exists($msgId2Cmd{$msgTypeRaw}) ? $msgId2Cmd{$msgTypeRaw} : $msgTypeRaw;
|
||||
Log 5, "CUL_MAX_Parse: len $len, msgcnt $msgcnt, msgflag $msgFlag, msgTypeRaw $msgType, src $src, dst $dst, groupid $groupid, payload $payload";
|
||||
if(exists($msgTypes{$msgTypeRaw})) {
|
||||
if(exists($msgId2Cmd{$msgTypeRaw})) {
|
||||
if($msgType eq "Ack") {
|
||||
Dispatch($shash, "MAX,Ack,$src,$payload", {RAWMSG => $rmsg});
|
||||
my $i = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user