2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-03 16:56:54 +00:00

zwave.attrtemplate: some small changes, also in utils file

git-svn-id: https://svn.fhem.de/fhem/trunk@22849 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
Beta-User 2020-09-25 18:06:37 +00:00
parent 9c03a4f330
commit 7b9f3a3cdc
2 changed files with 60 additions and 11 deletions

View File

@ -49,9 +49,59 @@ name:----Fibaro-devices-section--------
filter:TYPE=ZWave
order:01Fibaro00000
name:FGRM222
name:FGRM222_Roller_Mode
filter:TYPE=ZWave
order:01Fibaro000005
desc:Applies to Fibaro FGRM222 devices. This is for normal shutter mode. For other modes use different attrTemplates if available or manual configuration.
farewell:Things to be done manually: configure switch type (configSwitchType).
par:CALLSPEECHRECOGN;Set this to 0 to not set any speech recogn. related attributes;{ 1 }
par:ICON;ICON as set, defaults to fts_shutter_updown;{ AttrVal("DEVICE","icon","fts_shutter_updown") }
attr DEVICE icon ICON
deletereading -q DEVICE (?!associatedWith|model.*).*
attr DEVICE eventMap { usr=>{'dim.100'=>'dim 99' } }
attr DEVICE webCmd dim:stop
attr DEVICE cmdIcon stop:fts_shutter_manual
attr DEVICE widgetOverride dim:colorpicker,BRI,0,1,99
set DEVICE configRollerShutterOperatingModes 1RollerBlindModeWithPositioning
set DEVICE configReportsType BlindPositionReportsSentToThe0
option:{ CALLSPEECHRECOGN }
set DEVICE attrTemplate speechcontrol_type_blind
#closing section
option:{ 1 }
get DEVICE configAll
get DEVICE associationAll
setreading DEVICE attrTemplateVersion FGRM222_Roller_Mode_20200925
name:FGRM222_Ventian_Blind_Mode
filter:TYPE=ZWave
order:01Fibaro000005a
desc:Applies to Fibaro FGRM222 devices. This is for venetian blind mode. For other modes use differnt attrTemplates or manual configuration. Note: additional code needed - has to be downloaded seperately from svn.
farewell:Things to be done manually: configure switch type (configSwitchType) and turning time for lamellas (configInVenetianBlindModeTheParameter12).
par:CALLSPEECHRECOGN;Set this to 0 to not set any speech recogn. related attributes;{ 1 }
par:ICON;ICON as set, defaults to fts_shutter_updown;{ AttrVal("DEVICE","icon","fts_shutter_updown") }
attr DEVICE icon ICON
deletereading -q DEVICE (?!associatedWith|model.*).*
attr DEVICE eventMap { usr=>{'dim.100'=>'dim 99' } }
attr DEVICE webCmd dim:stop
attr DEVICE cmdIcon stop:fts_shutter_manual
attr DEVICE widgetOverride dim:colorpicker,BRI,0,1,99
attr DEVICE devStateIcon { FHEM::attrT_ZWave_Utils::devStateIcon_venetian_shutter($name,"FGRM222") }
set DEVICE configRollerShutterOperatingModes 2VenetianBlindModeWith2
set DEVICE configReportsType BlindPositionReportsSentToThe1
set DEVICE configSetLamellasBackToPrevious13 0LamellasReturnToPreviouslySet0
attr DEVICE userReadings dim:power..0.0.W {my $pos = ReadingsVal($name,"state",0) =~ m,dim, ? ReadingsNum($name,"state",0) : ReadingsNum($name,"dim",0);; my $pos1 = ReadingsNum($name,"position",0);; $pos = $pos1 if ($pos > $pos1 +3 || $pos < $pos1 -3);; return $pos }, positionSlat:power..0.0.W {ReadingsVal($name,"position",0) =~ m,Slat.([0-9]+),?$1:undef}
option:{ CALLSPEECHRECOGN }
set DEVICE attrTemplate speechcontrol_type_blind
#closing section
option:{ 1 }
get DEVICE configAll
get DEVICE associationAll
setreading DEVICE attrTemplateVersion FGRM222_Ventian_Blind_Mode_20200925
name:FGRM222_Choice_demo
filter:TYPE=ZWave
order:01Fibaro000008
desc:Applies to Fibaro FGRM222 devices. You can choose between normal shutter mode or venetian blind mode. For other modes use manual configuration. Note: additional code will be downloaded from svn.
farewell:Things to be done manually: configure switch type (configSwitchType) and (for venetain mode only) turning time for lamellas (configInVenetianBlindModeTheParameter12).
par:RADIO_ROLLER_MODE;Configure as normal shutter (no option to turn lamellas);{ undef }
@ -65,25 +115,22 @@ attr DEVICE eventMap { usr=>{'dim.100'=>'dim 99' } }
attr DEVICE webCmd dim:stop
attr DEVICE cmdIcon stop:fts_shutter_manual
attr DEVICE widgetOverride dim:colorpicker,BRI,0,1,99
option:{ RADIO_ROLLER_MODE }
set DEVICE configRollerShutterOperatingModes 1RollerBlindModeWithPositioning
set DEVICE configReportsType BlindPositionReportsSentToThe0
option:{ RADIO_VENETIANBLIND_MODE }
attr DEVICE devStateIcon { FHEM::attrT::ZWave::devStateIcon_venetian_shutter($name,"FGRM222") }
set DEVICE configRollerShutterOperatingModes 2VenetianBlindModeWith2
set DEVICE configReportsType BlindPositionReportsSentToThe1
set DEVICE configSetLamellasBackToPrevious13 0LamellasReturnToPreviouslySet0
attr DEVICE userReadings dim:power..0.0.W {my $pos = ReadingsVal($name,"state",0) =~ m,dim, ? ReadingsNum($name,"state",0) : ReadingsNum($name,"dim",0);; my $pos1 = ReadingsNum($name,"position",0);; $pos = $pos1 if ($pos > $pos1 +3 || $pos < $pos1 -3);; return $pos }, positionSlat:power..0.0.W {ReadingsVal($name,"position",0) =~ m,Slat.([0-9]+),?$1:undef}
option:{ CALLSPEECHRECOGN }
set DEVICE attrTemplate speechcontrol_type_blind
#closing section
option:{ 1 }
get DEVICE configAll
get DEVICE associationAll
setreading DEVICE attrTemplateVersion FGRM222_20200912
setreading DEVICE attrTemplateVersion FGRM222_Choice_demo_20200912

View File

@ -3,7 +3,7 @@
#
# packages ####################################################################
package FHEM::attrT::ZWave; ## no critic 'Package declaration'
package FHEM::attrT_ZWave_Utils; ## no critic 'Package declaration'
use strict;
use warnings;
@ -41,6 +41,7 @@ sub devStateIcon_venetian_shutter {
my $ret ="";
my $slatlevel = 0;
my $slatcommand_string = "dim ";
my $moving = 0;
if ($model eq "FGR223") {
my ($def,$defnr) = split(" ", InternalVal($levelname,"DEF",$levelname));
@ -48,10 +49,12 @@ sub devStateIcon_venetian_shutter {
my @slatnames = devspec2array("DEF=$def".'.'.$defnr);
$slatname = shift @slatnames;
$slatlevel= ReadingsNum($slatname,"state",0);
$moving = 1 if ReadingsNum($slatname,"power",0) > 0;
}
if ($model eq "FGRM222") {
$slatlevel= ReadingsNum($slatname,"positionSlat",0);
$slatcommand_string = "positionSlat "
$slatcommand_string = "positionSlat ";
$moving = 1 if ReadingsNum($slatname,"power",0) > 0;
}
#levelicon
@ -59,10 +62,8 @@ sub devStateIcon_venetian_shutter {
my $command_string = "dim 99";
$command_string = "dim 0" if $dimlevel > 50;
$symbol_string .= int ((109 - $dimlevel)/10)*10;
$ret .= "<a href=\"/fhem?cmd.dummy=set $levelname $command_string&XHR=1\">" . FW_makeImage($symbol_string,"fts_shutter_10") . "</a> ";
#stop
$ret .= "<a href=\"/fhem?cmd.dummy=set $levelname stop&XHR=1\">" . FW_makeImage("fts_shutter_shadding_stop","fts_shutter_shadding_stop") . "</a> ";
$ret .= $moving ? "<a href=\"/fhem?cmd.dummy=set $levelname stop&XHR=1\">" . FW_makeImage("edit_settings","edit_settings") . "</a> "
: "<a href=\"/fhem?cmd.dummy=set $levelname $command_string&XHR=1\">" . FW_makeImage($symbol_string,"fts_shutter_10") . "</a> ";
#slat
$symbol_string = "fts_blade_arc_close_";
@ -79,6 +80,7 @@ sub devStateIcon_venetian_shutter {
1;
__END__
=pod
=begin html