From 7c24289b99030d05d8c1d3d0beed575b61c391d4 Mon Sep 17 00:00:00 2001 From: Beta-User <> Date: Sat, 23 Mar 2019 17:40:59 +0000 Subject: [PATCH] mqtt2.template: use new options -q and farewell git-svn-id: https://svn.fhem.de/fhem/trunk@19007 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/lib/AttrTemplate/mqtt2.template | 52 +++++++++++------------ 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/fhem/FHEM/lib/AttrTemplate/mqtt2.template b/fhem/FHEM/lib/AttrTemplate/mqtt2.template index ffcfd401c..647cdf299 100644 --- a/fhem/FHEM/lib/AttrTemplate/mqtt2.template +++ b/fhem/FHEM/lib/AttrTemplate/mqtt2.template @@ -32,12 +32,12 @@ attr DEVCID bridgeRegexp \ attr DEVCID autocreate 1 attr DEVCID comment Do not use very open bridgeRegexp expressions! This might lead to irritating results... attr DEVCID room NEWDEVROOM -setreading DEVCID associatedWith DEVICE attr DEVCID setStateList on off deleteAttr DEVICE readingList -deletereading DEVICE .* +deletereading -q DEVICE .* deleteAttr DEVCID readingList -deletereading DEVCID .* +deletereading -q DEVCID .* +setreading DEVCID associatedWith DEVICE { fhem "trigger $FW_wname JS:location.href='$FW_ME?detail=DEVCID'" if($cl && $cl->{TYPE} eq "FHEMWEB") } farewell:template has been applied successfully. Be carefull when extending the brigeRegexp! attr DEVCID model A_00_MQTT2_CLIENT_general_bridge @@ -281,7 +281,7 @@ attr DEVICE devStateIcon open:fts_window_1w_open@red close:fts_window_1w@green #attr DEVICE genericDeviceType contact attr DEVICE eventMap true:close false:open attr DEVICE readingList BASE_TOPIC/DEV_ID:.* { json2nameValue($EVENT) } -deletereading DEVICE .* +deletereading -q DEVICE .* attr DEVICE model L_06_zigbee2mqtt_ContactSensor name:L_07_zigbee2mqtt_TempHumHpaSensor @@ -291,7 +291,7 @@ par:BASE_TOPIC;base topic as set in configuration.yaml of the zigbee2mqtt bridge par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","readingList","") =~ m,[^/]+[/]([^/]+).*:, ? $1 : undef } attr DEVICE stateFormat {sprintf ("Temperature: %.1f°C Humidity: %.1f%% Pressure: %.1fhpa", ReadingsVal($name,"temperature",0), ReadingsVal($name,"humidity",0), ReadingsVal($name,"pressure",0)) } attr DEVICE readingList BASE_TOPIC/DEV_ID:.* { json2nameValue($EVENT) } -deletereading DEVICE .* +deletereading -q DEVICE .* attr DEVICE model L_07_TempHumHpa_TempSensor #source post: https://forum.fhem.de/index.php/topic,94495.msg898198.html#msg898198 @@ -302,7 +302,7 @@ par:BASE_TOPIC;base topic as set in configuration.yaml of the zigbee2mqtt bridge par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","readingList","") =~ m,[^/]+[/]([^/]+).*:, ? $1 : undef } attr DEVICE stateFormat Motion: occupancy Luminance: illuminance attr DEVICE readingList BASE_TOPIC/DEV_ID:.* { json2nameValue($EVENT) } -deletereading DEVICE .* +deletereading -q DEVICE .* attr DEVICE model L_08_Human_Motion_TempSensor #source post: https://forum.fhem.de/index.php/topic,94495.msg898198.html#msg898198 @@ -313,7 +313,7 @@ par:BASE_TOPIC;base topic as set in configuration.yaml of the zigbee2mqtt bridge par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","readingList","") =~ m,[^/]+[/]([^/]+).*:, ? $1 : undef } attr DEVICE stateFormat Motion: action X: angle_x Y: angle_y Z: angle_z attr DEVICE readingList BASE_TOPIC/DEV_ID:.* { json2nameValue($EVENT) } -deletereading DEVICE .* +deletereading -q DEVICE .* attr DEVICE model L_09_Motion_Sensor #source post: https://forum.fhem.de/index.php/topic,94495.msg898198.html#msg898198 @@ -324,7 +324,7 @@ par:BASE_TOPIC;base topic as set in configuration.yaml of the zigbee2mqtt bridge par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","readingList","") =~ m,[^/]+[/](.*):, ? $1 : undef } attr DEVICE stateFormat Leak: water_leak attr DEVICE readingList BASE_TOPIC/DEV_ID:.* { json2nameValue($EVENT) } -deletereading DEVICE .* +deletereading -q DEVICE .* attr DEVICE model L_10_Water_Leak_Sensor #source post: https://forum.fhem.de/index.php/topic,94495.msg898198.html#msg898198 @@ -335,7 +335,7 @@ par:BASE_TOPIC;base topic as set in configuration.yaml of the zigbee2mqtt bridge par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","readingList","") =~ m,[^/]+[/]([^/]+).*:, ? $1 : undef } attr DEVICE stateFormat click attr DEVICE readingList BASE_TOPIC/DEV_ID:.* { json2nameValue($EVENT) } -deletereading DEVICE .* +deletereading -q DEVICE .* attr DEVICE model L_11_Light_Switch #source post: https://forum.fhem.de/index.php/topic,94495.msg916789.html#msg916789 @@ -346,7 +346,7 @@ par:BASE_TOPIC;base topic as set in configuration.yaml of the zigbee2mqtt bridge par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","readingList","") =~ m,[^/]+[/]([^/]+).*:, ? $1 : undef } attr DEVICE stateFormat Click: click Action: action attr DEVICE readingList BASE_TOPIC/DEV_ID:.* { json2nameValue($EVENT) } -deletereading DEVICE .* +deletereading -q DEVICE .* attr DEVICE model L_12_Wireless_Button name:L_13_zigbee2mqtt_wireless_button_old @@ -356,7 +356,7 @@ par:BASE_TOPIC;base topic as set in configuration.yaml of the zigbee2mqtt bridge par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","readingList","") =~ m,[^/]+[/]([^/]+).*:, ? $1 : undef } attr DEVICE stateFormat Click: click attr DEVICE readingList BASE_TOPIC/DEV_ID:.* { json2nameValue($EVENT) } -deletereading DEVICE .* +deletereading -q DEVICE .* attr DEVICE model L_13_wireless_button_old name:L_14_zigbee2mqtt_aqara_cube @@ -366,7 +366,7 @@ par:BASE_TOPIC;base topic as set in configuration.yaml of the zigbee2mqtt bridge par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","readingList","") =~ m,[^/]+[/]([^/]+).*:, ? $1 : undef } attr DEVICE stateFormat Action: action attr DEVICE readingList BASE_TOPIC/DEV_ID:.* { json2nameValue($EVENT) } -deletereading DEVICE .* +deletereading -q DEVICE .* attr DEVICE model L_14_aqara_cube @@ -394,7 +394,7 @@ attr DEVICE readingList \ tele/DEVNAME/SENSOR:.* { json2nameValue($EVENT) }\ tele/DEVNAME/INFO.:.* { json2nameValue($EVENT) }\ stat/DEVNAME/RESULT:.* { json2nameValue($EVENT) } -deletereading DEVICE .* +deletereading -q DEVICE .* attr DEVICE setStateList on off toggle attr DEVICE autocreate 0 attr DEVICE model A_01a_tasmota_basic_state_power1 @@ -417,7 +417,7 @@ attr DEVICE readingList \ tele/DEVNAME/INFO.:.* { json2nameValue($EVENT) }\ tele/DEVNAME/UPTIME:.* { json2nameValue($EVENT) }\ stat/DEVNAME/RESULT:.* { json2nameValue($EVENT) } -deletereading DEVICE .* +deletereading -q DEVICE .* set IO_DEV publish cmnd/DEVNAME/Restart 1 attr DEVICE autocreate 0 @@ -428,7 +428,7 @@ par:DEVNAME;ESP's name in the topic;{ AttrVal("DEVICE","readingList","") =~ m,te par:IO_DEV;Currently used IO;{ AttrVal("DEVICE","IODev","")} par:READINGLISTCLEARED;cleared from prefixes;{ AttrVal("DEVICE","readingList","") =~ s/, '[^_]+[_]'/, ''/g, ? $1 : undef } attr DEVICE readingList READINGLISTCLEARED -deletereading DEVICE .* +deletereading -q DEVICE .* set IO_DEV publish cmnd/DEVNAME/Restart 1 attr DEVICE autocreate 0 @@ -584,7 +584,7 @@ attr DEVICE stateFormat \ LWT\ \ state -deleteReading DEVICE .* +deleteReading -q DEVICE .* attr DEVICE setStateList open close half stop pct attr DEVICE comment After applying the template set SHUTTEROPENDURATION and SHUTTERCLOSEDURATION first.\ Use the "set x_configuration" Option. Example: "set x_configuration SHUTTEROPENDURATION 35"\ @@ -679,7 +679,7 @@ attr DEVICE readingList \ tele/DEVNAME/STATE:.* { json2nameValue($EVENT) }\ stat/DEVNAME/RESULT:.* { json2nameValue($EVENT) }\ tele/DEVNAME/INFO.:.* { json2nameValue($EVENT) } -deletereading DEVICE .* +deletereading -q DEVICE .* attr DEVICE autocreate 0 attr DEVICE devStateIcon {Color::devStateIcon($name,"rgb","Color","state")} attr DEVICE icon light_control @@ -732,7 +732,7 @@ attr DEVICE readingList \ shellies/DEVNAME/input/0:.* input0\ shellies/DEVNAME/online:.* online\ shellies/DEVNAME/announce:.* { json2nameValue($EVENT) } -deleteReading DEVICE .* +deleteReading -q DEVICE .* attr DEVICE model A_10_shelly1 # shellyplug using original firmware. @@ -765,7 +765,7 @@ attr DEVICE readingList \ shellies/DEVNAME/input/0:.* input0 attr DEVICE devStateIcon 0:fts_shutter_100 100:fts_shutter_10 9\d.*:fts_shutter_10 8\d.*:fts_shutter_20 7\d.*:fts_shutter_30 6\d.*:fts_shutter_40 5\d.*:fts_shutter_50 4\d.*:fts_shutter_60 3\d.*:fts_shutter_70 2\d.*:fts_shutter_80 1\d.*:fts_shutter_90 0\d.*:fts_shutter_100 set_.*:fts_shutter_updown attr DEVICE stateFormat pct -deleteReading DEVICE .* +deleteReading -q DEVICE .* attr DEVICE setStateList open close stop attr DEVICE model A_11b_shelly2_roller @@ -886,7 +886,7 @@ attr DEVICE setList\ brightness:colorpicker,BRI,0,1,100 shellies/DEVNAME/color/0/set {"ison":"true","mode":"white","$EVTPART0":"$EVTPART1"}\ temp:colorpicker,CT,3000,10,6500 shellies/DEVNAME/color/0/set {"ison":"true","mode":"white","$EVTPART0":"$EVTPART1"}\ rgb:colorpicker,RGB {$EVTPART1=~/(..)(..)(..)/; "shellies/DEVNAME/color/0/set {\"ison\":true,\"mode\":\"color\",\"red\":".hex($1).",\"green\":".hex($2)."\"blue\":".hex($3) } -deletereading DEVICE status_.* +deletereading -q DEVICE status_.* attr DEVICE readingList shellies/DEVNAME/color/0/status:.* {json2nameValue($EVENT)} attr DEVICE userReadings rgb {sprintf("%02X%02X%02X", ReadingsVal($name,"red",99), ReadingsVal($name,"green",99), ReadingsVal($name,"blue",99))} attr DEVICE webCmd on:off:brightness:temp:rgb @@ -915,6 +915,7 @@ attr DEVICE readingList shellies/DEVNAME/white/0/status:.* {json2nameValue($EVEN attr DEVICE setList off:noArg shellies/DEVNAME/white/0/command off\ on:noArg shellies/DEVNAME/white/0/command on\ brightness:colorpicker,BRI,0,1,100 shellies/DEVNAME/white/0/set {"ison":"true","mode":"white","brightness":"$EVTPART1"} +deletereading -q DEVICE .* setreading DEVICE associatedWith DEVICE_CH1,DEVICE_CH2,DEVICE_CH4 attr DEVICE webCmd on:off:brightness attr DEVICE model A_17a_shelly2rgbw_4w_split @@ -922,7 +923,6 @@ attr DEVICE comment Channel 1 for DEVICE, see also DEVICE_CH2, DEVICE_CH3 and DE attr DEVICE icon light_control attr DEVICE autocreate 0 attr DEVICE setStateList on off -deletereading DEVICE .* copy DEVICE DEVICE_CH2 setreading DEVICE_CH2 associatedWith DEVICE,DEVICE_CH3,DEVICE_CH4 attr DEVICE_CH2 readingList shellies/DEVNAME/white/1/status:.* {json2nameValue($EVENT)}\ @@ -998,7 +998,7 @@ par:BASE_ID;BASE_ID typically is milight;{ AttrVal("DEVICE","readingList","") =~ par:GROUP_ID;number from 0 to 4 representing one of the channels of an original bridge or remote;{ AttrVal("DEVICE","readingList","") =~ m,[^/]+[/][^/]+[/][^/]+[/]([0-4]):, ? $1 : undef } par:REMOTE_ID;HEX number representing a specific remote or bridge;{ AttrVal("DEVICE","readingList","") =~ m,([^/]+)[/](0x....)[/].*:, ? $2 : undef } par:BULB_TYPE;rgbw, cct, rgb_cct, rgb, fut089, ;{ AttrVal("DEVICE","readingList","") =~ m,[^/]+[/][^/]+[/][^/]+[/]([^/]+)[/].*:, ? $1 : undef } -deletereading DEVICE .*_.* +deletereading -q DEVICE .*_.* attr DEVICE icon light_control attr DEVICE eventMap /set_white:Weiss/night_mode:Nacht/white_mode:white/ attr DEVICE devStateIcon {zigbee2mqtt_devStateIcon255($name)} @@ -1026,7 +1026,7 @@ par:BASE_ID;BASE_ID typically is milight;{ AttrVal("DEVICE","readingList","") =~ par:REMOTE_ID;HEX number representing a specific remote or bridge;{ AttrVal("DEVICE","readingList","") =~ m,([^/]+)[/](0x....)[/].*:, ? $2 : undef } par:BULB_TYPE;rgbw, cct, rgb_cct, rgb, fut089, ;{ AttrVal("DEVICE","readingList","") =~ m,[^/]+[/][^/]+[/][^/]+[/]([^/]+)[/].*:, ? $1 : undef } copy DEVICE milight_REMOTE_ID_0 -deletereading milight_REMOTE_ID_0 .*_.* +deletereading -q milight_REMOTE_ID_0 .*_.* attr milight_REMOTE_ID_0 icon light_control attr milight_REMOTE_ID_0 eventMap /set_white:Weiss/night_mode:Nacht/white_mode:white/ attr milight_REMOTE_ID_0 devStateIcon {zigbee2mqtt_devStateIcon255($name)} @@ -1053,7 +1053,7 @@ par:BASE_ID;BASE_ID typically is milight;{ AttrVal("DEVICE","readingList","") =~ par:GROUP_ID;number from 0 to 4 representing one of the channels of an original bridge or remote;{ AttrVal("DEVICE","readingList","") =~ m,[^/]+[/][^/]+[/][^/]+[/]([0-4]):, ? $1 : undef } par:REMOTE_ID;HEX number representing a specific remote or bridge;{ AttrVal("DEVICE","readingList","") =~ m,([^/]+)[/](0x....)[/].*:, ? $2 : undef } par:BULB_TYPE;rgbw, cct, rgb_cct, rgb, fut089, ;{ AttrVal("DEVICE","readingList","") =~ m,[^/]+[/][^/]+[/][^/]+[/]([^/]+)[/].*:, ? $1 : undef } -deletereading DEVICE .*_.* +deletereading -q DEVICE .*_.* attr DEVICE icon light_control attr DEVICE eventMap /set_white:Weiss/night_mode:Nacht/white_mode:white/on:on/off:off/ON:on/OFF:off/next_mode:Mode/mode_speed_up:Faster/mode_speed_down:Slower/level_up:Up/level_down:Down/ attr DEVICE devStateIcon {zigbee2mqtt_devStateIcon255($name)} @@ -1091,7 +1091,7 @@ par:BASE_ID;BASE_ID typically is milight;{ AttrVal("DEVICE","readingList","") =~ par:GROUP_ID;number from 0 to 4 representing one of the channels of an original bridge or remote;{ AttrVal("DEVICE","readingList","") =~ m,[^/]+[/][^/]+[/][^/]+[/]([0-4]):, ? $1 : undef } par:REMOTE_ID;HEX number representing a specific remote or bridge;{ AttrVal("DEVICE","readingList","") =~ m,([^/]+)[/](0x....)[/].*:, ? $2 : undef } par:BULB_TYPE;rgbw, cct, rgb_cct, rgb, fut089, ;{ AttrVal("DEVICE","readingList","") =~ m,[^/]+[/][^/]+[/][^/]+[/]([^/]+)[/].*:, ? $1 : undef } -deletereading DEVICE .*_.* +deletereading -q DEVICE .*_.* attr DEVICE icon light_control attr DEVICE eventMap /set_white:Weiss/night_mode:Nacht/white_mode:white/on:on/off:off/ON:on/OFF:off/next_mode:Mode/mode_speed_up:Faster/mode_speed_down:Slower/level_up:Up/level_down:Down/ attr DEVICE devStateIcon {zigbee2mqtt_devStateIcon255($name)} @@ -1122,7 +1122,7 @@ par:BASE_ID;BASE_ID typically is milight;{ AttrVal("DEVICE","readingList","") =~ par:GROUP_ID;number from 0 to 4 representing one of the channels of an original bridge or remote;{ AttrVal("DEVICE","readingList","") =~ m,[^/]+[/][^/]+[/][^/]+[/]([0-4]):, ? $1 : undef } par:REMOTE_ID;HEX number representing a specific remote or bridge;{ AttrVal("DEVICE","readingList","") =~ m,([^/]+)[/](0x....)[/].*:, ? $2 : undef } par:BULB_TYPE;rgbw, cct, rgb_cct, rgb, fut089, ;{ AttrVal("DEVICE","readingList","") =~ m,[^/]+[/][^/]+[/][^/]+[/]([^/]+)[/].*:, ? $1 : undef } -deletereading DEVICE .*_.* +deletereading -q DEVICE .*_.* attr DEVICE icon light_control attr DEVICE eventMap /set_white:Weiss/night_mode:Nacht/white_mode:white/on:on/off:off/ON:on/OFF:off/next_mode:Mode/mode_speed_up:Faster/mode_speed_down:Slower/level_up:Up/level_down:Down/ attr DEVICE devStateIcon {zigbee2mqtt_devStateIcon255($name)}