From 576d2f4ad05fa28e6c76ccb74d112c75f8c2f060 Mon Sep 17 00:00:00 2001
From: Beta-User <>
Date: Thu, 17 Oct 2019 07:15:15 +0000
Subject: [PATCH] mqtt2.template: add tasmota-multi DS18x20 template; bugfix in
zigbee2mqtt AlarmSensor
git-svn-id: https://svn.fhem.de/fhem/trunk@20373 2b470e98-0d58-463d-a4d8-8e2adae1ed80
---
fhem/FHEM/lib/AttrTemplate/mqtt2.template | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/fhem/FHEM/lib/AttrTemplate/mqtt2.template b/fhem/FHEM/lib/AttrTemplate/mqtt2.template
index d54c00b54..f5c0080aa 100644
--- a/fhem/FHEM/lib/AttrTemplate/mqtt2.template
+++ b/fhem/FHEM/lib/AttrTemplate/mqtt2.template
@@ -445,7 +445,7 @@ par:BASE_TOPIC;base topic 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 setList \
sensitivity:low,medium,high BASE_TOPIC/DEV_ID/set {"sensitivity":"$EVTPART1"}
-attr DEVICE stateFormat Action: action X: angle_X Y: angle_Y Z: angle_Z
+attr DEVICE stateFormat Action: action X: angle_x Y: angle_y Z: angle_z
attr DEVICE readingList BASE_TOPIC/DEV_ID:.* { json2nameValue($EVENT) }
deletereading -q DEVICE (?!associatedWith).*
attr DEVICE model zigbee2mqtt_AlarmSensor
@@ -624,6 +624,19 @@ attr DEVICE stateFormat state\
attr DEVICE event-on-change-reading .*
attr DEVICE model tasmota_rf
+# forum: https://forum.fhem.de/index.php/topic,104475.0.html
+name:tasmota_use_DS18x20_id
+desc:Use this in case you have multiple DS18x20 sensors attached to your tasmota device. Adds a readingList entry to extract 1wire ID's from JSON to keep temparature values bound to the ID.
Forum Thread
See tasmota-Wiki for how to configure for multiple DS18x20 sensors
+filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*(tele|cmnd|stat).*
+order:A_01d2
+par:TELETOPIC;info topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}tele$3" : undef }
+attr DEVICE readingList \
+ TELETOPIC/INFO.:.* { json2nameValue($EVENT) }\
+ TELETOPIC/RESULT:.* { my %ret; while ($EVENT =~ /.Id...([A-F0-9]{12})...Temperature..([\d]+\.[\d]+)./g) { $ret{"Temperatur_".$1}=$2; }; return \%ret; }\
+ TELETOPIC/RESULT:.* { json2nameValue($EVENT) }
+farewell:template has been applied successfully. You might want to edit readingList attribute to avoid double info or let autocreate add more entries.
+attr DEVICE model tasmota_use_DS18x20_id
+
# tasmota 2ch as one FHEM device.
name:tasmota_2ch_unified
filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*(tele|cmnd|stat).*