2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

10_MYSENSORS_DEVICE.pm: uppdate to latest MYSENSORS api

git-svn-id: https://svn.fhem.de/fhem/trunk@15135 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
Hauswart 2017-09-25 14:01:02 +00:00
parent 15c7236d0f
commit 55ade35235
4 changed files with 122 additions and 84 deletions

View File

@ -1,5 +1,6 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
# Do not insert empty lines here, update check depends on it.
- feature: 10_MYSENSORS_DEVICE: updated to latest MYSENSORS version
- feature: 50_TelegramBot: hide cmd in favorites/changed favorites confirm
- feature: 49_SSCam: V2.9.0, function get homeModeState, minor fixes,
commandref revised

View File

@ -1,4 +1,4 @@
##############################################
P##############################################
#
# fhem bridge to MySensors (see http://mysensors.org)
#
@ -19,7 +19,6 @@
# You should have received a copy of the GNU General Public License
# along with fhem. If not, see <http://www.gnu.org/licenses/>.
#
# $Id$
#
##############################################
@ -85,26 +84,26 @@ BEGIN {
my %static_types = (
S_DOOR => { receives => [], sends => [V_TRIPPED,V_ARMED] }, # Door and window sensors
S_MOTION => { receives => [], sends => [V_TRIPPED] }, # MotionSensor
S_MOTION => { receives => [], sends => [V_TRIPPED,V_ARMED] }, # Motion sensors
S_SMOKE => { receives => [], sends => [V_TRIPPED,V_ARMED] }, # Smoke sensor
S_LIGHT => { receives => [V_STATUS,V_WATT], sends => [V_STATUS,V_WATT] }, # Binary device (on/off), Alias for S_BINARY
S_BINARY => { receives => [V_STATUS,V_WATT], sends => [V_STATUS,V_WATT] }, # Binary device (on/off)
S_DIMMER => { receives => [V_STATUS,V_PERCENTAGE,V_WATT], sends => [V_STATUS,V_PERCENTAGE,V_WATT] }, # Dimmable device of some kind
S_COVER => { receives => [V_UP,V_DOWN,V_STOP,V_PERCENTAGE], sends => [V_PERCENTAGE] }, # Window covers or shades
S_TEMP => { receives => [], sends => [V_TEMP] }, # Temperature sensor
S_TEMP => { receives => [], sends => [V_TEMP,V_ID] }, # Temperature sensor
S_HUM => { receives => [], sends => [V_HUM] }, # Humidity sensor
S_BARO => { receives => [], sends => [V_PRESSURE,V_FORECAST] }, # Barometer sensor (Pressure)
S_WIND => { receives => [], sends => [V_WIND,V_GUST] }, # Wind sensor
S_WIND => { receives => [], sends => [V_WIND,V_GUST,V_DIRECTION] }, # Wind sensor
S_RAIN => { receives => [], sends => [V_RAIN,V_RAINRATE] }, # Rain sensor
S_UV => { receives => [], sends => [V_UV] }, # UV Sensor
S_UV => { receives => [], sends => [V_UV] }, # UV sensor
S_WEIGHT => { receives => [], sends => [V_WEIGHT,V_IMPEDANCE] }, # Weight sensor for scales etc.
S_POWER => { receives => [V_VAR1], sends => [V_WATT,V_KWH,V_VAR1] }, # Power measuring device, like power meters
S_HEATER => { receives => [], sends => [V_HVAC_SETPOINT_HEAT,V_HVAC_FLOW_STATE,V_TEMP] }, # Heater device
S_DISTANCE => { receives => [], sends => [V_DISTANCE] }, # Distance sensor
S_POWER => { receives => [V_VAR1], sends => [V_WATT,V_KWH,V_VAR,V_VA,V_POWER_FACTOR] }, # Power measuring device, like power meters
S_HEATER => { receives => [], sends => [V_HVAC_SETPOINT_HEAT,V_HVAC_FLOW_STATE,V_TEMP,V_STATUS] }, # Heater device
S_DISTANCE => { receives => [], sends => [V_DISTANCE,V_UNIT_PREFIX] }, # Distance sensor
S_LIGHT_LEVEL => { receives => [], sends => [V_LIGHT_LEVEL] }, # Light sensor
S_ARDUINO_NODE => { receives => [], sends => [] }, # Arduino node device
S_ARDUINO_REPEATER_NODE => { receives => [], sends => [] }, # Arduino repeating node device
S_LOCK => { receives => [V_LOCK_STATUS], sends => [V_LOCK_STATUS] }, # Lock device
S_IR => { receives => [V_IR_SEND], sends => [V_IR_RECEIVE] }, # Ir sender/receiver device
S_IR => { receives => [V_IR_SEND], sends => [V_IR_RECEIVE,V_IR_RECORD] }, # Ir sender/receiver device
S_WATER => { receives => [V_VAR1], sends => [V_FLOW,V_VOLUME,V_VAR1] }, # Water meter
S_AIR_QUALITY => { receives => [], sends => [V_LEVEL,V_UNIT_PREFIX] }, # Air quality sensor e.g. MQ-2
S_CUSTOM => { receives => [V_VAR1,V_VAR2,V_VAR3,V_VAR4,V_VAR5], sends => [V_VAR1,V_VAR2,V_VAR3,V_VAR4,V_VAR5] }, # Use this for custom sensors where no other fits.
@ -113,13 +112,17 @@ my %static_types = (
S_RGB_LIGHT => { receives => [V_RGB,V_WATT], sends => [V_RGB,V_WATT] }, # RGB light
S_RGBW_LIGHT => { receives => [V_RGBW,V_WATT], sends => [V_RGBW,V_WATT] }, # RGBW light (with separate white component)
S_COLOR_SENSOR => { receives => [V_RGB], sends => [V_RGB] }, # Color sensor
S_HVAC => { receives => [], sends => [V_HVAC_SETPOINT_HEAT,V_HVAC_SETPOINT_COOL,V_HVAC_FLOW_STATE,V_HVAC_FLOW_MODE,V_HVAC_SPEED] }, # Thermostat/HVAC device
S_HVAC => { receives => [], sends => [V_STATUS,V_TEMP,V_HVAC_SETPOINT_HEAT,V_HVAC_SETPOINT_COOL,V_HVAC_FLOW_STATE,V_HVAC_FLOW_MODE,V_HVAC_SPEED] }, # Thermostat/HVAC device
S_MULTIMETER => { receives => [], sends => [V_VOLTAGE,V_CURRENT,V_IMPEDANCE] }, # Multimeter device
S_SPRINKLER => { receives => [], sends => [V_STATUS,V_TRIPPED] }, # Sprinkler device
S_WATER_LEAK => { receives => [], sends => [V_TRIPPED,V_ARMED] }, # Water leak sensor
S_SOUND => { receives => [], sends => [V_LEVEL,V_TRIPPED,V_ARMED] }, # Sound sensor
S_VIBRATION => { receives => [], sends => [V_LEVEL,V_TRIPPED,V_ARMED] }, # Vibration sensor
S_MOISTURE => { receives => [], sends => [V_LEVEL,V_TRIPPED,V_ARMED] }, # Moisture sensor
S_INFO => { receives => [V_TEXT], sends => [V_TEXT] }, # LCD text device
S_GAS => { receives => [], sends => [V_FLOW,V_VOLUME] }, # Gas meter
S_GPS => { receives => [], sends => [V_POSITION] }, # GPS Sensor
S_WATER_QUALITY => { receives => [], sends => [V_TEMP,V_PH,V_ORP,V_EC,V_STATUS] }, # Water quality sensor
);
my %static_mappings = (
@ -176,6 +179,16 @@ my %static_mappings = (
V_HVAC_SETPOINT_COOL => { type => "hvacsetpointcool" },
V_HVAC_SETPOINT_HEAT => { type => "hvacsetpointheat" },
V_HVAC_FLOW_MODE => { type => "hvacflowmode" },
V_TEXT => { type => "text" },
V_CUSTOM => { type => "custom" },
V_POSITION => { type => "position" },
V_IR_RECORD => { type => "ir_record" },
V_PH => { type => "ph" },
V_ORP => { type => "orp" },
V_EC => { type => "ec" },
V_VAR => { type => "value" },
V_VA => { type => "va" },
V_POWER_FACTOR => { type => "power_factor" },
);
sub Define($$) {
@ -186,6 +199,7 @@ sub Define($$) {
$hash->{sets} = {
'time' => "",
reboot => "",
# clear => "",
};
$hash->{ack} = 0;
$hash->{typeMappings} = {map {variableTypeToIdx($_) => $static_mappings{$_}} keys %static_mappings};
@ -209,10 +223,13 @@ sub Set($@) {
return grep (/(^on$)|(^off$)/,keys %{$hash->{sets}}) == 2 ? SetExtensions($hash, $list, $name, $command, @values) : "Unknown argument $command, choose one of $list";
}
COMMAND_HANDLER: {
$command eq "clear" and do {
sendClientMessage($hash, childId => 255, cmd => C_INTERNAL, subType => I_CHILDREN, payload => "C");
last;
};
# $command eq "clear" and do {
# # Test 102 anstatt 255 :) und Log
# sendClientMessage($hash, childId => 255, cmd => C_INTERNAL, subType => I_CHILDREN, payload => "C");
# Log3 ($name,3,"MYSENSORS_DEVICE $name: clear");
# # Test
# last;
# };
$command eq "time" and do {
sendClientMessage($hash, childId => 255, cmd => C_INTERNAL, subType => I_TIME, payload => time);
last;
@ -260,10 +277,10 @@ sub Attr($$$$) {
$attribute eq "mode" and do {
if ($command eq "set" and $value eq "repeater") {
$hash->{repeater} = 1;
$hash->{sets}->{clear} = "";
# $hash->{sets}->{clear} = "";
} else {
$hash->{repeater} = 0;
delete $hash->{sets}->{clear};
# delete $hash->{sets}->{clear};
}
last;
};
@ -517,7 +534,7 @@ sub onInternalMessage($$) {
};
$type == I_CHILDREN and do {
readingsSingleUpdate($hash, "state", "routingtable cleared", 1);
Log3 ($name,4,"MYSENSORS_DEVICE $name: routingtable cleared");
Log3 ($name, 3, "MYSENSORS_DEVICE $name: routingtable cleared");
last;
};
$type == I_SKETCH_NAME and do {
@ -594,6 +611,10 @@ sub mappedReadingToRaw($$$) {
1;
=pod
=item device
=item summary includes MYSENSOR clients
=item summary_DE integriert MYSENSOR Sensoren
=begin html
<a name="MYSENSORS_DEVICE"></a>

View File

@ -66,6 +66,16 @@ use constant {
V_HVAC_SETPOINT_COOL => 44,
V_HVAC_SETPOINT_HEAT => 45,
V_HVAC_FLOW_MODE => 46,
V_TEXT => 47,
V_CUSTOM => 48,
V_POSITION => 49,
V_IR_RECORD => 50,
V_PH => 51,
V_ORP => 52,
V_EC => 53,
V_VAR => 54,
V_VA => 55,
V_POWER_FACTOR => 56,
};
use constant variableTypes => qw{ V_TEMP V_HUM V_STATUS V_PERCENTAGE V_PRESSURE V_FORECAST V_RAIN
@ -73,7 +83,8 @@ use constant variableTypes => qw{ V_TEMP V_HUM V_STATUS V_PERCENTAGE V_PRESSURE
V_IMPEDANCE V_ARMED V_TRIPPED V_WATT V_KWH V_SCENE_ON V_SCENE_OFF
V_HVAC_FLOW_STATE V_HVAC_SPEED V_LIGHT_LEVEL V_VAR1 V_VAR2 V_VAR3 V_VAR4 V_VAR5
V_UP V_DOWN V_STOP V_IR_SEND V_IR_RECEIVE V_FLOW V_VOLUME V_LOCK_STATUS
V_LEVEL V_VOLTAGE V_CURRENT V_RGB V_RGBW V_ID V_UNIT_PREFIX V_HVAC_SETPOINT_COOL V_HVAC_SETPOINT_HEAT V_HVAC_FLOW_MODE};
V_LEVEL V_VOLTAGE V_CURRENT V_RGB V_RGBW V_ID V_UNIT_PREFIX V_HVAC_SETPOINT_COOL V_HVAC_SETPOINT_HEAT V_HVAC_FLOW_MODE
V_TEXT V_CUSTOM V_POSITION V_IR_RECORD V_PH V_ORP V_EC V_VAR V_VA V_POWER_FACTOR };
sub variableTypeToStr($) {
(variableTypes)[shift];
@ -120,7 +131,7 @@ use constant {
S_DOOR => 0,
S_MOTION => 1,
S_SMOKE => 2,
S_LIGHT => 3,
S_BINARY => 3,
S_DIMMER => 4,
S_COVER => 5,
S_TEMP => 6,
@ -153,13 +164,17 @@ use constant {
S_SOUND => 33,
S_VIBRATION => 34,
S_MOISTURE => 35,
S_INFO => 36,
S_GAS => 37,
S_GPS => 38,
S_WATER_QUALITY => 39,
};
use constant sensorTypes => qw{ S_DOOR S_MOTION S_SMOKE S_LIGHT S_DIMMER S_COVER S_TEMP S_HUM S_BARO S_WIND
use constant sensorTypes => qw{ S_DOOR S_MOTION S_SMOKE S_BINARY S_DIMMER S_COVER S_TEMP S_HUM S_BARO S_WIND
S_RAIN S_UV S_WEIGHT S_POWER S_HEATER S_DISTANCE S_LIGHT_LEVEL S_ARDUINO_NODE
S_ARDUINO_REPEATER_NODE S_LOCK S_IR S_WATER S_AIR_QUALITY S_CUSTOM S_DUST S_SCENE_CONTROLLER
S_RGB_LIGHT S_RGBW_LIGHT S_COLOR_SENSOR S_HVAC S_MULTIMETER S_SPRINKLER S_WATER_LEAK S_SOUND S_VIBRATION
S_MOISTURE};
S_MOISTURE S_INFO S_GAS S_GPS S_WATER_QUALITY};
sub sensorTypeToStr($) {
(sensorTypes)[shift];
@ -196,9 +211,10 @@ use constant {
P_LONG32 => 4,
P_ULONG32 => 5,
P_CUSTOM => 6,
P_FLOAT32 => 7,
};
use constant payloadTypes => qw{ P_STRING P_BYTE P_INT16 P_UINT16 P_LONG32 P_ULONG32 P_CUSTOM };
use constant payloadTypes => qw{ P_STRING P_BYTE P_INT16 P_UINT16 P_LONG32 P_ULONG32 P_CUSTOM P_FLOAT32 };
sub payloadTypeToStr($) {
(payloadTypes)[shift];

View File

@ -65,7 +65,7 @@ FHEM/10_KOPP_FC.pm raspii Sonstige Systeme
FHEM/10_MAX.pm rudolfkoenig/orphan MAX
FHEM/10_MQTT_BRIDGE eisler MQTT
FHEM/10_MQTT_DEVICE eisler MQTT
FHEM/10_MYSENSORS_DEVICE ntruchsess Sonstige Systeme
FHEM/10_MYSENSORS_DEVICE Hauswart Sonstige Systeme
FHEM/10_OWServer.pm neubert/mfr69bs 1Wire
FHEM/10_SOMFY.pm viegener Sonstige Systeme
FHEM/10_UNIRoll.pm C_Herrmann SlowRF
@ -489,7 +489,7 @@ FHEM/UConv.pm loredo FHEM Development
FHEM/Unit.pm loredo FHEM Development
FHEM/YahooWeatherAPI.pm neubert Unterstuetzende Dienste/Wettermodule
FHEM/lib/Device/Firmata/* ntruchsess Sonstige Systeme
FHEM/lib/Device/MySensors/* ntruchsess Sonstige Systeme
FHEM/lib/Device/MySensors/* Hauswart Sonstige Systeme
FHEM/lib/MP3/* Reinerlein Multimedia
FHEM/lib/Net/MQTT.pod eisler MQTT
FHEM/lib/Net/MQTT/* eisler MQTT