From 11ac8e1d540de5a2b8dfb65d5e360c40bdb705f1 Mon Sep 17 00:00:00 2001 From: Beta-User Date: Thu, 23 Jan 2020 09:20:49 +0000 Subject: [PATCH] mqtt2.attrTemplate: add another ems-esp template; enhance 2 shelly-pm devStateIcon-codes; httpmod.attrTemplate: small change in DWD git-svn-id: https://svn.fhem.de/fhem/trunk@21038 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/lib/AttrTemplate/httpmod.template | 3 ++- fhem/FHEM/lib/AttrTemplate/mqtt2.template | 23 +++++++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/fhem/FHEM/lib/AttrTemplate/httpmod.template b/fhem/FHEM/lib/AttrTemplate/httpmod.template index 838b949b2..b2ec9505b 100644 --- a/fhem/FHEM/lib/AttrTemplate/httpmod.template +++ b/fhem/FHEM/lib/AttrTemplate/httpmod.template @@ -32,7 +32,7 @@ attr DEVICE reading02Name SuperE10 attr DEVICE reading02Regex
Super E10
[\S\s\r\n]*?(\d.\d{2}[\S\s\r\n]*?[\d]+) attr DEVICE reading03Name SuperE5 attr DEVICE reading03Regex
Super E5
[\S\s\r\n]*?(\d.\d{2}[\S\s\r\n]*?[\d]+) -attr DEVICE readingOExpr $val =~ s/<[\d\D]+>//;;;;$val +attr DEVICE readingOExpr $val =~ s/<[\d\D]+>//;;$val attr DEVICE stateFormat E5: SuperE5 € / E10: SuperE10 € / D: Diesel € attr DEVICE timeout 10 attr DEVICE verbose 2 @@ -75,6 +75,7 @@ par:WHICHROOM;Actual room of the device, defaults to HTTPMOD; {AttrVal("DEVICE", attr DEVICE enableControlSet 1 attr DEVICE extractAllJSON 1 attr DEVICE extractAllJSONFilter REGIONCODE +attr DEVICE readingOExpr $val = FmtDateTime($val/1000) if $val =~ m/^[\d]+$/g && $val > 10000;;$val attr DEVICE readingEncode UTF-8 attr DEVICE preProcessRegex s/warnWetter..............|\);|\t|\n|\r//g attr DEVICE room WHICHROOM diff --git a/fhem/FHEM/lib/AttrTemplate/mqtt2.template b/fhem/FHEM/lib/AttrTemplate/mqtt2.template index 14c41003e..20ffb5642 100644 --- a/fhem/FHEM/lib/AttrTemplate/mqtt2.template +++ b/fhem/FHEM/lib/AttrTemplate/mqtt2.template @@ -664,7 +664,7 @@ attr DEVICE setList \ off:noArg CMNDTOPIC/POWER1 0\ on:noArg CMNDTOPIC/POWER1 1\ toggle:noArg CMNDTOPIC/POWER1 2 -attr DEVICE devStateIcon {my $onl = ReadingsVal($name,"LWT","false") eq "Online"?"10px-kreis-gruen":"10px-kreis-rot";; my $light = ReadingsVal($name,"state","off");;"".FW_makeImage($onl)." ".FW_makeImage($light)." uptime: ".ReadingsVal($name,"Uptime",undef).sprintf(" aktuell: %.1f W Tag: %.2f kWh Gestern: %.3f kWh Gesamt: %.4f kWh", ReadingsVal($name,"ENERGY_Power","-1"), ReadingsVal($name,"ENERGY_Today","-1"), ReadingsVal($name,"ENERGY_Yesterday","-1"), ReadingsVal($name,"ENERGY_Total","-1"))} +attr DEVICE devStateIcon {my $onl = ReadingsVal($name,"LWT","false") eq "Online"?"10px-kreis-gruen":"10px-kreis-rot"; my $light = ReadingsVal($name,"state","off");"".FW_makeImage($onl)." ".FW_makeImage($light)." uptime: ".ReadingsVal($name,"Uptime",undef).sprintf(" aktuell: %.1f W Tag: %.2f kWh Gestern: %.3f kWh Gesamt: %.4f kWh", ReadingsVal($name,"ENERGY_Power","-1"), ReadingsVal($name,"ENERGY_Today","-1"), ReadingsVal($name,"ENERGY_Yesterday","-1"), ReadingsVal($name,"ENERGY_Total","-1"))} attr DEVICE stateFormat {sprintf("aktuell: %.1f W Tag: %.2f kWh Gestern: %.3f kWh Gesamt: %.4f kWh", ReadingsVal($name,"ENERGY_Power","-1"), ReadingsVal($name,"ENERGY_Today","-1"), ReadingsVal($name,"ENERGY_Yesterday","-1"), ReadingsVal($name,"ENERGY_Total","-1"))} deletereading -q DEVICE (?!associatedWith).* attr DEVICE setStateList on off toggle @@ -1220,7 +1220,7 @@ attr DEVICE readingList \ shellies/DEVNAME/relay/0/energy:.* relay_0_energy\ shellies/DEVNAME/relay/0/energy:.* {'relay_0_kWh' => sprintf("%.2f",$EVENT/60/1000)}\ shellies/DEVNAME/longpush/0:.* longpush_0 -attr DEVICE devStateIcon {my $onl = ReadingsVal($name,"online","false") eq "true"?"10px-kreis-gruen":"10px-kreis-rot";; my $light = ReadingsVal($name,"state","off");; my $cons = ReadingsVal($name,"relay_0_power","unknown");; my $total = ReadingsVal($name,"relay_0_kWh","unknown");; my $temp = ReadingsVal($name,"temperature","-100");;"".FW_makeImage($onl)." ".FW_makeImage($light)."
Verbrauch: $cons / Total: $total/ Temp: $temp °C
"} +attr DEVICE devStateIcon {my $onl = ReadingsVal($name,"online","false") eq "false"?"10px-kreis-rot" : ReadingsVal($name,"new_fw","false") eq "true" ? "10px-kreis-gelb" : "10px-kreis-gruen";; my $light = ReadingsVal($name,"state","off");; my $cons = ReadingsVal($name,"relay_0_power","unknown");; my $total = ReadingsVal($name,"relay_0_kWh","unknown");; my $temp = ReadingsVal($name,"temperature","-100");;"".FW_makeImage($onl)." ".FW_makeImage($light)."
Verbrauch: $cons / Total: $total/ Temp: $temp °C
"} attr DEVICE comment To get appropriate loadState values: Change the default limit "100" in readingList to your needs. attr DEVICE webCmd : deletereading -q DEVICE (?!associatedWith).* @@ -1386,7 +1386,7 @@ order:A_11a1 par:DEVNAME;Shelly2 name in the topic;{ AttrVal("DEVICE","readingList","") =~ m,shellies/([^/]*)/, ? $1 : undef } set DEVICE attrTemplate shellyplug attr DEVICE comment Channel 1 for DEVICE, see also DEVICE_CH2 -attr DEVICE devStateIcon {my $onl = ReadingsVal($name,"online","false") eq "true"?"10px-kreis-gruen":"10px-kreis-rot";; my $light = ReadingsVal($name,"state","off");; my $cons = ReadingsVal($name,"relay_0_power","unknown");; my $temp = ReadingsVal($name,"temperature","-100");;"
".FW_makeImage($onl)." ".FW_makeImage($light)." Aktuell: $cons W / Temp.: $temp °C
"} +attr DEVICE devStateIcon {my $onl = ReadingsVal($name,"online","false") eq "false"?"10px-kreis-rot" : ReadingsVal($name,"new_fw","false") eq "true" ? "10px-kreis-gelb" : "10px-kreis-gruen";; my $light = ReadingsVal($name,"state","off");; my $cons = ReadingsVal($name,"relay_0_power","unknown");; my $temp = ReadingsVal($name,"temperature","-100");;"
".FW_makeImage($onl)." ".FW_makeImage($light)." Aktuell: $cons W / Temp.: $temp °C
"} attr DEVICE readingList shellies/DEVNAME/relay/0:.* state\ shellies/DEVNAME/relay/0:.* relay_0\ shellies/DEVNAME/input/0:.* input_0\ @@ -1776,10 +1776,25 @@ attr DEVICE readingList BASEPATH/boiler_data { json2nameValue($EVENT,'',$JSONMAP attr DEVICE model ems-esp_boiler #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.
Forum Thread
+order:E_02c +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 +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 BASEPATH/thermostat_data:.* { json2nameValue($EVENT, '', $JSONMAP) } +attr DEVICE stateFormat mode\ +desired-temp °C +attr DEVICE webCmd : +attr DEVICE model ems-esp_thermostat_read-only + name:ems-esp_thermostat_simple filter:TYPE=MQTT2_DEVICE desc:To configure a simple thermostat (e.g. RC300) 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