mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 18:59:33 +00:00
mqtt2.template: Tasmota: set sending defaults to lowercase, bugfixes forum #94434 #msg885869; shelly: extend shelly1, forum #94060 #msg885591
git-svn-id: https://svn.fhem.de/fhem/trunk@18220 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
fb223f4000
commit
c5332ebc41
@ -136,12 +136,12 @@ attr DEVICE model L_05_zigbee2mqtt_smart+plug
|
||||
# - DVES_XXXXXX:/SmartHome/Esszimmer/Stehlampe/tele/LWT: => /SmartHome/Esszimmer/Stehlampe/cmnd/
|
||||
name:A_01a_tasmota_basic_state_power1
|
||||
filter:TYPE=MQTT2_DEVICE
|
||||
desc:Applies to Sonoff Basic, S20 using POWER1-topic for relay state <br>Use this in case "SetOption26 1" was used as described in tasmota documentation <br>NOTE: This template is intended to configure also channel one of multi-channel tasmota devices
|
||||
#par:COMMAND;Command topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\btele(/.*)?/LWT:, ? "${1}cmnd$2" : undef }
|
||||
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("DEVICE","POWER1","")) }
|
||||
attr DEVICE eventMap { dev=>{'^(.*)POWER(.?): OFF$'=>'$1POWER$2: off', '^(.*)POWER(.?): ON$'=>'$1POWER$2: on'} }
|
||||
attr DEVICE stateFormat 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 \
|
||||
off:noArg cmnd/DEVNAME/POWER1 0\
|
||||
on:noArg cmnd/DEVNAME/POWER1 1\
|
||||
@ -160,17 +160,9 @@ attr DEVICE model A_01a_tasmota_basic_state_power1
|
||||
# sonoff 1 channel device flashed with Tasmota.
|
||||
name:A_01_tasmota_basic
|
||||
filter:TYPE=MQTT2_DEVICE
|
||||
desc:Applies to Sonoff 1 Channel devices using POWER-topic for relay state
|
||||
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
|
||||
par:DEVNAME;ESP's name in the topic;{ AttrVal("DEVICE","readingList","") =~ m,tele/([^/]*)/, ? $1 : undef }
|
||||
#par:COMMAND;Command topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\btele(/.*)?/LWT:, ? "${1}cmnd$2" : undef }
|
||||
#attr DEVICE stateFormat POWER
|
||||
attr DEVICE userReadings state:POWER:.* { lc(ReadingsVal("DEVICE","POWER","")) }
|
||||
attr DEVICE setList \
|
||||
off:noArg cmnd/DEVNAME/POWER 0\
|
||||
on:noArg cmnd/DEVNAME/POWER 1\
|
||||
toggle:noArg cmnd/DEVNAME/POWER 2
|
||||
attr DEVICE model A_01_tasmota_basic
|
||||
|
||||
|
||||
name:A_01x_tasmota_clear_readings_reset_readingsList_and_reboot
|
||||
filter:TYPE=MQTT2_DEVICE
|
||||
@ -191,7 +183,6 @@ attr DEVICE autocreate 0
|
||||
name:A_01x_tasmota_prefix_clearing_and_reboot
|
||||
filter:TYPE=MQTT2_DEVICE
|
||||
desc:Applies to all tasmota devices <br>NOTE: This template will delete some readings and clear the readingList from prefix use when expanding json. <br>When applying the template the tasmota device is rebooted 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","")}
|
||||
par:READINGLISTCLEARED;cleared from prefixes;{ AttrVal("DEVICE","readingList","") =~ s/, '[^_]+[_]'/, ''/g, ? $1 : undef }
|
||||
@ -250,10 +241,11 @@ filter:TYPE=MQTT2_DEVICE
|
||||
desc:sonoff 2 channel device flashed with Tasmota. <br>NOTE: a second device will be created for the second channel
|
||||
set DEVICE attrTemplate A_01a_tasmota_basic_state_power1
|
||||
#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 }
|
||||
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("DEVICE_CH2","POWER2","")) }
|
||||
attr DEVICE_CH2 stateFormat 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 \
|
||||
@ -262,7 +254,6 @@ attr DEVICE_CH2 setList \
|
||||
toggle:noArg cmnd/DEVNAME/POWER2 2
|
||||
attr DEVICE model A_02_tasmota_2channel_split
|
||||
|
||||
|
||||
# tasmota 4ch as one FHEM device.
|
||||
name:A_04b_tasmota_4ch_unified_icon
|
||||
filter:TYPE=MQTT2_DEVICE
|
||||
@ -280,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
|
||||
@ -291,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) }\
|
||||
@ -306,6 +297,34 @@ attr DEVICE stateFormat P1: POWER1 P2: POWER2 P3: POWER3 P4: POWER4
|
||||
attr DEVICE webCmd POWER1 toggle:POWER2 toggle:POWER3 toggle:POWER4 toggle
|
||||
attr DEVICE model A_04a_tasmota_4ch_unified_basic_text
|
||||
|
||||
name:A_01z_tasmota_set_lowercase_texts_and_state1
|
||||
filter:TYPE=MQTT2_DEVICE
|
||||
desc:Applies to all tasmota devices <br>NOTE: This template will change ON, OFF etc. sent from tasmota side to lowercase. <br>After applying the template you might consider to delete or change stateFormat, eventMap and/or userReadings attribute values
|
||||
par:DEVNAME;ESP's name in the topic;{ AttrVal("DEVICE","readingList","") =~ m,tele/([^/]*)/, ? $1 : undef }
|
||||
par:IO_DEV;Currently used IO;{ AttrVal("DEVICE","IODev","")}
|
||||
set IO_DEV publish cmnd/DEVNAME/Backlog StateText1 off; StateText2 on; StateText3 toggle; StateText4 hold; SetOption26 1; SaveData 1
|
||||
|
||||
name:A_01z_tasmota_set_uppercase_texts_and_state1
|
||||
filter:TYPE=MQTT2_DEVICE
|
||||
desc:Applies to all tasmota devices <br>NOTE: This template will change on, off etc. sent from tasmota side to uppercase. NOTE: this template only exists for compability reasons to older MQTT implementations; not recommended for other user groups
|
||||
par:DEVNAME;ESP's name in the topic;{ AttrVal("DEVICE","readingList","") =~ m,tele/([^/]*)/, ? $1 : undef }
|
||||
par:IO_DEV;Currently used IO;{ AttrVal("DEVICE","IODev","")}
|
||||
set IO_DEV publish cmnd/DEVNAME/Backlog StateText1 OFF; StateText2 ON; StateText3 TOGGLE; StateText4 HOLD; SetOption26 1
|
||||
attr DEVICE userReadings state:POWER1:.* { lc(ReadingsVal($name,"POWER1","")) }
|
||||
|
||||
name:A_01z_tasmota_set_power1_state_to_power
|
||||
filter:TYPE=MQTT2_DEVICE
|
||||
desc:Applies to single relay tasmota devices <br>NOTE: this template only exists for compability reasons to other HA solutions; not recommended for usage in FHEM context
|
||||
par:DEVNAME;ESP's name in the topic;{ AttrVal("DEVICE","readingList","") =~ m,tele/([^/]*)/, ? $1 : undef }
|
||||
par:IO_DEV;Currently used IO;{ AttrVal("DEVICE","IODev","")}
|
||||
set IO_DEV publish cmnd/DEVNAME/SetOption26 0
|
||||
attr DEVICE userReadings state:POWER:.* { lc(ReadingsVal($name,"POWER","")) }
|
||||
|
||||
#name:A_01z_tasmota_test_IPAdress_to_http
|
||||
#filter:TYPE=MQTT2_DEVICE
|
||||
#desc:Applies to single relay tasmota devices <br>NOTE: this template changes existing eventMap attribute
|
||||
#attr DEVICE eventMap { dev=>{'^IPAddress.?: (\d+)\.(\d+)\.(\d+)\.(\d+)$'=>'<html><a href=http://$1.$2.$3.$4/>IPAddress</a></html>', } }
|
||||
|
||||
|
||||
###########################################
|
||||
# SHELLY
|
||||
@ -317,7 +336,12 @@ par:DEVNAME;Shelly1 name in the topic;{ AttrVal("DEVICE","readingList","") =~ m,
|
||||
attr DEVICE setList\
|
||||
off:noArg shellies/DEVNAME/relay/0/command off\
|
||||
on:noArg shellies/DEVNAME/relay/0/command on
|
||||
attr DEVICE readingList shellies/DEVNAME/relay/0:.* state
|
||||
attr DEVICE readingList shellies/DEVNAME/relay/0:.* state\
|
||||
shellies/DEVNAME/relay/0:.* relay0\
|
||||
shellies/DEVNAME/input/0:.* input0\
|
||||
shellies/DEVNAME/online:.* online\
|
||||
shellies/DEVNAME/announce:.* { json2nameValue($EVENT, '', $JSONMAP) }
|
||||
deleteReading DEVICE .*
|
||||
attr DEVICE model A_10_shelly1
|
||||
|
||||
# shellyplug using original firmware.
|
||||
@ -340,7 +364,9 @@ attr DEVICE setList \
|
||||
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\
|
||||
shellies/DEVNAME/status/0/rollers:.* power
|
||||
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 model A_11b_shelly2_roller
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user