From 46b513b5bc73054a2b8951499e816210d3cb95f5 Mon Sep 17 00:00:00 2001
From: Beta-User <>
Date: Tue, 30 Apr 2019 08:38:45 +0000
Subject: [PATCH] mqtt2.template: change deleteReading regexp (Forum #94060)
git-svn-id: https://svn.fhem.de/fhem/trunk@19297 2b470e98-0d58-463d-a4d8-8e2adae1ed80
---
fhem/FHEM/lib/AttrTemplate/mqtt2.template | 40 +++++++++++------------
1 file changed, 20 insertions(+), 20 deletions(-)
diff --git a/fhem/FHEM/lib/AttrTemplate/mqtt2.template b/fhem/FHEM/lib/AttrTemplate/mqtt2.template
index c43942f65..75d472c88 100644
--- a/fhem/FHEM/lib/AttrTemplate/mqtt2.template
+++ b/fhem/FHEM/lib/AttrTemplate/mqtt2.template
@@ -34,9 +34,9 @@ attr DEVCID comment Do not use very open bridgeRegexp expressions! This might le
attr DEVCID room NEWDEVROOM
attr DEVCID setStateList on off
deleteAttr DEVICE readingList
-deletereading -q DEVICE [^(associatedWith)]*
+deletereading -q DEVICE (?!associatedWith).*
deleteAttr DEVCID readingList
-deletereading -q DEVCID [^(associatedWith)]*
+deletereading -q DEVCID (?!associatedWith).*
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!
@@ -291,7 +291,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 -q DEVICE [^(associatedWith)]*
+deletereading -q DEVICE (?!associatedWith).*
attr DEVICE model L_06_zigbee2mqtt_ContactSensor
name:L_07_zigbee2mqtt_TempHumHpaSensor
@@ -301,7 +301,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 -q DEVICE [^(associatedWith)]*
+deletereading -q DEVICE (?!associatedWith).*
attr DEVICE model L_07_TempHumHpa_TempSensor
#source post: https://forum.fhem.de/index.php/topic,94495.msg898198.html#msg898198
@@ -312,7 +312,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 -q DEVICE [^(associatedWith)]*
+deletereading -q DEVICE (?!associatedWith).*
attr DEVICE model L_08_Human_Motion_TempSensor
#source post: https://forum.fhem.de/index.php/topic,94495.msg898198.html#msg898198
@@ -323,7 +323,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 -q DEVICE [^(associatedWith)]*
+deletereading -q DEVICE (?!associatedWith).*
attr DEVICE model L_09_Motion_Sensor
#source post: https://forum.fhem.de/index.php/topic,94495.msg898198.html#msg898198
@@ -334,7 +334,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 -q DEVICE [^(associatedWith)]*
+deletereading -q DEVICE (?!associatedWith).*
attr DEVICE model L_10_Water_Leak_Sensor
#source post: https://forum.fhem.de/index.php/topic,94495.msg898198.html#msg898198
@@ -345,7 +345,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 -q DEVICE [^(associatedWith)]*
+deletereading -q DEVICE (?!associatedWith).*
attr DEVICE model L_11_Light_Switch
#source post: https://forum.fhem.de/index.php/topic,94495.msg916789.html#msg916789
@@ -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 Action: action
attr DEVICE readingList BASE_TOPIC/DEV_ID:.* { json2nameValue($EVENT) }
-deletereading -q DEVICE [^(associatedWith)]*
+deletereading -q DEVICE (?!associatedWith).*
attr DEVICE model L_12_Wireless_Button
name:L_13_zigbee2mqtt_wireless_button_old
@@ -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 Click: click
attr DEVICE readingList BASE_TOPIC/DEV_ID:.* { json2nameValue($EVENT) }
-deletereading -q DEVICE [^(associatedWith)]*
+deletereading -q DEVICE (?!associatedWith).*
attr DEVICE model L_13_wireless_button_old
name:L_14_zigbee2mqtt_aqara_cube
@@ -376,7 +376,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 -q DEVICE [^(associatedWith)]*
+deletereading -q DEVICE (?!associatedWith).*
attr DEVICE model L_14_aqara_cube
@@ -404,7 +404,7 @@ attr DEVICE readingList \
tele/DEVNAME/SENSOR:.* { json2nameValue($EVENT) }\
tele/DEVNAME/INFO.:.* { json2nameValue($EVENT) }\
stat/DEVNAME/RESULT:.* { json2nameValue($EVENT) }
-deletereading -q DEVICE [^(associatedWith)]*
+deletereading -q DEVICE (?!associatedWith).*
attr DEVICE setStateList on off toggle
attr DEVICE autocreate 0
attr DEVICE model A_01a_tasmota_basic_state_power1
@@ -427,7 +427,7 @@ attr DEVICE readingList \
tele/DEVNAME/INFO.:.* { json2nameValue($EVENT) }\
tele/DEVNAME/UPTIME:.* { json2nameValue($EVENT) }\
stat/DEVNAME/RESULT:.* { json2nameValue($EVENT) }
-deletereading -q DEVICE [^(associatedWith)]*
+deletereading -q DEVICE (?!associatedWith).*
set IO_DEV publish cmnd/DEVNAME/Restart 1
attr DEVICE autocreate 0
@@ -438,7 +438,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 -q DEVICE [^(associatedWith)]*
+deletereading -q DEVICE (?!associatedWith).*
set IO_DEV publish cmnd/DEVNAME/Restart 1
attr DEVICE autocreate 0
@@ -594,7 +594,7 @@ attr DEVICE stateFormat \
LWT\
\
state
-deletereading -q DEVICE [^(associatedWith)]*
+deletereading -q DEVICE (?!associatedWith).*
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"\
@@ -689,7 +689,7 @@ attr DEVICE readingList \
tele/DEVNAME/STATE:.* { json2nameValue($EVENT) }\
stat/DEVNAME/RESULT:.* { json2nameValue($EVENT) }\
tele/DEVNAME/INFO.:.* { json2nameValue($EVENT) }
-deletereading -q DEVICE [^(associatedWith)]*
+deletereading -q DEVICE (?!associatedWith).*
attr DEVICE autocreate 0
attr DEVICE devStateIcon {Color::devStateIcon($name,"rgb","Color","state")}
attr DEVICE icon light_control
@@ -737,7 +737,7 @@ attr DEVICE readingList \
shellies/DEVNAME/input/0:.* input0\
shellies/DEVNAME/online:.* online\
shellies/DEVNAME/announce:.* { json2nameValue($EVENT) }
-deletereading -q DEVICE [^(associatedWith)]*
+deletereading -q DEVICE (?!associatedWith).*
attr DEVICE model A_10_shelly1
# shellyplug using original firmware.
@@ -779,7 +779,7 @@ Aktueller Verbrauch: relay_0_power\
\
Temperatur: temperature °C
attr DEVICE webCmd :
-deletereading -q DEVICE [^(associatedWith)]*
+deletereading -q DEVICE (?!associatedWith).*
attr DEVICE model A_10b_shelly1pm
@@ -805,7 +805,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 -q DEVICE [^(associatedWith)]*
+deletereading -q DEVICE (?!associatedWith).*
attr DEVICE setStateList open close stop
attr DEVICE model A_11b_shelly2_roller
@@ -955,7 +955,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 [^(associatedWith)]*
+deletereading -q DEVICE (?!associatedWith).*
setreading DEVICE associatedWith DEVICE_CH1,DEVICE_CH2,DEVICE_CH4
attr DEVICE webCmd on:off:brightness
attr DEVICE model A_17a_shelly2rgbw_4w_split