From 9d9f3ef4f8b903d439a7815b0dd4510f88b22762 Mon Sep 17 00:00:00 2001
From: Beta-User <>
Date: Wed, 11 Nov 2020 06:00:57 +0000
Subject: [PATCH] mqtt2.template: further changes to ems-esp templates for V
2.1
git-svn-id: https://svn.fhem.de/fhem/trunk@23134 2b470e98-0d58-463d-a4d8-8e2adae1ed80
---
fhem/FHEM/lib/AttrTemplate/mqtt2.template | 135 +++++++++++++++++++---
1 file changed, 117 insertions(+), 18 deletions(-)
diff --git a/fhem/FHEM/lib/AttrTemplate/mqtt2.template b/fhem/FHEM/lib/AttrTemplate/mqtt2.template
index 204501db7..b81ad5cc4 100644
--- a/fhem/FHEM/lib/AttrTemplate/mqtt2.template
+++ b/fhem/FHEM/lib/AttrTemplate/mqtt2.template
@@ -71,7 +71,7 @@ filter:TYPE=MQTT2_DEVICE
desc:Adds a new ignoreRegexp to the courrent IO device of device it is applied to. This will prevent evaluation of incoming messages typically meant to go towards the hardware including branches with "cmnd" tasmota.
NOTE: early experimental version...
order:0000021
par:IODEVNAME;Name of the IO-Device; { InternalVal("DEVICE","LASTInputDev",AttrVal("DEVICE","IODev",undef)) }
-par:NEWIGNOREREGEXP;NEWIGNOREREGEXP as set if expression is already included, otherwise it will be added;{ my $old = AttrVal(InternalVal("DEVICE","LASTInputDev",AttrVal("DEVICE","IODev",undef)),"ignoreRegexp",'cmnd/[^/]+/'); 'cmnd/[^/]+/' =~ m/$old/ ? $old : $old.'|cmnd/[^/]+/' }
+par:NEWIGNOREREGEXP;NEWIGNOREREGEXP as set if expression is already included, otherwise it will be added;{ my $old = AttrVal(InternalVal("DEVICE","LASTInputDev",AttrVal("DEVICE","IODev",undef)),"ignoreRegexp",'cmnd/[^:"]+:'); 'cmnd/[^:"]+:' =~ m/$old/ ? $old : $old.'|cmnd/[^:"]+:' }
attr IODEVNAME ignoreRegexp NEWIGNOREREGEXP
name:MQTT2_IO_ignoreRegexp_shelly
@@ -79,7 +79,7 @@ filter:TYPE=MQTT2_DEVICE
desc:Adds a new ignoreRegexp to the courrent IO device of device it is applied to. This will prevent evaluation of incoming messages typically meant to go towards the hardware including branches with "command" for shelly.
NOTE: early experimental version!!! This is known for some strange effects, so make sure to have a copy of the existing one, of it's already sophisticated...
order:0000022
par:IODEVNAME;Name of the IO-Device; { InternalVal("DEVICE","LASTInputDev",AttrVal("DEVICE","IODev",undef)) }
-par:NEWIGNOREREGEXP;NEWIGNOREREGEXP as set if shelly is included, otherwise it will be added;{ my $old = AttrVal(InternalVal("DEVICE","LASTInputDev",AttrVal("DEVICE","IODev",undef)),'ignoreRegexp','shellies/[^/]+/command'); 'shellies/[^/]+/command' =~ m{$old} ? $old : $old.'|shellies/[^/]+/command' }
+par:NEWIGNOREREGEXP;NEWIGNOREREGEXP as set if shelly is included, otherwise it will be added;{ my $old = AttrVal(InternalVal("DEVICE","LASTInputDev",AttrVal("DEVICE","IODev",undef)),'ignoreRegexp','shellies/[^:"]+/command'); 'shellies/[^:"]+/command' =~ m{$old} ? $old : $old.'|shellies/[^:"]+/command' }
option:{return 1 if 'NEWIGNOREREGEXP' ne AttrVal(AttrVal(InternalVal("DEVICE","LASTInputDev",AttrVal("DEVICE","IODev",undef)),'ignoreRegexp','not_set');return 0}
attr IODEVNAME ignoreRegexp NEWIGNOREREGEXP
@@ -90,7 +90,7 @@ desc:Expands existing or adds a ignoreRegexp to the courrent IO device of device
order:000002a
farewell:template has been applied successfully. If you will not be redirected to IODev detail page, no changes have been made.
Check further extending the ignoreRegexp by yourself!
par:IODEVNAME;Name of the IO-Device; { InternalVal("DEVICE","LASTInputDev",AttrVal("DEVICE","IODev",undef)) }
-par:NEWIGNOREREGEXP;NEWIGNOREREGEXP as set if homeassistant is included, otherwise it will be added;{ my $old = AttrVal(InternalVal("DEVICE","LASTInputDev",AttrVal("DEVICE","IODev",undef)),"ignoreRegexp",'homeassistant/.*/config'); 'homeassistant/.*/config' =~ m/$old/ ? $old : $old.'|homeassistant/.*/config' }
+par:NEWIGNOREREGEXP;NEWIGNOREREGEXP as set if homeassistant is included, otherwise it will be added;{ my $old = AttrVal(InternalVal("DEVICE","LASTInputDev",AttrVal("DEVICE","IODev",undef)),"ignoreRegexp",'homeassistant/[^:"]+/config'); 'homeassistant/[^:"]+/config' =~ m/$old/ ? $old : $old.'|homeassistant/[^:"]+/config' }
option:{return 1 if 'NEWIGNOREREGEXP' ne AttrVal(InternalVal("DEVICE","LASTInputDev",AttrVal("DEVICE","IODev",undef)),'ignoreRegexp','not_set');return 0}
attr IODEVNAME ignoreRegexp NEWIGNOREREGEXP
{ fhem "trigger $FW_wname JS:location.href='$FW_ME?detail=IODEVNAME'" if($cl && $cl->{TYPE} eq "FHEMWEB") }
@@ -2480,6 +2480,25 @@ attr DEVICE userReadings state:(doorWindow|tilt).* { ReadingsVal($name,"doorWind
attr DEVICE model shellydw
setreading DEVICE attrTemplateVersion 20200812
+# shelly ix3 using original firmware
+# source info: https://forum.fhem.de/index.php/topic,114973.msg1092039.html#msg1092039
+name:shelly_ix3
+filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*shellies.*
+desc:shelly ix3 using original firmware.
Note: untested attrTemplate
+order:A_16c
+par:DEVNAME;name of this shelly;{ AttrVal("DEVICE","readingList","") =~ m,shellies/([^/]+)/, ? $1 : undef }
+#par:ICON;ICON as set, defaults to fts_window_1w_open;{ AttrVal("DEVICE","icon","fts_window_1w_open") }
+#attr DEVICE icon ICON
+attr DEVICE stateFormat In 1:\
+input_0\
+
In 2:\
+input_1\
+
In 3:\
+input_2
+attr DEVICE devStateIcon 0:off 1:on
+attr DEVICE model shelly_ix3
+setreading DEVICE attrTemplateVersion 20201110
+
#shelly2rgbw
# contributed by dkreutz http://forum.fhem.de/index.php/topic,94060.msg944338.html#msg944338
# shellyrgbw2 color mode
@@ -2984,8 +3003,7 @@ attr DEVICE icon ICON
modify DEVICE DEV_ID
attr DEVICE bridgeRegexp \
DEV_ID/(sensors|sm_data|hp_data|thermostat_data).*:.* "ems_esp_$1"\
- DEV_ID/(boiler_data|tapwater_active|heating_active|mixing_data|shower_data).*:.* "ems_esp_boiler"\
- DEV_ID/(status|info|heartbeat).*:.* "Heizung"
+ DEV_ID/(boiler_data|tapwater_active|heating_active|mixing_data|shower_data).*:.* "ems_esp_boiler"
attr DEVICE userReadings formatedUptime:uptime.* {my $m = ReadingsVal($name,"uptime_sec",0)/60;; return sprintf "0 000 00:%02d", $m if $m < 60;; my $h = $m / 60;; $m %= 60;; return sprintf "0 000 %02d:%02d", $h, $m if $h < 24;; my $d = $h / 24;; $h %= 24;; return sprintf "0 %03d %02d:%02d", $d, $h, $m if $d <365;; my $y = $d / 365;; $d %= 365;; return sprintf "%d %03d %02d:%02d", $y, $d, $h, $m}
attr DEVICE readingList DEV_ID/status:.* LWT\
DEV_ID/heartbeat:.* { json2nameValue($EVENT) }\
@@ -3002,7 +3020,88 @@ attr DEVICE devStateIcon online:it_net offline:it_net@red 2.1:lan_rs485 2.0:lan
attr DEVICE autocreate 1
attr DEVICE webCmd restart
attr DEVICE model ems-esp_heater_device
-setreading DEVICE attrTemplateVersion 20201107
+setreading DEVICE attrTemplateVersion 20201110
+
+name:ems-esp_boiler
+filter:TYPE=MQTT2_DEVICE
+desc:To configure a boiler device for use with an EMS-ESP with Firmware 2.1.0.
Forum Thread
+order:E_02b
+par:DEV_ID;ID topic set, default is "ems-esp";{ AttrVal("DEVICE","readingList","") =~ m,[^/:]+/([^/]+), ? $1 : "ems-esp" }
+attr DEVICE readingList DEV_ID/boiler_data { json2nameValue($EVENT) }\
+ DEV_ID/shower_data:.* { json2nameValue($EVENT) }\
+ DEV_ID/mixing_data:.* { json2nameValue($EVENT) }\
+ DEV_ID/tapwater_active:.* tapwater_active\
+ DEV_ID/heating_active:.* heating_active\
+ DEV_ID/boiler_data_ww:.* { json2nameValue($EVENT) }\
+attr DEVICE stateFormat \
+ Vorlauf: curFlowTemp C\
+ Rücklauf: retTemp C \
+ Vorlauf Soll: selFlowTemp C\
+ SystemDruck: sysPress Bar \
+ Wasserspeicher: wwStorageTemp2 C \
+ Status: BoilerStatus \
+ Status-Code: serviceCode serviceCodeNumber\
+ Temp Außen: outdoorTemp C\
+attr DEVICE devStateIcon idle:sani_heating heating:sani_heating@red tapwater:sani_water_hot@red
+attr DEVICE userReadings BoilerStatus {BoilerStatus("serviceCode","serviceCodeNumber")}
+attr DEVICE model ems-esp_boiler
+setreading DEVICE attrTemplateVersion 20201110
+
+#ems-esp thermostat device
+name:ems-esp_thermostat_read-only
+filter:TYPE=MQTT2_DEVICE
+desc:To configure a simple read-only thermostat (e.g. CT200) for use with an EMS-ESP with Firmware 2.1.0.
Forum Thread
+order:E_02c
+par:DEV_ID;ID topic set, default is "ems-esp";{ AttrVal("DEVICE","readingList","") =~ m,[^/:]+/([^/]+), ? $1 : "ems-esp" }
+par:ICON;ICON as set, defaults to temp_control;{ AttrVal("DEVICE","icon","temp_control") }
+attr DEVICE icon ICON
+attr DEVICE devStateIcon auto:time_automatic manual:time_manual_mode
+attr DEVICE jsonMap hc1_mode:mode hc1_seltemp:desired-temp hc1_daytemp:daytemp hc1_nighttemp:nighttemp hc1_holidayttemp:holidaytemp
+attr DEVICE readingList DEV_ID/thermostat_data:.* { json2nameValue($EVENT, '', $JSONMAP) }
+attr DEVICE stateFormat mode\
+desired-temp °C
+attr DEVICE webCmd :
+attr DEVICE model ems-esp_thermostat_read-only
+setreading DEVICE attrTemplateVersion 20201110
+
+name:ems-esp_thermostat_simple
+filter:TYPE=MQTT2_DEVICE
+desc:To configure a simple thermostat (e.g. RC300) for use with an EMS-ESP with Firmware 2.1.0.
Forum Thread
+order:E_02c1
+par:DEV_ID;ID topic set, default is "ems-esp";{ AttrVal("DEVICE","readingList","") =~ m,[^/:]+/([^/]+), ? $1 : "ems-esp" }
+par:ICON;ICON as set, defaults to temp_control;{ AttrVal("DEVICE","icon","temp_control") }
+attr DEVICE icon ICON
+attr DEVICE devStateIcon set.auto:edit_settings:mode+manual set.manual:edit_settings:mode+auto auto:time_automatic:mode+manual manual:time_manual_mode:mode+auto set.*°C:edit_settings
+attr DEVICE jsonMap hc1_mode:mode hc1_seltemp:desired-temp hc1_daytemp:daytemp hc1_nighttemp:nighttemp hc1_holidayttemp:holidaytemp
+attr DEVICE readingList DEV_ID/thermostat_data:.* { json2nameValue($EVENT, '', $JSONMAP) }
+attr DEVICE setList mode:uzsuSelectRadio,auto,manual DEV_ID/thermostat_cmd_mode1 $EVTPART1\
+ desired-temp:slider,15.0,0.5,30.0,1 DEV_ID/thermostat_cmd_temp1 $EVTPART1
+attr DEVICE setStateList on off
+attr DEVICE stateFormat mode\
+desired-temp °C
+attr DEVICE webCmd mode:desired-temp
+set DEVICE attrTemplate speechcontrol_type_thermostat
+attr DEVICE model ems-esp_thermostat_simple
+setreading DEVICE attrTemplateVersion 20201110
+
+name:ems-esp_thermostat_RC35_type
+filter:TYPE=MQTT2_DEVICE
+desc:To configure a thermostat comparable to RC35 for use with an EMS-ESP with Firmware 2.1.0
.Forum Thread
+order:E_02c1
+par:DEV_ID;ID topic set, default is "ems-esp";{ AttrVal("DEVICE","readingList","") =~ m,[^/:]+/([^/]+), ? $1 : "ems-esp" }
+attr DEVICE readingList DEV_ID/thermostat_data:.* { json2nameValue($EVENT) } \
+ DEV_ID/thermostat_data1:.* { json2nameValue($EVENT) } \
+ DEV_ID/thermostat_data_hc1:.* { json2nameValue($EVENT) } \
+attr DEVICE setList mode:uzsuSelectRadio,auto,manual DEV_ID/thermostat_cmd_mode1 $EVTPART1 \
+ desired-temp:slider,15.0,0.5,30.0,1 DEV_ID/thermostat_cmd_temp1 $EVTPART1 \
+ daytemp:slider,15.0,0.5,30.0,1 DEV_ID/thermostat_cmd_daytemp1 $EVTPART1 \
+ nighttemp:slider,15.0,0.5,30.0,1 DEV_ID/thermostat_cmd_nighttemp1 $EVTPART1 \
+ holidaytemp:slider,15.0,0.5,30.0,1 DEV_ID/thermostat_cmd_holidayttemp1 $EVTPART1
+attr DEVICE model ems-esp_thermostat_RC35_type
+attr DEVICE stateFormat mode\
+seltemp °C
+setreading DEVICE attrTemplateVersion 20201110
+
name:ems-esp_heater_device_outdated
@@ -3033,10 +3132,10 @@ attr DEVICE webCmd restart
attr DEVICE model ems-esp_heater_device_outdated
setreading DEVICE attrTemplateVersion 20200522 or prior
-name:ems-esp_boiler
+name:ems-esp_boiler_outdated
filter:TYPE=MQTT2_DEVICE
desc:To configure a boiler device for use with an EMS-ESP
.Forum Thread
-order:E_02b
+order:E_02b1
par:BASEPATH;base topic set in the ESP including "ems-esp";{ AttrVal("DEVICE","readingList","") =~ m,([^:]*ems-esp)/boiler_data:, ? "$1" : undef }
attr DEVICE readingList BASEPATH/boiler_data { json2nameValue($EVENT,'',$JSONMAP) }\
BASEPATH/shower_data:.* { json2nameValue($EVENT,'',$JSONMAP) }\
@@ -3048,14 +3147,14 @@ attr DEVICE devStateIcon idle:sani_heating heating:sani_heating@red tapwater:san
attr DEVICE setList wWComfort:select,hot,intelligent BASEPATH/boiler_cmd { "cmd":"comfort", "data": "$EVTPART1" }
attr DEVICE webCmd wWComfort
attr DEVICE eventMap hot:Hot intelligent:Eco
-attr DEVICE model ems-esp_boiler
+attr DEVICE model ems-esp_boiler_outdated
setreading DEVICE attrTemplateVersion 20200529
#ems-esp thermostat device
-name:ems-esp_thermostat_read-only
+name:ems-esp_thermostat_read-only_outdated
filter:TYPE=MQTT2_DEVICE
desc:To configure a simple read-only thermostat (e.g. CT200) for use with an EMS-ESP.
Forum Thread
-order:E_02c
+order:E_02c1
par:BASEPATH;base topic set in the ESP including "ems-esp";{ AttrVal("DEVICE","readingList","") =~ m,([^:]*ems-esp)/thermostat_data:, ? "$1" : undef }
par:ICON;ICON as set, defaults to temp_control;{ AttrVal("DEVICE","icon","temp_control") }
attr DEVICE icon ICON
@@ -3065,13 +3164,13 @@ attr DEVICE readingList BASEPATH/thermostat_data:.* { json2nameValue($EVENT, '',
attr DEVICE stateFormat mode\
desired-temp °C
attr DEVICE webCmd :
-attr DEVICE model ems-esp_thermostat_read-only
+attr DEVICE model ems-esp_thermostat_read-only_outdated
setreading DEVICE attrTemplateVersion 20200522 or prior
-name:ems-esp_thermostat_simple
+name:ems-esp_thermostat_simple_outdated
filter:TYPE=MQTT2_DEVICE
desc:To configure a simple thermostat (e.g. RC300) for use with an EMS-ESP.
Forum Thread
-order:E_02c1
+order:E_02ca
par:BASEPATH;base topic set in the ESP including "ems-esp";{ AttrVal("DEVICE","readingList","") =~ m,([^:]*ems-esp)/thermostat_data:, ? "$1" : undef }
par:ICON;ICON as set, defaults to temp_control;{ AttrVal("DEVICE","icon","temp_control") }
attr DEVICE icon ICON
@@ -3085,13 +3184,13 @@ attr DEVICE stateFormat mode\
desired-temp °C
attr DEVICE webCmd mode:desired-temp
set DEVICE attrTemplate speechcontrol_type_thermostat
-attr DEVICE model ems-esp_thermostat_simple
+attr DEVICE model ems-esp_thermostat_simple_outdated
setreading DEVICE attrTemplateVersion 20200522 or prior
-name:ems-esp_thermostat_RC35_type
+name:ems-esp_thermostat_RC35_type_outdated
filter:TYPE=MQTT2_DEVICE
desc:To configure a thermostat comparable to RC35 for use with an EMS-ESP
.Forum Thread
-order:E_02c1
+order:E_02ca1
par:BASEPATH;base topic set in the ESP including "ems-esp";{ AttrVal("DEVICE","readingList","") =~ m,([^:]*ems-esp)/thermostat_data:, ? "$1" : undef }
set DEVICE attrTemplate ems-esp_thermostat_simple
attr DEVICE setList mode:uzsuSelectRadio,auto,manual BASEPATH/thermostat_cmd_mode1 $EVTPART1\
@@ -3100,7 +3199,7 @@ attr DEVICE setList mode:uzsuSelectRadio,auto,manual BASEPATH/thermostat_cmd_mod
nighttemp:slider,15.0,0.5,30.0,1 BASEPATH/thermostat_cmd_nighttemp1 $EVTPART1\
holidaytemp:slider,15.0,0.5,30.0,1 BASEPATH/thermostat_cmd_holidayttemp1 $EVTPART1
set DEVICE attrTemplate speechcontrol_type_thermostat
-attr DEVICE model ems-esp_thermostat_RC35_type
+attr DEVICE model ems-esp_thermostat_RC35_type_outdated
setreading DEVICE attrTemplateVersion 20200522 or prior