2020-01-25 18:35:29 +00:00
|
|
|
##############################################
|
|
|
|
# $Id$
|
|
|
|
#
|
|
|
|
# (c) 2012 Copyright: Matthias Gehre, M.Gehre@gmx.de
|
|
|
|
# (c) 2019 Copyright: Wzut
|
|
|
|
#
|
|
|
|
# All rights reserved
|
|
|
|
#
|
|
|
|
# FHEM Forum : http://forum.fhem.de/
|
|
|
|
#
|
|
|
|
# This code is 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.
|
|
|
|
################################################################
|
2013-02-08 19:44:12 +00:00
|
|
|
|
2020-01-25 18:35:29 +00:00
|
|
|
package MaxCommon;
|
2013-02-08 19:44:12 +00:00
|
|
|
require Exporter;
|
|
|
|
@ISA = qw(Exporter);
|
2020-05-07 16:52:47 +00:00
|
|
|
@EXPORT = qw(%device_types %msgId2Cmd %msgCmd2Id $defaultWeekProfile validTemperature);
|
2013-02-08 19:44:12 +00:00
|
|
|
|
|
|
|
%device_types = (
|
2020-05-08 17:28:42 +00:00
|
|
|
0 => "Cube",
|
2013-02-08 19:44:12 +00:00
|
|
|
1 => "HeatingThermostat",
|
|
|
|
2 => "HeatingThermostatPlus",
|
|
|
|
3 => "WallMountedThermostat",
|
|
|
|
4 => "ShutterContact",
|
2020-03-08 17:22:28 +00:00
|
|
|
5 => "PushButton",
|
|
|
|
6 => "virtualShutterContact",
|
2020-05-07 16:52:47 +00:00
|
|
|
7 => "virtualThermostat",
|
|
|
|
8 => "PlugAdapter"
|
2013-02-08 19:44:12 +00: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",
|
|
|
|
|
2020-01-25 18:35:29 +00:00
|
|
|
"40" => "SetTemperature", # to thermostat
|
|
|
|
"42" => "WallThermostatControl", # by WallMountedThermostat
|
|
|
|
# Sending this without payload to thermostat sets desiredTempeerature to the comfort/eco temperature
|
|
|
|
# We don't use it, we just do SetTemperature
|
2013-02-08 19:44:12 +00:00
|
|
|
"43" => "SetComfortTemperature",
|
|
|
|
"44" => "SetEcoTemperature",
|
|
|
|
|
|
|
|
"50" => "PushButtonState",
|
|
|
|
|
2020-01-25 18:35:29 +00:00
|
|
|
"60" => "ThermostatState", # by HeatingThermostat
|
2013-02-08 19:44:12 +00:00
|
|
|
|
2013-02-13 23:35:10 +00:00
|
|
|
"70" => "WallThermostatState",
|
|
|
|
|
2013-02-08 19:44:12 +00:00
|
|
|
"82" => "SetDisplayActualTemperature",
|
|
|
|
|
|
|
|
"F1" => "WakeUp",
|
|
|
|
"F0" => "Reset",
|
|
|
|
);
|
2020-01-25 18:35:29 +00:00
|
|
|
|
2013-02-08 19:44:12 +00:00
|
|
|
%msgCmd2Id = reverse %msgId2Cmd;
|
|
|
|
|
2020-05-07 16:52:47 +00:00
|
|
|
my $defaultWeekProfile = "444855084520452045204520452045204520452045204520452044485508452045204520452045204520452045204520452045204448546c44cc55144520452045204520452045204520452045204448546c44cc55144520452045204520452045204520452045204448546c44cc55144520452045204520452045204520452045204448546c44cc55144520452045204520452045204520452045204448546c44cc5514452045204520452045204520452045204520";
|
2013-02-12 04:19:18 +00:00
|
|
|
|
2013-08-29 20:15:24 +00:00
|
|
|
|
2020-01-25 18:35:29 +00:00
|
|
|
sub validTemperature { return $_[0] eq "on" || $_[0] eq "off" || ($_[0] =~ /^\d+(\.[05])?$/ && $_[0] >= 4.5 && $_[0] <= 30.5); }
|
|
|
|
|
|
|
|
# Identify for numeric values and maps "on" and "off" to their temperatures
|
2020-05-07 16:52:47 +00:00
|
|
|
#sub MAX_ParseTemperature
|
|
|
|
#{
|
|
|
|
#return $_[0] eq "on" ? 30.5 : ($_[0] eq "off" ? 4.5 :$_[0]);
|
|
|
|
#}
|
2013-08-29 20:15:24 +00:00
|
|
|
|
2013-02-08 19:44:12 +00:00
|
|
|
1;
|