From 17d112a6505a9217675b0ea2ba07eca7e9d0c0b5 Mon Sep 17 00:00:00 2001 From: Beta-User Date: Mon, 11 Oct 2021 19:16:44 +0000 Subject: [PATCH] zwave.template and others: some fixes git-svn-id: https://svn.fhem.de/fhem/trunk@25064 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- .../lib/AttrTemplate/general_use.template | 21 +++++++++++++-- fhem/FHEM/lib/AttrTemplate/mqtt2.template | 15 +++++++---- fhem/FHEM/lib/AttrTemplate/zwave.template | 26 +++++++++++++++++++ 3 files changed, 55 insertions(+), 7 deletions(-) diff --git a/fhem/FHEM/lib/AttrTemplate/general_use.template b/fhem/FHEM/lib/AttrTemplate/general_use.template index cc7534c58..9af4d0bf5 100644 --- a/fhem/FHEM/lib/AttrTemplate/general_use.template +++ b/fhem/FHEM/lib/AttrTemplate/general_use.template @@ -22,6 +22,8 @@ order:Z00001 desc:template to set associatedWith reading for multichannel devices; call e.g. with CHANNELS=4. par:CHANNELS;CHANNELS: Nr. of channels to configure, defaults to 2;{ 2 } par:MAKECOPIES;MAKECOPIES: boolean, if set, device will be copied to other channel devices , defaults to 0;{ 0 } +par:IODEVATTR;IODEVATTR: attribute value if set, will be copied to other channel devices , defaults to 0;{ AttrVal('DEVICE','IODev',0) } +par:IODEVREADING;IODEVREADING: reading value if set and no attribute is set, will be copied to other channel devices , defaults to 0;{ AttrVal('DEVICE','IODev',0) ? 0 : ReadingsVal('DEVICE','IODev',0)} # 2 channels option:{return 1 if CHANNELS==2 && MAKECOPIES==1;;return 0} @@ -99,7 +101,7 @@ setreading DEVICE_CH5 associatedWith DEVICE,DEVICE_CH1,DEVICE_CH2,DEVICE_CH3,DEV setreading DEVICE_CH6 associatedWith DEVICE,DEVICE_CH1,DEVICE_CH2,DEVICE_CH3,DEVICE_CH4,DEVICE_CH5 # 8 channels -option:{return 1 if CHANNELS==8 && MAKECOPIES==1;;return 0} +option:{return 1 if CHANNELS==8 && MAKECOPIES==1;return 0} copy DEVICE DEVICE_CH2 copy DEVICE DEVICE_CH3 copy DEVICE DEVICE_CH4 @@ -124,8 +126,23 @@ setreading DEVICE_CH5 associatedWith DEVICE,DEVICE_CH1,DEVICE_CH2,DEVICE_CH3,DEV setreading DEVICE_CH6 associatedWith DEVICE,DEVICE_CH1,DEVICE_CH2,DEVICE_CH3,DEVICE_CH4,DEVICE_CH5,DEVICE_CH7,DEVICE_CH8 setreading DEVICE_CH7 associatedWith DEVICE,DEVICE_CH1,DEVICE_CH2,DEVICE_CH3,DEVICE_CH4,DEVICE_CH5,DEVICE_CH6,DEVICE_CH8 setreading DEVICE_CH8 associatedWith DEVICE,DEVICE_CH1,DEVICE_CH2,DEVICE_CH3,DEVICE_CH4,DEVICE_CH5,DEVICE_CH6,DEVICE_CH7 - option:{1} show DEVICE.* +##### +name:set_IODev_in_channels +filter:NAME=speechrecognTesting +order:Z00002 +desc:template to set attribute IODev or reading IODev for multichannel devices; call e.g. with set xyz attrTemplate set_IODev_in_channels SUBCHANNELS=DEVICE. +par:SUBCHANNELS;SUBCHANNELS: Regex for devices to copy value to, defaults to DEVICE_CH.*;{ undef } +par:IODEVATTR;IODEVATTR: attribute value if set, will be copied to other channel devices, defaults to 0;{ AttrVal('DEVICE','IODev',0) } +par:IODEVREADING;IODEVREADING: reading value if set and no attribute is set, will be copied to other channel devices , defaults to 0;{ AttrVal('DEVICE','IODev',0) ? 0 : ReadingsVal('DEVICE','IODev',0)} + +setreading SUBCHANNELS IODevattr IODEVATTR +setreading SUBCHANNELS IODevreading IODEVREADING +option:{ return 0 if "IODEVATTR" eq "0"; return 1 } +attr SUBCHANNELS IODev IODEVATTR + +option:{ return 0 if "IODEVREADING" eq "0"; return 1 } +setreading SUBCHANNELS IODev IODEVREADING \ No newline at end of file diff --git a/fhem/FHEM/lib/AttrTemplate/mqtt2.template b/fhem/FHEM/lib/AttrTemplate/mqtt2.template index aac4c589e..767a7c04d 100644 --- a/fhem/FHEM/lib/AttrTemplate/mqtt2.template +++ b/fhem/FHEM/lib/AttrTemplate/mqtt2.template @@ -187,7 +187,7 @@ filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* order:L_02a1 par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } -par:ICON;ICON as set, defaults to light_control;{ AttrVal("DEVICE","icon","mqtt_device") } +par:ICON;ICON as set, defaults to mqtt_device;{ AttrVal('DEVICE','icon','mqtt_device') } attr DEVICE icon ICON attr DEVICE devStateIcon online:rc_GREEN offline:rc_RED attr DEVICE devicetopic BASE_TOPIC/DEV_ID @@ -3982,7 +3982,8 @@ attr OMG_BT_ID stateFormat Last IO: last_IO attr OMG_BT_ID room NEWDEVROOM { fhem "trigger $FW_wname JS:location.href='$FW_ME?detail=OMG_BT_ID'" if($cl && $cl->{TYPE} eq "FHEMWEB") } attr OMG_BT_ID model OpenMQTTGateway_BT_gtag -setreading OMG_BT_ID attrTemplateVersion 20201207 +set DEVICE attrTemplate set_IODev_in_channels SUBCHANNELS=OMG_BT_ID +setreading OMG_BT_ID attrTemplateVersion 20211011 name:OpenMQTTGateway_BT_mi_flora_sensor @@ -4006,7 +4007,8 @@ attr OMG_BT_ID stateFormat T: temperature°C, M: moisture%, L: lux, F: fertility attr OMG_BT_ID room NEWDEVROOM { fhem "trigger $FW_wname JS:location.href='$FW_ME?detail=OMG_BT_ID'" if($cl && $cl->{TYPE} eq "FHEMWEB") } attr OMG_BT_ID model OpenMQTTGateway_BT_mi_flora_sensor -setreading OMG_BT_ID attrTemplateVersion 20200522 or prior +set DEVICE attrTemplate set_IODev_in_channels SUBCHANNELS=OMG_BT_ID +setreading OMG_BT_ID attrTemplateVersion 20211011 name:OpenMQTTGateway_simple_RF433_switch @@ -4036,7 +4038,9 @@ attr OMG_DEVCID setList\ farewell:template has been applied successfully. attr OMG_DEVCID room NEWDEVROOM attr OMG_DEVCID model OpenMQTTGateway_simple_RF433_switch -setreading OMG_DEVCID attrTemplateVersion 20200522 or prior +set DEVICE attrTemplate set_IODev_in_channels SUBCHANNELS=OMG_DEVCID +setreading OMG_DEVCID attrTemplateVersion 20211011 + name:OpenMQTTGateway_bme prereq:{my @devices=devspec2array("model=OpenMQTTGateway_MCU");return 1 if $devices[0];return 0} @@ -4092,7 +4096,8 @@ attr OMG_BT_ID stateFormat T: temperature°C, H: humidity%rH attr OMG_BT_ID room NEWDEVROOM { fhem "trigger $FW_wname JS:location.href='$FW_ME?detail=OMG_BT_ID'" if($cl && $cl->{TYPE} eq "FHEMWEB") } attr OMG_BT_ID model OpenMQTTGateway_BT_temp_hum_sensor -setreading OMG_BT_ID attrTemplateVersion 20200913 +set DEVICE attrTemplate set_IODev_in_channels SUBCHANNELS=OMG_BT_ID +setreading OMG_BT_ID attrTemplateVersion 20211011 ############### diff --git a/fhem/FHEM/lib/AttrTemplate/zwave.template b/fhem/FHEM/lib/AttrTemplate/zwave.template index 7a91c1bb2..a468344c0 100644 --- a/fhem/FHEM/lib/AttrTemplate/zwave.template +++ b/fhem/FHEM/lib/AttrTemplate/zwave.template @@ -44,6 +44,32 @@ par:CHANNEL01;First channel of the device - do not proceed if it can't be identi par:CHANNEL02;Second channel of the device - do not proceed if it can't be identified!;{ FHEM::attrT_ZWave_Utils::identify_channel_devices("DEVICE",2) } { fhem "trigger $FW_wname JS:location.href='$FW_ME?room=%23devspec%3dMAINCHANNEL,CHANNEL01,CHANNEL02'" if($cl && $cl->{TYPE} eq "FHEMWEB") } + +name:----generic-devices-section-------- +filter:TYPE=ZWave +order:00generic00000 +desc:Templates for non manufacturer specific devices + + +name:zwave_dimmer +filter:TYPE=ZWave +order:00generic00000 +desc:May help for all type of dimmer devices, developed for Qubino (Goap) ZMNHHDx Mini Dimmer, see https://forum.fhem.de/index.php/topic,123254.0.html. +farewell:No Problem encountered, enjoy! +par:CLASSESORDERED;Make sure, classes are in the right order;{ my $av = AttrVal('DEVICE','classes',''); $av =~ s{(SWITCH_BINARY )(SWITCH_MULTILEVEL )}{${2}$1}; $av } +par:CALLSPEECHRECOGN;Set this to 0 to not set any speech recogn. related attributes;{ 1 } +par:ICON;ICON as set, defaults to light_control;{ AttrVal('DEVICE','icon','light_control') } +attr DEVICE icon ICON +attr DEVICE classes CLASSESORDERED +attr DEVICE userReadings dim:(dim|reportedState).* {$1 =~ /reportedState/ ? ReadingsNum($name,'reportedState',0):ReadingsNum($name,'state',0)} +attr DEVICE eventMap { usr=>{'dim.100'=>'dim 99' } } +attr DEVICE webCmd dim +attr DEVICE widgetOverride dim:colorpicker,BRI,0,1,99 +set DEVICE attrTemplate speechcontrol_type_light +attr DEVICE model zigbee2mqtt_light_dimmer +setreading DEVICE attrTemplateVersion zwave_dimmer_20211011 + + name:----Fibaro-devices-section-------- filter:TYPE=ZWave order:01Fibaro00000