From df27046f473e1cf9cdcd0055ec5fc1567e5a880c Mon Sep 17 00:00:00 2001
From: martinp876 <>
Date: Mon, 2 Mar 2015 19:15:59 +0000
Subject: [PATCH] CUL_HM:low-battery detection RT,
git-svn-id: https://svn.fhem.de/fhem/trunk@8137 2b470e98-0d58-463d-a4d8-8e2adae1ed80
---
fhem/FHEM/10_CUL_HM.pm | 173 ++++++++++++++++++++++++-----------------
fhem/FHEM/HMConfig.pm | 1 +
2 files changed, 102 insertions(+), 72 deletions(-)
diff --git a/fhem/FHEM/10_CUL_HM.pm b/fhem/FHEM/10_CUL_HM.pm
index c0f2909ea..0d62713eb 100755
--- a/fhem/FHEM/10_CUL_HM.pm
+++ b/fhem/FHEM/10_CUL_HM.pm
@@ -386,7 +386,7 @@ sub CUL_HM_updateConfig($){
if ($md =~ m/HM-CC-RT-DN/) {$webCmd.=":burstXmit";}
}
elsif($st eq "blindActuator"){
- if ($hash->{helper}{role}{chn}){$webCmd="statusRequest:toggle:on:off:up:down:stop";}
+ if ($hash->{helper}{role}{chn}){$webCmd="statusRequest:toggleDir:on:off:up:down:stop";}
else{ $webCmd="statusRequest:getConfig:clear msgEvents";}
}
elsif($st eq "dimmer" ){
@@ -1323,11 +1323,11 @@ sub CUL_HM_Parse($$) {#########################################################
else{
$chn = $mI[1];
$setTemp = ($setTemp );
+ $lBat = $err&0x80?"low":"ok"; # prior to changes of $err!
$err = ($err >> 1);
$shash = $modules{CUL_HM}{defptr}{"$src$chn"} if($modules{CUL_HM}{defptr}{"$src$chn"});
$actTemp = ReadingsVal($name,"measured-temp","");
$vp = ReadingsVal($name,"actuator","");
- $lBat = $err&0x80?"low":"ok";
}
delete $devH->{helper}{getBatState};
$setTemp =(($setTemp ) & 0x3f )/2;
@@ -1763,11 +1763,11 @@ sub CUL_HM_Parse($$) {#########################################################
}
}
if ($st ne "switch"){
- my $dir = $err & 0x30;
- if ($dir == 0x10){push @evtEt,[$shash,1,"$eventName:up:$vs" ];}
- elsif($dir == 0x20){push @evtEt,[$shash,1,"$eventName:down:$vs"];}
- elsif($dir == 0x00){push @evtEt,[$shash,1,"$eventName:stop:$vs"];}
- elsif($dir == 0x30){push @evtEt,[$shash,1,"$eventName:err:$vs" ];}
+ my $dir = ($err >> 4) & 3;
+ my %dirName = ( 0=>"stop" ,1=>"up" ,2=>"down" ,3=>"err" );
+ push @evtEt,[$shash,1,"$eventName:$dirName{$dir}:$vs" ];
+ $shash->{helper}{dir}{rct} = $shash->{helper}{dir}{cur} if($shash->{helper}{dir}{cur} ne $dirName{$dir});
+ $shash->{helper}{dir}{cur} = $dirName{$dir};
}
if (!$rSUpdt){#dont touch if necessary for dimmer
if(($err&0x70) == 0x10 || ($err&0x70) == 0x20){
@@ -3753,6 +3753,32 @@ sub CUL_HM_Set($@) {#+++++++++++++++++ set command+++++++++++++++++++++++++++++
CUL_HM_PushCmdStack($hash,$hash->{helper}{dlvlCmd});
$hash = $chnHash; # report to channel if defined
}
+ elsif($cmd eq "toggleDir") { ################################################
+ if ($hash->{helper}{dir}{cur} && $hash->{helper}{dir}{cur} ne "err"){
+ my $old = $hash->{helper}{dir}{cur};
+ $hash->{helper}{dir}{cur} = $hash->{helper}{dir}{cur} eq "stop" ?(($hash->{helper}{dir}{rct}
+ && $hash->{helper}{dir}{rct} eq "up")?"down"
+ :"up")
+ :"stop";
+ $hash->{helper}{dir}{rct} = $old;
+ }
+ else{
+ $hash->{helper}{dir}{rct} = "stop";
+ $hash->{helper}{dir}{cur} = "up";
+ }
+ if ($hash->{helper}{dir}{cur} eq "up" ){
+ $hash->{helper}{dlvl} = "C8";
+ $hash->{helper}{dlvlCmd} = "++$flag"."11$id$dst"."02$chn".'C80000';
+ CUL_HM_PushCmdStack($hash,$hash->{helper}{dlvlCmd});
+ }elsif ($hash->{helper}{dir}{cur} eq "down"){
+ $hash->{helper}{dlvl} = "00";
+ $hash->{helper}{dlvlCmd} = "++$flag"."11$id$dst"."02$chn".'000000';
+ CUL_HM_PushCmdStack($hash,$hash->{helper}{dlvlCmd});
+ }else {
+ delete $hash->{helper}{dlvl};
+ CUL_HM_PushCmdStack($hash,'++'.$flag.'11'.$id.$dst.'03'.$chn);
+ }
+ }
elsif($cmd =~ m/^(on-for-timer|on-till)$/) { ################################
my (undef,undef,$duration,$ramp) = @a; #date prepared extention to entdate
if ($cmd eq "on-till"){
@@ -8011,48 +8037,48 @@ sub CUL_HM_tempListTmpl(@) { ##################################################
subType dependent commands:
- - switch
-
- - on - set level to 100%
- - off - set level to 0%
- - on-for-timer <sec> -
- set the switch on for the given seconds [0-85825945].
Note:
- off-for-timer like FS20 is not supported. It may to be programmed
- thru channel register.
- - on-till <time> - set the switch on for the given end time.
- set <name> on-till 20:32:10
- Currently a max of 24h is supported with endtime.
-
- - press <[short|long]> <[on|off|<peer>]> <btnNo>
- simulate a press of the local button or direct connected switch of the actor.
- [short|long] select simulation of short or long press of the button.
- Parameter is optional, short is default
- [on|off|<peer>] is relevant for devices with direct buttons per channel (blind or dimmer).
- Those are available for dimmer and blind-actor, usually not for switches
- <peer> allows to stimulate button-press of any peer of the actor.
- i.e. if the actor is peered to any remote, virtual or io (HMLAN/CUL)
- press can trigger the action defined.
- [noBurst] relevant for virtual only
- It will cause the command being added to the command queue of the peer. No burst is
- issued subsequent thus the command is pending until the peer wakes up. It therefore
- delays the button-press, but will cause less traffic and performance cost.
- Example:
-
- set actor press # trigger short of internal peer self assotiated to the channel
- set actor press long # trigger long of internal peer self assotiated to the channel
- set actor press on # trigger short of internal peer self related to 'on'
- set actor press long off # trigger long of internal peer self related to 'of'
- set actor press long FB_Btn01 # trigger long peer FB button 01
- set actor press long FB_chn:8 # trigger long peer FB button 08
- set actor press self01 # trigger short of internal peer 01
- set actor press fhem02 # trigger short of FHEM channel 2
-
-
- - toggle - toggle the Actor. It will switch from any current
+
- switch
+
+ - on - set level to 100%
+ - off - set level to 0%
+ - on-for-timer <sec> -
+ set the switch on for the given seconds [0-85825945].
Note:
+ off-for-timer like FS20 is not supported. It may to be programmed
+ thru channel register.
+ - on-till <time> - set the switch on for the given end time.
+ set <name> on-till 20:32:10
+ Currently a max of 24h is supported with endtime.
+
+ - press <[short|long]> <[on|off|<peer>]> <btnNo>
+ simulate a press of the local button or direct connected switch of the actor.
+ [short|long] select simulation of short or long press of the button.
+ Parameter is optional, short is default
+ [on|off|<peer>] is relevant for devices with direct buttons per channel (blind or dimmer).
+ Those are available for dimmer and blind-actor, usually not for switches
+ <peer> allows to stimulate button-press of any peer of the actor.
+ i.e. if the actor is peered to any remote, virtual or io (HMLAN/CUL)
+ press can trigger the action defined.
+ [noBurst] relevant for virtual only
+ It will cause the command being added to the command queue of the peer. No burst is
+ issued subsequent thus the command is pending until the peer wakes up. It therefore
+ delays the button-press, but will cause less traffic and performance cost.
+ Example:
+
+ set actor press # trigger short of internal peer self assotiated to the channel
+ set actor press long # trigger long of internal peer self assotiated to the channel
+ set actor press on # trigger short of internal peer self related to 'on'
+ set actor press long off # trigger long of internal peer self related to 'of'
+ set actor press long FB_Btn01 # trigger long peer FB button 01
+ set actor press long FB_chn:8 # trigger long peer FB button 08
+ set actor press self01 # trigger short of internal peer 01
+ set actor press fhem02 # trigger short of FHEM channel 2
+
+
+ - toggle - toggle the Actor. It will switch from any current
level to off or from off to 100%
-
-
-
+
+
+
- dimmer, blindActuator
Dimmer may support virtual channels. Those are autocrated if applicable. Usually there are 2 virtual channels
in addition to the primary channel. Virtual dimmer channels are inactive by default but can be used in
@@ -8061,30 +8087,31 @@ sub CUL_HM_tempListTmpl(@) { ##################################################
Dimmer virtual channels are completely different from FHEM virtual buttons and actors but
are part of the HM device. Documentation and capabilities for virtual channels is out of scope.
- - 0 - 100 [on-time] [ramp-time]
- set the actuator to the given value (in percent)
- with a resolution of 0.5.
- Optional for dimmer on-time and ramp time can be choosen, both in seconds with 0.1s granularity.
- On-time is analog "on-for-timer".
- Ramp-time default is 2.5s, 0 means instantanous
-
- - on
- - off
- - press <[short|long]><[on|off]>
- - toggle
- - on-for-timer <sec> - Dimmer only!
- - on-till <time> - Dimmer only!
- - stop - stop motion (blind) or dim ramp
- - pct <level> [<ontime>] [<ramptime>] - set actor to a desired absolut level.
- Optional ontime and ramptime could be given for dimmer.
- ontime may be time in seconds. It may also be entered as end-time in format hh:mm:ss
-
- - up [changeValue] [<ontime>] [<ramptime>] dim up one step
- - down [changeValue] [<ontime>] [<ramptime>] dim up one step
- changeValue is optional an gives the level to be changed up or down in percent. Granularity is 0.5%, default is 10%.
- ontime is optional an gives the duration of the level to be kept. '0' means forever and is default.
- ramptime is optional an defines the change speed to reach the new level. It is meaningful only for dimmer.
-
+ - 0 - 100 [on-time] [ramp-time]
+ set the actuator to the given value (in percent)
+ with a resolution of 0.5.
+ Optional for dimmer on-time and ramp time can be choosen, both in seconds with 0.1s granularity.
+ On-time is analog "on-for-timer".
+ Ramp-time default is 2.5s, 0 means instantanous
+
+ - on
+ - off
+ - press <[short|long]><[on|off]>
+ - toggle
+ - toggleDir - toggled drive direction between up/stop/down/stop
+ - on-for-timer <sec> - Dimmer only!
+ - on-till <time> - Dimmer only!
+ - stop - stop motion (blind) or dim ramp
+ - pct <level> [<ontime>] [<ramptime>] - set actor to a desired absolut level.
+ Optional ontime and ramptime could be given for dimmer.
+ ontime may be time in seconds. It may also be entered as end-time in format hh:mm:ss
+
+ - up [changeValue] [<ontime>] [<ramptime>] dim up one step
+ - down [changeValue] [<ontime>] [<ramptime>] dim up one step
+ changeValue is optional an gives the level to be changed up or down in percent. Granularity is 0.5%, default is 10%.
+ ontime is optional an gives the duration of the level to be kept. '0' means forever and is default.
+ ramptime is optional an defines the change speed to reach the new level. It is meaningful only for dimmer.
+
@@ -9384,6 +9411,8 @@ sub CUL_HM_tempListTmpl(@) { ##################################################
- off
- press <[short|long]><[on|off]>
- toggle
+ - toggleDir - toggelt die fahrtrichtung des Rollo-Aktors.
+ Es wird umgeschaltet zwischen auf/stop/ab/stop
- on-for-timer <sec> - Nur Dimmer!
- on-till <time> - Nur Dimmer!
- stop - Stopt Bewegung (Rollo) oder Dimmerrampe
diff --git a/fhem/FHEM/HMConfig.pm b/fhem/FHEM/HMConfig.pm
index a0e1a7558..0bece1743 100644
--- a/fhem/FHEM/HMConfig.pm
+++ b/fhem/FHEM/HMConfig.pm
@@ -1419,6 +1419,7 @@ $culHmSubTypeDevSets{blindActuator} = $culHmSubTypeDevSets{switch};
blindActuator =>{ on =>""
,off =>""
,toggle =>""
+ ,toggleDir =>""
,pct =>"[] ... []"
,stop =>""
,press =>"[long|short] [on|off|] [] [] ..."