diff --git a/fhem/FHEM/lib/AttrTemplate/mqtt2.template b/fhem/FHEM/lib/AttrTemplate/mqtt2.template index c4c9c2ca2..5a6cac161 100644 --- a/fhem/FHEM/lib/AttrTemplate/mqtt2.template +++ b/fhem/FHEM/lib/AttrTemplate/mqtt2.template @@ -18,26 +18,26 @@ desc: Forum Thread< # name:A_00_MQTT2_CLIENT_general_bridge filter:TYPE=MQTT2_DEVICE -desc:recommended to use this as general bridgeing device when using MQTT2_CLIENT as IO to get around missing CID info for distinguishing different popular devices
NOTE:
NOTE:
- for use with MQTT2_CLIENT use a copy of the device and change its DEF to a different clientId like GeneralBridge, delete original's readingList after applying the template! +desc:recommended to use this as general bridgeing device when using MQTT2_CLIENT as IO to get around missing CID info for distinguishing different popular devices
NOTE:
This might create a new MQTT2-device or change existing ones, especially destroy readingList attributes! Have a look in the room you assigned to the IO device to find the new device. par:IODEVNAME;Name of the IO-Device; {AttrVal("DEVICE","IODev","") ? AttrVal("DEVICE","IODev","" ) : undef } par:DEVTYPE;TYPE of the device; { InternalVal("DEVICE","TYPE","")} par:DEVCID;CID of the device as written in the DEF; { InternalVal(AttrVal("DEVICE","IODev",""),"clientId","mosquitto") eq InternalVal("DEVICE","DEF","mosquitto") ? "MQTT2_GeneralBridge" : InternalVal("DEVICE","DEF","mosquitto")} par:IODEVROOM;Room of the IOdevice; {AttrVal(AttrVal("DEVICE","IODev",""),"room","" ) ? AttrVal(AttrVal("DEVICE","IODev",""),"room","" ) : undef } -attr DEVICE bridgeRegexp (tele|cmnd)[/]([^/]+)[/].*:.* "$2"\ +defmod DEVCID MQTT2_\DEVICE DEVCID +attr DEVCID bridgeRegexp \ + (tele|cmnd)[/]([^/]+)[/].*:.* "$2"\ shellies[/]([^/]+)[/].*:.* "$1"\ (ESPClient_[^/]+)[/].*:.* "$1" -attr DEVICE autocreate 1 -attr DEVICE comment Do not use very open bridgeRegexp expressions! This might lead to irritating results... -attr DEVICE room IODEVROOM -attr DEVICE setStateList on off -#modify DEVICE DEVCID -#copy DEVICE DEVCID +attr DEVCID autocreate 1 +attr DEVCID comment Do not use very open bridgeRegexp expressions! This might lead to irritating results... +attr DEVCID room IODEVROOM +setreading DEVCID associatedWith DEVICE +attr DEVCID setStateList on off deleteAttr DEVICE readingList -#deleteAttr DEVCID readingList -#delete DEVICE -#reload 10_DEVTYPE.pm -#attr DEVCID model A_00_MQTT2_CLIENT_general_bridge -attr DEVICE model A_00_MQTT2_CLIENT_general_bridge +deletereading DEVICE .* +deleteAttr DEVCID readingList +deletereading DEVCID .* +attr DEVCID model A_00_MQTT2_CLIENT_general_bridge ########################################### # zigbee2mqtt @@ -165,20 +165,23 @@ attr DEVICE model L_02c_zigbee2mqtt_light_rgb_rgb #source post: https://forum.fhem.de/index.php/topic,97303.msg905935.html#msg905935 name:L_02d_zigbee2mqtt_light_rgbw_hex filter:TYPE=MQTT2_DEVICE:FILTER=CID=zigbee.* -desc: A dimmable rgbw light connected via zigbee2mqtt
rgb value is encoded as HEX value
Experimental, still untested +desc: A dimmable rgbw light connected via zigbee2mqtt
rgb value is encoded as HEX value
tested with Mueller Light tint RGBW bulb par:BASE_TOPIC;base topic as set in configuration.yaml of the zigbee2mqtt bridge in the topics;{ AttrVal("DEVICE","readingList","") =~ m,([^/]+)[/].*:, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","readingList","") =~ m,[^/]+[/]([^/]+).*:, ? $1 : undef } attr DEVICE icon hue_filled_white_and_color_e27_b22 attr DEVICE stateFormat {lc ReadingsVal("$name","state",0)} attr DEVICE devStateIcon {zigbee2mqtt_devStateIcon255($name)} -attr DEVICE webCmd toggle:on:off:brightness:hex:white +attr DEVICE webCmd toggle:on:off:brightness:color_temp:white:bright:color attr DEVICE readingList BASE_TOPIC/DEV_ID:.* { json2nameValue($EVENT) } attr DEVICE setList \ on:noArg BASE_TOPIC/DEV_ID/set {"state":"ON"}\ off:noArg BASE_TOPIC/DEV_ID/set {"state":"OFF"}\ - white:noArg BASE_TOPIC/DEV_ID/set {"color_temp": 154 , "color_temp": 500}\ + white:noArg BASE_TOPIC/DEV_ID/set {"brightness": 200 , "color_temp": 320}\ + bright:noArg BASE_TOPIC/DEV_ID/set {"brightness": 254, "color_temp": 250}\ + color_temp:colorpicker,CT,250,1,454 BASE_TOPIC/DEV_ID/set {"$EVTPART0":"$EVTPART1"}\ brightness:colorpicker,BRI,0,5,255 BASE_TOPIC/DEV_ID/set {"state":"on","$EVTPART0":"$EVTPART1"}\ - hex:colorpicker,HEX,0,15,255 BASE_TOPIC/DEV_ID/set {"color":{"$EVTPART0":"#$EVTPART1"}} + color:colorpicker,HEX,0,15,255 BASE_TOPIC/DEV_ID/set {"color":{"$EVTPART0":"#$EVTPART1"}} +attr DEVICE userReadings color:color_y.* {Color::xyY2hex(ReadingsVal($name,"color_x",0),ReadingsVal($name,"color_y",0),ReadingsVal($name,"brightness",254))} attr DEVICE model L_02d_zigbee2mqtt_light_rgbw_hex #source post: https://forum.fhem.de/index.php/topic,97303.msg905935.html#msg905935 @@ -537,6 +540,67 @@ attr DEVICE_CH2 setStateList on off toggle attr DEVICE model A_02_tasmota_2channel_split attr DEVICE_CH2 model A_02_tasmota_2channel_split +#contributed by 87insane +# tasmota 2ch as shutter device. +name:A_02b_tasmota_2ch_shutter_invert_1 +filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*(tele|cmnd).* +desc:Configures a dual chanel tasmota device as shutter; needs a special firmware version to operate.
Forum Thread
NOTE: This template will configure the shutter in ROLLO style with pct 0% = open shutter. Use template A_02b_tasmota_2ch_shutter_invert_0, if you need a Homematic-style device pct 100% = open. +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 DEVICE attrTemplate A_01z_tasmota_set_lowercase_texts_and_state1 +set IO_DEV publish cmnd/DEVNAME/Backlog LedState 2; SetOption80 1; SetOption14 1; SetOption81 1; switchmode1 3; switchmode2 3; SaveData 1; +set IO_DEV publish cmnd/DEVNAME/Restart 1 +defmod configure_DEVICEattrTemplate_at at +00:00:20 set IO_DEV publish cmnd/DEVNAME/Backlog SHUTTEROPENDURATION 20;; SHUTTERCLOSEDURATION 20;; SHUTTERINVERT 1;; GROUPTOPIC Rollos;; SaveData 1;; +attr DEVICE setList \ + close:noArg cmnd/DEVNAME/SHUTTERCLOSE\ + open:noArg cmnd/DEVNAME/SHUTTEROPEN\ + half:noArg cmnd/DEVNAME/SHUTTERPOSITION 50\ + pct:slider,0,1,100 cmnd/DEVNAME/SHUTTERPOSITION $EVTPART1\ + stop:noArg cmnd/DEVNAME/SHUTTERSTOP\ + resetClose:noArg cmnd/DEVNAME/SHUTTERSETCLOSE\ + 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'}}\ + stat/DEVNAME/POWER2:.* POWER2\ + stat/DEVNAME/POWER2:on {{'state' => 'closing'}}\ + stat/DEVNAME/SHUTTER1:.* state\ + stat/DEVNAME/SHUTTER1:.* pct\ + tele/DEVNAME/RESULT:.* { json2nameValue($EVENT) }\ + tele/DEVNAME/STATE:.* { json2nameValue($EVENT) }\ + 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 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 \ +LWT\ +\ +state +deleteReading DEVICE .* +attr DEVICE setStateList open close half stop pct +attr DEVICE comment After applying the template set SHUTTEROPENDURATION and SHUTTERCLOSEDURATION first.\ +Use the "set x_configuration" Option. Example: "set x_configuration SHUTTEROPENDURATION 35"\ +Shutter specific commands available: SHUTTEROPENDURATION, SHUTTERCLOSEDURATION, SHUTTERRELAY, SHUTTER50PERCENT, SHUTTERSETCLOSE, SHUTTERINVERT; you may use this for general setOptions in tasmota also.\ +commands may need restart to take effect.\ +For calibration and further information on the available commands see https://github.com/stefanbode/Sonoff-Tasmota/wiki/Shutter-blinds-working-with-two-relays. +attr DEVICE model A_02b_tasmota_2ch_shutter_invert_1 + +# tasmota 2ch as shutter device. +name:A_02b_tasmota_2ch_shutter_invert_0 +filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*(tele|cmnd).* +desc:Configures a dual chanel tasmota device as shutter; needs a special firmware version to operate.
Forum Thread
NOTE: This template will configure the shutter in Homematic-style with pct 100% = open. For ROLLO style device with pct 0% = open shutter. Use template A_02b_tasmota_2ch_shutter_invert_1 instead. +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 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 model A_02b_tasmota_2ch_shutter_invert_0 + # tasmota 4ch as one FHEM device. name:A_04b_tasmota_4ch_unified_icon filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*(tele|cmnd).*