2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-22 14:16:42 +00:00

mqtt2.template: Tasmota: smaller corrections to streamline attributes forum #94434 #msg886570; shelly: change roller device for better ASC compability, forum #92628 #msg886363

git-svn-id: https://svn.fhem.de/fhem/trunk@18227 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
Beta-User 2019-01-13 07:51:01 +00:00
parent 4ff2107b1c
commit 826ec6ff5f

View File

@ -139,7 +139,7 @@ filter:TYPE=MQTT2_DEVICE
desc:Applies to Sonoff Basic, S20 using POWER1-topic for relay state <br>NOTE: The format the device is sending data will also be changed to lowercase!<br>NOTE: This template is intended to configure also channel one of multi-channel tasmota devices
par:DEVNAME;ESP's name in the topic;{ AttrVal("DEVICE","readingList","") =~ m,tele/([^/]*)/, ? $1 : undef }
attr DEVICE stateFormat POWER1
attr DEVICE userReadings state:POWER1:.* { lc(ReadingsVal($name,"POWER1","")) }
#attr DEVICE userReadings state:POWER1:.* { lc(ReadingsVal($name,"POWER1","")) }
#attr DEVICE eventMap { dev=>{'^(.*)POWER(.?): OFF$'=>'$1POWER$2: off', '^(.*)POWER(.?): ON$'=>'$1POWER$2: on'} }
set DEVICE attrTemplate A_01z_tasmota_set_lowercase_texts_and_state1
attr DEVICE setList \
@ -163,11 +163,9 @@ filter:TYPE=MQTT2_DEVICE
desc:Applies to Sonoff 1 Channel devices using POWER-topic for relay state <br>NOTE: Power topic will be set to POWER1; the format the device is sending data will also be changed to lowercase!
set DEVICE attrTemplate A_01a_tasmota_basic_state_power1
name:A_01x_tasmota_clear_readings_reset_readingsList_and_reboot
filter:TYPE=MQTT2_DEVICE
desc: replaces the readingList with defaults, clears the readingList and reboots to get all readings
#par:COMMAND;Command topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\btele(/.*)?/LWT:, ? "${1}cmnd$2" : undef }
par:DEVNAME;ESP's name in the topic;{ AttrVal("DEVICE","readingList","") =~ m,tele/([^/]*)/, ? $1 : undef }
par:IO_DEV;Currently used IO;{ AttrVal("DEVICE","IODev","")}
attr DEVICE readingList \
@ -245,14 +243,16 @@ par:DEVNAME;ESP's name in the topic;{ AttrVal("DEVICE","readingList","") =~ m,te
attr DEVICE comment Channel 1 for DEVICE, see also DEVICE_CH2
copy DEVICE DEVICE_CH2
attr DEVICE_CH2 stateFormat POWER2
attr DEVICE_CH2 userReadings state:POWER2:.* { lc(ReadingsVal($name,"POWER2","")) }
#attr DEVICE_CH2 userReadings state:POWER2:.* { lc(ReadingsVal($name,"POWER2","")) }
attr DEVICE_CH2 comment Channel 2 for DEVICE
setreading DEVICE_CH2 associatedWith DEVICE
attr DEVICE_CH2 setList \
off:noArg cmnd/DEVNAME/POWER2 0\
on:noArg cmnd/DEVNAME/POWER2 1\
toggle:noArg cmnd/DEVNAME/POWER2 2
attr DEVICE_CH2 setStateList on off toggle
attr DEVICE model A_02_tasmota_2channel_split
attr DEVICE_CH2 model A_02_tasmota_2channel_split
# tasmota 4ch as one FHEM device.
name:A_04b_tasmota_4ch_unified_icon
@ -271,7 +271,7 @@ attr DEVICE devStateIcon { "<div>\
<a href=\"/fhem?cmd.dummy=set ".$name." p3 toggle&XHR=1\">POWER3:" . FW_makeImage(lc ReadingsVal($name, "POWER3", "off")) . "</a> \
<a href=\"/fhem?cmd.dummy=set ".$name." p4 toggle&XHR=1\">POWER4:" . FW_makeImage(lc ReadingsVal($name, "POWER4", "off")) . "</a\
></div>" }
attr DEVICE userReadings state:POWER.*:.* { lc(ReadingsVal($name,"POWER1","") . " " . ReadingsVal($name,"POWER2","") . " " . ReadingsVal($name,"POWER3","") . " " . ReadingsVal($name,"POWER4","")) }
#attr DEVICE userReadings state:POWER.*:.* { lc(ReadingsVal($name,"POWER1","") . " " . ReadingsVal($name,"POWER2","") . " " . ReadingsVal($name,"POWER3","") . " " . ReadingsVal($name,"POWER4","")) }
attr DEVICE stateFormat P1: POWER1 P2: POWER2 P3: POWER3 P4: POWER4
attr DEVICE webCmd :
attr DEVICE model A_04b_tasmota_4ch_unified_icon
@ -282,7 +282,7 @@ desc:Configures a single device
filter:TYPE=MQTT2_DEVICE
set DEVICE attrTemplate A_01a_tasmota_basic_state_power1
par:DEVNAME;ESP's name in the topic;{ AttrVal("DEVICE","readingList","") =~ m,tele/([^/]*)/, ? $1 : undef }
attr DEVICE userReadings state:POWER.*:.* { lc(ReadingsVal($name,"POWER1","") . " " . ReadingsVal($name,"POWER2","") . " " . ReadingsVal($name,"POWER3","") . " " . ReadingsVal($name,"POWER4","")) }
#attr DEVICE userReadings state:POWER.*:.* { lc(ReadingsVal($name,"POWER1","") . " " . ReadingsVal($name,"POWER2","") . " " . ReadingsVal($name,"POWER3","") . " " . ReadingsVal($name,"POWER4","")) }
attr DEVICE readingList tele/DEVNAME/LWT:.* LWT\
tele/DEVNAME/STATE:.* { json2nameValue($EVENT,'',$JSONMAP) }\
tele/DEVNAME/SENSOR:.* { json2nameValue($EVENT,'',$JSONMAP) }\
@ -362,12 +362,14 @@ attr DEVICE setList \
open:noArg shellies/DEVNAME/roller/0/command open\
close:noArg shellies/DEVNAME/roller/0/command close\
stop:noArg shellies/DEVNAME/roller/0/command stop\
pos:slider,0,1,100 shellies/DEVNAME/roller/0/command/pos $EVTPART1
attr DEVICE readingList shellies/DEVNAME/roller/0/pos:.* state\
pct:slider,0,1,100 shellies/DEVNAME/roller/0/command/pos $EVTPART1\
DoRecalibration:noArg shellies/DEVNAME/roller/0/command rc\
attr DEVICE readingList shellies/DEVNAME/roller/0/pos:.* pct\
shellies/DEVNAME/status/0/rollers:.* power\
shellies/DEVNAME/online:.* online\
shellies/DEVNAME/announce:.* { json2nameValue($EVENT, '', $JSONMAP) }
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
attr DEVICE stateFormat pct
attr DEVICE model A_11b_shelly2_roller
# shelly2 using original firmware.