From 4eccdb0adf07a8228f5cd8e0a52cb5e1c4e4e12f Mon Sep 17 00:00:00 2001 From: Beta-User Date: Mon, 29 Apr 2019 18:12:07 +0000 Subject: [PATCH] mqtt2.template: add shelly1pm #94060 git-svn-id: https://svn.fhem.de/fhem/trunk@19289 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/lib/AttrTemplate/mqtt2.template | 48 ++++++++++++++++++++--- 1 file changed, 42 insertions(+), 6 deletions(-) diff --git a/fhem/FHEM/lib/AttrTemplate/mqtt2.template b/fhem/FHEM/lib/AttrTemplate/mqtt2.template index 47a06257f..c43942f65 100644 --- a/fhem/FHEM/lib/AttrTemplate/mqtt2.template +++ b/fhem/FHEM/lib/AttrTemplate/mqtt2.template @@ -515,7 +515,7 @@ attr DEVICE setList \ POWER1:on,off,toggle cmnd/DEVNAME/POWER1 $EVTPART1\ POWER2:on,off,toggle cmnd/DEVNAME/POWER2 $EVTPART1 attr DEVICE webCmd POWER1 on:POWER1 off:POWER2 on:POWER2 off -attr DEVICE devStateIcon Online:10px-kreis-gruen@green Offline:10px-kreis-rot@red 1.on:on:POWER1+off 1.off:off:POWER1+on 2.on:on:POWER2+off 2.off:off:POWER2+on +attr DEVICE devStateIcon Online:10px-kreis-gruen Offline:10px-kreis-rot 1.on:on:POWER1+off 1.off:off:POWER1+on 2.on:on:POWER2+off 2.off:off:POWER2+on attr DEVICE readingList \ tele/DEVNAME/LWT:.* LWT\ tele/DEVNAME/STATE:.* { json2nameValue($EVENT) }\ @@ -575,7 +575,6 @@ attr DEVICE setList \ x_configuration cmnd/DEVNAME/$EVTPART1 $EVTPART2 attr DEVICE readingList \ tele/DEVNAME/LWT:.* LWT\ - cmnd/DEVNAME/POWER:.* POWER\ stat/DEVNAME/RESULT:.* { json2nameValue($EVENT) }\ stat/DEVNAME/POWER1:.* POWER1\ stat/DEVNAME/POWER1:on {{'state' => 'opening'}}\ @@ -588,7 +587,7 @@ attr DEVICE readingList \ tele/DEVNAME/SENSOR:.* { json2nameValue($EVENT) }\ tele/DEVNAME/INFO.:.* { json2nameValue($EVENT) }\ tele/DEVNAME/UPTIME:.* { json2nameValue($EVENT) } -attr DEVICE devStateIcon opening:fts_shutter_up@red closing:fts_shutter_down@red Online:10px-kreis-gruen@green Offline:10px-kreis-rot@red 100:fts_shutter_100 0:fts_shutter_10 9\d.*:fts_shutter_90 8\d.*:fts_shutter_80 7\d.*:fts_shutter_70 6\d.*:fts_shutter_60 5\d.*:fts_shutter_50 4\d.*:fts_shutter_40 3\d.*:fts_shutter_30 2\d.*:fts_shutter_20 1\d.*:fts_shutter_10 \b\d\b.*:fts_shutter_10 set_.*:fts_shutter_updown +attr DEVICE devStateIcon opening:fts_shutter_up@red closing:fts_shutter_down@red Online:10px-kreis-gruen Offline:10px-kreis-rot 100:fts_shutter_100 0:fts_shutter_10 9\d.*:fts_shutter_90 8\d.*:fts_shutter_80 7\d.*:fts_shutter_70 6\d.*:fts_shutter_60 5\d.*:fts_shutter_50 4\d.*:fts_shutter_40 3\d.*:fts_shutter_30 2\d.*:fts_shutter_20 1\d.*:fts_shutter_10 \b\d\b.*:fts_shutter_10 set_.*:fts_shutter_updown attr DEVICE cmdIcon open:fts_shutter_up close:fts_shutter_down stop:fts_shutter_manual half:fts_shutter_50 attr DEVICE webCmd :open:close:half:stop:pct attr DEVICE stateFormat \ @@ -613,7 +612,7 @@ par:DEVNAME;ESP's name in the topic;{ AttrVal("DEVICE","readingList","") =~ m,te par:IO_DEV;Currently used IO;{ AttrVal("DEVICE","IODev","")} set DEVICE attrTemplate A_02b_tasmota_2ch_shutter_invert_1 defmod configure_DEVICEattrTemplate_at at +00:00:20 set IO_DEV publish cmnd/DEVNAME/Backlog SHUTTEROPENDURATION 20;; SHUTTERCLOSEDURATION 20;; SHUTTERINVERT 0;; GROUPTOPIC Rollos;; SaveData 1;; -attr DEVICE devStateIcon opening:fts_shutter_up@red closing:fts_shutter_down@red Online:10px-kreis-gruen@green Offline:10px-kreis-rot@red 100:fts_shutter_10 0:fts_shutter_100 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 \b\d\b.*:fts_shutter_90 +attr DEVICE devStateIcon opening:fts_shutter_up@red closing:fts_shutter_down@red Online:10px-kreis-gruen Offline:10px-kreis-rot 100:fts_shutter_10 0:fts_shutter_100 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 \b\d\b.*:fts_shutter_90 attr DEVICE model A_02b_tasmota_2ch_shutter_invert_0 # tasmota 4ch as one FHEM device. @@ -627,7 +626,7 @@ attr DEVICE setList \ POWER2:on,off,toggle cmnd/DEVNAME/POWER2 $EVTPART1\ POWER3:on,off,toggle cmnd/DEVNAME/POWER3 $EVTPART1\ POWER4:on,off,toggle cmnd/DEVNAME/POWER4 $EVTPART1 -attr DEVICE devStateIcon Online:10px-kreis-gruen@green Offline:10px-kreis-rot@red 1.on:on:POWER1+off 1.off:off:POWER1+on 2.on:on:POWER2+off 2.off:off:POWER2+on 3.on:on:POWER3+off 3.off:off:POWER3+on 4.on:on:POWER4+off 4.off:off:POWER4+on +attr DEVICE devStateIcon Online:10px-kreis-gruen Offline:10px-kreis-rot 1.on:on:POWER1+off 1.off:off:POWER1+on 2.on:on:POWER2+off 2.off:off:POWER2+on 3.on:on:POWER3+off 3.off:off:POWER3+on 4.on:on:POWER4+off 4.off:off:POWER4+on #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\ @@ -749,6 +748,41 @@ set DEVICE attrTemplate A_10_shelly1 attr DEVICE getList power:noArg shellies/DEVNAME/relay/power power attr DEVICE model A_10a_shellyplug +#contributed by 87insane, https://forum.fhem.de/index.php/topic,94060.msg934614.html#msg934614 +# shelly1pm using original firmware. +name:A_10b_shelly1pm +filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*shellies.* +par:DEVNAME;Shelly1 name in the topic;{ AttrVal("DEVICE","readingList","") =~ m,shellies/([^/]*)/, ? $1 : undef } +attr DEVICE setList\ + relay0:on,off,toggle shellies/DEVNAME/relay/0/command $EVTPART1\ + off:noArg shellies/DEVNAME/relay/0/command off\ + on:noArg shellies/DEVNAME/relay/0/command on +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) }\ + shellies/DEVNAME/relay/0/power:.* relay_0_power\ + shellies/DEVNAME/temperature:.* temperature\ + shellies/DEVNAME/overtemperature:.* overtemperature\ + shellies/DEVNAME/relay/0/energy:.* relay_0_energy\ + shellies/DEVNAME/longpush/0:.* longpush_0\ + shellies/announce:.* { json2nameValue($EVENT) } +attr DEVICE devStateIcon true:10px-kreis-gruen false:10px-kreis-rot on:on:relay0+off off:off:relay0+on +attr DEVICE stateFormat \ +online\ +\ +relay0\ +
\ +Aktueller Verbrauch: relay_0_power\ +
\ +Temperatur: temperature °C +attr DEVICE webCmd : +deletereading -q DEVICE [^(associatedWith)]* +attr DEVICE model A_10b_shelly1pm + + # shelly2 using original firmware in roller mode. name:A_11b_shelly2_roller filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*shellies.* @@ -1020,7 +1054,7 @@ par:BULB_TYPE;rgbw, cct, rgb_cct, rgb, fut089, ;{ AttrVal("DEVICE","readingList" deletereading -q DEVICE .*_.* attr DEVICE icon light_control attr DEVICE eventMap /set_white:Weiss/night_mode:Nacht/white_mode:white/ -attr DEVICE devStateIcon {zigbee2mqtt_devStateIcon255($name)} +attr DEVICE devStateIcon {zigbee2mqtt_devStateIcon255($name,"hex",1)} attr DEVICE webCmd brightness:hue:command attr DEVICE readingList \ BASE_ID/states/REMOTE_ID/BULB_TYPE/GROUP_ID:.* { json2nameValue($EVENT) }\ @@ -1035,6 +1069,8 @@ attr DEVICE setList\ command:uzsuSelectRadio,Weiss,Nacht BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"$EVTPART0":"$EVTPART1"} attr DEVICE setStateList on off attr DEVICE userReadings hex:color_r.* {Color::rgb2hex(ReadingsVal($name,"color_r",255),ReadingsVal($name,"color_g",255),ReadingsVal($name,"color_b",255))}, hue:bulb_mode.*white {"0"} +attr DEVICE setStateList on off +attr DEVICE setExtensionsEvent 1 attr DEVICE model X_01_esp_milight_hub_rgbw_bulb #rgbw-group