########################################### # $Id$ # # Comments start with #. Empty lines are ignored. # Syntax of one entry: name: line, one optional filter: line, zero or more par: lines, FHEM-Commands # filter:INTERNAL=VALUE (optional) # par: name of the parameter; comment; perl_code (optional) # perl_code returns a value for the parameter, or undef. # If undef, the user has to specify them (the comment is shown to the user) ########################################### name:General_Info filter:TYPE=MQTT2_DEVICE desc: Forum Thread for
- suggesting new templates
- bug reports on mqtt2.template
NOTE: Some templates are only visible in case the existing device configuration meets some minimum requirements, e.g. the CID starting with "zigbee"!
Have a look in the mqtt2.template file itself to get more info order:000000 ############### #MQTT2_CLIENT_Bridge # name: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:
This might create a new MQTT2-device or change existing ones, especially destroy readingList attributes! order:000001 farewell:As you are using MQTT2_CLIENT, you should consider also setting an appropriate ignoreRegexp attribute to the MQTT2_CLIENT device! See attrTemplate MQTT2_IO_ignoreRegexp_basic for details. #par:DEVCID;CID of the device as written in the DEF; { InternalVal(AttrVal('DEVICE','IODev',InternalVal('DEVICE','IODev',undef)->{NAME}),'clientId','mosquitto') eq InternalVal('DEVICE','DEF','mosquitto') ? 'MQTT2_GeneralBridge'" : InternalVal('DEVICE','DEF','mosquitto')} par:ICON;ICON as set, defaults to mqtt_bridge_2;{ AttrVal("DEVICE","icon","mqtt_bridge_2") } attr DEVICE icon ICON attr DEVICE bridgeRegexp \ (tele|stat|shellies|valetudo|Advantech)/([^/]+)/.*:.* "$2"\ (shellyp(lus|ro4pm)[^/:_]{4,}+)/.*:.* "$1"\ zigbee2mqtt/bridge/.*:.* "zigbee2mqtt"\ sonos/connected.* "sonos"\ tvheadend/[^/:]+.* "tvheadend"\ milight/LWT:.* "milight"\ (ESPClient_[^/]+)/.*:.* "$1"\ (ebusd[^/]*)/global/.*:.* "$1"\ [^/]+/(ems-esp[^/]+)/start:.* "$1"\ (mygateway[\d]+)-(in|out)/.* "$1"\ (wallpanel|wled)/([^/]+)/.*:.* "$1_$2"\ go-eCharger/([^/]+)/.*:.* "go_eCharger_$1"\ owntracks/[^/]+/([^/:]+).* "owntracks_$1"\ home/(O[^/]*M[^/]*G[^/]*)/LWT:.* "$1"\ instar/([^/]+)/.*:.* "instar_$1"\ homeassistant/.*/config:.* ""\ tasmota/discovery/[^/:]+/(config|sensors):.* "" attr DEVICE setList clear_all:noArg {fhem("deleteattr $NAME readingList; deletereading -q $NAME (?!associatedWith|IODev).*");return undef} attr DEVICE autocreate 1 attr DEVICE comment Do not use very open bridgeRegexp expressions! This might lead to irritating results... Especially make sure to not have two regexpes that may both match! attr DEVICE setStateList on off farewell:template has been applied successfully. Be carefull when extending the brigeRegexp! attr DEVICE model MQTT2_CLIENT_general_bridge setreading DEVICE attrTemplateVersion 20220110 ############### #MQTT2 IO ignoreRegexp # name:MQTT2_IO_ignoreRegexp_basic 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 and "command" for shelly.
Additionally homeassistat discovery branch will be deactivated.
NOTE: early experimental version... order:000002 par:IODEVNAME;Name of the IO-Device; { InternalVal('DEVICE','LASTInputDev',AttrVal('DEVICE','IODev',InternalVal('DEVICE','IODev',undef)->{NAME})) } set DEVICE attrTemplate MQTT2_IO_ignoreRegexp_shelly \IODEVNAME=IODEVNAME set DEVICE attrTemplate MQTT2_IO_ignoreRegexp_tasmota \IODEVNAME=IODEVNAME set DEVICE attrTemplate MQTT2_IO_ignoreRegexp_homeassistant \IODEVNAME=IODEVNAME setreading IODEVNAME attrTemplateVersion 20210528 name:MQTT2_IO_ignoreRegexp_tasmota 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',InternalVal('DEVICE','IODev',undef)->{NAME})) } par:NEWIGNOREREGEXP;NEWIGNOREREGEXP as set if expression is already included, otherwise it will be added;{ my $old = AttrVal(InternalVal('DEVICE','LASTInputDev',AttrVal('DEVICE','IODev',InternalVal('DEVICE','IODev',undef)->{NAME})),'ignoreRegexp','cmnd/[^:"]+:'); 'cmnd/[^:"]+:' =~ m/$old/ ? $old : $old.'|cmnd/[^:"]+:' } attr IODEVNAME ignoreRegexp NEWIGNOREREGEXP name:MQTT2_IO_ignoreRegexp_shelly 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',InternalVal('DEVICE','IODev',undef)->{NAME})) } par:NEWIGNOREREGEXP;NEWIGNOREREGEXP as set if shelly is included, otherwise it will be added;{ my $old = AttrVal(InternalVal('DEVICE','LASTInputDev',AttrVal('DEVICE','IODev',InternalVal('DEVICE','IODev',undef)->{NAME})),'ignoreRegexp','shellies/[^:"]+/command'); 'shellies/[^:"]+/command' =~ m{$old} ? $old : $old.'|shellies/[^:"]+/command' } option:{return 1 if 'NEWIGNOREREGEXP' ne AttrVal(InternalVal('DEVICE','LASTInputDev',AttrVal('DEVICE','IODev',InternalVal('DEVICE','IODev',undef)->{NAME})),'ignoreRegexp','not_set');return 0} attr IODEVNAME ignoreRegexp NEWIGNOREREGEXP name:MQTT2_IO_ignoreRegexp_homeassistant filter:TYPE=MQTT2_DEVICE desc:Expands existing or adds a ignoreRegexp to the courrent IO device of device it is applied to. This will prevent evaluation of incoming messages meant for homeassistant for auto-discovery of devices. You are strongly encouraged to not use homeassistant autodiscovery at all, but in case you need it for some reason, adding this ignoreRegexp-expression might help to avoid confusion!
NOTE: early experimental version... 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',InternalVal('DEVICE','IODev',undef)->{NAME})) } par:NEWIGNOREREGEXP;NEWIGNOREREGEXP as set if homeassistant is included, otherwise it will be added;{ my $old = AttrVal(InternalVal('DEVICE','LASTInputDev',AttrVal('DEVICE','IODev',InternalVal('DEVICE','IODev',undef)->{NAME})),'ignoreRegexp','homeassistant/[^:"]+/config'); 'homeassistant/[^:"]+/config' =~ m/$old/ ? $old : $old.'|homeassistant/[^:"]+/config' } option:{return 1 if 'NEWIGNOREREGEXP' ne AttrVal(InternalVal('DEVICE','LASTInputDev',AttrVal('DEVICE','IODev',InternalVal('DEVICE','IODev',undef)->{NAME})),'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') } name:do_general_mqtt_cleanup filter:NAME=speechrecognTesting order:000002b desc:template to do some cleanup especially to a MQTT2_CLIENT_general_bridge device (if existant)... #and set ignoreRegexp that may help in case MQTT commands may be issued from not within this FHEM server; call e.g. with ADD_TO_IO_IGNOREREGEXP=milight/0x[0-9a-fA-F]{1,4}[/].*/[0-8]. par:IODEVNAME;Name of the IO-Device; { InternalVal('DEVICE','LASTInputDev',AttrVal('DEVICE','IODev',InternalVal('DEVICE','IODev',undef)->{NAME})) } par:ADD_TO_IO_IGNOREREGEXP;add ignoreRegexp to be attached to the current one, defaults to "";{ '' } deletereading -q TYPE=MQTT2_\DEVICE:FILTER=model=MQTT2_CLIENT_general_bridge (?!associatedWith|IODev).* deleteattr TYPE=MQTT2_\DEVICE:FILTER=model=MQTT2_CLIENT_general_bridge readingList #par:IODEVNAME;Name of the IO-Device; { InternalVal("DEVICE","LASTInputDev",AttrVal("DEVICE","IODev",undef)) } #par:NEWIGNOREREGEXP;NEWIGNOREREGEXP as set if regex part is included, otherwise it will be added;{ my $old = AttrVal('IODEVNAME','ignoreRegexp','ADD_TO_IO_IGNOREREGEXP'); 'ADD_TO_IO_IGNOREREGEXP' =~ m/$old/ ? $old : $old.'|ADD_TO_IO_IGNOREREGEXP' } #option:{return 1 if 'NEWIGNOREREGEXP' ne AttrVal('IODEVNAME','ignoreRegexp','not_set');;return 0} #attr IODEVNAME ignoreRegexp NEWIGNOREREGEXP ########################################### # mosquitto state, see https://forum.fhem.de/index.php/topic,117988.msg1124272.html#msg1124272 name:MQTT2_mosquitto_SYS prereq:{my @devices=devspec2array("TYPE=MQTT2_CLIENT");;return 1 if $devices[0];;return 0} filter:TYPE=MQTT2_DEVICE desc:Shows health info about mosquitto. Needs additional subscriptions on MQTT2_CLIENT side, see https://forum.fhem.de/index.php/topic,117988.msg1124272.html#msg1124272 for details. order:000002 attr DEVICE readingList\ .*SYS/broker/.+:.* { $TOPIC=~m,SYS/broker/(.*),;; my %h;; $h{$1}=$EVENT;; \%h } attr DEVICE model MQTT2_mosquitto_SYS setreading DEVICE attrTemplateVersion 20210121 ########################################### # zigbee2mqtt # The zigbee2mqtt bridge device (entire hex id of devices as bridgeRegexp) name:zigbee2mqtt_bridge desc:The zigbee2mqtt bridge device filter:TYPE=MQTT2_DEVICE order:L_01 farewell:template has been applied successfully.
Note: In case you not exclusively use FHEM to send MQTT commands to your devices, it's highly recommended to extend the ignoreRegexp of your IO device! Could be something like |zigbee2mqtt/[A-Za-z0-9._]+/set. par:BASE_TOPIC;base topic as set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic","") =~ m,[\b]?([^/:]+)(/.+)?, ? $1 : AttrVal("DEVICE","readingList","") =~ m,[\b]?([^/:]+)/bridge/.+, ? $1 : undef } par:ICON;ICON as set, defaults to mqtt;{ AttrVal("DEVICE","icon","mqtt") } attr DEVICE icon ICON attr DEVICE devicetopic BASE_TOPIC attr DEVICE bridgeRegexp\ BASE_TOPIC/([A-Za-z0-9._]+)[/]?.*:.* "zigbee_$1" attr DEVICE getList\ devicelist:noArg log $\DEVICETOPIC/bridge/config/devices/get\ networkmap_raw:noArg raw $\DEVICETOPIC/bridge/networkmap raw\ networkmap_graphviz:noArg graphviz $\DEVICETOPIC/bridge/networkmap graphviz attr DEVICE readingList\ $\DEVICETOPIC/bridge/state:.* state\ $\DEVICETOPIC/bridge/config/devices:.* {}\ $\DEVICETOPIC/bridge/config/log_level:.* log_level\ $\DEVICETOPIC/bridge/config/permit_join:.* permit_join\ $\DEVICETOPIC/bridge/config/rename:.* { json2nameValue($EVENT, 'rename_') }\ $\DEVICETOPIC/bridge/config:.* { json2nameValue($EVENT) }\ $\DEVICETOPIC/bridge/log:.*\"type\".\"devices\".\"message\".* devices\ $\DEVICETOPIC/bridge/log:.* log\ $\DEVICETOPIC/bridge/logging:.* { json2nameValue($EVENT,'log_') }\ $\DEVICETOPIC/bridge/networkmap:.* {}\ $\DEVICETOPIC/bridge/networkmap/graphviz:.* graphviz\ $\DEVICETOPIC/bridge/networkmap/raw:.* raw\ $\DEVICETOPIC/bridge/devices:.* devices\ $\DEVICETOPIC/bridge/info:.* info\ $\DEVICETOPIC/bridge/groups:.* groups\ $\DEVICETOPIC/bridge/event:.* { json2nameValue($EVENT) }\ $\DEVICETOPIC/bridge/extensions:.* extensions attr DEVICE setList\ log_level:debug,info,warn,error $\DEVICETOPIC/bridge/config/log_level $EVTPART1\ permit_join:true,false $\DEVICETOPIC/bridge/config/permit_join $EVTPART1\ remove:textField $\DEVICETOPIC/bridge/config/remove $EVTPART1\ ota_update:textField $\DEVICETOPIC/bridge/ota_update/update $EVTPART1\ ota_update_check:textField $\DEVICETOPIC/bridge/ota_update/check $EVTPART1\ y_device_setting:textField $\DEVICETOPIC/$EVTPART1/set {"$EVTPART2": "$EVTPART3"}\ x_bind:textField $\DEVICETOPIC/bridge/bind/$EVTPART1 $EVTPART2\ x_bind_unbind:textField $\DEVICETOPIC/bridge/unbind/$EVTPART1 $EVTPART2\ x_device_options:textField $\DEVICETOPIC/bridge/config/device_options {"friendly_name":"$EVTPART1","options": {"$EVTPART2": "$EVTPART3"}}\ x_group_add_to:textField $\DEVICETOPIC/bridge/group/$EVTPART1/add $EVTPART2\ x_group_rm_from:textField $\DEVICETOPIC/bridge/group/$EVTPART1/remove $EVTPART2\ x_group_rm_from_all:textField $\DEVICETOPIC/bridge/group/$EVTPART1/remove_all $EVTPART2\ x_group_add_group:textField $\DEVICETOPIC/bridge/config/add_group $EVTPART1\ x_group_rm_group:textField $\DEVICETOPIC/bridge/config/remove_group $EVTPART1\ z_elapsed:textField $\DEVICETOPIC/bridge/config/elapsed $EVTPART1\ z_last_seen:disable,ISO_8601,epoch,ISO_8601_local $\DEVICETOPIC/bridge/config/last_seen $EVTPART1\ z_ban:textField $\DEVICETOPIC/bridge/config/ban $EVTPART1\ z_rename:textField $\DEVICETOPIC/bridge/config/rename {"old":"$EVTPART1","new":"$EVTPART2"}\ z_reset_CC:noArg $\DEVICETOPIC/bridge/config/reset attr DEVICE setStateList on off attr DEVICE comment To check for new updates of the deamon software, you might want to use a separate HTTPMOD device. See HTTPMOD template zigbee2mqtt_daemon_updates for further details. #set DEVICE attrTemplate do_general_mqtt_cleanup ADD_TO_IO_IGNOREREGEXP=BASE_TOPIC/[A-Za-z0-9._]+/set set DEVICE attrTemplate do_general_mqtt_cleanup attr DEVICE model zigbee2mqtt_bridge setreading DEVICE attrTemplateVersion 20220114 # Based on https://forum.fhem.de/index.php/topic,94060.msg872371.html#msg872371 #A pure router device, e.g. a CC2531 flashed with router firmware #Contributed by aperoap, https://forum.fhem.de/index.php/topic,94494.msg992467.html#msg992467 name:zigbee2mqtt_router_only_device desc: For zigbee2mqtt pure router devices, e.g. a CC2531 flashed with router firmware. To get information on device going offline, set "availability_timeout" to a reasonable value in zigbee2mqtt's configuration.yaml. filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* order:L_02a1 par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } par:ICON;ICON as set, defaults to mqtt_device;{ AttrVal('DEVICE','icon','mqtt_device') } attr DEVICE icon ICON attr DEVICE devStateIcon online:rc_GREEN offline:rc_RED attr DEVICE devicetopic BASE_TOPIC/DEV_ID attr DEVICE readingList $\DEVICETOPIC:.* { json2nameValue($EVENT) }\ $\DEVICETOPIC/availability:.* availability deletereading -q DEVICE (?!associatedWith|IODev).* attr DEVICE stateFormat availability attr DEVICE comment To get also information on device going offline, set "availability_timeout" to a reasonable value in configuration.yaml. farewell:template has been applied successfully. Please check configuration.yaml to get regular updates on availability. attr DEVICE model zigbee2mqtt_router_only_device setreading DEVICE attrTemplateVersion 20200904 # A dimmable light connected via zigbee2mqtt name:zigbee2mqtt_light_dimmer desc: A dimmable light connected via zigbee2mqtt
Tested with: Tradfri LED1650R5 + LED1649C5, Osram Lightify W32 filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* order:L_02a par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } par:ICON;ICON as set, defaults to light_control;{ AttrVal("DEVICE","icon","light_control") } attr DEVICE icon ICON attr DEVICE devStateIcon {zigbee2mqtt_devStateIcon255($name)} attr DEVICE webCmd toggle:on:off:brightness attr DEVICE devicetopic BASE_TOPIC/DEV_ID attr DEVICE readingList $\DEVICETOPIC:.* { json2nameValue($EVENT) } attr DEVICE setList \ on:noArg $\DEVICETOPIC/set {"state":"ON"}\ off:noArg $\DEVICETOPIC/set {"state":"OFF"}\ brightness:colorpicker,BRI,0,5,255 $\DEVICETOPIC/set {"state":"on","$EVTPART0":"$EVTPART1"} attr DEVICE setStateList on off set DEVICE attrTemplate speechcontrol_type_light_255 attr DEVICE model zigbee2mqtt_light_dimmer setreading DEVICE attrTemplateVersion 20200904 # A dimmable color light connected via zigbee2mqtt name:zigbee2mqtt_light_cct filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* desc: A dimmable light with color temperature via zigbee2mqtt
Tested with: tradfri FLOALT panel WS 30x90 order:L_02b par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } par:ICON;ICON as set, defaults to light_control;{ AttrVal("DEVICE","icon","light_control") } attr DEVICE icon ICON attr DEVICE webCmd toggle:on:off:brightness:ct attr DEVICE devicetopic BASE_TOPIC/DEV_ID attr DEVICE readingList $\DEVICETOPIC:.* { json2nameValue($EVENT,'',$JSONMAP) } attr DEVICE setList \ on:noArg $\DEVICETOPIC/set {"state":"ON"}\ off:noArg $\DEVICETOPIC/set {"state":"OFF"}\ brightness:colorpicker,BRI,0,5,255 $\DEVICETOPIC/set {"state":"on","$EVTPART0":"$EVTPART1"}\ ct:colorpicker,CT,154,2,500 $\DEVICETOPIC/set {"color_temp":"$EVTPART1"}\ ct_startup:coolest,cool,neutral,warmest,previous $\DEVICETOPIC/set {"color_temp_startup":"$EVTPART1"} attr DEVICE jsonMap color_temp:ct color_temp_startup:ct_startup set DEVICE attrTemplate speechcontrol_type_light_255 attr DEVICE model zigbee2mqtt_light_cct setreading DEVICE attrTemplateVersion 20211019 #source post: https://forum.fhem.de/index.php/topic,97303.msg905935.html#msg905935 name:zigbee2mqtt_light_rgb_hex filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* desc: A dimmable rgb light connected via zigbee2mqtt
rgb value is encoded as HEX value
Experimental, still untested order:L_02c par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } par:ICON;ICON as set, defaults to hue_filled_white_and_color_e27_b22;{ AttrVal("DEVICE","icon","hue_filled_white_and_color_e27_b22") } attr DEVICE icon ICON attr DEVICE stateFormat {lc ReadingsVal($name,"state",0)} attr DEVICE devStateIcon {zigbee2mqtt_devStateIcon255($name)} attr DEVICE webCmd toggle:on:off:brightness:hex attr DEVICE devicetopic BASE_TOPIC/DEV_ID attr DEVICE readingList $\DEVICETOPIC:.* { json2nameValue($EVENT) } attr DEVICE setList \ on:noArg $\DEVICETOPIC/set {"state":"ON"}\ off:noArg $\DEVICETOPIC/set {"state":"OFF"}\ brightness:colorpicker,BRI,0,5,255 $\DEVICETOPIC/set {"state":"on","$EVTPART0":"$EVTPART1"}\ hex:colorpicker,HEX,0,15,255 $\DEVICETOPIC/set {"color":{"$EVTPART0":"#$EVTPART1"}} attr DEVICE userReadings hex:color_y.* {Color::xyY2hex(ReadingsVal($name,"color_x",0),ReadingsVal($name,"color_y",0),ReadingsVal($name,"brightness",254))} set DEVICE attrTemplate speechcontrol_type_light_255 attr DEVICE model zigbee2mqtt_light_rgb_hex setreading DEVICE attrTemplateVersion 20200904 name:zigbee2mqtt_light_rgb_rgb filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* desc: A dimmable rgb light connected via zigbee2mqtt
rgb values will be sent as individual values r,g and b
Experimental, still untested order:L_02c par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } par:ICON;ICON as set, defaults to hue_filled_white_and_color_e27_b22;{ AttrVal("DEVICE","icon","hue_filled_white_and_color_e27_b22") } attr DEVICE icon ICON attr DEVICE stateFormat {lc ReadingsVal($name,"state",0)} attr DEVICE devStateIcon {zigbee2mqtt_devStateIcon255($name)} attr DEVICE webCmd toggle:on:off:brightness:color attr DEVICE devicetopic BASE_TOPIC/DEV_ID attr DEVICE readingList $\DEVICETOPIC:.* { json2nameValue($EVENT) } attr DEVICE setList \ on:noArg $\DEVICETOPIC/set {"state":"ON"}\ off:noArg $\DEVICETOPIC/set {"state":"OFF"}\ brightness:colorpicker,BRI,0,5,255 $\DEVICETOPIC/set {"state":"on","$EVTPART0":"$EVTPART1"}\ color:colorpicker,RGB {"$\DEVICETOPIC/set ".zigbee2mqtt_RGB2JSON($EVTPART1)} set DEVICE attrTemplate speechcontrol_type_light_255 attr DEVICE model zigbee2mqtt_light_rgb_rgb setreading DEVICE attrTemplateVersion 20200904 #source post: https://forum.fhem.de/index.php/topic,97303.msg905935.html#msg905935 name: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
tested with Mueller Light tint RGBW bulb order:L_02d par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } par:ICON;ICON as set, defaults to hue_filled_white_and_color_e27_b22;{ AttrVal("DEVICE","icon","hue_filled_white_and_color_e27_b22") } attr DEVICE icon ICON attr DEVICE stateFormat {lc ReadingsVal($name,"state",0)} attr DEVICE devStateIcon {zigbee2mqtt_devStateIcon255($name)} attr DEVICE webCmd toggle:on:off:brightness:ct:warm:white:hex attr DEVICE devicetopic BASE_TOPIC/DEV_ID attr DEVICE readingList $\DEVICETOPIC:.* { json2nameValue($EVENT,'',$JSONMAP) } attr DEVICE setList \ on:noArg $\DEVICETOPIC/set {"state":"ON"}\ off:noArg $\DEVICETOPIC/set {"state":"OFF"}\ warm:noArg $\DEVICETOPIC/set {"brightness": 200 , "color_temp": 360}\ white:noArg $\DEVICETOPIC/set {"brightness": 254, "color_temp": 250}\ ct:colorpicker,CT,250,1,454 $\DEVICETOPIC/set {"color_temp":"$EVTPART1"}\ brightness:colorpicker,BRI,0,5,255 $\DEVICETOPIC/set {"state":"on","$EVTPART0":"$EVTPART1"}\ hex:colorpicker,HEX,0,15,255 $\DEVICETOPIC/set {"color":{"$EVTPART0":"#$EVTPART1"}} attr DEVICE userReadings hex:color_y.* {Color::xyY2hex(ReadingsVal($name,"color_x",0),ReadingsVal($name,"color_y",0),ReadingsVal($name,"brightness",254))} attr DEVICE jsonMap color_temp:ct set DEVICE attrTemplate speechcontrol_type_light_255 attr DEVICE model zigbee2mqtt_light_rgbw_hex setreading DEVICE attrTemplateVersion 20211018 #source post: https://forum.fhem.de/index.php/topic,97303.msg905935.html#msg905935 name:zigbee2mqtt_light_rgbw_rgb filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* order:L_02d1 desc: A dimmable rgbw light connected via zigbee2mqtt
rgb values will be sent as individual values r,g and b
Experimental, still untested par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } par:ICON;ICON as set, defaults to hue_filled_white_and_color_e27_b22;{ AttrVal("DEVICE","icon","hue_filled_white_and_color_e27_b22") } attr DEVICE icon ICON attr DEVICE stateFormat {lc ReadingsVal($name,"state",0)} attr DEVICE devStateIcon {zigbee2mqtt_devStateIcon255($name)} attr DEVICE webCmd toggle:on:off:brightness:color:white attr DEVICE devicetopic BASE_TOPIC/DEV_ID attr DEVICE readingList $\DEVICETOPIC:.* { json2nameValue($EVENT) } attr DEVICE setList \ on:noArg $\DEVICETOPIC/set {"state":"ON"}\ off:noArg $\DEVICETOPIC/set {"state":"OFF"}\ white:noArg $\DEVICETOPIC/set {"color_temp": 154 , "color_temp": 500}\ brightness:colorpicker,BRI,0,5,255 $\DEVICETOPIC/set {"state":"on","$EVTPART0":"$EVTPART1"}\ color:colorpicker,RGB {"$\DEVICETOPIC/set ".zigbee2mqtt_RGB2JSON($EVTPART1)} set DEVICE attrTemplate speechcontrol_type_light_255 attr DEVICE model zigbee2mqtt_light_rgbw_rgb setreading DEVICE attrTemplateVersion 20200904 #source post: https://forum.fhem.de/index.php/topic,96985.msg902627.html#msg902627 name:zigbee2mqtt_light_rgbcct_hex desc: A dimmable rgb light connected via zigbee2mqtt
rgb value is encoded as HEX value
Experimental, still untested filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* order:L_02e par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } par:ICON;ICON as set, defaults to hue_filled_white_and_color_e27_b22;{ AttrVal("DEVICE","icon","hue_filled_white_and_color_e27_b22") } attr DEVICE icon ICON attr DEVICE stateFormat {lc ReadingsVal($name,"state",0)} attr DEVICE devStateIcon {zigbee2mqtt_devStateIcon255($name)} attr DEVICE webCmd toggle:on:off:brightness:ct:hex attr DEVICE devicetopic BASE_TOPIC/DEV_ID attr DEVICE readingList $\DEVICETOPIC:.* { json2nameValue($EVENT,'',$JSONMAP) } attr DEVICE setList \ on:noArg $\DEVICETOPIC/set {"state":"ON"}\ off:noArg $\DEVICETOPIC/set {"state":"OFF"}\ brightness:colorpicker,BRI,0,5,255 $\DEVICETOPIC/set {"state":"on","$EVTPART0":"$EVTPART1"}\ ct:colorpicker,CT,154,2,500 $\DEVICETOPIC/set {"color_temp":"$EVTPART1"}\ hex:colorpicker,HEX,0,15,255 $\DEVICETOPIC/set {"color":{"$EVTPART0":"#$EVTPART1"}} set DEVICE attrTemplate speechcontrol_type_light_255 attr DEVICE jsonMap color_temp:ct attr DEVICE model zigbee2mqtt_light_rgbcct_hex setreading DEVICE attrTemplateVersion 20211018 #source post: https://forum.fhem.de/index.php/topic,97303.msg905935.html#msg905935 name:zigbee2mqtt_light_rgbcct_rgb filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* order:L_02e1 desc: A dimmable rgb-cct light connected via zigbee2mqtt
rgb values will be sent as individual values r,g and b
Tested with: RGB-CCT GL-C-008 par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } par:ICON;ICON as set, defaults to hue_filled_white_and_color_e27_b22;{ AttrVal("DEVICE","icon","hue_filled_white_and_color_e27_b22") } attr DEVICE icon ICON attr DEVICE stateFormat {lc ReadingsVal($name,"state",0)} attr DEVICE devStateIcon {zigbee2mqtt_devStateIcon255($name)} attr DEVICE webCmd toggle:on:off:brightness:ct:color attr DEVICE devicetopic BASE_TOPIC/DEV_ID attr DEVICE readingList $\DEVICETOPIC:.* { json2nameValue($EVENT,'',$JSONMAP) } attr DEVICE setList \ on:noArg $\DEVICETOPIC/set {"state":"ON"}\ off:noArg $\DEVICETOPIC/set {"state":"OFF"}\ brightness:colorpicker,BRI,0,5,255 $\DEVICETOPIC/set {"state":"on","$EVTPART0":"$EVTPART1"}\ ct:colorpicker,CT,154,2,500 $\DEVICETOPIC/set {"color_temp":"$EVTPART1"}\ color:colorpicker,RGB {"$\DEVICETOPIC/set ".zigbee2mqtt_RGB2JSON($EVTPART1)} set DEVICE attrTemplate speechcontrol_type_light_255 attr DEVICE model zigbee2mqtt_light_rgbcct_rgb setreading DEVICE attrTemplateVersion 20211018 # zigbee2mqtt 2 channel dimmer device name:zigbee2mqtt_2channel_dimmer_split filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* desc:For zigbee2mqtt 2 channel dimmer device.
NOTE: a second device will be created for the second channel
NOTE: Untested updated version, should work with MOES MS-105B, see https://forum.fhem.de/index.php/topic,124612.0.html order:L_02g1 par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal('DEVICE','devicetopic',AttrVal('DEVICE','readingList','')) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal('DEVICE','devicetopic',AttrVal('DEVICE','readingList','')) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } par:ICON;ICON as set, defaults to light_control;{ AttrVal('DEVICE','icon','light_control') } attr DEVICE icon ICON attr DEVICE eventMap { dev=>{ON=>'on',OFF=>'off'} } attr DEVICE devicetopic BASE_TOPIC/DEV_ID attr DEVICE readingList $\DEVICETOPIC:.* { json2nameValue($EVENT,'',$JSONMAP) } attr DEVICE jsonMap state:availability state_l1:state state_l2:0 brightness_l1:brightness brightness_l2:0 attr DEVICE setList \ on:noArg $\DEVICETOPIC/l1/set {"state":"ON"}\ off:noArg $\DEVICETOPIC/l1/set {"state":"OFF"}\ toggle:noArg $\DEVICETOPIC/l1/set {"state":"TOGGLE"}\ brightness:colorpicker,BRI,0,1,254 $\DEVICETOPIC/l1/set {"state":"ON","$EVTPART0":"$EVTPART1"} attr DEVICE setStateList on off toggle attr DEVICE webCmd brightness deletereading -q DEVICE (?!associatedWith|IODev).* set DEVICE attrTemplate set_associatedWith \CHANNELS=2 \MAKECOPIES=1 attr DEVICE_CH2 setList \ on:noArg $\DEVICETOPIC/l2/set {"state":"ON"}\ off:noArg $\DEVICETOPIC/l2/set {"state":"OFF"}\ toggle:noArg $\DEVICETOPIC/l2/set {"state":"TOGGLE"}\ brightness:colorpicker,BRI,0,1,254 $\DEVICETOPIC/l2/set {"state":"ON","$EVTPART0":"$EVTPART1"} attr DEVICE_CH2 setStateList on off toggle deletereading -q DEVICE_CH2 (?!associatedWith|IODev).* attr DEVICE_CH2 jsonMap state_l1:0 state_l2:state state:0 consumption:0 linkquality:0 power:0 temperature:0 brightness_l1:0 brightness_l2:brightness set DEVICE,DEVICE_CH2 attrTemplate speechcontrol_type_light_255 attr DEVICE,DEVICE_CH2 model zigbee2mqtt_2channel_dimmer_split setreading DEVICE,DEVICE_CH2 attrTemplateVersion 20211207 # zigbee2mqtt air purifier name:zigbee2mqtt_air_purifier filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* desc:For zigbee2mqtt air purifier.
NOTE: Untested updated version, should work with tradfri STARKVIND, see https://forum.fhem.de/index.php/topic,124515.0.html order:L_02i par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal('DEVICE','devicetopic',AttrVal('DEVICE','readingList','')) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal('DEVICE','devicetopic',AttrVal('DEVICE','readingList','')) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } par:ICON;ICON as set, defaults to Ventilator_wind;{ AttrVal('DEVICE','icon','Ventilator_wind') } attr DEVICE icon ICON attr DEVICE eventMap { dev=>{ON=>'on',OFF=>'off'} } attr DEVICE devicetopic BASE_TOPIC/DEV_ID attr DEVICE readingList $\DEVICETOPIC:.* { json2nameValue($EVENT,'',$JSONMAP) } attr DEVICE getList state:noArg state $\DEVICETOPIC/get {"fan_state": ""}\ fan_speed:noArg fan_speed $\DEVICETOPIC/get {"fan_speed": ""}\ pm25:noArg pm25 $\DEVICETOPIC/get {"pm25": ""}\ air_quality:noArg air_quality $\DEVICETOPIC/get {"air_quality": ""}\ child_lock:noArg child_lock $\DEVICETOPIC/get {"child_lock": ""}\ replace_filter:noArg replace_filter $\DEVICETOPIC/get {"replace_filter": ""} attr DEVICE jsonMap fan_state:state state_l2:0 brightness_l1:brightness brightness_l2:0 attr DEVICE setList \ on:noArg $\DEVICETOPIC/set {"fan_state":"ON"}\ off:noArg $\DEVICETOPIC/set {"fan_state":"OFF"}\ toggle:noArg $\DEVICETOPIC/set {"fan_state":"TOGGLE"}\ fan_mode:off,auto,1,2,3,4,5,6,7,8,9 $\DEVICETOPIC/set {"fan_mode": "$EVTPART1"} attr DEVICE setStateList on off toggle attr DEVICE webCmd fan_mode deletereading -q DEVICE (?!associatedWith|IODev).* attr DEVICE model zigbee2mqtt_air_purifier setreading DEVICE attrTemplateVersion 20211207 # zigbee2mqtt air quality sensor name:zigbee2mqtt_air_quality filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* desc:For zigbee2mqtt air quality sensor.
NOTE: Untested updated version, should work with tradfri frient A/S, see https://forum.fhem.de/index.php/topic,124515.0.html order:L_02i par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal('DEVICE','devicetopic',AttrVal('DEVICE','readingList','')) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal('DEVICE','devicetopic',AttrVal('DEVICE','readingList','')) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } par:ICON;ICON as set, defaults to feinstaub_pm25;{ AttrVal('DEVICE','icon','feinstaub_pm25') } attr DEVICE icon ICON attr DEVICE devicetopic BASE_TOPIC/DEV_ID attr DEVICE readingList $\DEVICETOPIC/availability:.* availability\ $\DEVICETOPIC:.* { json2nameValue($EVENT,'',$JSONMAP) } attr DEVICE jsonMap battery:batteryPercent voltage:batterymV attr DEVICE stateFormat air quality: air_quality, VOC: voc, Hum: humidity deletereading -q DEVICE (?!associatedWith|IODev).* attr DEVICE model zigbee2mqtt_air_quality setreading DEVICE attrTemplateVersion 20211207 name:zigbee2mqtt_smokeDetector filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* order:L_03 par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } par:ICON;ICON as set, defaults to secur_smoke_detector;{ AttrVal("DEVICE","icon","secur_smoke_detector") } attr DEVICE icon ICON attr DEVICE devicetopic BASE_TOPIC/DEV_ID attr DEVICE readingList $\DEVICETOPIC:.* { json2nameValue($EVENT) } attr DEVICE stateFormat smoke attr DEVICE model zigbee2mqtt_smokeDetector setreading DEVICE attrTemplateVersion 20200904 name:zigbee2mqtt_hueMotionSensor filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* order:L_04 par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } par:ICON;ICON as set, defaults to people_sensor;{ AttrVal("DEVICE","icon","people_sensor") } attr DEVICE icon ICON attr DEVICE stateFormat T: temperature_weather B: illuminance L: linkquality attr DEVICE devicetopic BASE_TOPIC/DEV_ID attr DEVICE readingList $\DEVICETOPIC:.* { json2nameValue($EVENT) } attr DEVICE userReadings temperature_weather { sprintf("%.1f",ReadingsVal($name,"temperature","")+2.5) } set DEVICE attrTemplate speechcontrol_gdt_and_mapping GENERICDEVTYPE=motion HOMEBRIDGEMAPPING="MotionDetected=state,values=motion:1;nomotion:0" attr DEVICE model zigbee2mqtt_hueMotionSensor setreading DEVICE attrTemplateVersion 20200904 name:zigbee2mqtt_plug filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* desc: Should work e.g. with Osram smart+plug order:L_05 par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } par:ICON;ICON as set, defaults to message_socket;{ AttrVal("DEVICE","icon","message_socket") } attr DEVICE icon ICON attr DEVICE eventMap { dev=>{ON=>'on',OFF=>'off'} } attr DEVICE devicetopic BASE_TOPIC/DEV_ID attr DEVICE readingList $\DEVICETOPIC:.* { json2nameValue($EVENT) } attr DEVICE setList \ on:noArg $\DEVICETOPIC/set {"state":"ON"}\ off:noArg $\DEVICETOPIC/set {"state":"OFF"}\ toggle:noArg $\DEVICETOPIC/set {"state":"TOGGLE"} attr DEVICE setStateList on off toggle set DEVICE attrTemplate speechcontrol_type_switch attr DEVICE model zigbee2mqtt_plug setreading DEVICE attrTemplateVersion 20200904 name:zigbee2mqtt_plug_w_energy_measuring filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* desc: For plugs with energy measuring features like innr SP 120 or Blitzwolf Powerplug BW-SHP13 order:L_05a set DEVICE attrTemplate zigbee2mqtt_plug attr DEVICE devStateIcon {my $light = FW_makeImage(ReadingsVal($name,"state","off")); my $current = ReadingsVal($name,"current",0); my $pwr = ReadingsVal($name,"power",0); my $energy = ReadingsVal($name,"energy",0); qq(
$light Aktuell: $current A Leistung.: $pwr W)} attr DEVICE model zigbee2mqtt_plug_w_energy_measuring setreading DEVICE attrTemplateVersion 20200903 # zigbee2mqtt 2 channel device name:zigbee2mqtt_2channel_split filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* desc:For zigbee2mqtt 2 channel device.
NOTE: a second device will be created for the second channel
NOTE: Untested updated version, should work with LLKZMK11LM, Ubisys S2 (-R), order:L_05c par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } par:ICON;ICON as set, defaults to message_socket;{ AttrVal("DEVICE","icon","message_socket") } attr DEVICE icon ICON attr DEVICE eventMap { dev=>{ON=>'on',OFF=>'off'} } attr DEVICE devicetopic BASE_TOPIC/DEV_ID attr DEVICE readingList $\DEVICETOPIC:.* { json2nameValue($EVENT,'',$JSONMAP) } attr DEVICE jsonMap state:availability state_l1:state state_l2:0 attr DEVICE setList \ on:noArg $\DEVICETOPIC/l1/set {"state":"ON"}\ off:noArg $\DEVICETOPIC/l1/set {"state":"OFF"}\ toggle:noArg $\DEVICETOPIC/l1/set {"state":"TOGGLE"} attr DEVICE setStateList on off toggle deletereading -q DEVICE (?!associatedWith|IODev).* set DEVICE attrTemplate set_associatedWith \CHANNELS=2 \MAKECOPIES=1 attr DEVICE_CH2 setList \ on:noArg $\DEVICETOPIC/l2/set {"state":"ON"}\ off:noArg $\DEVICETOPIC/l2/set {"state":"OFF"}\ toggle:noArg $\DEVICETOPIC/l2/set {"state":"TOGGLE"} attr DEVICE_CH2 setStateList on off toggle deletereading -q DEVICE_CH2 (?!associatedWith|IODev).* attr DEVICE_CH2 jsonMap state_l1:0 state_l2:state state:0 consumption:0 linkquality:0 power:0 temperature:0 set DEVICE,DEVICE_CH2 attrTemplate speechcontrol_type_switch attr DEVICE,DEVICE_CH2 model zigbee2mqtt_2channel_split setreading DEVICE,DEVICE_CH2 attrTemplateVersion 20200929 # zigbee2mqtt 2 channel device with buttons, forum #102866 name:zigbee2mqtt_2channel_split_w_buttons filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* desc:For zigbee2mqtt 2 channel device with 2 buttons.
NOTE: a second device will be created for the second channel
NOTE: Untested version, should work with Xiaomi QBKG12LM order:Steckerleiste »Zigbee Smart Home«L_05d par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } par:ICON;ICON as set, defaults to message_socket;{ AttrVal("DEVICE","icon","message_socket") } set DEVICE attrTemplate zigbee2mqtt_2channel_split attr DEVICE devicetopic BASE_TOPIC/DEV_ID attr DEVICE setList \ on:noArg $\DEVICETOPIC/left/set {"state":"ON"}\ off:noArg $\DEVICETOPIC/left/set {"state":"OFF"}\ toggle:noArg $\DEVICETOPIC/left/set {"state":"TOGGLE"} attr DEVICE jsonMap state:availability state_left:state state_right:0 attr DEVICE_CH2 setList \ on:noArg $\DEVICETOPIC/right/set {"state":"ON"}\ off:noArg $\DEVICETOPIC/right/set {"state":"OFF"}\ toggle:noArg $\DEVICETOPIC/right/set {"state":"TOGGLE"} attr DEVICE_CH2 jsonMap state_left:0 state_right:state state:0 consumption:0 linkquality:0 power:0 temperature:0 attr DEVICE,DEVICE_CH2 model zigbee2mqtt_2channel_split_w_buttons setreading DEVICE,DEVICE_CH2 attrTemplateVersion 20200904 # zigbee2mqtt 3 channel device name:zigbee2mqtt_3channel_split filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* desc:For zigbee2mqtt 3 channel device like Silvercrest Steckerleiste »Zigbee Smart Home«.
NOTE: Two additional devices will be created for further channels.
NOTE: Untested updated version order:L_05e par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } par:ICON;ICON as set, defaults to message_socket;{ AttrVal("DEVICE","icon","message_socket") } attr DEVICE icon ICON attr DEVICE eventMap { dev=>{ON=>'on',OFF=>'off'} } attr DEVICE devicetopic BASE_TOPIC/DEV_ID attr DEVICE readingList $\DEVICETOPIC:.* { json2nameValue($EVENT,'',$JSONMAP) } attr DEVICE jsonMap state:availability state_l1:state state_l2:0 state_l3:0 attr DEVICE setList \ on:noArg $\DEVICETOPIC/1/set {"state_l1":"ON"}\ off:noArg $\DEVICETOPIC/1/set {"state_l1":"OFF"}\ toggle:noArg $\DEVICETOPIC/1/set {"state_l1":"TOGGLE"} attr DEVICE setStateList on off toggle deletereading -q DEVICE (?!associatedWith|IODev).* set DEVICE attrTemplate set_associatedWith \CHANNELS=3 \MAKECOPIES=1 attr DEVICE_CH2 setList \ on:noArg $\DEVICETOPIC/l2/set {"state_l2":"ON"}\ off:noArg $\DEVICETOPIC/l2/set {"state_l2":"OFF"}\ toggle:noArg $\DEVICETOPIC/l2/set {"state_l2":"TOGGLE"} attr DEVICE_CH2 jsonMap state_l2:state state_l1:0 state_l3:0 state:0 consumption:0 linkquality:0 power:0 temperature:0 attr DEVICE_CH3 setList \ on:noArg $\DEVICETOPIC/l3/set {"state_l3":"ON"}\ off:noArg $\DEVICETOPIC/l3/set {"state_l3":"OFF"}\ toggle:noArg $\DEVICETOPIC/l3/set {"state_l3":"TOGGLE"} attr DEVICE_CH2 jsonMap state_l3:state state_l1:0 state_l2:0 state:0 consumption:0 linkquality:0 power:0 temperature:0 set DEVICE,DEVICE_CH2,DEVICE_CH3 attrTemplate speechcontrol_type_switch attr DEVICE,DEVICE_CH2,DEVICE_CH3 model zigbee2mqtt_3channel_split setreading DEVICE,DEVICE_CH2,DEVICE_CH3 attrTemplateVersion 20211030 # A blind drive motor TS0601_cover connected via zigbee2mqtt #contributed by barneybaer, https://forum.fhem.de/index.php/topic,94495.msg1134215.html#msg1134215 name:zigbee2mqtt_blind_drive desc: A blind drive motor connected via zigbee2mqtt
Tested with: Tuya AM43 TS0601_cover filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* order:L_05f par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } par:ICON;ICON as set, defaults to fts_shutter_100;{ AttrVal("DEVICE","icon","fts_shutter_100") } attr DEVICE icon ICON 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 webCmd open:close:stop:pct:speed attr DEVICE devicetopic BASE_TOPIC/DEV_ID attr DEVICE jsonMap position:pct motor_speed:speed attr DEVICE readingList $\DEVICETOPIC:.* { json2nameValue($EVENT,'',$JSONMAP) } attr DEVICE setList \ open:noArg $\DEVICETOPIC/set {"state":"OPEN"}\ close:noArg $\DEVICETOPIC/set {"state":"CLOSE"}\ stop:noArg $\DEVICETOPIC/set {"state":"STOP"}\ pct:slider,0,1,100 $\DEVICETOPIC/set {"position":"$EVTPART1"}\ speed:colorpicker,BRI,0,1,255 $\DEVICETOPIC/set {"options": {"motor_speed":"$EVTPART1"}} attr DEVICE stateFormat pct set DEVICE attrTemplate speechcontrol_type_blind attr DEVICE model zigbee2mqtt_blind_drive setreading DEVICE attrTemplateVersion 20211113 name:zigbee2mqtt_ContactSensor desc: Contact sensor via zigbee2mqtt
Tested with: Xiaomi models Aqara and Mijia filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* order:L_06 par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } attr DEVICE devStateIcon open:fts_window_1w_open@red close:fts_window_1w@green attr DEVICE eventMap true:close false:open attr DEVICE devicetopic BASE_TOPIC/DEV_ID attr DEVICE readingList $\DEVICETOPIC:.* { json2nameValue($EVENT,'',$JSONMAP) } attr DEVICE jsonMap contact:state deletereading -q DEVICE (?!associatedWith|IODev).* set DEVICE attrTemplate speechcontrol_gdt_and_mapping GENERICDEVTYPE=ContactSensor HOMEBRIDGEMAPPING=ContactSensorState=state,values=true:CONTACT_DETECTED;false:CONTACT_NOT_DETECTED attr DEVICE model zigbee2mqtt_ContactSensor setreading DEVICE attrTemplateVersion 20210301 name:zigbee2mqtt_TempHumHpaSensor desc: Temp/hum/hpa sensor via zigbee2mqtt
Tested with: Xiaomi Aqara WSDCGQ11LM Temperature Humidity Sensor filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* order:L_07 par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } par:ICON;ICON as set, defaults to temperature_humidity;{ AttrVal("DEVICE","icon","temperature_humidity") } attr DEVICE icon ICON attr DEVICE devicetopic BASE_TOPIC/DEV_ID attr DEVICE stateFormat {sprintf ("Temperature: %.1f°C Humidity: %.1f%% Pressure: %.1fhpa", ReadingsVal($name,"temperature",0), ReadingsVal($name,"humidity",0), ReadingsVal($name,"pressure",0)) } attr DEVICE readingList $\DEVICETOPIC:.* { json2nameValue($EVENT,'',$JSONMAP) } deletereading -q DEVICE (?!associatedWith|IODev).* attr DEVICE model zigbee2mqtt_TempHumHpaSensor setreading DEVICE attrTemplateVersion 20200904 #source post: https://forum.fhem.de/index.php/topic,94495.msg898198.html#msg898198 name:zigbee2mqtt_TempHumSensor desc: Temp/hum sensor via zigbee2mqtt
Tested with: Xiaomi MiJia WSDCGQ01LM Temperature Humidity Sensor filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* order:L_07a par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } par:ICON;ICON as set, defaults to temperature_humidity;{ AttrVal("DEVICE","icon","temperature_humidity") } attr DEVICE icon ICON attr DEVICE stateFormat {sprintf ("Temperature: %.1f°C Humidity: %.1f%%", ReadingsVal($name,"temperature",0), ReadingsVal($name,"humidity",0)) } attr DEVICE devicetopic BASE_TOPIC/DEV_ID attr DEVICE readingList $\DEVICETOPIC:.* { json2nameValue($EVENT,'',$JSONMAP) } deletereading -q DEVICE (?!associatedWith|IODev).* attr DEVICE model zigbee2mqtt_TempHumSensor setreading DEVICE attrTemplateVersion 20200904 #by TomLee, https://forum.fhem.de/index.php/topic,116310.msg1105927.html#msg1105927 name:zigbee2mqtt_human_body_movement desc: Human motion sensor via zigbee2mqtt
Tested with: Xiaomi MiJia human RTCGQ01LM body movement sensor (occupancy) filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* order:L_08 set DEVICE attrTemplate zigbee2mqtt_human_body_movement_illuminance attr DEVICE jsonMap battery:batteryPercent voltage:batterymV attr DEVICE stateFormat Motion: occupancy\ Battery: batteryPercent% attr DEVICE model zigbee2mqtt_human_body_movement setreading DEVICE attrTemplateVersion 20201208 #source post: https://forum.fhem.de/index.php/topic,94495.msg898198.html#msg898198, addon by TomLee, https://forum.fhem.de/index.php/topic,116310.msg1105927.html#msg1105927 name:zigbee2mqtt_human_body_movement_illuminance desc: Human motion sensor with illumiuance measurement via zigbee2mqtt
Tested with: Xiaomi Aqara RTCGQ11LM Human Motion Sensor filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* order:L_08a par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } par:ICON;ICON as set, defaults to people_sensor;{ AttrVal("DEVICE","icon","people_sensor") } attr DEVICE icon ICON attr DEVICE devStateIcon Motion..true:people_sensor Motion..false:motion_detector attr DEVICE devicetopic BASE_TOPIC/DEV_ID attr DEVICE jsonMap battery:batteryPercent voltage:batterymV illuminance_lux:0 attr DEVICE stateFormat Motion: occupancy\ Luminance: illuminance Battery: batteryPercent% attr DEVICE readingList $\DEVICETOPIC:.* { json2nameValue($EVENT,'',$JSONMAP) } attr DEVICE userReadings batteryVoltage:batterymV.* {ReadingsNum($name,'batterymV',0)/1000} deletereading -q DEVICE (?!associatedWith|IODev).* attr DEVICE model zigbee2mqtt_human_body_movement_illuminance setreading DEVICE attrTemplateVersion 20201208 name:zigbee2mqtt_Light_Intensity_Sensor desc: Light Intensity Sensor via zigbee2mqtt
Tested with: Xiaomi MiJia light intensity sensor GZCGQ01LM filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* order:L_08a01 par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } par:ICON;ICON as set, defaults to weather_sun;{ AttrVal("DEVICE","icon","weather_sun") } attr DEVICE icon ICON attr DEVICE devicetopic BASE_TOPIC/DEV_ID attr DEVICE stateFormat Lux: illuminance_lux Luminance: illuminance attr DEVICE readingList $\DEVICETOPIC:.* { json2nameValue($EVENT,'',$JSONMAP) } deletereading -q DEVICE (?!associatedWith|IODev).* attr DEVICE model zigbee2mqtt_Light_Intensity_Sensor setreading DEVICE attrTemplateVersion 20200904 #source post: https://forum.fhem.de/index.php/topic,94495.msg975785.html#msg975785 # Osram Lightify, Smart+ Motion Sensor name:zigbee2mqtt_TempMotion_sensor desc: Temperature and motion sensor via zigbee2mqtt
Tested with: Osram Lightify Motion Sensor filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* order:L_08a02 par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } attr DEVICE icon ICON attr DEVICE devicetopic BASE_TOPIC/DEV_ID attr DEVICE stateFormat Motion: occupancy T: temperature attr DEVICE readingList $\DEVICETOPIC:.* { json2nameValue($EVENT,'',$JSONMAP) } deletereading -q DEVICE (?!associatedWith|IODev).* attr DEVICE model zigbee2mqtt_TempMotion_sensor setreading DEVICE attrTemplateVersion 20200904 #source post: https://forum.fhem.de/index.php/topic,94495.msg898198.html#msg898198 name:zigbee2mqtt_Motion_Sensor desc: Smart motion sensor via zigbee2mqtt
Tested with: Xiaomi Aqara DJT11LM Smart Motion Sensor filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* order:L_09 par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } par:ICON;ICON as set, defaults to people_sensor;{ AttrVal("DEVICE","icon","people_sensor") } attr DEVICE icon ICON attr DEVICE devicetopic BASE_TOPIC/DEV_ID attr DEVICE stateFormat Motion: action X: angle_x Y: angle_y Z: angle_z attr DEVICE readingList $\DEVICETOPIC:.* { json2nameValue($EVENT) } deletereading -q DEVICE (?!associatedWith|IODev).* attr DEVICE model zigbee2mqtt_Motion_Sensor setreading DEVICE attrTemplateVersion 20200904 #source post: https://forum.fhem.de/index.php/topic,94495.msg898198.html#msg898198 name:zigbee2mqtt_Water_Leak_Sensor desc: Water leak sensor via zigbee2mqtt
Tested with: Xiaomi Aqara SJCGQ11LM Water Leak Sensor filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* order:L_10 par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } attr DEVICE stateFormat Leak: state attr DEVICE devicetopic BASE_TOPIC/DEV_ID attr DEVICE readingList $\DEVICETOPIC:.* { json2nameValue($EVENT,'',$JSONMAP) } attr DEVICE jsonMap water_leak:state deletereading -q DEVICE (?!associatedWith|IODev).* attr DEVICE model zigbee2mqtt_Water_Leak_Sensor setreading DEVICE attrTemplateVersion 20200904 #source post: https://forum.fhem.de/index.php/topic,94495.msg898198.html#msg898198 name:zigbee2mqtt_Light_Switch desc: Smart light switch 2btn via zigbee2mqtt
Tested with: Xiaomi Aqara WXKG02LM 2btn Smart Light Switch filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* order:L_11 par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } par:ICON;ICON as set, defaults to control_home;{ AttrVal("DEVICE","icon","control_home") } attr DEVICE icon ICON attr DEVICE stateFormat click attr DEVICE devicetopic BASE_TOPIC/DEV_ID attr DEVICE readingList $\DEVICETOPIC:.* { json2nameValue($EVENT) } deletereading -q DEVICE (?!associatedWith|IODev).* set DEVICE attrTemplate speechcontrol_type_switch attr DEVICE model zigbee2mqtt_Light_Switch setreading DEVICE attrTemplateVersion 20200904 #contributed by Puccini, source post: https://forum.fhem.de/index.php/topic,108538.msg1106932.html#msg1106932 name:zigbee2mqtt_scene_controller desc: Wireless button via zigbee2mqtt
Tested with: Xiaomi Aqara WXCJKG13LM wireless switch filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* order:L_12 par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","readingList","") =~ m,[\b]?([^/:]+)[/].*:, ? $1 : undef } par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } par:ICON;ICON as set, defaults to control_home;{ AttrVal("DEVICE","icon","control_home") } attr DEVICE icon ICON attr DEVICE stateFormat Action: action Batterie: battery % attr DEVICE devicetopic BASE_TOPIC/DEV_ID attr DEVICE readingList $\DEVICETOPIC:.* { json2nameValue($EVENT) } deletereading -q DEVICE (?!associatedWith|IODev).* attr DEVICE model zigbee2mqtt_scene_controller setreading DEVICE attrTemplateVersion 20200904 #source post: https://forum.fhem.de/index.php/topic,94495.msg916789.html#msg916789 name:zigbee2mqtt_Wireless_Button desc: Wireless button via zigbee2mqtt
Tested with: Xiaomi Aqara WXKG12LM wireless switch with gyroscope filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* order:L_12a par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","readingList","") =~ m,[\b]?([^/:]+)[/].*:, ? $1 : undef } par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } par:ICON;ICON as set, defaults to control_home;{ AttrVal("DEVICE","icon","control_home") } attr DEVICE icon ICON attr DEVICE stateFormat Click: click Action: action attr DEVICE devicetopic BASE_TOPIC/DEV_ID attr DEVICE readingList $\DEVICETOPIC:.* { json2nameValue($EVENT,'',$JSONMAP) } attr DEVICE jsonMap battery:batteryPercent voltage:batterymV attr DEVICE userReadings batteryVoltage:batterymV.* {ReadingsNum($name,'batterymV',0)/1000} deletereading -q DEVICE (?!associatedWith|IODev).* attr DEVICE model zigbee2mqtt_Wireless_Button setreading DEVICE attrTemplateVersion 20201208 name:zigbee2mqtt_wireless_button_old desc: Wireless button without gyro via zigbee2mqtt
Tested with: Xiaomi Aqara WXKG11LM wireless button filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* order:L_13 par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } par:ICON;ICON as set, defaults to control_home;{ AttrVal("DEVICE","icon","control_home") } attr DEVICE icon ICON attr DEVICE stateFormat Click: click attr DEVICE devicetopic BASE_TOPIC/DEV_ID attr DEVICE readingList $\DEVICETOPIC:.* { json2nameValue($EVENT) } deletereading -q DEVICE (?!associatedWith|IODev).* #not yet tested, see https://forum.fhem.de/index.php/topic,113224.msg1075311.html#msg1075311 #set DEVICE attrTemplate speechcontrol_gdt_and_mapping GENERICDEVTYPE=StatelessProgrammableSwitch HOMEBRIDGEMAPPING= "ProgrammableSwitchEvent=click,values=single:SINGLE_PRESS;;double:DOUBLE_PRESS" attr DEVICE model zigbee2mqtt_wireless_button_old setreading DEVICE attrTemplateVersion 20200904 name:zigbee2mqtt_aqara_cube desc: Aqara smarthome cube via zigbee2mqtt
Tested with: Xiaomi Aqara MFKZQ01LM smarthome cube filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* order:L_14 par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } attr DEVICE stateFormat Action: action attr DEVICE devicetopic BASE_TOPIC/DEV_ID attr DEVICE readingList $\DEVICETOPIC:.* { json2nameValue($EVENT,'',$JSONMAP) } attr DEVICE jsonMap battery:batteryPercent voltage:batterymV attr DEVICE userReadings batteryVoltage:batterymV.* {ReadingsNum($name,'batterymV',0)/1000} deletereading -q DEVICE (?!associatedWith|IODev).* attr DEVICE model zigbee2mqtt_aqara_cube setreading DEVICE attrTemplateVersion 20210226 #source post: https://forum.fhem.de/index.php/topic,94494.msg983905.html#msg983905 name:zigbee2mqtt_AlarmSensor desc: Alarm sensor via zigbee2mqtt
Can report actions drop, tilt or vibration as well as x,y,z coordinates of its movement.
Sensitivity can be set to low, medium or high.
Tested with: Xiaomi DJT11LM Vibration Sensor filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* order:L_15 par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } par:ICON;ICON as set, defaults to secur_alarm;{ AttrVal("DEVICE","icon","secur_alarm") } attr DEVICE icon ICON attr DEVICE devicetopic BASE_TOPIC/DEV_ID attr DEVICE setList \ sensitivity:low,medium,high $\DEVICETOPIC/set {"sensitivity":"$EVTPART1"} attr DEVICE stateFormat Action: action X: angle_x Y: angle_y Z: angle_z attr DEVICE readingList $\DEVICETOPIC:.* { json2nameValue($EVENT) } deletereading -q DEVICE (?!associatedWith|IODev).* attr DEVICE model zigbee2mqtt_AlarmSensor setreading DEVICE attrTemplateVersion 20200904 # SYMFONSIK sound controller #contributed by KurtK: https://forum.fhem.de/index.php/topic,94495.msg1056562.html#msg1056562 name:zigbee2mqtt_symfonsik_sound_controller desc: IKEA SYMFONSIK sound controller via zigbee2mqtt
Tested with: IKEA E1744 SYMFONSIK sound controller filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* order:L_16 par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } par:ICON;ICON as set, defaults to it_remote;{ AttrVal("DEVICE","icon","it_remote") } attr DEVICE icon ICON attr DEVICE devicetopic BASE_TOPIC/DEV_ID attr DEVICE stateFormat Action: action Volume: volume Batterie: battery % attr DEVICE readingList $\DEVICETOPIC:.* { json2nameValue($EVENT) } attr DEVICE model zigbee2mqtt_symfonsik_sound_controller attr DEVICE userReadings volume:brightness.* {int(ReadingsVal($name,"brightness",10)/2.55)} deletereading -q DEVICE (?!associatedWith|IODev).* setreading DEVICE attrTemplateVersion 20200904 # Eurotronic Spirit ZigBee version name:zigbee2mqtt_eurotronic_spirit desc: First version for Eurotronic SPZB0001 via zigbee2mqtt
Not yet tested...
tbd (?): map eurotronic_system_mode to readings (userReadings?) filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* order:L_17 par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } par:ICON;ICON as set, defaults to temp_control;{ AttrVal("DEVICE","icon","temp_control") } attr DEVICE icon ICON attr DEVICE devicetopic BASE_TOPIC/DEV_ID attr DEVICE readingList $\DEVICETOPIC:.* { json2nameValue($EVENT,'',$JSONMAP) } attr DEVICE setList \ boost:true,false $\DEVICETOPIC/set {"eurotronic_host_flags": {"boost": $EVTPART1 }}\ btnLock:true,false $\DEVICETOPIC/set {"eurotronic_host_flags": {"child_protection": $EVTPART1 }}\ desired-temp:slider,5.0,0.5,30.0,1 $\DEVICETOPIC/set {"current_heating_setpoint": $EVTPART1 }\ daytemp:slider,5.0,0.5,30.0,1 $\DEVICETOPIC/set {"occupied_heating_setpoint": $EVTPART1 }\ nighttemp:slider,5.0,0.5,30.0,1 $\DEVICETOPIC/set {"unoccupied_heating_setpoint": $EVTPART1 }\ window_open:true,false $\DEVICETOPIC/set {"eurotronic_host_flags": {"window_open": $EVTPART1 }}\ boost:true,false $\DEVICETOPIC/set {"eurotronic_host_flags": {"boost": $EVTPART1 }}\ x_mirror_display:true,false $\DEVICETOPIC/set {"eurotronic_host_flags": {"mirror_display": $EVTPART1 }} attr DEVICE stateFormat Measured: temperature Battery: battery % attr DEVICE webCmd desired-temp attr DEVICE widgetOverride desired-temp:knob,min:5,max:30,angleArc:180,width:40,height:40,fgColor:#FF9900,bgColor:#CCCCCC,step:0.5,lineCap:round,angleOffset:225 attr DEVICE jsonMap occupied_heating_setpoint:daytemp unoccupied_heating_setpoint:nighttemp child_protection:btnLock current_heating_setpoint:desired-temp local_temperature:temperature battery:batteryPercent voltage:batterymV attr DEVICE userReadings batteryVoltage:batterymV.* {ReadingsNum($name,'batterymV',0)/1000} attr DEVICE setStateList on off attr DEVICE model zigbee2mqtt_eurotronic_spirit set DEVICE attrTemplate speechcontrol_type_thermostat deletereading -q DEVICE (?!associatedWith|IODev).* setreading DEVICE attrTemplateVersion 20220110 name:zigbee2mqtt_thermostat_with_weekrofile desc: Developed for Model HY368-ZB manufactured by Moes via zigbee2mqtt
Might not completely work for all firmware versions and also some commands seem not yet to be fully integrated on the zigbee2mqtt side...
To contribute, participate in Forum Thread filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* order:L_17a par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } par:ICON;ICON as set, defaults to temp_control;{ AttrVal("DEVICE","icon","temp_control") } par:WPNAME;weekprofile attr value, defaults to device name;{ AttrVal("DEVICE","weekprofile","DEVICE") } farewell:template has been applied successfully.
NOTE: code has been downloaded from svn (contrib).
For use with weekprofile, additional configuration is needed! { Svn_GetFile("contrib/AttrTemplate/99_attrT_z2m_thermostat_Utils.pm", "FHEM/99_attrT_z2m_thermostat_Utils.pm", sub(){ CommandReload(undef, "99_attrT_z2m_thermostat_Utils.pm") }) } attr DEVICE comment For use with weekprofile, additional configuration is needed attr DEVICE icon ICON attr DEVICE devicetopic BASE_TOPIC/DEV_ID attr DEVICE userattr weekprofile attr DEVICE weekprofile WPNAME attr DEVICE readingList $\DEVICETOPIC:.* { my %h; my $temp = $EVENT; $temp =~ s/,?("(holidays|workdays)":.([^]]+))./$h{$2}=$3/ge; $EVENT =~ s/,?("(holidays|workdays)":.([^]]+)).//g; my $h2 = json2nameValue($EVENT,'',$JSONMAP); %h = (%h,%$h2); \%h } attr DEVICE setList \ desired-temp:slider,5.0,0.5,30.0,1 $\DEVICETOPIC/set {"current_heating_setpoint": $EVTPART1 }\ btnLock:LOCK,UNLOCK $\DEVICETOPIC/set {"child_lock": "$EVTPART1"}\ preset:schedule,manual,boost,complex,comfort,eco $\DEVICETOPIC/set {"preset": "$EVTPART1"}\ mode:heat,auto,off $\DEVICETOPIC/set {"system_mode": "$EVTPART1"}\ holidays $\DEVICETOPIC/set/schedule { "holidays":[$EVTPART1] }\ workdays $\DEVICETOPIC/set/schedule { "workdays":[$EVTPART1] }\ week:5+2,6+1,7 $\DEVICETOPIC/set $EVTPART1\ weekprofile { FHEM::attrT_z2m_thermostat_Utils::z2t_send_weekprofile($NAME, $EVTPART1, $EVTPART2) }\ x_send_set_payload:textField { my $payload = $EVENT;$payload =~ s/$EVTPART0 //; qq($\DEVICETOPIC/set $payload)} attr DEVICE getList desired-temp:noArg desired-temp $\DEVICETOPIC/get {"current_heating_setpoint": ""}\ temperature:noArg temperature $\DEVICETOPIC/get {"local_temperature": ""}\ preset:noArg preset $\DEVICETOPIC/get {"preset": ""} attr DEVICE periodicCmd temperature:55 attr DEVICE stateFormat btnLock\ Measured: temperature Battery: batteryPercent % attr DEVICE devStateIcon LOCKED:secur_lock:btnLock+UNLOCK UNLOCKED:secur_open:btnLock+LOCK attr DEVICE webCmd desired-temp attr DEVICE widgetOverride desired-temp:knob,min:5,max:30,angleArc:180,width:40,height:40,fgColor:#FF9900,bgColor:#CCCCCC,step:0.5,lineCap:round,angleOffset:225 attr DEVICE jsonMap current_heating_setpoint:desired-temp local_temperature:temperature Battery:batteryPercent system_mode:mode battery:batteryPercent voltage:batterymV attr DEVICE setStateList on off attr DEVICE userReadings batteryState:battery_low.* {ReadingsVal($name,'battery_low','false') eq 'false'?'ok':'low'}, batteryVoltage:batterymV.* {ReadingsNum($name,'batterymV',0)/1000} attr DEVICE model zigbee2mqtt_thermostat_with_weekrofile set DEVICE attrTemplate speechcontrol_type_thermostat deletereading -q DEVICE (?!associatedWith|IODev).* setreading DEVICE attrTemplateVersion 20220110 #contributed by barneybaer, https://forum.fhem.de/index.php/topic,94495.msg1145005.html#msg1145005 name:zigbee2mqtt_thermostat_without_weekprofile desc: Developed for Model Saswell SEA801-Zigbee/SEA802-Zigbee manufactured by Saswell via zigbee2mqtt
filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* order:L_17b par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } par:ICON;ICON as set, defaults to temp_control;{ AttrVal("DEVICE","icon","temp_control") } attr DEVICE icon ICON attr DEVICE devicetopic BASE_TOPIC/DEV_ID attr DEVICE readingList $\DEVICETOPIC:.* { json2nameValue($EVENT,'',$JSONMAP) } attr DEVICE setList \ desired-temp:slider,5.0,0.5,30.0,1 $\DEVICETOPIC/set {"current_heating_setpoint": "$EVTPART1"}\ btnLock:LOCK,UNLOCK $\DEVICETOPIC/set {"child_lock": "$EVTPART1"}\ mode:heat,auto,off $\DEVICETOPIC/set {"system_mode": "$EVTPART1"}\ away:ON,OFF $\DEVICETOPIC/set {"away_mode": "$EVTPART1"}\ window_detection:ON,OFF,TOOGLE $\DEVICETOPIC/set {"window_detection": "$EVTPART1"} attr DEVICE periodicCmd temperature:55 attr DEVICE devStateIcon LOCKED:secur_lock:btnLock+UNLOCK UNLOCKED:secur_open:btnLock+LOCK attr DEVICE webCmd desired-temp attr DEVICE jsonMap current_heating_setpoint:desired-temp local_temperature:temperature Battery:batteryPercent system_mode:mode voltage:batterymV attr DEVICE stateFormat btnLock\ Measured: temperature Battery: batteryPercent % attr DEVICE userReadings batteryState:battery_low.* {ReadingsVal($name,'battery_low','false') eq 'false'?'ok':'low'}, batteryVoltage:batterymV.* {ReadingsNum($name,'batterymV',0)/1000} attr DEVICE model zigbee2mqtt_thermostat_without_weekrofile set DEVICE attrTemplate speechcontrol_type_thermostat deletereading -q DEVICE (?!associatedWith|IODev).* setreading DEVICE attrTemplateVersion 20220110 ########################################### # TASMOTA # The regexp must handle # - tele/sonoff/LWT: => cmnd/sonoff/ # - DVES_XXXXXX:/SmartHome/Esszimmer/Stehlampe/tele/LWT: => /SmartHome/Esszimmer/Stehlampe/cmnd/ name:tasmota_basic_state_power1 filter:TYPE=MQTT2_DEVICE desc:Applies to Sonoff Basic, S20 using POWER1-topic for relay state
NOTE: The format the device is sending data will also be changed to lowercase!
NOTE: This template is intended to configure also channel one of multi-channel tasmota devices order:A_01a par:CMNDTOPIC;Command topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}cmnd$3" : undef } par:TELETOPIC;info topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}tele$3" : undef } par:STATTOPIC;ack topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}stat$3" : undef } par:CALLSPEECHRECOGN;Set this to 0 to not set any speech recogn. related attributes;{ 1 } par:ICON;ICON as set, defaults to hue_filled_outlet;{ AttrVal("DEVICE","icon","hue_filled_outlet") } attr DEVICE icon ICON attr DEVICE jsonMap POWER1:0 POWER2:0 POWER3:0 POWER4:0 Dimmer:0 Channel_0:0 Channel_1:0 Channel_2:0 Channel_3:0 Channel_4:0 HSBColor:0 Color:0 set DEVICE attrTemplate tasmota_set_lowercase_texts_and_state1 attr DEVICE setList \ off:noArg CMNDTOPIC/POWER1 0\ on:noArg CMNDTOPIC/POWER1 1\ toggle:noArg CMNDTOPIC/POWER1 2\ setOtaUrl:textField CMNDTOPIC/OtaUrl $EVTPART1\ upgrade:noArg CMNDTOPIC/upgrade 1 attr DEVICE readingList \ TELETOPIC/LWT:.* LWT\ TELETOPIC/STATE:.* { json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/SENSOR:.* { json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/INFO.:.* { $EVENT =~ m,^..Info[1-3]..(.+).$, ? json2nameValue($1,'',$JSONMAP) : json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/UPTIME:.* { json2nameValue($EVENT,'',$JSONMAP) }\ STATTOPIC/POWER1:.* state\ STATTOPIC/RESULT:.* { json2nameValue($EVENT,'',$JSONMAP) } deletereading -q DEVICE (?!associatedWith|IODev).* attr DEVICE setStateList on off toggle attr DEVICE comment NOTE: For on-for-timer SetExtensions are used. You may add on-for-timer option running on the device. The following is limited to 1h max duration, but will not affect future simple "on" commands:
on-for-timer {my $duration = $EVTPART1*10; 'cmnd/CMNDTOPIC/Backlog POWER1 1; delay '.$duration.'; POWER1 0'}
See the "Praxisbeispiele" in the wiki for "pulseTime1" alternative option and it's restrictions. attr DEVICE autocreate 0 attr DEVICE model tasmota_basic_state_power1 setreading DEVICE attrTemplateVersion 20210523 option:{ CALLSPEECHRECOGN } set DEVICE attrTemplate speechcontrol_type_switch # sonoff 1 channel device flashed with Tasmota. name:tasmota_basic filter:TYPE=MQTT2_DEVICE desc:Applies to Sonoff 1 Channel devices using POWER-topic for relay state
NOTE:
- Power topic will be set to POWER1;
- the format the device is sending data will also be changed to lowercase!
- finally, you'll see the device as model tasmota_basic_state_power1. order:A_01 set DEVICE attrTemplate tasmota_basic_state_power1 CALLSPEECHRECOGN=1 name:tasmota_clear_readings_reset_readingsList_and_reboot filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*(tele|cmnd|stat).* desc: replaces the readingList with defaults, clears the readingList and reboots to get all readings order:A_01x par:CMNDTOPIC;Command topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}cmnd$3" : undef } par:TELETOPIC;info topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}tele$3" : undef } par:STATTOPIC;ack topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}stat$3" : undef } par:IO_DEV;Currently used IO;{ AttrVal('DEVICE','IODev',InternalVal('DEVICE','IODev',undef)->{NAME}) } attr DEVICE readingList \ TELETOPIC/LWT:.* LWT\ TELETOPIC/STATE:.* { json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/SENSOR:.* { json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/INFO.:.* { $EVENT =~ m,^..Info[1-3]..(.+).$, ? json2nameValue($1,'',$JSONMAP) : json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/UPTIME:.* { json2nameValue($EVENT,'',$JSONMAP) }\ STATTOPIC/POWER1:.* state\ STATTOPIC/RESULT:.* { json2nameValue($EVENT,'',$JSONMAP) } deletereading -q DEVICE (?!associatedWith|IODev).* set IO_DEV publish CMNDTOPIC/Restart 1 attr DEVICE autocreate 0 # tasmota device with one relay, one motion sensor via switch name:tasmota_1ch+motion+SI7021 desc:tasmota device with one relay, one motion sensor via switch and one SI7021 combined temperature and humidity sensor.
Configures a single device including all readings filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*(tele|cmnd|stat).* order:A_01b set DEVICE attrTemplate tasmota_basic_state_power1 CALLSPEECHRECOGN=1 par:CMNDTOPIC;Command topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}cmnd$3" : undef } attr DEVICE setList \ off:noArg CMNDTOPIC/POWER1 0\ on:noArg CMNDTOPIC/POWER1 1\ toggle:noArg CMNDTOPIC/POWER1 2 attr DEVICE stateFormat { ReadingsVal($name, 'state', 'off') . ' ' .\ ReadingsVal($name, 'motion', 'off') . ' '\ . sprintf("%.1f°C ",ReadingsNum($name,'temperature',0))\ . sprintf("%.0f%%",ReadingsNum($name,'humidity',0)) } attr DEVICE readingList \ TELETOPIC/LWT:.* LWT\ TELETOPIC/STATE:.* { json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/SENSOR:.* { json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/INFO.:.* { $EVENT =~ m,^..Info[1-3]..(.+).$, ? json2nameValue($1,'',$JSONMAP) : json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/UPTIME:.* { json2nameValue($EVENT,'',$JSONMAP) }\ STATTOPIC/POWER1:.* state\ STATTOPIC/POWER2:.* motion\ STATTOPIC/RESULT:.* { json2nameValue($EVENT,'',$JSONMAP) } attr DEVICE devStateIcon {\ my $state = lc ReadingsVal($name, 'motion', 'off');\ my $devStateIcon = 'building_security@green';\ if ($state eq "on") {\ $devStateIcon = 'building_security@red';\ }\ "
" . FW_makeImage(lc ReadingsVal($name, 'state', 'off'))\ . FW_makeImage($devStateIcon) . sprintf(\ "  [Temp: %.1f°C / Feucht: %.0f%%]",\ ReadingsVal($name,"temperature",0),\ ReadingsVal($name,"humidity",0)\ ) . "
"\ } attr DEVICE jsonMap POWER1:0 POWER2:0 POWER3:0 POWER4:0 Dimmer:0 Channel_0:0 Channel_1:0 Channel_2:0 Channel_3:0 Channel_4:0 HSBColor:0 Color:0 SI7021_Temperature:temperature SI7021_Humidity:humidity SI7021_DewPoint:DewPoint attr DEVICE model tasmota_1ch+motion+SI7021 setreading DEVICE attrTemplateVersion 20220108 name:tasmota_POW filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*(tele|cmnd|stat).* desc:Applies to Sonoff POW devices and other Tasmota flashed devices with power measuring abilities.
NOTE: Power topic will be set to POWER1; the format the device is sending data will also be changed to lowercase! order:A_01c par:CMNDTOPIC;Command topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}cmnd$3" : undef } par:CALLSPEECHRECOGN;Set this to 0 to not set any speech recogn. related attributes;{ 1 } set DEVICE attrTemplate tasmota_basic_state_power1 \CALLSPEECHRECOGN=CALLSPEECHRECOGN attr DEVICE setList \ off:noArg CMNDTOPIC/POWER1 0\ on:noArg CMNDTOPIC/POWER1 1\ toggle:noArg CMNDTOPIC/POWER1 2 attr DEVICE devStateIcon {my $text = ' uptime: '.ReadingsVal($name,"Uptime","unknown").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"));; 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)."$text"} 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|IODev).* attr DEVICE setStateList on off toggle attr DEVICE webCmd : attr DEVICE model tasmota_POW setreading DEVICE attrTemplateVersion 20210903 # sonoff 1 channel + USB device flashed with Tasmota. name:tasmota_POW_USB_split filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*(tele|cmnd|stat).* desc:Plug with additional USB outlet flashed with Tasmota.
For use e.g. with Gosund SP112 or Blitzwolf SH5
NOTE: a second device will be created for the USB channel.
NOTE: still untested template, feedback is welcome! order:A_01c1 set DEVICE attrTemplate tasmota_2channel_split \CALLSPEECHRECOGN=0 set DEVICE attrTemplate tasmota_POW \CALLSPEECHRECOGN=0 par:CMNDTOPIC;Command topic prefix, without trailing /;{ AttrVal('DEVICE','readingList','') =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}cmnd$3" : undef } par:ICON;ICON as set, defaults to usb;{ AttrVal('DEVICE_CH2','icon','usb') } attr DEVICE_CH2 icon ICON attr DEVICE_CH2 comment Channel 2 (USB outlets) for DEVICE attr DEVICE_CH2 devStateIcon on:usb:off off:usb@red:on attr DEVICE_CH2 setStateList on off toggle set DEVICE,DEVICE_CH2 attrTemplate speechcontrol_type_switch attr DEVICE,DEVICE_CH2 model tasmota_POW_USB_split setreading DEVICE,DEVICE_CH2 attrTemplateVersion 20210903 # plug with LED flashed with Tasmota. name:tasmota_plug_with_rgbw_split filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*(tele|cmnd|stat).* desc:plug with seperate RGBW LED flashed with Tasmota.
NOTE: a second device will be created for the rgb device.
Tested with Tasmota V. 7.1.2 and Maxcio YX-DE02 Plug using template: {"NAME":"Maxcio YX-DE04","GPIO":[255,17,255,21,56,40,0,0,37,38,39,255,255],"FLAG":1,"BASE":18} order:A_01c1a set DEVICE attrTemplate tasmota_basic_state_power1 CALLSPEECHRECOGN=0 par:CMNDTOPIC;Command topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}cmnd$3" : undef } par:TELETOPIC;info topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}tele$3" : undef } par:STATTOPIC;ack topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}stat$3" : undef } attr DEVICE comment Mains channel for DEVICE, see also DEVICE_CH2 for rgb LED 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)} attr DEVICE jsonMap POWER1:0 Dimmer:0 Channel_1:0 Channel_2:0 Channel_3:0 HSBColor:0 POWER2:0 setreading DEVICE associatedWith DEVICE_CH2 deletereading -q DEVICE (?!associatedWith|IODev).* copy DEVICE DEVICE_CH2 deleteattr DEVICE_CH2 stateFormat attr DEVICE_CH2 comment RGBW channel for DEVICE setreading DEVICE_CH2 associatedWith DEVICE attr DEVICE_CH2 setList \ off:noArg CMNDTOPIC/POWER2 0\ on:noArg CMNDTOPIC/POWER2 1\ toggle:noArg CMNDTOPIC/POWER2 2\ Color:colorpicker,RGB CMNDTOPIC/COLOR\ pct:colorpicker,BRI,0,5,100 CMNDTOPIC/DIMMER\ white:colorpicker,BRI,0,5,100 { "CMNDTOPIC/COLOR ". sprintf("000000%02X",$EVTPART1*2.55) }\ dimup:noArg { my $num=int((ReadingsNum($NAME,'pct',0)+4)/10)*10+10; return qq {CMNDTOPIC/Dimmer $num}; }\ dimdown:noArg { my $num=int((ReadingsNum($NAME,'pct',0)+7)/10)*10-10; return qq {CMNDTOPIC/Dimmer $num}; } attr DEVICE_CH2 readingList \ STATTOPIC/RESULT:.* { json2nameValue($EVENT,'',$JSONMAP) }\ STATTOPIC/POWER2:.* state attr DEVICE_CH2 jsonMap POWER2:0 Dimmer:pct Channel_4:white Channel_1:0 Channel_2:0 Channel_3:0 HSBColor:0 POWER1:0 Heap:0 LedTable:0 LoadAvg:0 MqttCount:0 SaveData:0 Scheme:0 SetOption26:0 Sleep:0 SleepMode:0 Speed:0 StateText1:0 StateText2:0 StateText3:0 StateText4:0 Time:0 Uptime:0 UptimeSec:0 Wifi_SSId:0 Wifi_RSSI:0 Wifi_LinkCount:0 Wifi_Downtime:0 Wifi_Channel:0 Wifi_BSSId:0 Wifi_AP:0 ANALOG_A0:0 SetOption26:0 Sleep:0 SleepMode:0 Speed:0 StateText1:0 StateText2:0 StateText3:0 StateText4:0 Time:0 Uptime:0 UptimeSec:0 Wifi_SSId:0 Wifi_RSSI:0 Wifi_LinkCount:0 Wifi_Downtime:0 Wifi_Channel:0 Wifi_BSSId:0 Wifi_AP:0 ANALOG_A0:0 attr DEVICE_CH2 webCmd pct:white:Color attr DEVICE_CH2 webCmdLabel Helligkeit\ :Weiss\ :Farbe: attr DEVICE_CH2 devStateIcon {Color::devStateIcon($name,"rgb","Color","pct","state")} attr DEVICE_CH2 setStateList on off toggle deletereading -q DEVICE_CH2 (?!associatedWith|IODev).* set DEVICE,DEVICE_CH2 attrTemplate speechcontrol_type_switch attr DEVICE,DEVICE_CH2 model tasmota_plug_with_rgbw_split setreading DEVICE,DEVICE_CH2 attrTemplateVersion 20210903 #tasmota device with Infrared-circuit name:tasmota_ir desc:Demonstrates multiple options how to configure tasmota devices as IR remote control extension.
Forum Thread IR-Remote
Forum Thread tasmota_ir-Template
Tasmota IR-Remote Docu
Tasmota IR Communication Docu
Simple IR-circuit
irsend syntax
NOTE: This is more like a showcase for several options to send and receive commands, not really a "ready to use" device. Most likely, it's a good idea to add repeats to the commands. filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*(tele|cmnd|stat).* order:A_01d par:CMNDTOPIC;Command topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}cmnd$3" : undef } par:TELETOPIC;info topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}tele$3" : undef } par:POWERCMD;needed command to be sent like in example dec '{"protocol":"NEC","bits":32,"data":551489775}' (without '');{ undef } par:VOLUMEUPCMD;needed command to be sent like in example raw '0,926,844,958,832,1798,868,902,848,900,870,900,852,908,918,958,794,934,874,928,1738,934,856,1764' (without '');{ undef } par:MULTIPLE1CMD;needed command to be sent like in example hex '{"Protocol":"NEC","Bits":32,"Data":0x8166817E}' (without '');{ undef } par:MULTIPLE2CMD;needed command to be sent like in example hex '{"Protocol":"NEC","Bits":32,"Data":0x8166817E}' (without '');{ undef } par:ICON;ICON as set, defaults to IR;{ AttrVal("DEVICE","icon","IR") } attr DEVICE icon ICON attr DEVICE setList \ power:noArg CMNDTOPIC/IRsend POWERCMD\ volumeup:noArg CMNDTOPIC/IRsend VOLUMEUPCMD\ 11:noArg CMNDTOPIC/Backlog IRsend MULTIPLE1CMD;CMNDTOPIC/delay 8;CMNDTOPIC/IRsend MULTIPLE2CMD\ irsend:textField CMNDTOPIC/irsend {"Protocol":"$EVTPART1","Bits":$EVTPART2,"Data":"0x$EVTPART3","Repeat": 2} attr DEVICE readingList \ TELETOPIC/INFO.:.* { $EVENT =~ m,^..Info[1-3]..(.+).$, ? json2nameValue($1,'',$JSONMAP) : json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/RESULT:.* { $EVENT =~ m,..IrReceived....Protocol...([A-Za-z0-9]+)...Bits..([\d]+)..Data...([A-Za-z0-9]+)..., ? {"$1_$2"=>$3} : json2nameValue($EVENT) } attr DEVICE stateFormat state\
\ IPAddress attr DEVICE event-on-change-reading .* attr DEVICE model tasmota_ir setreading DEVICE attrTemplateVersion 20210515 #tasmota device with rf-circuit name:tasmota_rf desc:Demonstrates multiple options how to configure tasmota devices as rf remote control extension.
Forum Thread
NOTE: still widely untested... filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*(tele|cmnd|stat).* order:A_01d1 par:CMNDTOPIC;Command topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}cmnd$3" : undef } par:TELETOPIC;info topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}tele$3" : undef } par:POWERCMD;sample command in dec notation, could be something like '{"protocol":"NEC","bits":32,"data":551489775}' (without '');{ undef } par:VOLUMEUPCMD;sample command in raw notation, could be something like '0,926,844,958,832,1798,868,902,848,900,870,900,852,908,918,958,794,934,874,928,1738,934,856,1764' (without '');{ undef } #par:MULTIPLE1CMD;needed command to be sent like in example hex '{"Protocol":"NEC","Bits":32,"Data":0x8166817E}' (without '');{ undef } #par:MULTIPLE2CMD;needed command to be sent like in example hex '{"Protocol":"NEC","Bits":32,"Data":0x8166817E}' (without '');{ undef } attr DEVICE setList \ power:noArg CMNDTOPIC/RFsend POWERCMD\ volumeup:noArg CMNDTOPIC/RFsend VOLUMEUPCMD\ rfsend:textField CMNDTOPIC/RFsend {"Protocol":"$EVTPART1","Bits":$EVTPART2,"Data":"0x$EVTPART3"} attr DEVICE readingList \ TELETOPIC/INFO.:.* { $EVENT =~ m,^..Info[1-3]..(.+).$, ? json2nameValue($1,'',$JSONMAP) : json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/RESULT:.* { $EVENT =~ m,..RfReceived....Sync..([A-Za-z0-9]+)..Low..([\d]+)..High..([\d]+)..Data...([A-Za-z0-9]+)...RfKey...([^"]+)..., ? {"json_raw"=>$EVENT} : undef }\ TELETOPIC/RESULT:.* { $EVENT =~ m,..RfReceived....Sync..([A-Za-z0-9]+)..Low..([\d]+)..High..([\d]+)..Data...([A-Za-z0-9]+)...RfKey...([^"]+)..., ? {"Data"=>"$4"} : undef } attr DEVICE stateFormat state\
\ IPAddress attr DEVICE event-on-change-reading .* attr DEVICE model tasmota_rf setreading DEVICE attrTemplateVersion 20210515 name:tasmota_rf_keys_example desc:Demonstrates how to configure rf receiving tasmota device with a stored rf-key pair to act as a switch.
NOTE: this will create a new device!
See Forum Thread for further details...
To add further pairs of stored keys as seperate switches, just use a RAW copy of the new device and change references to the key pair accordingly. filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*(tele|cmnd|stat).* order:A_01d1a farewell:New device hast been configured; to add further pairs of stored keys as seperate switches, just use a RAW copy of this device and change references to the key pair accordingly. par:CMNDTOPIC;Command topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}cmnd$3" : undef } par:TELETOPIC;info topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}tele$3" : undef } par:STATTOPIC;ack topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}stat$3" : undef } par:NEWDEVROOM;Room of the calling device; {AttrVal("DEVICE","room","MQTT2_\DEVICE" )} par:ICON;ICON as set, defaults to mqtt_bridge_2;{ AttrVal("DEVICE","icon","mqtt_bridge_2") } defmod DEVICE_KEY1_2 MQTT2_\DEVICE tasmotaRF attr DEVICE_KEY1_2 devStateIcon Online:mqtt_bridge_2@#1de223 Offline:mqtt_bridge_2@red attr DEVICE_KEY1_2 icon ICON attr DEVICE_KEY1_2 readingList TELETOPIC/INFO.:.* { $EVENT =~ m,^..Info[1-3]..(.+).$, ? json2nameValue($1,'',$JSONMAP) : json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/LWT:.* LWT\ TELETOPIC/STATE:.* { json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/RESULT:.* { json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/UPTIME:.* { json2nameValue($EVENT,'',$JSONMAP) }\ STATTOPIC/RESULT:.* { json2nameValue($EVENT,'',$JSONMAP) } attr DEVICE_KEY1_2 setList on:noArg CMNDTOPIC/RfKey1 6\ off:noArg CMNDTOPIC/RfKey2 6 attr DEVICE_KEY1_2 stateFormat LWT\ IPAddress\ state { fhem "trigger $FW_wname JS:location.href='$FW_ME?detail=DEVICE_KEY1_2'" if($cl && $cl->{TYPE} eq "FHEMWEB") } attr DEVICE_KEY1_2 room NEWDEVROOM attr DEVICE_KEY1_2 setStateList on off attr DEVICE_KEY1_2 userReadings state:RfKey[12].* { ReadingsAge($name,"RfKey2",10000) > ReadingsAge($name,"RfKey1",10000) ? "on" : "off" } attr DEVICE_KEY1_2 model tasmota_rf_keys_example setreading DEVICE_KEY1_2 attrTemplateVersion 20210515 # forum: https://forum.fhem.de/index.php/topic,104475.0.html name:tasmota_use_DS18x20_id desc:Use this in case you have multiple DS18x20 sensors attached to your tasmota device. Adds a readingList entry to extract 1wire ID's from JSON to keep temparature values bound to the ID.
Forum Thread
See tasmota-Wiki for how to configure for multiple DS18x20 sensors filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*(tele|cmnd|stat).* order:A_01d2 par:TELETOPIC;info topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}tele$3" : undef } attr DEVICE readingList \ TELETOPIC/INFO.:.* { $EVENT =~ m,^..Info[1-3]..(.+).$, ? json2nameValue($1,'',$JSONMAP) : json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/SENSOR:.* { my %ret; while ($EVENT =~ /.Id...([A-F0-9]{12})...Temperature..([-]?[\d]+\.[\d]+)./g) { $ret{"Temperatur_".$1}=$2; }; return \%ret; }\ TELETOPIC/RESULT:.* { json2nameValue($EVENT,'',$JSONMAP) } farewell:template has been applied successfully. You might want to edit readingList attribute to avoid double info or let autocreate add more entries. attr DEVICE model tasmota_use_DS18x20_id setreading DEVICE attrTemplateVersion 20210515 # tasmota 2ch as one FHEM device. name:tasmota_2ch_unified filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*(tele|cmnd|stat).* desc:Configures a single device including all readings order:A_02a set DEVICE attrTemplate tasmota_basic_state_power1 CALLSPEECHRECOGN=0 deleteattr DEVICE jsonMap par:CMNDTOPIC;Command topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}cmnd$3" : undef } par:TELETOPIC;info topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}tele$3" : undef } par:STATTOPIC;ack topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}stat$3" : undef } attr DEVICE setList \ POWER1:on,off,toggle CMNDTOPIC/POWER1 $EVTPART1\ POWER2:on,off,toggle CMNDTOPIC/POWER2 $EVTPART1 attr DEVICE webCmd POWER1 on:POWER1 off:POWER2 on:POWER2 off 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 \ TELETOPIC/LWT:.* LWT\ TELETOPIC/STATE:.* { json2nameValue($EVENT) }\ TELETOPIC/SENSOR:.* { json2nameValue($EVENT) }\ TELETOPIC/INFO.:.* { $EVENT =~ m,^..Info[1-3]..(.+).$, ? json2nameValue($1,'',$JSONMAP) : json2nameValue($EVENT,'',$JSONMAP) }\ STATTOPIC/RESULT:.* { json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/UPTIME:.* { json2nameValue($EVENT) }\ STATTOPIC/POWER1:.* POWER1\ STATTOPIC/POWER2:.* POWER2 attr DEVICE stateFormat LWT\ 1:POWER1\ 2:POWER2\
\ IPAddress attr DEVICE webCmd POWER1:POWER2 attr DEVICE model tasmota_2ch_unified setreading DEVICE attrTemplateVersion 20210515 # sonoff 2 channel device flashed with Tasmota. name:tasmota_2channel_split filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*(tele|cmnd|stat).* desc:sonoff 2 channel device flashed with Tasmota.
NOTE: a second device will be created for the second channel order:A_02 par:CMNDTOPIC;Command topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}cmnd$3" : undef } par:STATTOPIC;ack topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}stat$3" : undef } par:CALLSPEECHRECOGN;Set this to 0 to not set any speech recogn. related attributes;{ 1 } par:SETCHANNELINFO;Set this to 0 to not set channelinfo;{ 1 } set DEVICE attrTemplate tasmota_basic_state_power1 \CALLSPEECHRECOGN=0 copy DEVICE DEVICE_CH2 defmod DEVICE_CH2 MQTT2_\DEVICE DEVICE_CH2 deleteattr DEVICE_CH2 alias attr DEVICE_CH2 readingList \ STATTOPIC/POWER2:.* state attr DEVICE_CH2 jsonMap POWER2:0 Dimmer:pct POWER1:0 Heap:0 LedTable:0 LoadAvg:0 MqttCount:0 SaveData:0 Scheme:0 SetOption26:0 Sleep:0 SleepMode:0 Speed:0 StateText1:0 StateText2:0 StateText3:0 StateText4:0 Time:0 Uptime:0 UptimeSec:0 Wifi_SSId:0 Wifi_RSSI:0 Wifi_LinkCount:0 Wifi_Downtime:0 Wifi_Channel:0 Wifi_BSSId:0 Wifi_AP:0 ANALOG_A0:0 SetOption26:0 Sleep:0 SleepMode:0 Speed:0 StateText1:0 StateText2:0 StateText3:0 StateText4:0 Time:0 Uptime:0 UptimeSec:0 Wifi_SSId:0 Wifi_RSSI:0 Wifi_LinkCount:0 Wifi_Downtime:0 Wifi_Channel:0 Wifi_BSSId:0 Wifi_AP:0 attr DEVICE_CH2 setList \ off:noArg CMNDTOPIC/POWER2 0\ on:noArg CMNDTOPIC/POWER2 1\ toggle:noArg CMNDTOPIC/POWER2 2 attr DEVICE_CH2 setStateList on off toggle attr DEVICE,DEVICE_CH2 model tasmota_2channel_split setreading DEVICE,DEVICE_CH2 attrTemplateVersion 20220127 option:{SETCHANNELINFO} set DEVICE attrTemplate set_associatedWith \CHANNELS=2 option:{ CALLSPEECHRECOGN } set DEVICE,DEVICE_CH2 attrTemplate speechcontrol_type_switch # sonoff 2 channel device flashed with Tasmota with dual energy meassuring. Source: https://forum.fhem.de/index.php/topic,122231.0.html name:tasmota_2channel_split_energy filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*(tele|cmnd|stat).* desc:sonoff 2 channel device with seperate energy measuring options flashed with Tasmota, e.g. Sonoff DUAL R3 (tasmota version >=9.5.0).
NOTE: a second device will be created for the second channel order:A_02a1 par:CMNDTOPIC;Command topic prefix, without trailing /;{ AttrVal("DEVICE",'readingList','') =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}cmnd$3" : undef } par:TELETOPIC;info topic prefix, without trailing /;{ AttrVal("DEVICE",'readingList','') =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}tele$3" : undef } par:STATTOPIC;ack topic prefix, without trailing /;{ AttrVal("DEVICE",'readingList','') =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}stat$3" : undef } par:CALLSPEECHRECOGN;Set this to 0 to not set any speech recogn. related attributes;{ 1 } par:SETCHANNELINFO;Set this to 0 to not set channelinfo;{ 1 } set DEVICE attrTemplate tasmota_basic_state_power1 \CALLSPEECHRECOGN=0 attr DEVICE setExtensionsEvent 1 attr DEVICE setStateList on off toggle attr DEVICE readingList \ TELETOPIC/LWT:.* LWT\ CMNDTOPIC/POWER:.* {}\ TELETOPIC/STATE:.* { json2nameValue($EVENT,undef,$JSONMAP) }\ TELETOPIC/SENSOR:.* { json2nameValue($EVENT,undef,$JSONMAP,undef,'_2$') }\ TELETOPIC/INFO.:.* { $EVENT =~ m,^..Info[1-3]..(.+).$, ? json2nameValue($1,undef,$JSONMAP) : json2nameValue($EVENT,undef,$JSONMAP) }\ TELETOPIC/UPTIME:.* { json2nameValue($EVENT,undef,$JSONMAP) }\ STATTOPIC/POWER1:.* state\ STATTOPIC/RESULT:.* { json2nameValue($EVENT,undef,$JSONMAP) } copy DEVICE DEVICE_CH2 deleteattr DEVICE_CH2 alias attr DEVICE_CH2 readingList \ STATTOPIC/POWER2:.* state\ TELETOPIC/SENSOR:.* { json2nameValue($EVENT,undef,$JSONMAP,'_2$') } attr DEVICE_CH2 setList \ off:noArg CMNDTOPIC/POWER2 0\ on:noArg CMNDTOPIC/POWER2 1\ toggle:noArg CMNDTOPIC/POWER2 2 attr DEVICE,DEVICE_CH2 model tasmota_2channel_split_energy setreading DEVICE,DEVICE_CH2 attrTemplateVersion 20210728 option:{SETCHANNELINFO} set DEVICE attrTemplate set_associatedWith \CHANNELS=2 option:{ CALLSPEECHRECOGN } set DEVICE,DEVICE_CH2 attrTemplate speechcontrol_type_switch # sonoff NSPanel flashed with Tasmota. name:tasmota_NSPanel_split filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*(tele|cmnd|stat).* desc:Early version for Sonoff NSPanel (2 channel) device flashed with Tasmota.
NOTE: a second device will be created for the second channel.
See Forum Thread and Tasmota Template Repository order:A_02a7 par:CMNDTOPIC;Command topic prefix, without trailing /;{ AttrVal('DEVICE','readingList','') =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}cmnd$3" : undef } par:TELETOPIC;info topic prefix, without trailing /;{ AttrVal('DEVICE','readingList','') =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}tele$3" : undef } par:STATTOPIC;ack topic prefix, without trailing /;{ AttrVal('DEVICE','readingList','') =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}stat$3" : undef } par:RADIO_COMPLETE;Full execution of all settings;{ undef } par:RADIO_UPDATECH1ONLY_NO;Exclude 2. channel, full execution of all settings to main channel;{ undef } par:RADIO_UPDATECH1ONLY_NOINITCFG;Exclude 2. channel and content of attribute initConfig in main channel;{ undef } attr DEVICE userattr initConfig option:{ RADIO_COMPLETE } set DEVICE attrTemplate tasmota_2channel_split CALLSPEECHRECOGN=1 SETCHANNELINFO=1 attr DEVICE_CH2 webCmd : attr DEVICE_CH2 model tasmota_NSPanel_split setreading DEVICE_CH2 attrTemplateVersion 20220128 option:{ RADIO_UPDATECH1ONLY_NO || RADIO_COMPLETE } attr DEVICE initConfig set DEVICE x_NSPSend_delete 1; set DEVICE x_NSPSend_delete 2; set DEVICE x_NSPSend_delete 3; set DEVICE x_NSPSend_delete 4; set DEVICE x_NSPSend_delete 5; set DEVICE x_NSPSend_delete 6; set DEVICE x_NSPSend_delete 7; set DEVICE x_NSPSend_delete 8; set DEVICE x_NSPSend_json {"HMI_resources":[{"index":1,"ctype":"group","id":"1","uiid":1}]}; option:{ RADIO_UPDATECH1ONLY_NO } set DEVICE attrTemplate tasmota_basic_state_power1 CALLSPEECHRECOGN=1 option:global attr DEVICE icon tradfri_filled_floalt attr DEVICE comment Initial configuration is just an example. You may delete these parts if not needed. For more info see Forum Thread (https://forum.fhem.de/index.php/topic,125423.0.html) and Tasmota Template Repository (https://templates.blakadder.com/sonoff_NSPanel.html). attr DEVICE readingList \ TELETOPIC/LWT:.* LWT\ TELETOPIC/LWT:Online {my $cmds=AttrVal('DEVICE','initConfig','');fhem("$cmds"); undef}\ TELETOPIC/STATE:.* { json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/SENSOR:.* { json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/INFO.:.* { $EVENT =~ m,^..Info[1-3]..(.+).$, ? json2nameValue($1,'',$JSONMAP) : json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/UPTIME:.* { json2nameValue($EVENT,'',$JSONMAP) }\ STATTOPIC/POWER1:.* state\ STATTOPIC/RESULT:.* { $EVENT =~ m,\A..NSPanel.+id...(\d+).+params..(.+)..\z, ? json2nameValue($2,"Pan_${1}_",$JSONMAP) : json2nameValue($EVENT,'',$JSONMAP) } attr DEVICE setList \ off:noArg CMNDTOPIC/POWER1 0\ on:noArg CMNDTOPIC/POWER1 1\ toggle:noArg CMNDTOPIC/POWER1 2\ setOtaUrl:textField CMNDTOPIC/OtaUrl $EVTPART1\ upgrade:noArg CMNDTOPIC/upgrade 1\ x_NSPSend_json:textField { my $payload = $EVENT;$payload =~ s/$EVTPART0 //g; qq(CMNDTOPIC/NSPSend $payload)}\ x_NSPSend_delete:selectnumbers,1,1,8,0,lin CMNDTOPIC/NSPSend {"index":$EVTPART1, "type":"delete"} attr DEVICE stateFormat \ LWT\ \ state attr DEVICE devStateIcon Online:10px-kreis-gruen Offline:10px-kreis-rot attr DEVICE,DEVICE_CH2 webCmd : attr DEVICE,DEVICE_CH2 model tasmota_NSPanel_split setreading DEVICE,DEVICE_CH2 attrTemplateVersion 20220128 #contributed by 87insane # tasmota 2ch as shutter device. name:tasmota_2ch_shutter_invert_1 filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*(tele|cmnd|stat).* desc:Configures a dual chanel tasmota device as shutter; needs some configuration of firmware compilation to operate, see Tasmota wiki
and Forum Thread
NOTE: This template will configure the shutter in ROLLO style with pct 0% = open shutter. Use template tasmota_2ch_shutter_invert_0, if you need a Homematic-style device pct 100% = open. order:A_02b par:CMNDTOPIC;Command topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}cmnd$3" : undef } par:TELETOPIC;info topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}tele$3" : undef } par:STATTOPIC;ack topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}stat$3" : undef } par:IO_DEV;Currently used IO;{ AttrVal('DEVICE','IODev',InternalVal('DEVICE','IODev',undef)->{NAME}) } par:CALLSPEECHRECOGN;Set this to 0 to not set any speech recogn. related attributes;{ 1 } par:BCKLGCMND;Send out configuration command via backlog?;{ 1 } par:ICON;ICON as set, defaults to fts_shutter_updown;{ AttrVal("DEVICE","icon","fts_shutter_updown") } set DEVICE attrTemplate tasmota_set_lowercase_texts_and_state1 attr DEVICE icon ICON option:{BCKLGCMND} set IO_DEV publish CMNDTOPIC/Backlog LedState 2; SetOption80 1; Interlock 1,2; Interlock ON; SetOption81 1; switchmode1 3; switchmode2 3; PulseTime1 0; PulseTime2 0; SaveData 1; set IO_DEV publish CMNDTOPIC/Restart 1 option:global attr DEVICE setList \ close:noArg CMNDTOPIC/ShutterClose1\ open:noArg CMNDTOPIC/ShutterOpen1\ half:noArg CMNDTOPIC/ShutterPosition1 50\ pct:slider,0,1,100 CMNDTOPIC/ShutterPosition1 $EVTPART1\ stop:noArg CMNDTOPIC/ShutterStop1\ resetClose:noArg CMNDTOPIC/ShutterSetClose1\ x_configuration CMNDTOPIC/$EVTPART1 $EVTPART2 attr DEVICE readingList \ TELETOPIC/LWT:.* LWT\ STATTOPIC/RESULT:.* { json2nameValue($EVENT) }\ STATTOPIC/POWER1:.* POWER1\ STATTOPIC/POWER1:on {{'state' => 'opening'}}\ STATTOPIC/POWER2:.* POWER2\ STATTOPIC/POWER2:on {{'state' => 'closing'}}\ STATTOPIC/SHUTTER1:.* state\ STATTOPIC/SHUTTER1:.* pct\ TELETOPIC/RESULT:.* { json2nameValue($EVENT) }\ TELETOPIC/STATE:.* { json2nameValue($EVENT) }\ TELETOPIC/SENSOR:.* { json2nameValue($EVENT) }\ TELETOPIC/INFO.:.* { $EVENT =~ m,^..Info[1-3]..(.+).$, ? json2nameValue($1,'',$JSONMAP) : json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/UPTIME:.* { json2nameValue($EVENT) } 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 eventMap open:opens close:closes attr DEVICE stateFormat \ LWT\ \ state deletereading -q DEVICE (?!associatedWith|IODev).* attr DEVICE setStateList open close half stop pct attr DEVICE comment After applying the template set "ShutterOpenDuration1" and "ShutterCloseDuration1" first.\ Use the "set x_configuration" Option. Example: "set x_configuration ShutterOpenDuration1 35"\ Shutter specific commands available: ShutterOpenDuration1, ShutterCloseDuration1, ShutterRelay1, ShutterSetHalfway1, ShutterSetClose1, ShutterInvert1, ShutterMotordelay1, ShutterCalibration1; you may use this for general setOptions in tasmota also.\ commands may need restart to take effect.\ For calibration, use of more than one shutter device and further information on the available commands see Tasmota wiki. attr DEVICE model tasmota_2ch_shutter_invert_1 setreading DEVICE attrTemplateVersion 20210607 option:{ CALLSPEECHRECOGN } set DEVICE attrTemplate speechcontrol_type_blind # tasmota 2ch as shutter device. name:tasmota_2ch_shutter_invert_0 filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*(tele|cmnd|stat).* desc:Configures a dual chanel tasmota device as shutter; needs some configuration of firmware compilation to operate, see Tasmota wiki
and 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 tasmota_2ch_shutter_invert_1 instead. order:A_02b1 par:IO_DEV;Currently used IO;{ AttrVal('DEVICE','IODev',InternalVal('DEVICE','IODev',undef)->{NAME}) } par:CMNDTOPIC;Command topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}cmnd$3" : undef } par:BCKLGCMND;Send out configuration command via backlog?;{ 1 } set DEVICE attrTemplate tasmota_2ch_shutter_invert_1 \BCKLGCMND=0 option:{BCKLGCMND} set IO_DEV publish CMNDTOPIC/Backlog LedState 2; SetOption80 1; Interlock 1,2; Interlock ON; SetOption81 1; switchmode1 3; switchmode2 3; PulseTime1 0; PulseTime2 0; ShutterOpenDuration1 20; ShutterCloseDuration1 20; ShutterInvert1 0; SaveData 1; set IO_DEV publish CMNDTOPIC/Restart 1 option:global 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 tasmota_2ch_shutter_invert_0 setreading DEVICE attrTemplateVersion 20210607 # tasmota 4ch as double shutter device. name:tasmota_4ch_two_shutters_invert_0 filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*(tele|cmnd|stat).* desc:Configures a four channel tasmota device as two shutters; needs some additional configuration via web-interface to operate properly, see Tasmota wiki
and Forum Thread
NOTE: This template will configure the shutters in Homematic-style with pct 100% = open. order:A_02b2 par:CMNDTOPIC;Command topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}cmnd$3" : undef } par:STATTOPIC;ack topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}stat$3" : undef } par:IO_DEV;Currently used IO;{ AttrVal('DEVICE','IODev',InternalVal('DEVICE','IODev',undef)->{NAME}) } par:BCKLGCMND;Send out configuration command via backlog?;{ 1 } set DEVICE attrTemplate tasmota_2ch_shutter_invert_1 \BCKLGCMND=0 option:{BCKLGCMND} set IO_DEV publish CMNDTOPIC/Backlog SetOption26 1; SetOption80 1; SetOption81 1; ShutterRelay1 1; ShutterRelay2 3; PulseTime1 0; PulseTime2 0; PulseTime3 0; PulseTime4 0; SwitchMode1 3; SwitchMode2 3; SwitchMode3 3; SwitchMode4 3; Interlock 1,2 3,4; Interlock 1; StateText1 off; StateText2 on; StateText3 toggle; StateText4 hold; ShutterOpenDuration1 20; ShutterCloseDuration1 20; ShutterOpenDuration2 20; ShutterCloseDuration2 20; ShutterInvert1 0; SaveData 1; set IO_DEV publish CMNDTOPIC/Restart 1 option:global set DEVICE attrTemplate set_associatedWith \CHANNELS=2 \MAKECOPIES=1 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_CH2 devStateIcon opening:fts_shutter_up@red closing:fts_shutter_down@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_CH2 stateFormat state attr DEVICE_CH2 setList \ close:noArg CMNDTOPIC/ShutterClose2\ open:noArg CMNDTOPIC/ShutterOpen2\ half:noArg CMNDTOPIC/ShutterPosition2 50\ pct:slider,0,1,100 CMNDTOPIC/ShutterPosition2 $EVTPART1\ stop:noArg CMNDTOPIC/ShutterStop2\ resetClose:noArg CMNDTOPIC/ShutterSetClose2 attr DEVICE_CH2 readingList \ STATTOPIC/RESULT:.* { json2nameValue($EVENT) }\ STATTOPIC/POWER3:.* POWER3\ STATTOPIC/POWER3:on {{'state' => 'opening'}}\ STATTOPIC/POWER4:.* POWER4\ STATTOPIC/POWER4:on {{'state' => 'closing'}}\ STATTOPIC/SHUTTER2:.* state\ STATTOPIC/SHUTTER2:.* pct attr DEVICE,DEVICE_CH2 model tasmota_4ch_two_shutters_invert_0 setreading DEVICE,DEVICE_CH2 attrTemplateVersion 20210607 set DEVICE,DEVICE_CH2 attrTemplate speechcontrol_type_blind name:tasmota_2ch_shutter_venetian_invert_0 filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*(tele|cmnd|stat).* desc:Configures a dual chanel tasmota device as venetian shutter; needs Tasmota version 10.0.0.1 or higher, see Tasmota wiki
and Forum Thread
NOTE: This template will configure the shutter in Homematic-style device pct 100% = open, and for a tilt range from -90 to 90 degrees. order:A_02b3 par:CMNDTOPIC;Command topic prefix, without trailing /;{ AttrVal('DEVICE','readingList','') =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}cmnd$3" : undef } par:TELETOPIC;info topic prefix, without trailing /;{ AttrVal('DEVICE','readingList','') =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}tele$3" : undef } par:STATTOPIC;ack topic prefix, without trailing /;{ AttrVal('DEVICE','readingList','') =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}stat$3" : undef } par:IO_DEV;Currently used IO;{ AttrVal('DEVICE','IODev',InternalVal('DEVICE','IODev',undef)->{NAME}) } par:CALLSPEECHRECOGN;Set this to 0 to not set any speech recogn. related attributes;{ 1 } par:BCKLGCMND;Send out configuration command via backlog?;{ 1 } par:ICON;ICON as set, defaults to fts_shutter_updown;{ AttrVal('DEVICE','icon','fts_shutter_updown') } set DEVICE attrTemplate tasmota_set_lowercase_texts_and_state1 attr DEVICE icon ICON option:{BCKLGCMND} set IO_DEV publish CMNDTOPIC/Backlog LedState 2; SetOption80 1; Interlock 1,2; Interlock ON; SetOption81 1; SetOption80 1; PowerOnState 0; switchmode1 3; switchmode2 3; PulseTime1 0; PulseTime2 0; SaveData 1; set IO_DEV publish CMNDTOPIC/Restart 1 option:global attr DEVICE setList \ close:noArg CMNDTOPIC/ShutterClose1\ open:noArg CMNDTOPIC/ShutterOpen1\ half:noArg CMNDTOPIC/ShutterPosition1 50\ pct:slider,0,1,100 CMNDTOPIC/ShutterPosition1 $EVTPART1\ stop:noArg CMNDTOPIC/ShutterStop1\ closeSlat:noArg CMNDTOPIC/ShutterTilt1 CLOSE\ openSlat:noArg CMNDTOPIC/ShutterTilt1 OPEN\ halfSlat:noArg CMNDTOPIC/ShutterTilt1 0\ tiltSlat:slider,-90,5,90 CMNDTOPIC/ShutterTilt1 $EVTPART1\ resetClose:noArg CMNDTOPIC/ShutterSetClose1\ x_configuration CMNDTOPIC/$EVTPART1 $EVTPART2 attr DEVICE readingList \ TELETOPIC/LWT:.* LWT\ TELETOPIC/STATE:.* { json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/SENSOR:.* { json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/INFO.:.* { $EVENT =~ m,^..Info[1-3]..(.+).$, ? json2nameValue($1,'',$JSONMAP) : json2nameValue($EVENT,'',$JSONMAP) }\ STATTOPIC/RESULT:.* { json2nameValue($EVENT,'',$JSONMAP) }\ STATTOPIC/POWER1:.* {{'state' => 'opening'} if $EVENT eq 'on'}\ STATTOPIC/POWER2:.* {{'state' => 'closing'} if $EVENT eq 'on'}\ STATTOPIC/SHUTTER1:.* state attr DEVICE devStateIcon {my $onl = ReadingsVal($name,'LWT','Offline') eq 'Offline' ? 'rot' : 'gruen'; $onl = FW_makeImage("10px-kreis-$onl"); my $ip = ReadingsVal($name,'IPAddress','none'); my $pct = maxNum(int((109 - ReadingsNum($name,'pct',0))/10)*10, 1); my $open = ReadingsVal($name,'state',''); my $lvicon = $open eq 'opening' ? 'fts_shutter_up@red' : $open eq 'closing' ? 'fts_shutter_down@red' : "fts_shutter_$pct"; $lvicon = FW_makeImage($lvicon); my $lvcmd = ($open eq 'opening' || $open eq 'closing') ? 'stop' : $pct > 50 ? 'open' : 'close'; my $slt = ReadingsNum($name,'tiltSlat',90); my $slticon = 'fts_blade_arc_close_'; $slticon .= $slt > 0 ? '00' : $slt > -45 ? '50' : '100'; $slticon = FW_makeImage($slticon); my $sltcmd = $slt > 0 ? 'closeSlat' : $slt > -45 ? 'openSlat' : 'halfSlat'; qq($onl
$lvicon
$slticon $slt) } attr DEVICE cmdIcon open:fts_shutter_up close:fts_shutter_down stop:fts_shutter_manual half:fts_shutter_50 attr DEVICE webCmd pct:tiltSlat #attr DEVICE eventMap open:opens close:closes deleteattr DEVICE eventMap attr DEVICE jsonMap POWER1:0 POWER2:0 Shutter1_Tilt:tiltSlat Shutter1_Target:pct ANALOG_Temperature:temperature attr DEVICE stateFormat LWT level: state slat: tiltSlat deletereading -q DEVICE (?!associatedWith|IODev).* attr DEVICE setStateList open close half stop pct openSlat closeSlat halfSlat attr DEVICE widgetOverride pct:knob,min:-90,max:90,angleArc:180,width:40,height:40,fgColor:#CCCCCC,bgColor:#FF9900,step:5,lineCap:round,rotation:anticlockwise,displayPrevious:1 pct:colorpicker,BRI,0,1,100 attr DEVICE comment After applying the template set "ShutterOpenDuration1", "ShutterCloseDuration1" and "shuttertiltconfig1" first.\ Use the "set x_configuration" Option. Example: "set x_configuration ShutterOpenDuration1 35".\ This is for a tilt range from -90 to 90 degrees, if you have different tilt options, adopt range manually\ For calibration, tilt range settings, use of more than one shutter device and further information on the available commands see Tasmota wiki. attr DEVICE model tasmota_2ch_shutter_venetian_invert_0 setreading DEVICE attrTemplateVersion 20220214 option:{ CALLSPEECHRECOGN } set DEVICE attrTemplate speechcontrol_type_blind # based on a proposal by twdotnet, https://forum.fhem.de/index.php/topic,94495.msg1137400.html#msg1137400 # shelly i3 3 channel input switches # shelly i3 3 channel input switches with device configuration name:tasmota_3channel_input_shelly_i3 filter:TYPE=MQTT2_DEVICE desc:Shelly i3 device flashed with Tasmota, provides three input only channels.

Device will be configured with selectable SwitchMode and optional GPIO Template.
Recommended SwitchModes 1=FollowMode (normally open switches> or 2=InvertedFollowMode (normally closed switches)

Tasmota 9.1+ is required for SetOption114 to detach switches from relays.
For Tasmota <9.1 fake relays on GPIO2,GPIO3,GPIO4 will be used. In case of ghost switching try using SwitchMode=2 with normally closed switches on inputs.

NOTE:
A second and third device will be created for the second and third input with suffixes *_CH2 and *_CH3

order:A_03 par:RADIO_TEMPLATE;Configure device and GPIO with SetOption114 (for Tasmota 9.1+);{ undef } par:RADIO_TEMPLATE_PRE91;Configure device and GPIO with fake relays (for Tasmota <9.1);{ undef } par:RADIO_NO_TEMPLATE;Configure device without GPIO template;{ undef } par:SWITCHMODE1;SwitchMode for Input 1;{ undef } par:SWITCHMODE2;SwitchMode for Input 2;{ undef } par:SWITCHMODE3;SwitchMode for Input 3;{ undef } par:CMNDTOPIC;Command topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}cmnd$3" : undef } par:TELETOPIC;info topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}tele$3" : undef } par:STATTOPIC;ack topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}stat$3" : undef } par:SETCHANNELINFO;Set this to 0 to not set channelinfo;{ 1 } par:ICON;ICON as set, defaults to taster;{ AttrVal("DEVICE","icon","taster") } par:IO_DEV;Currently used IO;{ AttrVal('DEVICE','IODev',InternalVal('DEVICE','IODev',undef)->{NAME}) } # autoconfigure device option:{RADIO_NO_TEMPLATE} set IO_DEV publish CMNDTOPIC/Backlog StateText1 off; StateText2 on; StateText3 toggle; StateText4 hold; SwitchMode1 SWITCHMODE1; SwitchMode2 SWITCHMODE2; SwitchMode3 SWITCHMODE3; SetOption26 1; SetOption114 1; SaveData 1 option:{RADIO_TEMPLATE} set IO_DEV publish CMNDTOPIC/Backlog StateText1 off; StateText2 on; StateText3 toggle; StateText4 hold; SwitchMode1 SWITCHMODE1; SwitchMode2 SWITCHMODE2; SwitchMode3 SWITCHMODE3; SetOption26 1; SetOption114 1; SaveData 1; template {"NAME":"Shelly i3","GPIO":[0,0,0,0,0,0,0,0,193,194,192,0,0,4736],"FLAG":0,"BASE":18}; module 0 option:{RADIO_TEMPLATE_PRE91} set IO_DEV publish CMNDTOPIC/Backlog StateText1 off; StateText2 on; StateText3 toggle; StateText4 hold; SwitchMode1 SWITCHMODE1; SwitchMode2 SWITCHMODE2; SwitchMode3 SWITCHMODE3; SetOption26 1; SaveData 1; template {"NAME":"Shelly i3","GPIO":[0,0,224,225,226,0,0,0,193,194,192,0,0,4736],"FLAG":0,"BASE":18}; module 0 option:global # setup main device channel 1 attr DEVICE icon ICON attr DEVICE jsonMap Switch1_Action:state attr DEVICE setList \ off:noArg STATTOPIC/Switch1 0\ on:noArg STATTOPIC/Switch1 1\ toggle:noArg STATTOPIC/Switch1 2 attr DEVICE readingList \ TELETOPIC/LWT:.* LWT\ STATTOPIC/RESULT:.* { json2nameValue($EVENT,'',$JSONMAP) } deletereading -q DEVICE (?!associatedWith|IODev).* attr DEVICE setStateList on off toggle attr DEVICE autocreate 0 # channel 2 copy DEVICE DEVICE_CH2 deleteattr DEVICE_CH2 alias attr DEVICE_CH2 readingList \ STATTOPIC/RESULT:.* { json2nameValue($EVENT,'',$JSONMAP) } attr DEVICE_CH2 jsonMap Switch2_Action:state attr DEVICE_CH2 setList \ off:noArg STATTOPIC/Switch2 0\ on:noArg STATTOPIC/Switch2 1\ toggle:noArg STATTOPIC/Switch2 2 # channel 3 copy DEVICE_CH2 DEVICE_CH3 deleteattr DEVICE_CH3 alias attr DEVICE_CH3 jsonMap Switch3_Action:state attr DEVICE_CH3 setList \ off:noArg STATTOPIC/Switch3 0\ on:noArg STATTOPIC/Switch3 1\ toggle:noArg STATTOPIC/Switch3 2 # associations option:{SETCHANNELINFO} set DEVICE attrTemplate set_associatedWith \CHANNELS=3 attr DEVICE,DEVICE_CH2,DEVICE_CH3 model tasmota_shelly_i3 setreading DEVICE,DEVICE_CH2,DEVICE_CH3 attrTemplateVersion 20210607 # sonoff 4 channel device flashed with Tasmota. # contributed by Blauhorn, https://forum.fhem.de/index.php/topic,94495.msg976113.html#msg976113 name:tasmota_4channel_split filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*(tele|cmnd|stat).* desc:sonoff 4 channel device flashed with Tasmota.
NOTE: a second, third and fourth device will be created for each additional channel order:A_04 par:CMNDTOPIC;Command topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}cmnd$3" : undef } par:STATTOPIC;ack topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}stat$3" : undef } set DEVICE attrTemplate tasmota_2channel_split CALLSPEECHRECOGN=0 SETCHANNELINFO=0 #create device for CH3 copy DEVICE_CH2 DEVICE_CH3 attr DEVICE_CH3 setList \ off:noArg CMNDTOPIC/POWER3 0\ on:noArg CMNDTOPIC/POWER3 1\ toggle:noArg CMNDTOPIC/POWER3 2 attr DEVICE_CH3 setStateList on off toggle attr DEVICE_CH3 readingList \ STATTOPIC/POWER3:.* state #create device for CH4 copy DEVICE_CH2 DEVICE_CH4 attr DEVICE_CH4 setList \ off:noArg CMNDTOPIC/POWER4 0\ on:noArg CMNDTOPIC/POWER4 1\ toggle:noArg CMNDTOPIC/POWER4 2 attr DEVICE_CH4 readingList \ STATTOPIC/POWER4:.* state attr DEVICE_CH4 setStateList on off toggle #set the model attr for all new devices attr DEVICE,DEVICE_CH2,DEVICE_CH3,DEVICE_CH4 model tasmota_4channel_split setreading DEVICE,DEVICE_CH2,DEVICE_CH3,DEVICE_CH4 attrTemplateVersion 20200828 set DEVICE attrTemplate set_associatedWith \CHANNELS=4 set DEVICE,DEVICE_CH2,DEVICE_CH3,DEVICE_CH4 attrTemplate speechcontrol_type_switch # 4-way multi socket 3AC+USB device flashed with Tasmota. # Tested with Power Strip Hyleton 333, please see Tasmota Template Repository # contributed by joelinux, https://forum.fhem.de/index.php/topic,94495.msg1031089.html#msg1031089 name:tasmota_3socketUSB_split filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*(tele|cmnd|stat).* desc:4 channel device flashed with Tasmota.
NOTE: Tested with 4-way Power Strip Hyleton 333, please see Tasmota Template Repository
NOTE: a second, third and fourth device will be created for each additional channel.
NOTE: Please wait some seconds to allow Tasmota Device to complete reboot. order:A_04_4base par:CMNDTOPIC;Command topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}cmnd$3" : undef } par:TELETOPIC;info topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}tele$3" : undef } par:STATTOPIC;ack topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}stat$3" : undef } par:ICON;ICON as set, defaults to hue_filled_outlet;{ AttrVal("DEVICE","icon","hue_filled_outlet") } par:IO_DEV;Currently used IO;{ AttrVal('DEVICE','IODev',InternalVal('DEVICE','IODev',undef)->{NAME}) } par:LONGITUDE;Read longitude set in FHEM;{ AttrVal("global","longitude","8.686")} par:LATITUDE;Read latitude set in FHEM;{ AttrVal("global","latitude","50.112")} par:ALTITUDE;Read altitude set in FHEM;{ AttrVal("global","altitude","0")} par:BUTTONRULE;Suggest Tasmota Button Rule for Power Strip;{ q/rule on button1#state=3 do backlog power1 2; power2 2; power3 2; power4 2 endon on button1#state=2 do backlog power1 1; power2 1; power3; power4 1 endon/ } par:JSONSUPPRESS;Tasmota reading pairs to suppress;"LedTable:0 SaveData:0 Scheme:0 SetOption26:0 ANALOG_A0:0 Speed:0 StateText1:0 StateText2:0 StateText3:0 StateText4:0 Module:0 Version:0 FallbackTopic:0 GroupTopic:0 WebServerMode:0 Hostname:Hostname RestartReason:0 Time:0 Uptime:0 UptimeSec:0 Heap:0 SleepMode:0 Sleep:0 LoadAvg:0 MqttCount:0 Wifi_AP:0 Wifi_SSId:0 Wifi_BSSId:0 Wifi_Channel:0 Wifi_RSSI:0 Wifi_Signal:0 Wifi_LinkCount:0 Wifi_Downtime:0 subscriptions:0 Status_ButtonRetain:0 Status_ButtonTopic:0 Status_LedMask:0 Status_LedState:0 Status_Module:0 Status_Power:0 Status_PowerOnState:0 Status_PowerRetain:0 Status_SaveData:0 Status_SaveState:0 Status_SensorRetain:0 Status_SwitchMode_1:0 Status_SwitchMode_2:0 Status_SwitchMode_3:0 Status_SwitchMode_4:0 Status_SwitchMode_5:0 Status_SwitchMode_6:0 Status_SwitchMode_7:0 Status_SwitchRetain:0 Status_SwitchTopic:0 Status_Topic:0" # Do some cleanup to eventually rerun apply template process deletereading -q DEVICE (?!associatedWith|IODev).* # delete DEVICE_CH2 # delete DEVICE_CH3 # delete DEVICE_USB # prime Tasmota device set DEVICE attrTemplate tasmota_set_lowercase_texts_and_state1 # additional settings to aid speech recognition to detect capabilities properly # add some attributes to make your new device looking great attr DEVICE icon ICON attr DEVICE comment Admin Info and Channel 1 for DEVICE, see also DEVICE_CH2, DEVICE_CH3, and DEVICE_USB attr DEVICE devStateIcon Online:10px-kreis-gruen Offline:10px-kreis-rot attr DEVICE event-on-change-reading .* attr DEVICE stateFormat LWT\ state\ IPAddress attr DEVICE readingList \ TELETOPIC/LWT:.* LWT\ TELETOPIC/INFO.:.* { $EVENT =~ m,^..Info[1-3]..(.+).$, ? json2nameValue($1,'',$JSONMAP) : json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/STATE:.* { json2nameValue($EVENT,'state_',$JSONMAP) }\ STATTOPIC/RESULT:.* { json2nameValue($EVENT,'',$JSONMAP) }\ STATTOPIC/STATUS:.* { json2nameValue($EVENT,'',$JSONMAP) }\ STATTOPIC/POWER1:.* state\ STATTOPIC/POWER2:.* POWER2\ STATTOPIC/POWER3:.* POWER3\ STATTOPIC/POWER4:.* POWER4\ CMNDTOPIC/POWER:.* POWER attr DEVICE setList\ off:noArg CMNDTOPIC/POWER1 0\ on:noArg CMNDTOPIC/POWER1 1\ toggle:noArg CMNDTOPIC/POWER1 2\ x_Reboot:noArg CMNDTOPIC/restart 1\ x_Status:noArg CMNDTOPIC/Status\ x_setOtaUrl:multiple,http://thehackbox.org/tasmota/release/tasmota-DE.bin CMNDTOPIC/OtaUrl $EVTPART1\ x_upgrade:noArg CMNDTOPIC/upgrade 1\ x_ShowHostname:noArg CMNDTOPIC/Backlog setoption53 1; Status;\ x_DisableBlinkLED:noArg CMNDTOPIC/Backlog LEDPower 0; setoption31 1; Status;\ x_SaveData:0,1 CMNDTOPIC/savedata $EVTPART1\ x_Configuration CMNDTOPIC/$EVTPART1 $EVTPART2\ x_RuleButton:noArg CMNDTOPIC/BUTTONRULE\ x_RuleEnable:noArg CMNDTOPIC/Backlog setoption1 1; setoption32 15; rule1 1\ x_Location:noArg CMNDTOPIC/Backlog Latitude LATITUDE; Longitude LONGITUDE; Altitude ALTITUDE\ x_NTPServer:multiple,fritz.box CMNDTOPIC/ntpserver $EVTPART1 # we want state to represent 1st channel. attr DEVICE jsonMap POWER1:state Dimmer:pct attr DEVICE userReadings formatedUptime:state_UptimeSec.* { my $m = ReadingsVal($name,"state_UptimeSec",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 } setreading DEVICE associatedWith DEVICE_CH2,DEVICE_CH3,DEVICE_USB # # create devices for 2nd, 3rd and 4th channel loop:#:2:3:4 copy DEVICE DEVICE_CH# defmod DEVICE_CH# MQTT2_\DEVICE DEVICE_CH# attr DEVICE_CH# setStateList on off toggle attr DEVICE_CH# setList \ off:noArg CMNDTOPIC/POWER# 0\ on:noArg CMNDTOPIC/POWER# 1\ toggle:noArg CMNDTOPIC/POWER# 2 attr DEVICE_CH# readingList \ TELETOPIC/LWT:.* LWT\ TELETOPIC/INFO.:.* { $EVENT =~ m,^..Info[1-3]..(.+).$, ? json2nameValue($1,'',$JSONMAP) : json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/STATE:.* { json2nameValue($EVENT,'state_',$JSONMAP) }\ STATTOPIC/STATUS:.* { json2nameValue($EVENT,'',$JSONMAP) }\ STATTOPIC/POWER#:.* state loop:END rename DEVICE_CH4 DEVICE_USB # setreading DEVICE_CH2 associatedWith DEVICE,DEVICE_CH3,DEVICE_USB setreading DEVICE_CH3 associatedWith DEVICE,DEVICE_CH2,DEVICE_USB setreading DEVICE_USB associatedWith DEVICE,DEVICE_CH2,DEVICE_CH3 # set attributes specific for 3rd channel attr DEVICE_CH2 comment Channel 2 for DEVICE, see also DEVICE_CH3 and DEVICE_USB attr DEVICE_CH3 comment Channel 3 for DEVICE, see also DEVICE_CH2 and DEVICE_USB attr DEVICE_USB comment Channel 4 (USB) for DEVICE, see also DEVICE_CH2 and DEVICE_CH3 # # we want state to represent 2nd channel. # keep all POWERx readings to allow period tele/STATE messages to update relay state reading # Suppress all other readings on split device. These readings are visible on first device only. # Tasmota version upgrades are likely to add/remove readings. So some unwanted ones may appear on second device after such upgrade attr DEVICE_CH2 jsonMap POWER2:state POWER1:0 POWER3:0 POWER4:0 POWER5:0 JSONSUPPRESS # # we want state to represent 3rd channel. attr DEVICE_CH3 jsonMap POWER3:state POWER1:0 POWER2:0 POWER4:0 POWER5:0 JSONSUPPRESS # # we want state to represent 4th (USB) channel. attr DEVICE_USB jsonMap POWER4:state POWER1:0 POWER2:0 POWER3:0 POWER5:0 JSONSUPPRESS # USB channel gets a unique icon attr DEVICE_USB icon rc_USB #finally set the model attr for all new devices and do a reboot of device set IO_DEV publish CMNDTOPIC/status set IO_DEV publish CMNDTOPIC/restart 1 farewell:Template has been applied successfully. Wait some seconds for reboot to complete and watch readings get populated. set DEVICE,DEVICE_CH2,DEVICE_CH3,DEVICE_USB attrTemplate speechcontrol_type_switch attr DEVICE,DEVICE_CH2,DEVICE_CH3,DEVICE_USB model tasmota_3socketUSB_channel_split setreading DEVICE,DEVICE_CH2,DEVICE_CH3,DEVICE_USB attrTemplateVersion 20211030 # tasmota 4ch as one FHEM device. name:tasmota_4ch_unified_icon filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*(tele|cmnd|stat).* desc:Configures a single device including all readings
NOTE: Clicking on icons will issue a corresponding toggle command order:A_04b set DEVICE attrTemplate tasmota_basic_state_power1 par:CMNDTOPIC;Command topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}cmnd$3" : undef } par:TELETOPIC;info topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}tele$3" : undef } par:STATTOPIC;ack topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}stat$3" : undef } attr DEVICE setList \ POWER1:on,off,toggle CMNDTOPIC/POWER1 $EVTPART1\ POWER2:on,off,toggle CMNDTOPIC/POWER2 $EVTPART1\ POWER3:on,off,toggle CMNDTOPIC/POWER3 $EVTPART1\ POWER4:on,off,toggle CMNDTOPIC/POWER4 $EVTPART1 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 readingList \ TELETOPIC/LWT:.* LWT\ TELETOPIC/STATE:.* { json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/SENSOR:.* { json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/INFO.:.* { $EVENT =~ m,^..Info[1-3]..(.+).$, ? json2nameValue($1,'',$JSONMAP) : json2nameValue($EVENT,'',$JSONMAP) }\ STATTOPIC/RESULT:.* { json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/UPTIME:.* { json2nameValue($EVENT,'',$JSONMAP) }\ STATTOPIC/POWER1:.* POWER1\ STATTOPIC/POWER2:.* POWER2\ STATTOPIC/POWER3:.* POWER3\ STATTOPIC/POWER4:.* POWER4 attr DEVICE stateFormat LWT\ 1:POWER1\ 2:POWER2\ 3:POWER3\ 4:POWER4\
IPAddress attr DEVICE webCmd POWER1:POWER2:POWER3:POWER4 attr DEVICE model tasmota_4ch_unified_icon setreading DEVICE attrTemplateVersion 20210515 # tasmota 4ch as one FHEM device. name:tasmota_4ch_unified_basic_text desc:Configures a single device filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*(tele|cmnd|stat).* order:A_04a1 set DEVICE attrTemplate tasmota_basic_state_power1 par:CMNDTOPIC;Command topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}cmnd$3" : undef } par:TELETOPIC;info topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}tele$3" : undef } par:STATTOPIC;ack topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}stat$3" : undef } attr DEVICE readingList \ TELETOPIC/LWT:.* LWT\ TELETOPIC/STATE:.* { json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/SENSOR:.* { json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/INFO.:.* { $EVENT =~ m,^..Info[1-3]..(.+).$, ? json2nameValue($1,'',$JSONMAP) : json2nameValue($EVENT,'',$JSONMAP) }\ STATTOPIC/RESULT:.* { json2nameValue($EVENT,'',$JSONMAP) } attr DEVICE setList \ POWER1:on,off,toggle CMNDTOPIC/POWER1 $EVTPART1\ POWER2:on,off,toggle CMNDTOPIC/POWER2 $EVTPART1\ POWER3:on,off,toggle CMNDTOPIC/POWER3 $EVTPART1\ POWER4:on,off,toggle CMNDTOPIC/POWER4 $EVTPART1 attr DEVICE setStateList on off toggle 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 tasmota_4ch_unified_basic_text setreading DEVICE attrTemplateVersion 20210515 # contributed by hummeruli, https://forum.fhem.de/index.php/topic,94495.msg1026611.html#msg1026611 # tasmota 8ch as one FHEM device. name:tasmota_8ch_unified_icon filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*(tele|cmnd|stat).* desc:Configures a single device including all readings
NOTE: Clicking on icons will issue a corresponding toggle command order:A_04c set DEVICE attrTemplate tasmota_basic_state_power1 par:CMNDTOPIC;Command topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}cmnd$3" : undef } par:TELETOPIC;info topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}tele$3" : undef } par:STATTOPIC;ack topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}stat$3" : undef } attr DEVICE setList \ POWER1:on,off,toggle CMNDTOPIC/POWER1 $EVTPART1\ POWER2:on,off,toggle CMNDTOPIC/POWER2 $EVTPART1\ POWER3:on,off,toggle CMNDTOPIC/POWER3 $EVTPART1\ POWER4:on,off,toggle CMNDTOPIC/POWER4 $EVTPART1\ POWER5:on,off,toggle CMNDTOPIC/POWER5 $EVTPART1\ POWER6:on,off,toggle CMNDTOPIC/POWER6 $EVTPART1\ POWER7:on,off,toggle CMNDTOPIC/POWER7 $EVTPART1\ POWER8:on,off,toggle CMNDTOPIC/POWER8 $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 5.on:on:POWER5+off 5.off:off:POWER5+on 6.on:on:POWER6+off 6.off:off:POWER6+on 7.on:on:POWER7+off 7.off:off:POWER7+on 8.on:on:POWER8+off 8.off:off:POWER8+on attr DEVICE readingList \ TELETOPIC/LWT:.* LWT\ TELETOPIC/STATE:.* { json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/SENSOR:.* { json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/INFO.:.* { $EVENT =~ m,^..Info[1-3]..(.+).$, ? json2nameValue($1,'',$JSONMAP) : json2nameValue($EVENT,'',$JSONMAP) }\ STATTOPIC/RESULT:.* { json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/UPTIME:.* { json2nameValue($EVENT,'',$JSONMAP) }\ STATTOPIC/POWER1:.* POWER1\ STATTOPIC/POWER2:.* POWER2\ STATTOPIC/POWER3:.* POWER3\ STATTOPIC/POWER4:.* POWER4\ STATTOPIC/POWER5:.* POWER5\ STATTOPIC/POWER6:.* POWER6\ STATTOPIC/POWER7:.* POWER7\ STATTOPIC/POWER8:.* POWER8 attr DEVICE stateFormat LWT\ Hostname
\ 1:POWER1\ 2:POWER2\ 3:POWER3\ 4:POWER4\ 5:POWER5\ 6:POWER6\ 7:POWER7\ 8:POWER8 attr DEVICE model tasmota_8ch_unified_icon setreading DEVICE attrTemplateVersion 20210515 name:tasmota_8channel_split filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*(tele|cmnd|stat).* desc:sonoff 8 channel device flashed with Tasmota.
NOTE: several additional devices will be created for channels 2 to 8 order:A_04c1 par:CMNDTOPIC;Command topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}cmnd$3" : undef } par:STATTOPIC;ack topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}stat$3" : undef } set DEVICE attrTemplate tasmota_2channel_split CALLSPEECHRECOGN=0 SETCHANNELINFO=0 attr DEVICE jsonMap POWER1:0 POWER2:0 POWER3:0 POWER4:0 POWER5:0 POWER6:0 POWER7:0 POWER8:0 attr DEVICE_CH2 jsonMap POWER1:0 POWER2:0 POWER3:0 POWER4:0 POWER5:0 POWER6:0 POWER7:0 POWER8:0 Dimmer:pct Channel_4:white Channel_1:0 Channel_2:0 Channel_3:0 HSBColor:0 POWER1:0 Heap:0 LedTable:0 LoadAvg:0 MqttCount:0 SaveData:0 Scheme:0 SetOption26:0 Sleep:0 SleepMode:0 Speed:0 StateText1:0 StateText2:0 StateText3:0 StateText4:0 Time:0 Uptime:0 UptimeSec:0 Wifi_SSId:0 Wifi_RSSI:0 Wifi_LinkCount:0 Wifi_Downtime:0 Wifi_Channel:0 Wifi_BSSId:0 Wifi_AP:0 ANALOG_A0:0 SetOption26:0 Sleep:0 SleepMode:0 Speed:0 StateText1:0 StateText2:0 StateText3:0 StateText4:0 Time:0 Uptime:0 UptimeSec:0 Wifi_SSId:0 Wifi_RSSI:0 Wifi_LinkCount:0 Wifi_Downtime:0 Wifi_Channel:0 Wifi_BSSId:0 Wifi_AP:0 ANALOG_A0:0 loop:#:3:4:5:6:7:8 copy DEVICE_CH2 DEVICE_CH# defmod DEVICE_CH# MQTT2_\DEVICE DEVICE_CH# attr DEVICE_CH# setList \ off:noArg CMNDTOPIC/POWER# 0\ on:noArg CMNDTOPIC/POWER# 1\ toggle:noArg CMNDTOPIC/POWER# 2 attr DEVICE_CH# readingList \ STATTOPIC/POWER#:.* state loop:END attr DEVICE,DEVICE_CH2,DEVICE_CH3,DEVICE_CH4,DEVICE_CH5,DEVICE_CH6,DEVICE_CH7,DEVICE_CH8 model tasmota_8channel_split setreading DEVICE,DEVICE_CH2,DEVICE_CH3,DEVICE_CH4,DEVICE_CH5,DEVICE_CH6,DEVICE_CH7,DEVICE_CH8 attrTemplateVersion 20211030 set DEVICE attrTemplate set_associatedWith \CHANNELS=8 set DEVICE,DEVICE_CH2,DEVICE_CH3,DEVICE_CH4,DEVICE_CH5,DEVICE_CH6,DEVICE_CH7,DEVICE_CH8 attrTemplate speechcontrol_type_switch #source post: https://forum.fhem.de/index.php/topic,94495.msg899041.html#msg899041 name:tasmota_rgb_led_controller filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*(tele|cmnd|stat).* desc:Tasmota RGB controller tested with RGB variant of Magichome, arilux LC-01 ,etc... -> https://github.com/arendst/Sonoff-Tasmota/wiki/MagicHome-LED-strip-controller order:A_05a set DEVICE attrTemplate tasmota_basic_state_power1 par:CMNDTOPIC;Command topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}cmnd$3" : undef } par:TELETOPIC;info topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}tele$3" : undef } par:STATTOPIC;ack topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}stat$3" : undef } par:ICON;ICON as set, defaults to light_control;{ AttrVal("DEVICE","icon","light_control") } attr DEVICE icon ICON attr DEVICE setList\ off:noArg CMNDTOPIC/POWER1 0\ on:noArg CMNDTOPIC/POWER1 1\ toggle:noArg CMNDTOPIC/POWER1 2\ Color:colorpicker,RGB CMNDTOPIC/COLOR\ Dimmer:colorpicker,BRI,0,5,100 CMNDTOPIC/DIMMER deletereading -q DEVICE (?!associatedWith|IODev).* attr DEVICE autocreate 0 attr DEVICE devStateIcon {Color::devStateIcon($name,"rgb","Color","Dimmer","state")} attr DEVICE webCmd Color:Color ff0000:Color 00ff00:Color 0000ff:toggle:on:off set DEVICE attrTemplate speechcontrol_type_light attr DEVICE model tasmota_rgb_led_controller setreading DEVICE attrTemplateVersion 20200522 or prior name:tasmota_rgbw_led filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*(tele|cmnd|stat).* desc:Tasmota RGBW bulb or RGBW LED controller order:A_05a1 set DEVICE attrTemplate tasmota_basic_state_power1 par:CMNDTOPIC;Command topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}cmnd$3" : undef } par:TELETOPIC;info topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}tele$3" : undef } par:STATTOPIC;ack topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}stat$3" : undef } par:ICON;ICON as set, defaults to light_control;{ AttrVal("DEVICE","icon","light_control") } attr DEVICE icon ICON deletereading -q DEVICE (?!associatedWith|IODev).* attr DEVICE setList\ off:noArg CMNDTOPIC/POWER1 0\ on:noArg CMNDTOPIC/POWER1 1\ toggle:noArg CMNDTOPIC/POWER1 2\ Color:colorpicker,RGB CMNDTOPIC/COLOR\ pct:colorpicker,BRI,0,5,100 CMNDTOPIC/DIMMER\ dimup:noArg { my $num=int((ReadingsNum($NAME,'pct',0)+4)/10)*10+10; return qq {CMNDTOPIC/Dimmer $num}; }\ dimdown:noArg { my $num=int((ReadingsNum($NAME,'pct',0)+7)/10)*10-10; return qq {CMNDTOPIC/Dimmer $num}; }\ white:colorpicker,BRI,0,5,100 { "CMNDTOPIC/COLOR ". sprintf("000000%02X",$EVTPART1*2.55) }\ saturation:colorpicker,BRI,0,1,100 CMNDTOPIC/HSBCOLOR2\ Speed:colorpicker,BRI,0,1,20 CMNDTOPIC/SPEED\ Fade:uzsuSelect,ON,OFF CMNDTOPIC/FADE $EVTPART1\ mode:selectnumbers,0,1,4,0,lin CMNDTOPIC/SCHEME attr DEVICE readingList \ TELETOPIC/LWT:.* LWT\ TELETOPIC/STATE:.* { json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/SENSOR:.* { json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/INFO.:.* { $EVENT =~ m,^..Info[1-3]..(.+).$, ? json2nameValue($1,'',$JSONMAP) : json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/UPTIME:.* { json2nameValue($EVENT,'',$JSONMAP) }\ STATTOPIC/RESULT:.* { json2nameValue($EVENT,'',$JSONMAP) }\ STATTOPIC/RESULT:.* { $EVENT =~ m,HSBColor...(\d+)\,(\d+)\,(\d+), ? $2 eq ReadingsVal($NAME,"saturation","unknown") ? return : { "saturation"=>$2 } : return }\ STATTOPIC/POWER1:.* state attr DEVICE jsonMap POWER1:0 Dimmer:pct Channel_4:white Channel_1:0 Channel_2:0 Channel_3:0 HSBColor:0 attr DEVICE webCmd pct:white:Color attr DEVICE webCmdLabel Helligkeit\ :Weiss\ :Farbe: attr DEVICE devStateIcon {Color::devStateIcon($name,"rgb","Color","pct","state")} attr DEVICE setStateList on off toggle set DEVICE attrTemplate speechcontrol_type_light attr DEVICE model tasmota_rgbw_led setreading DEVICE attrTemplateVersion 20210515 name:tasmota_rgbcct_light filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*(tele|cmnd|stat).* desc:Tasmota RGBW bulb with CT option like LSC Smart Connect Candle 400lm RGBW order:A_05a2 set DEVICE attrTemplate tasmota_basic_state_power1 set DEVICE attrTemplate tasmota_rgbw_led par:CMNDTOPIC;Command topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}cmnd$3" : undef } par:TELETOPIC;info topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}tele$3" : undef } par:STATTOPIC;ack topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}stat$3" : undef } attr DEVICE setList\ off:noArg CMNDTOPIC/POWER1 0\ on:noArg CMNDTOPIC/POWER1 1\ toggle:noArg CMNDTOPIC/POWER1 2\ Color:colorpicker,RGB CMNDTOPIC/COLOR\ pct:colorpicker,BRI,0,5,100 CMNDTOPIC/DIMMER\ dimup:noArg { my $num=int((ReadingsNum($NAME,'pct',0)+4)/10)*10+10; return qq {CMNDTOPIC/Dimmer $num}; }\ dimdown:noArg { my $num=int((ReadingsNum($NAME,'pct',0)+7)/10)*10-10; return qq {CMNDTOPIC/Dimmer $num}; }\ white:colorpicker,BRI,0,5,100 { "CMNDTOPIC/COLOR ". sprintf("000000%02X",$EVTPART1*2.55) }\ CT:colorpicker,CT,153,5,500 CMNDTOPIC/CT attr DEVICE jsonMap POWER1:0 Dimmer:pct Channel_4:white Channel_1:0 Channel_2:0 Channel_3:0 HSBColor:0 Channel_5:0 attr DEVICE webCmd pct:white:Color:CT attr DEVICE webCmdLabel Helligkeit\ :Weiss\ :Farbe\ :Temp set DEVICE attrTemplate speechcontrol_type_light attr DEVICE model tasmota_rgbcct_led setreading DEVICE attrTemplateVersion 20200522 or prior name:tasmota_cct_led filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*(tele|cmnd|stat).* desc:Tasmota CCT bulb or CCT LED controller order:A_05a3 set DEVICE attrTemplate tasmota_basic_state_power1 par:CMNDTOPIC;Command topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}cmnd$3" : undef } par:TELETOPIC;info topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}tele$3" : undef } par:STATTOPIC;ack topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}stat$3" : undef } par:ICON;ICON as set, defaults to light_control;{ AttrVal("DEVICE","icon","light_control") } attr DEVICE icon ICON deletereading -q DEVICE (?!associatedWith|IODev).* attr DEVICE setList\ off:noArg CMNDTOPIC/POWER1 0\ on:noArg CMNDTOPIC/POWER1 1\ toggle:noArg CMNDTOPIC/POWER1 2\ CT:colorpicker,CT,153,5,500 CMNDTOPIC/CT\ pct:colorpicker,BRI,0,5,100 CMNDTOPIC/DIMMER\ dimup:noArg { my $num=int((ReadingsNum($NAME,'pct',0)+4)/10)*10+10; return qq {CMNDTOPIC/Dimmer $num}; }\ dimdown:noArg { my $num=int((ReadingsNum($NAME,'pct',0)+7)/10)*10-10; return qq {CMNDTOPIC/Dimmer $num}; } attr DEVICE readingList \ TELETOPIC/LWT:.* LWT\ TELETOPIC/STATE:.* { json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/SENSOR:.* { json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/INFO.:.* { $EVENT =~ m,^..Info[1-3]..(.+).$, ? json2nameValue($1,'',$JSONMAP) : json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/UPTIME:.* { json2nameValue($EVENT,'',$JSONMAP) }\ STATTOPIC/RESULT:.* { json2nameValue($EVENT,'',$JSONMAP) }\ STATTOPIC/POWER1:.* state attr DEVICE jsonMap POWER1:0 Dimmer:pct Channel_4:0 Channel_1:0 Channel_2:0 Channel_3:0 HSBColor:0 attr DEVICE webCmd pct:CT attr DEVICE devStateIcon {Color::devStateIcon($name,"dimmer",'',"pct","state")} attr DEVICE setStateList on off toggle set DEVICE attrTemplate speechcontrol_type_light attr DEVICE model tasmota_cct_led setreading DEVICE attrTemplateVersion 20210515 #source post: https://forum.fhem.de/index.php/topic,105364.0.html name:tasmota_TuyaMCU_dimmer filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*(tele|cmnd|stat).* desc:Tasmota controller, suitable for devices using the "Tuya MCU Module" to control a dimmer.
See instructions in https://github.com/arendst/Tasmota/wiki/TuyaMCU-Configurations#dimmer and Forum Thread order:A_05b set DEVICE attrTemplate tasmota_basic_state_power1 par:CMNDTOPIC;Command topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}cmnd$3" : undef } par:TELETOPIC;info topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}tele$3" : undef } par:STATTOPIC;ack topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}stat$3" : undef } par:ICON;ICON as set, defaults to light_control;{ AttrVal("DEVICE","icon","light_control") } attr DEVICE icon ICON attr DEVICE setList\ off:noArg CMNDTOPIC/POWER1 0\ on:noArg CMNDTOPIC/POWER1 1\ toggle:noArg CMNDTOPIC/POWER1 2\ Dimmer:colorpicker,BRI,0,5,100 CMNDTOPIC/DIMMER deletereading -q DEVICE (?!associatedWith|IODev).* attr DEVICE autocreate 0 attr DEVICE devStateIcon off:light_light_dim_00:on on:light_light_dim_90:off attr DEVICE webCmd Dimmer attr DEVICE comment After applying the template, the device to be controlled needs further configuration. For the necessary steps see Tasmota wiki instructions. farewell:template has been applied successfully. Now it's recommended to do some configruation, see Tasmota wiki instructions. set DEVICE attrTemplate speechcontrol_type_light attr DEVICE model tasmota_TuyaMCU_dimmer setreading DEVICE attrTemplateVersion 20200522 or prior # tasmota battery powered window sensor MC400A # contributed by OppiM, source post https://forum.fhem.de/index.php/topic,94495.msg1084052.html#msg1084052 name:tasmota_window_sensor_MC400A filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*(tele|cmnd|stat).* desc:Configures a MC400A windows sensor.
Note: This is part of the TuyaMCU model family within tasmota, see https://tasmota.github.io/docs/TuyaMCU/ for further details! order:A_05c attr DEVICE icon tuer_fenster_kontakt attr DEVICE jsonMap TuyaReceived_Cmnd:0 TuyaReceived_CmndData:0 TuyaReceived_Data:0 attr DEVICE autocreate 0 par:IO_DEV;Currently used IO;{ AttrVal('DEVICE','IODev',InternalVal('DEVICE','IODev',undef)->{NAME}) } par:CMNDTOPIC;Command topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}cmnd$3" : undef } par:TELETOPIC;info topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}tele$3" : undef } par:STATTOPIC;ack topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}stat$3" : undef } set IO_DEV publish CMNDTOPIC/Rule1 ON TuyaReceived#Data=55AA00050005030400010213 DO publish stat/%topic%/batteryState ok; publish stat/%topic%/batteryPercent 100 ENDON ON TuyaReceived#Data=55AA00050005030400010112 DO publish stat/%topic%/batteryState ok; publish stat/%topic%/batteryPercent 50 ENDON ON TuyaReceived#Data=55AA00050005030400010011 DO publish stat/%topic%/batteryState low; publish stat/%topic%/batteryPercent 5 ENDON set IO_DEV publish CMNDTOPIC/Backlog Template {"NAME":"MC400A","GPIO":[0,107,0,108,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":54}; Module 0; SetOption1 1; SetOption65 1; SetOption66 1; SwitchMode 1; TuyaMCU 51,21; StateText1 closed; StateText2 open; Timezone 99; Rule1 1;SaveData 1; Reboot 1 attr DEVICE setList \ nosleep:noArg CMNDTOPIC/SerialSend5 55AA000200010002\ setOtaUrl:textField CMNDTOPIC/OtaUrl $EVTPART1\ upgrade:noArg CMNDTOPIC/upgrade 1 attr DEVICE devStateIcon Online:10px-kreis-gruen Offline:10px-kreis-rot attr DEVICE readingList \ TELETOPIC/LWT:.* LWT\ TELETOPIC/INFO.:.* { $EVENT =~ m,^..Info[1-3]..(.+).$, ? json2nameValue($1,'',$JSONMAP) : json2nameValue($EVENT,'',$JSONMAP) }\ STATTOPIC/RESULT:.* { json2nameValue($EVENT) }\ STATTOPIC/POWER:.* state\ TELETOPIC/RESULT:.* { json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/STATE:.* { json2nameValue($EVENT) }\ STATTOPIC/batteryState:.* batteryState\ STATTOPIC/batteryPercent:.* batteryPercent attr DEVICE stateFormat LWT\ state attr DEVICE model tasmota_window_sensor_MC400A setreading DEVICE attrTemplateVersion 20210607 name:tasmota_set_lowercase_texts_and_state1 filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*(tele|cmnd|stat).* desc:Applies to all tasmota devices
NOTE: This template will change ON, OFF etc. sent from tasmota side to lowercase.
After applying the template you might consider to delete or change stateFormat, eventMap and/or userReadings attribute values order:A_01z par:CMNDTOPIC;Command topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}cmnd$3" : undef } par:IO_DEV;Currently used IO;{ AttrVal('DEVICE','IODev',InternalVal('DEVICE','IODev',undef)->{NAME}) } set IO_DEV publish CMNDTOPIC/Backlog StateText1 off; StateText2 on; StateText3 toggle; StateText4 hold; SetOption26 1; SaveData 1 name:tasmota_set_uppercase_texts_and_state1 filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*(tele|cmnd|stat).* desc:Applies to all tasmota devices
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 order:A_01z1 par:CMNDTOPIC;Command topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}cmnd$3" : undef } par:IO_DEV;Currently used IO;{ AttrVal('DEVICE','IODev',InternalVal('DEVICE','IODev',undef)->{NAME}) } set IO_DEV publish CMNDTOPIC/Backlog StateText1 OFF; StateText2 ON; StateText3 TOGGLE; StateText4 HOLD; SetOption26 1 attr DEVICE userReadings state:POWER1:.* { lc(ReadingsVal($name,"POWER1","")) } name:tasmota_set_power1_state_to_power filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*(tele|cmnd|stat).* desc:Applies to single relay tasmota devices
NOTE: this template only exists for compability reasons to other HA solutions; not recommended for usage in FHEM context order:A_01z2 par:CMNDTOPIC;Command topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}cmnd$3" : undef } par:IO_DEV;Currently used IO;{ AttrVal('DEVICE','IODev',InternalVal('DEVICE','IODev',undef)->{NAME}) } set IO_DEV publish CMNDTOPIC/SetOption26 0 attr DEVICE userReadings state:POWER:.* { lc(ReadingsVal($name,"POWER","")) } ###### #Tasmota bt2tasmota section name:tasmota_bt2tasmota_bridge filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*(tele|cmnd|stat).* desc:This is a very early version of a template meant to configure a bridge device showing some basic info about the microcontroller (mcu) itself. For further details on bluetooth2tasmota visit https://tasmota.github.io/docs/Bluetooth_ESP32/ and https://tasmota.github.io/docs/Commands/#ble-esp32
NOTE: Initial version, not yet tested...
Most likely will be subject to changes!!! order:A_06t01 farewell:template has been applied successfully.\n Note: some changes have been applied to the mcu firmware settings. Incoming messages from bluetooth devices now should be forwarded to different FHEM devices, make sure, you have a TYPE=autocreate device active. par:CMNDTOPIC;Command topic prefix, without trailing /;{ AttrVal('DEVICE','readingList','') =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}cmnd$3" : undef } par:TELETOPIC;info topic prefix, without trailing /;{ AttrVal('DEVICE','readingList','') =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}tele$3" : undef } par:STATTOPIC;ack topic prefix, without trailing /;{ AttrVal('DEVICE','readingList','') =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}stat$3" : undef } par:BRIDGETOPIC;bridgeRegexp to be set;{ my $rL = AttrVal('DEVICE','readingList',''); $rL =~ m,([^:]*)\btele(/.*/)LWT:, ? qq{${1}tele${2}([^/]+)} : $rL =~ m,([^:]*/)tele/LWT:, ? qq{${1}([^/]+)/tele} : undef } par:IO_DEV;Currently used IO;{ AttrVal('DEVICE','IODev',InternalVal('DEVICE','IODev',undef)->{NAME}) } set IO_DEV publish CMNDTOPIC/Backlog StateText1 off; StateText2 on; StateText3 toggle; StateText4 hold; SetOption26 1; MI32Option6 1; SaveData 1 par:ICON;ICON as set, defaults to MQTT;{ AttrVal('DEVICE','icon','mqtt') } attr DEVICE icon ICON attr DEVICE bridgeRegexp \ BRIDGETOPIC/SENSOR:.* "bt2t_$1" attr DEVICE readingList \ TELETOPIC/LWT:.* LWT\ TELETOPIC/INFO.:.* { $EVENT =~ m,^..Info[1-3]..(.+).$, ? json2nameValue($1,'',$JSONMAP) : json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/UPTIME:.* { json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/STATE:.* { json2nameValue($EVENT,'',$JSONMAP) }\ STATTOPIC/RESULT:.* { json2nameValue($EVENT,'',$JSONMAP) }\ STATTOPIC/POWER:.* LED attr DEVICE setStateList on off attr DEVICE stateFormat LWT\ Hostname
attr DEVICE devStateIcon Online:10px-kreis-gruen@green Offline:10px-kreis-rot@red set IO_DEV publish CMNDTOPIC/restart 1 attr DEVICE model tasmota_bt2tasmota_bridge deletereading -q DEVICE (?!associatedWith|IODev).* setreading DEVICE attrTemplateVersion 20220111 #$yyMMddhhmmsshex = sub{sprintf '%02X%02X%02X%02X%02X%02X', $_[5]-100, $_[4]+1, $_[3], $_[2], $_[1], $_[0]}->(localtime); # see https://forum.fhem.de/index.php/topic,123411.msg1179717.html#msg1179717 ###### #Tasmota zigbee2tasmota section name:tasmota_zigbee2tasmota_bridge filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*(tele|cmnd|stat).* desc:This template is meant to configure a bridge device showing some basic info about the microcontroller (mcu) itself. For further details on zigbee2tasmota visit https://tasmota.github.io/docs/Zigbee/
NOTE: Initial version, not yet tested, just build according to https://forum.fhem.de/index.php/topic,112253.0.html
Needs still some changes!!! order:A_01u01 farewell:template has been applied successfully.\n Note: some changes have been applied to the mcu firmware settings. Incoming messages from zigbee devices now should be forwarded to different FHEM devices, make sure, you have a TYPE=autocreate device active. par:CMNDTOPIC;Command topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}cmnd$3" : undef } par:TELETOPIC;info topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}tele$3" : undef } par:STATTOPIC;ack topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}stat$3" : undef } par:BRIDGETOPIC;bridgeRegexp to be set;{ my $rL = AttrVal("DEVICE",'readingList',''); $rL =~ m,([^:]*)\btele(/.*/)LWT:, ? qq{${1}tele${2}([^/]+)} : $rL =~ m,([^:]*/)tele/LWT:, ? qq{${1}([^/]+)/tele} : undef } par:IO_DEV;Currently used IO;{ AttrVal('DEVICE','IODev',InternalVal('DEVICE','IODev',undef)->{NAME}) } set IO_DEV publish CMNDTOPIC/Backlog StateText1 off; StateText2 on; StateText3 toggle; StateText4 hold; SetOption26 1; SetOption89 1; SetOption83 1; SaveData 1 par:ICON;ICON as set, defaults to MQTT;{ AttrVal("DEVICE","icon","mqtt") } attr DEVICE icon ICON attr DEVICE getList\ ZbStatus1:noArg ZbStatus1 CMNDTOPIC/ZbStatus1\ ZbStatus2:textField ZbStatus2 CMNDTOPIC/ZbStatus2 $EVTPART1 attr DEVICE setList permit_join:0,1,99 CMNDTOPIC/ZbPermitJoin $EVTPART1\ x_Reboot:noArg CMNDTOPIC/restart 1\ x_ZbSend:textField CMNDTOPIC/ZbSend {"device":"0x$EVTPART1","send":{"$EVTPART2":"$EVTPART3"}}\ z_ZbBind_single:textField CMNDTOPIC/ZbBind {"Device":"$EVTPART1","ToDevice":"0x$EVTPART2","Endpoint":$EVTPART3,"ToEndpoint":$EVTPART4,"Cluster":$EVTPART5}\ z_ZbBind_group:textField CMNDTOPIC/ZbBind {"Device":"$EVTPART1","ToGroup":"0x$EVTPART2","Endpoint":$EVTPART3,"Cluster":$EVTPART4} attr DEVICE bridgeRegexp \ BRIDGETOPIC/SENSOR:.* "z2t_$1" attr DEVICE readingList \ TELETOPIC/LWT:.* LWT\ TELETOPIC/INFO.:.* { $EVENT =~ m,^..Info[1-3]..(.+).$, ? json2nameValue($1,'',$JSONMAP) : json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/UPTIME:.* { json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/STATE:.* { json2nameValue($EVENT) }\ TELETOPIC/RESULT:.* { json2nameValue($EVENT) }\ STATTOPIC/RESULT:.* { $EVENT =~ m,(ZbStatus.), ? { $1=>$EVENT } : json2nameValue($EVENT,'',$JSONMAP) }\ STATTOPIC/POWER:.* LED attr DEVICE setStateList on off attr DEVICE stateFormat LWT\ Hostname
attr DEVICE devStateIcon Online:10px-kreis-gruen@green Offline:10px-kreis-rot@red set IO_DEV publish CMNDTOPIC/restart 1 attr DEVICE model tasmota_zigbee2tasmota_bridge deletereading -q DEVICE (?!associatedWith|IODev).* setreading DEVICE attrTemplateVersion 20210811 { AttrTemplate_Initialize() } name:tasmota_zigbee2tasmota_replace_ID prereq:{my @devices=devspec2array("model=tasmota_zigbee2tasmota_bridge");;return 1 if $devices[0];;return 0} filter:TYPE=MQTT2_DEVICE:FILTER=readingList=(.*tele.*/....|/..../tele)/SENSOR:.* desc:As the bridge tends to assign a new ID each time you join a device to the ZigBee network, you may want to update existing devices with the new ID instead of reconfiguring the new ones! Don't forget to delete the autocreated other device afterwards...
NOTE: as the ID consists just of four letters, make sure, there's nothing beeing wrongly replaced... order:A_01u01a par:DEV_ID;Provide the new ZigBee short ID, hex value without leading 0x;{ undef } par:DEV_OLD_ID;ZigBee short ID, hex value without leading 0x;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)/.*/([^/]+)/SENSOR?:, ? "$3" : undef } par:READINGLIST;Existing readingList attribute value;{ AttrVal("DEVICE",'readingList','') } par:SETLIST;Existing setList attribute value;{ AttrVal("DEVICE",'setList','') } par:GETLIST;Existing getList attribute value;{ AttrVal("DEVICE",'getList','') } par:DEVTOPIC;Existing devicetopic attribute value;{ AttrVal("DEVICE",'devicetopic','') } par:DEVCID;Existing CID internal value;{ InternalVal("DEVICE",'CID',"z2t_DEV_ID") } option:{return 1 if length("DEVCID");return 0} {my $new = q(DEVCID); $new =~ s{DEV_OLD_ID}{DEV_ID}g; CommandDefMod(undef, "DEVICE MQTT2_\DEVICE $new")} option:{return 1 if qw(READINGLIST);return 0} {no warnings qw(constant); my $new = q(READINGLIST); $new =~ s{DEV_OLD_ID}{DEV_ID}g; CommandAttr(undef, "DEVICE readingList $new")} option:{return 1 if qw(SETLIST);return 0} {no warnings qw(constant); my $new = q(SETLIST); $new =~ s{DEV_OLD_ID}{DEV_ID}g; CommandAttr(undef, "DEVICE setList $new")} option:{return 1 if qw(GETLIST);return 0} {no warnings qw(constant); my $new = q(GETLIST); $new =~ s{DEV_OLD_ID}{DEV_ID}g; CommandAttr(undef, "DEVICE getList $new")} option:{return 1 if length("DEVTOPIC");return 0} {my $new = q(DEVTOPIC); $new =~ s{DEV_OLD_ID}{DEV_ID}g; CommandAttr(undef, "DEVICE devicetopic $new")} farewell:Template has been applied. NOTE: as the replaced ID consists just of four letters, make sure, there's nothing beeing wrongly replaced... name:tasmota_zigbee2tasmota_light_dimmer prereq:{my @devices=devspec2array("model=tasmota_zigbee2tasmota_bridge");;return 1 if $devices[0];;return 0} filter:TYPE=MQTT2_DEVICE:FILTER=readingList=(.*tele.*/....|/..../tele)/SENSOR:.* desc:This template is meant to configure a dimmable bulb device like Osram A 60 (no hue, no cct).
NOTE: Early testing version, not yet tested, just build according to https://forum.fhem.de/index.php/topic,112253.0.html
Might still need some changes! order:A_01u02 par:CMNDTOPIC;Command topic prefix, without trailing /;{ my $rL = AttrVal("DEVICE",'readingList',''); $rL =~ m,([^:]*)\b(tele|cmnd|stat)(/.*/[^/]+/SENSOR)?:, ? "${1}cmnd$3" : $rL =~ m,([^:]*)\b(/.*)/([^/].{4})/tele/SENSOR:, ? "${1}/cmnd" : undef } par:TELETOPIC;ack topic prefix, without trailing /;{ my $rL = AttrVal("DEVICE",'readingList',''); $rL =~ m,([^:]*)\b(tele|cmnd|stat)(/.*/[^/]+/SENSOR)?:, ? "${1}tele$3" : $rL =~ m,([^:]*)\b(/.*/[^/].{4})/tele/SENSOR:, ? qq{${1}/tele/SENSOR} : undef } par:DEV_ID;ZigBee short ID, hex value without leading 0x;{ my $rL = AttrVal("DEVICE",'readingList',''); $rL =~ m,([^:]*)\b(tele|cmnd|stat)/.*/([^/]+)/SENSOR:, ? "$3" : $rL =~ m,([^:]*)\b(/.*/)([^/].{4})/tele/SENSOR:, ? "$3" : undef } par:ICON;ICON as set, defaults to light_control;{ AttrVal("DEVICE","icon","light_control") } par:CALLSPEECHRECOGN;Set this to 0 to not set any speech recogn. related attributes;{ 1 } attr DEVICE icon ICON attr DEVICE readingList \ TELETOPIC:.* { $EVENT =~ s/"Power":1/"Power":"on"/g; $EVENT =~ s/"Power":0/"Power":"off"/g; $EVENT =~ m,^.*(..Device.+)..$, ? json2nameValue($1,'',$JSONMAP) : $EVENT =~ m,0xDEV_ID.:(.*).., ? json2nameValue($1,'',$JSONMAP) : undef } attr DEVICE setList on CMNDTOPIC/ZbSend {"device":"0xDEV_ID","send":{"Power":"On"}}\ off CMNDTOPIC/ZbSend {"device":"0xDEV_ID","send":{"Power":"Off"}}\ brightness:colorpicker,BRI,0,5,254 CMNDTOPIC/ZbSend { "device":"0xDEV_ID", "send":{"Dimmer":$EVTPART1} }\ dimup:noArg CMNDTOPIC/ZbSend { "device":"0xDEV_ID", "send":{"DimmerUp":""} }\ dimdown:noArg CMNDTOPIC/ZbSend { "device":"0xDEV_ID", "send":{"DimmerDown":""} } attr DEVICE setStateList on off attr DEVICE devStateIcon {zigbee2mqtt_devStateIcon255($name)} attr DEVICE setExtensionsEvent 1 attr DEVICE jsonMap Dimmer:brightness Power:state Device:0 Hue:hue Sat:saturation CT:ct deletereading -q DEVICE (?!associatedWith|IODev).* option:{ CALLSPEECHRECOGN } set DEVICE attrTemplate speechcontrol_type_light_255 attr DEVICE model tasmota_zigbee2tasmota_light_dimmer setreading DEVICE attrTemplateVersion 20210811 name:tasmota_zigbee2tasmota_light_cct prereq:{my @devices=devspec2array("model=tasmota_zigbee2tasmota_bridge");;return 1 if $devices[0];;return 0} filter:TYPE=MQTT2_DEVICE:FILTER=readingList=(.*tele.*/....|/..../tele)/SENSOR:.* desc:This template is meant to configure a dimmable bulb device with color teperature option like TRADFRI bulb E27 WW 806lm (no hue, but cct).
NOTE: Early testing version, not yet tested, just build according to https://forum.fhem.de/index.php/topic,112253.0.html
Might still need some changes! order:A_01u02a par:CMNDTOPIC;Command topic prefix, without trailing /;{ my $rL = AttrVal("DEVICE",'readingList',''); $rL =~ m,([^:]*)\b(tele|cmnd|stat)(/.*/[^/]+/SENSOR)?:, ? "${1}cmnd$3" : $rL =~ m,([^:]*)\b(/.*)/([^/].{4})/tele/SENSOR:, ? "${1}/cmnd" : undef } par:DEV_ID;ZigBee short ID, hex value without leading 0x;{ my $rL = AttrVal("DEVICE",'readingList',''); $rL =~ m,([^:]*)\b(tele|cmnd|stat)/.*/([^/]+)/SENSOR:, ? "$3" : $rL =~ m,([^:]*)\b(/.*/)([^/].{4})/tele/SENSOR:, ? "$3" : undef }set DEVICE attrTemplate tasmota_zigbee2tasmota_light_dimmer \CALLSPEECHRECOGN=1 attr DEVICE setList on CMNDTOPIC/ZbSend {"device":"0xDEV_ID","send":{"Power":"On"}}\ off CMNDTOPIC/ZbSend {"device":"0xDEV_ID","send":{"Power":"Off"}}\ brightness:colorpicker,BRI,0,5,254 CMNDTOPIC/ZbSend { "device":"0xDEV_ID", "send":{"Dimmer":$EVTPART1} }\ dimup:noArg CMNDTOPIC/ZbSend { "device":"0xDEV_ID", "send":{"DimmerUp":""} }\ dimdown:noArg CMNDTOPIC/ZbSend { "device":"0xDEV_ID", "send":{"DimmerDown":""} }\ ct:colorpicker,CT,153,5,370 CMNDTOPIC/ZbSend { "device":"0xDEV_ID", "send":{"CT":$EVTPART1} } attr DEVICE model tasmota_zigbee2tasmota_light_cct setreading DEVICE attrTemplateVersion 20210811 name:tasmota_zigbee2tasmota_light_cct_hue prereq:{my @devices=devspec2array("model=tasmota_zigbee2tasmota_bridge");;return 1 if $devices[0];;return 0} filter:TYPE=MQTT2_DEVICE:FILTER=readingList=(.*tele.*/....|/..../tele)/SENSOR:.* desc:This template is meant to configure a dimmable bulb device with ful hue options.
NOTE: Early testing version, not yet tested, just build according to https://forum.fhem.de/index.php/topic,112253.0.html
Might still need some changes! order:A_01u02c par:CMNDTOPIC;Command topic prefix, without trailing /;{ my $rL = AttrVal("DEVICE",'readingList',''); $rL =~ m,([^:]*)\b(tele|cmnd|stat)(/.*/[^/]+/SENSOR)?:, ? "${1}cmnd$3" : $rL =~ m,([^:]*)\b(/.*)/([^/].{4})/tele/SENSOR:, ? "${1}/cmnd" : undef } par:DEV_ID;ZigBee short ID, hex value without leading 0x;{ my $rL = AttrVal("DEVICE",'readingList',''); $rL =~ m,([^:]*)\b(tele|cmnd|stat)/.*/([^/]+)/SENSOR:, ? "$3" : $rL =~ m,([^:]*)\b(/.*/)([^/].{4})/tele/SENSOR:, ? "$3" : undef } set DEVICE attrTemplate tasmota_zigbee2tasmota_light_dimmer \CALLSPEECHRECOGN=1 attr DEVICE setList on CMNDTOPIC/ZbSend {"device":"0xDEV_ID","send":{"Power":"On"}}\ off CMNDTOPIC/ZbSend {"device":"0xDEV_ID","send":{"Power":"Off"}}\ brightness:colorpicker,BRI,0,5,254 CMNDTOPIC/ZbSend { "device":"0xDEV_ID", "send":{"Dimmer":$EVTPART1} }\ dimup:noArg CMNDTOPIC/ZbSend { "device":"0xDEV_ID", "send":{"DimmerUp":""} }\ dimdown:noArg CMNDTOPIC/ZbSend { "device":"0xDEV_ID", "send":{"DimmerDown":""} }\ ct:colorpicker,CT,153,5,370 CMNDTOPIC/ZbSend { "device":"0xDEV_ID", "send":{"CT":$EVTPART1} }\ hue:colorpicker,HUE,0,1,254 CMNDTOPIC/ZbSend { "device":"0xDEV_ID", "send":{"Hue":$EVTPART1} }\ saturation:colorpicker,BRI,0,1,254 CMNDTOPIC/ZbSend { "device":"0xDEV_ID", "send":{"Sat":$EVTPART1} } attr DEVICE model tasmota_zigbee2tasmota_light_cct_hue setreading DEVICE attrTemplateVersion 20210811 name:tasmota_zigbee2tasmota_single_switch prereq:{my @devices=devspec2array("model=tasmota_zigbee2tasmota_bridge");;return 1 if $devices[0];;return 0} filter:TYPE=MQTT2_DEVICE:FILTER=readingList=(.*tele.*/....|/..../tele)/SENSOR:.* desc:This template is meant to configure a simple on/off relay switch device like Osram Müller Licht Tint smart switch (on/off).
NOTE: Early testing version, not yet tested, just build according to https://forum.fhem.de/index.php/topic,112253.0.html
Might still need some changes! order:A_01u03 par:CMNDTOPIC;Command topic prefix, without trailing /;{ my $rL = AttrVal("DEVICE",'readingList',''); $rL =~ m,([^:]*)\b(tele|cmnd|stat)(/.*/[^/]+/SENSOR)?:, ? "${1}cmnd$3" : $rL =~ m,([^:]*)\b(/.*)/([^/].{4})/tele/SENSOR:, ? "${1}/cmnd" : undef } par:DEV_ID;ZigBee short ID, hex value without leading 0x;{ my $rL = AttrVal("DEVICE",'readingList',''); $rL =~ m,([^:]*)\b(tele|cmnd|stat)/.*/([^/]+)/SENSOR:, ? "$3" : $rL =~ m,([^:]*)\b(/.*/)([^/].{4})/tele/SENSOR:, ? "$3" : undef } par:DEV_ID;ZigBee short ID, hex value without leading 0x;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)/.*/([^/]+)/SENSOR?:, ? "$3" : undef } par:ICON;ICON as set, defaults to on;{ AttrVal("DEVICE","icon","on") } par:CALLSPEECHRECOGN;Set this to 0 to not set any speech recogn. related attributes;{ 1 } attr DEVICE icon ICON attr DEVICE readingList \ TELETOPIC:.* { $EVENT =~ s/"Power":1/"Power":"on"/g; $EVENT =~ s/"Power":0/"Power":"off"/g; $EVENT =~ m,^.*(..Device.+)..$, ? json2nameValue($1,'',$JSONMAP) : $EVENT =~ m,0xDEV_ID.:(.*).., ? json2nameValue($1,'',$JSONMAP) : undef } attr DEVICE setList on CMNDTOPIC/ZbSend {"device":"0xDEV_ID","send":{"Power":"On"}}\ off CMNDTOPIC/ZbSend {"device":"0xDEV_ID","send":{"Power":"Off"}} attr DEVICE setStateList on off attr DEVICE setExtensionsEvent 1 attr DEVICE jsonMap Power:state Device:0 deletereading -q DEVICE (?!associatedWith|IODev).* option:{ CALLSPEECHRECOGN } set DEVICE attrTemplate speechcontrol_type_switch option:global attr DEVICE model tasmota_zigbee2tasmota_single_switch setreading DEVICE attrTemplateVersion 20210811 name:tasmota_zigbee2tasmota_2channel_split prereq:{my @devices=devspec2array("model=tasmota_zigbee2tasmota_bridge");;return 1 if $devices[0];;return 0} filter:TYPE=MQTT2_DEVICE:FILTER=readingList=(.*tele.*/....|/..../tele)/SENSOR:.* desc:zigbee 2 channel switch device like QS-Zigbee-S04-2C-L.
NOTE: Early testing version, not yet tested.
NOTE: a second device will be created for the second channel order:A_01u031 par:CMNDTOPIC;Command topic prefix, without trailing /;{ my $rL = AttrVal("DEVICE",'readingList',''); $rL =~ m,([^:]*)\b(tele|cmnd|stat)(/.*/[^/]+/SENSOR)?:, ? "${1}cmnd$3" : $rL =~ m,([^:]*)\b(/.*)/([^/].{4})/tele/SENSOR:, ? "${1}/cmnd" : undef } par:TELETOPIC;ack topic prefix, without trailing /;{ my $rL = AttrVal("DEVICE",'readingList',''); $rL =~ m,([^:]*)\b(tele|cmnd|stat)(/.*/[^/]+/SENSOR)?:, ? "${1}tele$3" : $rL =~ m,([^:]*)\b(/.*/[^/].{4})/tele/SENSOR:, ? qq{${1}/tele/SENSOR} : undef } par:DEV_ID;ZigBee short ID, hex value without leading 0x;{ my $rL = AttrVal("DEVICE",'readingList',''); $rL =~ m,([^:]*)\b(tele|cmnd|stat)/.*/([^/]+)/SENSOR:, ? "$3" : $rL =~ m,([^:]*)\b(/.*/)([^/].{4})/tele/SENSOR:, ? "$3" : undef } par:ICON;ICON as set, defaults to on;{ AttrVal("DEVICE","icon","on") } par:CALLSPEECHRECOGN;Set this to 0 to not set any speech recogn. related attributes;{ 1 } attr DEVICE icon ICON attr DEVICE setStateList on off attr DEVICE setExtensionsEvent 1 attr DEVICE jsonMap Power:state Device:0 Endpoint:0 deletereading -q DEVICE (?!associatedWith|IODev).* set DEVICE attrTemplate set_associatedWith \CHANNELS=2 \MAKECOPIES=1 attr DEVICE readingList \ TELETOPIC:.* { return if $EVENT !~ m/.Endpoint..1/; $EVENT =~ s/"Power":1/"Power":"on"/g; $EVENT =~ s/"Power":0/"Power":"off"/g; $EVENT =~ m,^.*(..Device.+)..$, ? json2nameValue($1,'',$JSONMAP) : $EVENT =~ m,0xDEV_ID.:(.*).., ? json2nameValue($1,'',$JSONMAP) : undef } attr DEVICE setList on CMNDTOPIC/ZbSend {"device":"0xDEV_ID","Endpoint":1,"send":{"Power":"On"}}\ off CMNDTOPIC/ZbSend {"device":"0xDEV_ID","Endpoint":1,"send":{"Power":"Off"}} attr DEVICE_CH2 readingList \ TELETOPIC:.* { return if $EVENT !~ m/.Endpoint..2/; $EVENT =~ s/"Power":1/"Power":"on"/g; $EVENT =~ s/"Power":0/"Power":"off"/g; $EVENT =~ m,^.*(..Device.+)..$, ? json2nameValue($1,'',$JSONMAP) : $EVENT =~ m,0xDEV_ID.:(.*).., ? json2nameValue($1,'',$JSONMAP) : undef } attr DEVICE_CH2 setList on CMNDTOPIC/ZbSend {"device":"0xDEV_ID","Endpoint":2,"send":{"Power":"On"}}\ off CMNDTOPIC/ZbSend {"device":"0xDEV_ID","Endpoint":2,"send":{"Power":"Off"}} option:{ CALLSPEECHRECOGN } set DEVICE,DEVICE_CH2 attrTemplate speechcontrol_type_switch option:global attr DEVICE,DEVICE_CH2 model tasmota_zigbee2tasmota_2channel_split setreading DEVICE,DEVICE_CH2 attrTemplateVersion 20210811 name:tasmota_zigbee2tasmota_generic_battery_sensor prereq:{my @devices=devspec2array("model=tasmota_zigbee2tasmota_bridge");;return 1 if $devices[0];;return 0} filter:TYPE=MQTT2_DEVICE:FILTER=readingList=(.*tele.*/....|/..../tele)/SENSOR:.* desc:This template is meant to configure an arbitrary battery powered ZigBee sensor.
NOTE: jsonMap also is ok for Xiaomi Temp/Humi Sensor order:A_01u04 par:TELETOPIC;ack topic prefix, without trailing /;{ my $rL = AttrVal("DEVICE",'readingList',''); $rL =~ m,([^:]*)\b(tele|cmnd|stat)(/.*/[^/]+/SENSOR)?:, ? "${1}tele$3" : $rL =~ m,([^:]*)\b(/.*/[^/].{4})/tele/SENSOR:, ? qq{${1}/tele/SENSOR} : undef } par:DEV_ID;ZigBee short ID, hex value without leading 0x;{ my $rL = AttrVal("DEVICE",'readingList',''); $rL =~ m,([^:]*)\b(tele|cmnd|stat)/.*/([^/]+)/SENSOR:, ? "$3" : $rL =~ m,([^:]*)\b(/.*/)([^/].{4})/tele/SENSOR:, ? "$3" : undef } par:ICON;ICON as set, defaults to measure_battery_75;{ AttrVal("DEVICE","icon","measure_battery_75") } par:CALLSPEECHRECOGN;Set this to 0 to not set any speech recogn. related attributes;{ 1 } attr DEVICE icon ICON attr DEVICE comment For forther configuration use e.g. stateFormat attribtue like T: temperature°C | H: humidity% | B: batteryPercent% attr DEVICE readingList \ TELETOPIC:.* { $EVENT =~ m,^.*(..Device.+)..$, ? json2nameValue($1,'',$JSONMAP) : $EVENT =~ m,0xDEV_ID.:(.*).., ? json2nameValue($1,'',$JSONMAP) : undef } attr DEVICE jsonMap Device:0 Battery:0 BatteryPercentage:batteryPercent BatteryVoltage:batteryVoltage Temperature:temperature Humidity:humidity deletereading -q DEVICE (?!associatedWith|IODev).* option:{ CALLSPEECHRECOGN } attr DEVICE model tasmota_zigbee2tasmota_generic_battery_sensor setreading DEVICE attrTemplateVersion 20210811 name:tasmota_zigbee2tasmota_remote_control prereq:{my @devices=devspec2array("model=tasmota_zigbee2tasmota_bridge");;return 1 if $devices[0];;return 0} filter:TYPE=MQTT2_DEVICE:FILTER=readingList=(.*tele.*/....|/..../tele)/SENSOR:.* desc:This template is meant to configure an arbitrary zigbee remote control unit.
NOTE: Early testing version, not yet tested, just build according to https://forum.fhem.de/index.php/topic,112253.0.html
Might still need some changes! order:A_01u04a par:TELETOPIC;ack topic prefix, without trailing /;{ my $rL = AttrVal("DEVICE",'readingList',''); $rL =~ m,([^:]*)\b(tele|cmnd|stat)(/.*/[^/]+/SENSOR)?:, ? "${1}tele$3" : $rL =~ m,([^:]*)\b(/.*/[^/].{4})/tele/SENSOR:, ? qq{${1}/tele/SENSOR} : undef } par:DEV_ID;ZigBee short ID, hex value without leading 0x;{ my $rL = AttrVal("DEVICE",'readingList',''); $rL =~ m,([^:]*)\b(tele|cmnd|stat)/.*/([^/]+)/SENSOR:, ? "$3" : $rL =~ m,([^:]*)\b(/.*/)([^/].{4})/tele/SENSOR:, ? "$3" : undef } par:ICON;ICON as set, defaults to tradfri_remote;{ AttrVal("DEVICE","icon","tradfri_remote") } attr DEVICE icon ICON attr DEVICE readingList \ TELETOPIC:.* { $EVENT =~ m,(([0-9])([0-9])([0-9])([0-9])!([0-9][0-9])), ? { 'state'=>"${5}${4}${3}${2}$6" } : $EVENT =~ m,^.*(..Device.+)..$, ? json2nameValue($1,'',$JSONMAP) : $EVENT =~ m,0xDEV_ID.:(.*).., ? json2nameValue($1,'',$JSONMAP) : undef } attr DEVICE jsonMap Device:0 Battery:0 BatteryPercentage:batteryPercent BatteryVoltage:batteryVoltage Temperature:temperature deletereading -q DEVICE (?!associatedWith|IODev).* attr DEVICE model tasmota_zigbee2tasmota_remote_control setreading DEVICE attrTemplateVersion 20210811 name:tasmota_zigbee2tasmota_window_contact prereq:{my @devices=devspec2array("model=tasmota_zigbee2tasmota_bridge");;return 1 if $devices[0];;return 0} filter:TYPE=MQTT2_DEVICE:FILTER=readingList=(.*tele.*/....|/..../tele)/SENSOR:.* desc:This template is meant to configure a window contact, e.g. like Xiaomi MCCGQ01LM.
NOTE: Early testing version, not yet tested, just build according to https://forum.fhem.de/index.php/topic,112253.0.html
Might still need some changes! order:A_01u04b par:TELETOPIC;ack topic prefix, without trailing /;{ my $rL = AttrVal("DEVICE",'readingList',''); $rL =~ m,([^:]*)\b(tele|cmnd|stat)(/.*/[^/]+/SENSOR)?:, ? "${1}tele$3" : $rL =~ m,([^:]*)\b(/.*/[^/].{4})/tele/SENSOR:, ? qq{${1}/tele/SENSOR} : undef } par:DEV_ID;ZigBee short ID, hex value without leading 0x;{ my $rL = AttrVal("DEVICE",'readingList',''); $rL =~ m,([^:]*)\b(tele|cmnd|stat)/.*/([^/]+)/SENSOR:, ? "$3" : $rL =~ m,([^:]*)\b(/.*/)([^/].{4})/tele/SENSOR:, ? "$3" : undef } par:ICON;ICON as set, defaults to tuer_fenster_kontakt;{ AttrVal("DEVICE","icon","tuer_fenster_kontakt") } par:CALLSPEECHRECOGN;Set this to 0 to not set any speech recogn. related attributes;{ 1 } attr DEVICE icon ICON attr DEVICE readingList \ TELETOPIC:.* { $EVENT =~ s/"(Power|Contact)":1/"state":"open"/g; $EVENT =~ s/"(Power|Contact)":0/"state":"closed"/g; $EVENT =~ m,^.*(..Device.+)..$, ? json2nameValue($1,'',$JSONMAP) : $EVENT =~ m,0xDEV_ID.:(.*).., ? json2nameValue($1,'',$JSONMAP) : undef } attr DEVICE jsonMap Device:0 Battery:0 BatteryPercentage:batteryPercent BatteryVoltage:batteryVoltage deletereading -q DEVICE (?!associatedWith|IODev).* option:{ CALLSPEECHRECOGN } set DEVICE attrTemplate speechcontrol_gdt_and_mapping GENERICDEVTYPE=contact HOMEBRIDGEMAPPING="ContactSensorState=state,values=closed:CONTACT_DETECTED;;open:CONTACT_NOT_DETECTED" option:global attr DEVICE model tasmota_zigbee2tasmota_window_contact setreading DEVICE attrTemplateVersion 20210811 name:tasmota_zigbee2tasmota_motion_sensor prereq:{my @devices=devspec2array("model=tasmota_zigbee2tasmota_bridge");;return 1 if $devices[0];;return 0} filter:TYPE=MQTT2_DEVICE:FILTER=readingList=(.*tele.*/....|/..../tele)/SENSOR:.* desc:This template is meant to configure an ZigBee motion sensor like Sonoff SNZB-03 order:A_01u04c par:TELETOPIC;ack topic prefix, without trailing /;{ my $rL = AttrVal("DEVICE",'readingList',''); $rL =~ m,([^:]*)\b(tele|cmnd|stat)(/.*/[^/]+/SENSOR)?:, ? "${1}tele$3" : $rL =~ m,([^:]*)\b(/.*/[^/].{4})/tele/SENSOR:, ? qq{${1}/tele/SENSOR} : undef } par:DEV_ID;ZigBee short ID, hex value without leading 0x;{ my $rL = AttrVal("DEVICE",'readingList',''); $rL =~ m,([^:]*)\b(tele|cmnd|stat)/.*/([^/]+)/SENSOR:, ? "$3" : $rL =~ m,([^:]*)\b(/.*/)([^/].{4})/tele/SENSOR:, ? "$3" : undef } par:ICON;ICON as set, defaults to people_sensor;{ AttrVal("DEVICE","icon","people_sensor") } par:CALLSPEECHRECOGN;Set this to 0 to not set any speech recogn. related attributes;{ 1 } attr DEVICE icon ICON attr DEVICE readingList \ TELETOPIC:.* { $EVENT =~ m,^.*(..Device.+)..$, ? json2nameValue($1,'',$JSONMAP) : $EVENT =~ m,0xDEV_ID.:(.*).., ? json2nameValue($1,'',$JSONMAP) : undef } attr DEVICE jsonMap Device:0 Battery:0 BatteryPercentage:batteryPercent BatteryVoltage:batteryVoltage attr DEVICE stateFormat Motion: Occupancy deletereading -q DEVICE (?!associatedWith|IODev).* attr DEVICE model tasmota_zigbee2tasmota_motion_sensor setreading DEVICE attrTemplateVersion 20210811 # Eurotronic Spirit ZigBee version name:tasmota_zigbee2tasmota_eurotronic_spirit prereq:{my @devices=devspec2array("model=tasmota_zigbee2tasmota_bridge");;return 1 if $devices[0];;return 0} filter:TYPE=MQTT2_DEVICE:FILTER=readingList=(.*tele.*/....|/..../tele)/SENSOR:.* desc: First version for Eurotronic SPZB0001 via zigbee2tasmota
Not yet tested...
tbd (?): map eurotronic_system_mode to readings (userReadings?), see Forum Thread order:A_01u05a par:CMNDTOPIC;Command topic prefix, without trailing /;{ my $rL = AttrVal("DEVICE",'readingList',''); $rL =~ m,([^:]*)\b(tele|cmnd|stat)(/.*/[^/]+/SENSOR)?:, ? "${1}cmnd$3" : $rL =~ m,([^:]*)\b(/.*)/([^/].{4})/tele/SENSOR:, ? "${1}/cmnd" : undef } par:TELETOPIC;ack topic prefix, without trailing /;{ my $rL = AttrVal("DEVICE",'readingList',''); $rL =~ m,([^:]*)\b(tele|cmnd|stat)(/.*/[^/]+/SENSOR)?:, ? "${1}tele$3" : $rL =~ m,([^:]*)\b(/.*/[^/].{4})/tele/SENSOR:, ? qq{${1}/tele/SENSOR} : undef } par:DEV_ID;ZigBee short ID, hex value without leading 0x;{ my $rL = AttrVal("DEVICE",'readingList',''); $rL =~ m,([^:]*)\b(tele|cmnd|stat)/.*/([^/]+)/SENSOR:, ? "$3" : $rL =~ m,([^:]*)\b(/.*/)([^/].{4})/tele/SENSOR:, ? "$3" : undef } par:ICON;ICON as set, defaults to hm-cc-rt-dn;{ AttrVal("DEVICE","icon","hm-cc-rt-dn") } par:CALLSPEECHRECOGN;Set this to 0 to not set any speech recogn. related attributes;{ 1 } attr DEVICE icon ICON attr DEVICE comment For forther configuration use e.g. stateFormat attribtue like T: temperature°C | H: humidity% | B: batteryPercent% attr DEVICE readingList \ TELETOPIC:.* { $EVENT =~ m,^.*(..Device.+)..$, ? json2nameValue($1,'',$JSONMAP) : $EVENT =~ m,0xDEV_ID.:(.*).., ? json2nameValue($1,'',$JSONMAP) : undef } attr DEVICE jsonMap Device:0 Battery:0 BatteryPercentage:batteryPercent BatteryVoltage:batteryVoltage Temperature:temperature Humidity:humidity deletereading -q DEVICE (?!associatedWith|IODev).* attr DEVICE setList desired-temp:slider,5.0,0.5,30.0,1 CMNDTOPIC/ZbSend {"device":"0xDEV_ID","Write":{"OccupiedHeatingSetpoint": $EVTPART1}}\ temp-offset:slider,-10.0,0.5,10.0,1 CMNDTOPIC/ZbSend {"device":"0xDEV_ID","Write":{"LocalTemperatureCalibration":$EVTPART1}} attr DEVICE stateFormat Measured: temperature Battery: batteryPercent % attr DEVICE webCmd desired-temp attr DEVICE widgetOverride desired-temp:knob,min:5,max:30,angleArc:180,width:40,height:40,fgColor:#FF9900,bgColor:#CCCCCC,step:0.5,lineCap:round,angleOffset:225 attr DEVICE setStateList on off attr DEVICE jsonMap Battery:0 Device:0 BatteryPercentage:batteryPercent LocalTemperature:temperature OccupiedHeatingSetpoint:dayTemp UnoccupiedHeatingSetpoint:nightTemp CurrentTemperatureSetPoint:desired-temp PIHeatingDemand:valve option:{ CALLSPEECHRECOGN } set DEVICE attrTemplate speechcontrol_type_thermostat option:global attr DEVICE model tasmota_zigbee2tasmota_eurotronic_spirit setreading DEVICE attrTemplateVersion 20210811 # Thermostat Beca Wifi name:WThermostatBeca filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*(tele|cmnd|stat).* desc: First version for WThermostat Beca.
Not yet tested...
see Forum Thread. Might also be ok for original firmware from https://github.com/klausahrenberg/WThermostatBeca order:E_05a par:CMNDTOPIC;Command topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}cmnd$3" : undef } par:TELETOPIC;info topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}tele$3" : undef } par:STATTOPIC;ack topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}stat$3" : undef } par:ICON;ICON as set, defaults to hm-tc-it-wm-w-eu;{ AttrVal("DEVICE","icon","hm-tc-it-wm-w-eu") } par:CALLSPEECHRECOGN;Set this to 0 to not set any speech recogn. related attributes;{ 1 } par:WPNAME;weekprofile attr value, defaults to device name;{ AttrVal('DEVICE','weekprofile','DEVICE') } { Svn_GetFile("contrib/AttrTemplate/99_attrT_z2m_thermostat_Utils.pm", "FHEM/99_attrT_z2m_thermostat_Utils.pm", sub(){ CommandReload(undef, "99_attrT_z2m_thermostat_Utils.pm") }) } attr DEVICE icon ICON attr DEVICE userattr weekprofile attr DEVICE weekprofile WPNAME attr DEVICE devStateIcon \ LWT\ \ state attr DEVICE setStateList on off weekprofile attr DEVICE readingList TELETOPIC/LWT:.* LWT\ devices/(network|clock|thermostat|logging):.* {}\ STATTOPIC/things/network/properties:.* { json2nameValue($EVENT,'net_',$JSONMAP) }\ STATTOPIC/things/thermostat/properties:.* { $EVENT =~ s/true/"on"/g;; $EVENT =~ s/false/"off"/g;; json2nameValue($EVENT,'',$JSONMAP) }\ STATTOPIC/things/logging/properties:.* { json2nameValue($EVENT,'log_',$JSONMAP) }\ STATTOPIC/things/clock/properties:.* { json2nameValue($EVENT,'clock_',$JSONMAP) }\ STATTOPIC/things/thermostat/deviceOn:.* {{state => $EVENT eq 'false' ? 'off' : 'on'}}\ STATTOPIC/things/thermostat/targetTemperature:.* desired-temp attr DEVICE setList on:noArg CMNDTOPIC/things/thermostat/properties/deviceOn true\ off:noArg CMNDTOPIC/things/thermostat/properties/deviceOn false\ desired-temp:slider,5.0,0.5,35.0,1 CMNDTOPIC/things/thermostat/properties/targetTemperature $EVTPART1\ mode:heat,auto,cool CMNDTOPIC/things/thermostat/properties/mode $EVTPART1\ weekprofile { FHEM::attrT_z2m_thermostat_Utils::z2t_send_Beca_weekprofile($NAME, $EVTPART1, $EVTPART2, 'CMNDTOPIC/things/thermostat/schedules') }\ x_send_mcucommand:textField { my $payload = $EVENT;$payload =~ s/$EVTPART0 //g; qq(CMNDTOPIC/things/thermostat/mcucommand $payload)} attr DEVICE getList desired-temp:noArg desired-temp CMNDTOPIC/things/thermostat/properties attr DEVICE jsonMap targetTemperature:0 deviceOn:0 attr DEVICE webCmd mode:desired-temp set DEVICE attrTemplate speechcontrol_type_thermostat deletereading -q DEVICE (?!associatedWith|IODev).* attr DEVICE model WThermostatBeca setreading DEVICE attrTemplateVersion 20211006 ########################################### # SHELLY # # shelly1 using original firmware. name:shelly1 filter:TYPE=MQTT2_DEVICE desc:Base template for a lot of first generation shelly devices par:DEVNAME;Shelly1 name in the topic;{ AttrVal("DEVICE","readingList","") =~ m,shellies/([^/]*)/, ? $1 : undef } par:CALLSPEECHRECOGN;Set this to 0 to not set any speech recogn. related attributes;{ 1 } order:A_10 attr DEVICE setList\ off:noArg shellies/DEVNAME/relay/0/command off\ on:noArg shellies/DEVNAME/relay/0/command on\ x_update:noArg shellies/DEVNAME/command update_fw\ x_mqttcom shellies/DEVNAME/command $EVTPART1 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/announce:.* { $EVENT =~ m,..id...DEVNAME...mac.*, ? json2nameValue($EVENT) : return } attr DEVICE devStateIcon {my $onl = ReadingsVal($name,"online","false") eq "false" ? "rot" : ReadingsVal($name,"new_fw","false") eq "true" ? "gelb" : "gruen"; my $light = ReadingsVal($name,"state","off"); my $show = '" : "http://".ReadingsVal($name,"ip","none").' "target="_blank">'; $show .= FW_makeImage("10px-kreis-".$onl).""; "
$show ".FW_makeImage($light)."
" } deletereading -q DEVICE (?!associatedWith|IODev).* set DEVICE x_mqttcom announce attr DEVICE model shelly1 setreading DEVICE attrTemplateVersion 20211030 option:{ CALLSPEECHRECOGN } set DEVICE attrTemplate speechcontrol_type_switch name:shelly_announces filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*shellies.* order:A_101 desc:Allows central administration of all shelly firmware updates attr DEVICE setList\ update_fw_all:noArg {"shellies/command update_fw"}\ update_fw_device:textField {"shellies/$EVTPART1/command update_fw"}\ request_update_all:noArg {"shellies/command update"}\ request_update_device:textField {"shellies/$EVTPART1/command update"}\ request_announces:noArg {"shellies/command announce"} set DEVICE request_announces attr DEVICE readingList shellies/announce:.* { $EVENT =~ m,id...([^"]+), ? json2nameValue($EVENT,$1."_") : json2nameValue($EVENT) } # shellyplug using original firmware. name:shellyplug filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*shellies.* order:A_10a par:DEVNAME;ShellyPlug name in the topic;{ AttrVal("DEVICE","readingList","") =~ m,shellies/([^/]*)/, ? $1 : undef } par:CALLSPEECHRECOGN;Set this to 0 to not set any speech recogn. related attributes;{ 1 } set DEVICE attrTemplate shelly1 \CALLSPEECHRECOGN=0 attr DEVICE getList power:noArg shellies/DEVNAME/relay/power power attr DEVICE model shellyplug setreading DEVICE attrTemplateVersion 20211030 option:{ CALLSPEECHRECOGN } set DEVICE attrTemplate speechcontrol_type_switch #contributed by 87insane, https://forum.fhem.de/index.php/topic,94060.msg934614.html#msg934614 # shelly1pm using original firmware. name:shelly1_w_energy_measuring filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*shellies.* order:A_10b desc:Applies to single relay Shelly devices offering energy measuring like Shelly 1PM or Shelly Plug S par:DEVNAME;Shelly1 name in the topic;{ AttrVal("DEVICE","readingList","") =~ m,shellies/([^/]*)/, ? $1 : undef } par:RADIO_SETUSERREADING;Set userreading for total energy consumption;{ undef } par:RADIO_DONOTSETUSERREADING;Do not set userreading for total energy consumption;{ undef } par:NEWUSERREADINGS;NEWUSERREADINGS as set if relay_0_energy_total is included, otherwise it will be added;{ my $old = AttrVal("DEVICE","userReadings",undef);; !defined $old ? 'relay_0_energy_total:relay_0_energy:.* monotonic {ReadingsNum("$name","relay_0_energy",0)}' : $old =~ m,relay_0_energy_total:relay_0_energy.*, ? $old : $old.', relay_0_energy_total:relay_0_energy:.* monotonic {ReadingsNum("$name","relay_0_energy",0)}' } par:CALLSPEECHRECOGN;Set this to 0 to not set any speech recogn. related attributes;{ 1 } attr DEVICE setList\ relay0:on,off,toggle shellies/DEVNAME/relay/0/command $EVTPART1\ toggle:noArg shellies/DEVNAME/relay/0/command toggle\ off:noArg shellies/DEVNAME/relay/0/command off\ on:noArg shellies/DEVNAME/relay/0/command on\ x_update:noArg shellies/DEVNAME/command update_fw\ x_mqttcom shellies/DEVNAME/command $EVTPART1 attr DEVICE readingList \ shellies/DEVNAME/relay/0:.* state\ shellies/DEVNAME/relay/0:.* relay0\ shellies/DEVNAME/input/0:.* input0\ shellies/DEVNAME/online:.* online\ shellies/announce:.* { $EVENT =~ m,..id...DEVNAME...mac.*, ? json2nameValue($EVENT) : return }\ shellies/DEVNAME/announce:.* { json2nameValue($EVENT) }\ shellies/DEVNAME/relay/0/power:.* relay_0_power\ shellies/DEVNAME/relay/0/power:.* { my $compare = $EVTPART0 < 100 ? "off":"on"; ReadingsVal($NAME,"loadState","off") ne $compare ? { 'loadState' => $compare } : return }\ shellies/DEVNAME/temperature:.* temperature\ shellies/DEVNAME/temperature_f:.* temperature_f\ shellies/DEVNAME/input_event/0:.* { json2nameValue($EVENT) }\ shellies/DEVNAME/overtemperature:.* overtemperature\ 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 "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 : attr DEVICE setStateList on off toggle deletereading -q DEVICE (?!associatedWith|IODev).* set DEVICE x_mqttcom announce attr DEVICE model shelly1_w_energy_measuring setreading DEVICE attrTemplateVersion 20200831 option:{ CALLSPEECHRECOGN } set DEVICE attrTemplate speechcontrol_type_switch option:{ RADIO_SETUSERREADING } attr DEVICE userReadings NEWUSERREADINGS name:shelly1_w_energy_measuring_washer_example filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*shellies.* order:A_10b1 desc:Example how to configure a single relay Shelly device offering energy measuring like Shelly 1PM or Shelly Plug S to visualise state of a machine behind the plug. Icons will not allow to turn the machine off. par:DEVNAME;Shelly1 name in the topic;{ AttrVal("DEVICE","readingList","") =~ m,shellies/([^/]*)/, ? $1 : undef } set DEVICE attrTemplate shelly1_w_energy_measuring CALLSPEECHRECOGN=0 attr DEVICE devStateIcon { my $amp = ReadingsVal($name,"online","false") eq "false" ? "rot" : ReadingsVal($name,"new_fw","false") eq "true" ? "gelb" : "gruen"; my $pic = ReadingsVal($name,"loadState","") eq "on"?'scene_laundry_room_fem@green':'scene_laundry_room_fem'; my $text = ReadingsVal($name,"loadState","") eq "on"?"Waschmaschine läuft - Aktuell: ".ReadingsVal($name,"relay_0_power","")." W":'Standby'; my $show = "$amp" eq "gelb" ? "".FW_makeImage("10px-kreis-".$amp)."" : "".FW_makeImage("10px-kreis-".$amp).""; "
$show ".FW_makeImage($pic)." $text
" } attr DEVICE userReadings total_temp:loadState:.on { ReadingsNum("$name","relay_0_kWh",0) },wash:loadState:.off { ReadingsNum("$name","total",0) - ReadingsNum("$name","total_temp",0) },price:loadState:.off {sprintf("%.2f",ReadingsNum("$name","wash",1)*ReadingsNum("kWh_Price","state",0.30))},time:loadState:.off {strftime("%H:%M", localtime(ReadingsAge("$name","total_temp",0)-3600))} attr DEVICE comment To get appropriate loadState values: Change the default limit "100" in readingList to your needs; using a seperate device named kWh_Price indicating actual energy price in state will lead to realistic price results or change the refference/the value "0.30" in userReadings "price". attr DEVICE model shelly1_w_energy_measuring_washer_example setreading DEVICE attrTemplateVersion 20200831 name:shelly2em filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*shellies.* order:A_10c desc:Applies to Shelly 2em devices.
See https://forum.fhem.de/index.php/topic,123920.msg1185387.html#msg1185387 par:DEVNAME;Shelly device name in the topic;{ AttrVal('DEVICE','readingList','') =~ m,shellies/([^/]*)/, ? $1 : undef } par:RADIO_SETUSERREADING;Set userreading for total energy consumption;{ undef } par:RADIO_DONOTSETUSERREADING;Do not set userreading for total energy consumption;{ undef } par:NEWUSERREADINGS;NEWUSERREADINGS as set if emeter_0_energy_total is included, otherwise it will be added;{ my $tobeadded = q(emeter_0_energy_total:emeter_0_energy:.* monotonic {ReadingsNum($name,'emeter_0_energy',0)}, emeter_1_energy_total:emeter_1_energy:.* monotonic {ReadingsNum($name,'emeter_1_energy',0)}); my $old = AttrVal('DEVICE','userReadings',undef); !defined $old ? $tobeadded : $old =~ m,emeter_0_energy_total:emeter_0_energy.*, ? $old : $old." $tobeadded" } set DEVICE attrTemplate shelly1_w_energy_measuring \RADIO_SETUSERREADING=RADIO_SETUSERREADING \RADIO_DONOTSETUSERREADING=RADIO_DONOTSETUSERREADING attr DEVICE devStateIcon {my $onl = ReadingsVal($name,'online','false') eq 'true'?'10px-kreis-gruen':'10px-kreis-rot'; my $light = ReadingsVal($name,'state','off'); my $cons1 = ReadingsVal($name,'emeter_0_power','unknown'); my $cons2 = ReadingsVal($name,'emeter_1_power','unknown'); my $total1 = ReadingsVal($name,'emeter_0_kWh','unknown'); my $total2 = ReadingsVal($name,'emeter_1_kWh','unknown'); my $total_w = $cons1+$cons2; my $total_sum = $total1+$total2; ''.FW_makeImage($onl)." ".FW_makeImage($light)."
P1: $cons1 W / Total P1: $total1 kWh
P2: $cons2 W / Total P2: $total2 kWh
2 Phases total: $total_w W / $total_sum kWh
"} attr DEVICE stateFormat { my $light = ReadingsVal($name,'state','off'); my $cons1 = ReadingsVal($name,'emeter_0_power','unknown'); my $cons2 = ReadingsVal($name,'emeter_1_power','unknown'); my $total1 = ReadingsVal($name,'emeter_0_kWh','unknown'); my $total2 = ReadingsVal($name,'emeter_1_kWh','unknown'); return qq(Relay: $light,
P1: $cons1 W / Total P1: $total1 kWh
P2: $cons2 W / Total P2: $total2 kWh) } attr DEVICE readingList shellies/DEVNAME/online:.* online\ shellies/DEVNAME/announce:.* { json2nameValue($EVENT) }\ shellies/DEVNAME/relay/0:.* state\ shellies/DEVNAME/input_event/0:.* { json2nameValue($EVENT) }\ shellies/DEVNAME/input/0:.* input0\ shellies/DEVNAME/online:.* online\ shellies/DEVNAME/emeter/0/power:.* emeter_0_power\ shellies/DEVNAME/emeter/0/current:.* emeter_0_current\ shellies/DEVNAME/emeter/0/voltage:.* emeter_0_voltage\ shellies/DEVNAME/emeter/0/reactive_power:.* emeter_0_reactive_power\ shellies/DEVNAME/emeter/1/power:.* emeter_1_power\ shellies/DEVNAME/emeter/1/pf:.* emeter_1_pf\ shellies/DEVNAME/emeter/1/current:.* emeter_1_current\ shellies/DEVNAME/emeter/1/voltage:.* emeter_1_voltage\ shellies/DEVNAME/emeter/1/reactive_power:.* emeter_1_reactive_power\ shellies/DEVNAME/emeter/0/energy:.* emeter_0_energy\ shellies/DEVNAME/emeter/0/returned_energy:.* emeter_0_returned_energy\ shellies/DEVNAME/emeter/0/total:.* emeter_0_total\ shellies/DEVNAME/emeter/0/total:.* {'emeter_0_kWh' => sprintf("%.2f",$EVENT/1000)}\ shellies/DEVNAME/emeter/0/total_returned:.* emeter_0_total_returned\ shellies/DEVNAME/emeter/1/energy:.* emeter_1_energy\ shellies/DEVNAME/emeter/1/returned_energy:.* emeter_1_returned_energy\ shellies/DEVNAME/emeter/1/total:.* emeter_1_total\ shellies/DEVNAME/emeter/1/total:.* {'emeter_1_kWh' => sprintf("%.2f",$EVENT/1000)}\ shellies/DEVNAME/emeter/1/total_returned:.* emeter_1_total_returned deletereading -q DEVICE (?!associatedWith|IODev).* set DEVICE x_mqttcom announce attr DEVICE model shelly2em setreading DEVICE attrTemplateVersion 20220109 option:{ RADIO_SETUSERREADING } attr DEVICE userReadings NEWUSERREADINGS name:shelly3em filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*shellies.* order:A_10c1 desc:Applies to Shelly 3em devices.
NOTE: early version, might still need some testing par:DEVNAME;Shelly1 name in the topic;{ AttrVal("DEVICE","readingList","") =~ m,shellies/([^/]*)/, ? $1 : undef } par:RADIO_SETUSERREADING;Set userreading for total energy consumption;{ undef } par:RADIO_DONOTSETUSERREADING;Do not set userreading for total energy consumption;{ undef } par:NEWUSERREADINGS;NEWUSERREADINGS as set if emeter_0_energy_total is included, otherwise it will be added;{ my $tobeadded = 'emeter_0_energy_total:emeter_0_energy:.* monotonic {ReadingsNum("$name","emeter_0_energy",0)}, emeter_1_energy_total:emeter_1_energy:.* monotonic {ReadingsNum("$name","emeter_1_energy",0)}, emeter_2_energy_total:emeter_2_energy:.* monotonic {ReadingsNum("$name","emeter_2_energy",0)}'; my $old = AttrVal("DEVICE","userReadings",undef); !defined $old ? $tobeadded : $old =~ m,emeter_0_energy_total:emeter_0_energy.*, ? $old : $old." $tobeadded" } set DEVICE attrTemplate shelly1_w_energy_measuring \RADIO_SETUSERREADING=RADIO_SETUSERREADING \RADIO_DONOTSETUSERREADING=RADIO_DONOTSETUSERREADING attr DEVICE devStateIcon {my $onl = FW_makeImage(ReadingsVal($name,'online','false') eq 'true'?'10px-kreis-gruen':'10px-kreis-rot'); my $light = FW_makeImage(ReadingsVal($name,'state','off')); my $cons1 = ReadingsVal($name,'emeter_0_power',0); my $cons2 = ReadingsVal($name,'emeter_1_power',0); my $cons3 = ReadingsVal($name,'emeter_2_power',0); my $total1 = ReadingsVal($name,'emeter_0_kWh',0); my $total2 = ReadingsVal($name,'emeter_1_kWh',0); my $total3 = ReadingsVal($name,'emeter_2_kWh',0); my $total_sum = $total1+$total2+$total3; my $total_w =$cons1+$cons2+$cons3; my $ip = ReadingsVal($name,'ip','unknown'); qq($onl $light
P1: $cons1 W / Total P1: $total1 kWh
P2: $cons2 W / Total P2: $total2 kWh
P3: $cons3 W / Total P3: $total3 kWh
3 Phases total: $total_w W / $total_sum kWh
)} attr DEVICE stateFormat { my $light = ReadingsVal($name,'state','off'); my $cons1 = ReadingsVal($name,'emeter_0_power',0); my $cons2 = ReadingsVal($name,'emeter_1_power',0); my $cons3 = ReadingsVal($name,'emeter_2_power',0); my $total1 = ReadingsVal($name,'emeter_0_kWh',0); my $total2 = ReadingsVal($name,'emeter_1_kWh',0); my $total3 = ReadingsVal($name,'emeter_2_kWh',0); return qq(Relay: $light,
P1: $cons1 W / Total P1: $total1 kWh
P2: $cons2 W / Total P2: $total2 kWh
P3: $cons3 W / Total P3: $total3 kWh) } attr DEVICE readingList shellies/DEVNAME/online:.* online\ shellies/DEVNAME/announce:.* { json2nameValue($EVENT) }\ shellies/announce:.* { $EVENT =~ m,..id...DEVNAME...mac.*, ? json2nameValue($EVENT) : return }\ shellies/DEVNAME/relay/0:.* state\ shellies/DEVNAME/input_event/0:.* { json2nameValue($EVENT) }\ shellies/DEVNAME/input/0:.* input0\ shellies/DEVNAME/online:.* online\ shellies/DEVNAME/emeter/0/power:.* emeter_0_power\ shellies/DEVNAME/emeter/0/pf:.* emeter_0_pf\ shellies/DEVNAME/emeter/0/current:.* emeter_0_current\ shellies/DEVNAME/emeter/0/voltage:.* emeter_0_voltage\ shellies/DEVNAME/emeter/1/power:.* emeter_1_power\ shellies/DEVNAME/emeter/1/pf:.* emeter_1_pf\ shellies/DEVNAME/emeter/1/current:.* emeter_1_current\ shellies/DEVNAME/emeter/1/voltage:.* emeter_1_voltage\ shellies/DEVNAME/emeter/2/power:.* emeter_2_power\ shellies/DEVNAME/emeter/2/pf:.* emeter_2_pf\ shellies/DEVNAME/emeter/2/current:.* emeter_2_current\ shellies/DEVNAME/emeter/2/voltage:.* emeter_2_voltage\ shellies/DEVNAME/emeter/0/energy:.* emeter_0_energy\ shellies/DEVNAME/emeter/0/returned_energy:.* emeter_0_returned_energy\ shellies/DEVNAME/emeter/0/total:.* emeter_0_total\ shellies/DEVNAME/emeter/0/total:.* {'emeter_0_kWh' => sprintf("%.2f",$EVENT/1000)}\ shellies/DEVNAME/emeter/0/total_returned:.* emeter_0_total_returned\ shellies/DEVNAME/emeter/1/energy:.* emeter_1_energy\ shellies/DEVNAME/emeter/1/returned_energy:.* emeter_1_returned_energy\ shellies/DEVNAME/emeter/1/total:.* emeter_1_total\ shellies/DEVNAME/emeter/1/total:.* {'emeter_1_kWh' => sprintf("%.2f",$EVENT/1000)}\ shellies/DEVNAME/emeter/1/total_returned:.* emeter_1_total_returned\ shellies/DEVNAME/emeter/2/energy:.* emeter_2_energy\ shellies/DEVNAME/emeter/2/returned_energy:.* emeter_2_returned_energy\ shellies/DEVNAME/emeter/2/total:.* emeter_2_total\ shellies/DEVNAME/emeter/2/total:.* {'emeter_2_kWh' => sprintf("%.2f",$EVENT/1000)}\ shellies/DEVNAME/emeter/2/total_returned:.* emeter_2_total_returned deletereading -q DEVICE (?!associatedWith|IODev).* set DEVICE x_mqttcom announce attr DEVICE model shelly3em setreading DEVICE attrTemplateVersion 20220109 option:{ RADIO_SETUSERREADING } attr DEVICE userReadings NEWUSERREADINGS # shelly2 using original firmware in roller mode. name:shelly2_roller filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*shellies.* desc:shelly2 using original firmware.
NOTE: shelly2 roller operated, change settings first! order:A_11b par:DEVNAME;Shelly2 name in the topic;{ AttrVal("DEVICE","readingList","") =~ m,shellies/([^/]*)/, ? $1 : undef } attr DEVICE comment shelly2 roller operated attr DEVICE setList \ open:noArg shellies/DEVNAME/roller/0/command open\ close:noArg shellies/DEVNAME/roller/0/command close\ stop:noArg shellies/DEVNAME/roller/0/command stop\ pct:slider,0,1,100 shellies/DEVNAME/roller/0/command/pos $EVTPART1\ x_recalibration:noArg shellies/DEVNAME/roller/0/command rc\ x_update:noArg shellies/DEVNAME/command update_fw\ x_mqttcom shellies/DEVNAME/command $EVTPART1 attr DEVICE readingList \ shellies/DEVNAME/roller/0/pos:.* pct\ shellies/DEVNAME/status/0/rollers:.* power\ shellies/DEVNAME/online:.* online\ shellies/DEVNAME/announce:.* { json2nameValue($EVENT) }\ shellies/announce:.* { $EVENT =~ m,..id...DEVNAME...mac.*, ? json2nameValue($EVENT) : return }\ shellies/DEVNAME/roller/0:.* state\ shellies/DEVNAME/input/1:.* input1\ shellies/DEVNAME/input/0:.* input0 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 set_.*:fts_shutter_updown attr DEVICE stateFormat pct deletereading -q DEVICE (?!associatedWith|IODev).* attr DEVICE setStateList open close stop set DEVICE x_mqttcom announce attr DEVICE eventMap open:opens close:closes set DEVICE attrTemplate speechcontrol_type_blind attr DEVICE model shelly2_roller setreading DEVICE attrTemplateVersion 20201206 # shelly25 using original firmware in roller mode. # contributed by 87insane, https://forum.fhem.de/index.php/topic,94060.msg940978.html#msg940978 name:shelly25_roller_invert_0 filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*shellies.* desc:shelly25 using original firmware.
NOTE: shelly25 roller operated, change settings first! order:A_11b1a par:DEVNAME;Shellyswitch25 name in the topic;{ AttrVal("DEVICE","readingList","") =~ m,shellies/([^/]*)/, ? $1 : undef } attr DEVICE comment Shelly 2.5 in Roller-Mode. 100=opened / 0=closed attr DEVICE setList \ open:noArg shellies/DEVNAME/roller/0/command open\ close:noArg shellies/DEVNAME/roller/0/command close\ half:noArg shellies/DEVNAME/roller/0/command/pos 50\ stop:noArg shellies/DEVNAME/roller/0/command stop\ pct:slider,0,1,100 shellies/DEVNAME/roller/0/command/pos $EVTPART1\ x_recalibration:noArg shellies/DEVNAME/roller/0/command rc\ x_update:noArg shellies/DEVNAME/command update_fw\ x_mqttcom shellies/DEVNAME/command $EVTPART1 attr DEVICE readingList \ shellies/DEVNAME/roller/0/pos:.* pct\ shellies/DEVNAME/status/0/rollers:.* power\ shellies/DEVNAME/online:.* online\ shellies/DEVNAME/announce:.* { json2nameValue($EVENT) }\ shellies/announce:.* { $EVENT =~ m,..id...DEVNAME...mac.*, ? json2nameValue($EVENT) : return }\ shellies/DEVNAME/roller/0:.* current\ shellies/DEVNAME/roller/0:open {{'state' => 'opening'}}\ shellies/DEVNAME/roller/0:close {{'state' => 'closing'}}\ shellies/DEVNAME/roller/0/pos:.* state\ shellies/DEVNAME/input/1:.* input1\ shellies/DEVNAME/input/0:.* input0\ shellies/DEVNAME/relay/power:.* power\ shellies/DEVNAME/relay/energy:.* energy\ shellies/DEVNAME/temperature:.* temperature\ shellies/DEVNAME/overtemperature:.* overtemperature\ shellies/DEVNAME/roller/0/power:.* roller_0_power\ shellies/DEVNAME/roller/0/energy:.* roller_0_energy\ shellies/DEVNAME/temperature_f:.* temperature_f attr DEVICE devStateIcon .*/open:fts_shutter_up@red .*/close:fts_shutter_down@red true:10px-kreis-gruen false:10px-kreis-rot 0/stop:fts_shutter_100 100/stop:fts_shutter_10 9\d/stop:fts_shutter_10 8\d/stop:fts_shutter_20 7\d/stop:fts_shutter_30 6\d/stop:fts_shutter_40 5\d/stop:fts_shutter_50 4\d/stop:fts_shutter_60 3\d/stop:fts_shutter_70 2\d/stop:fts_shutter_80 1\d/stop:fts_shutter_90 0\d/stop:fts_shutter_100 set_.*:fts_shutter_updown attr DEVICE stateFormat \ online\ \ state/current 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 deletereading -q DEVICE (?!associatedWith|IODev).* attr DEVICE setStateList open close half stop pct attr DEVICE eventMap open:opens close:closes set DEVICE x_mqttcom announce set DEVICE attrTemplate speechcontrol_type_blind attr DEVICE model shelly25_roller_invert_0 setreading DEVICE attrTemplateVersion 20210126 name:shelly25_roller_invert_1 filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*shellies.* desc:shelly25 using original firmware.
NOTE: shelly25 roller operated, change settings first! order:A_11b1b par:DEVNAME;Shellyswitch25 name in the topic;{ AttrVal("DEVICE","readingList","") =~ m,shellies/([^/]*)/, ? $1 : undef } attr DEVICE comment Shelly 2.5 in Roller-Mode. 0=opened / 100=closed attr DEVICE setList \ open:noArg shellies/DEVNAME/roller/0/command open\ close:noArg shellies/DEVNAME/roller/0/command close\ half:noArg shellies/DEVNAME/roller/0/command/pos 50\ stop:noArg shellies/DEVNAME/roller/0/command stop\ pct:slider,0,1,100 {"shellies/DEVNAME/roller/0/command/pos ".(100-$EVTPART1)}\ x_recalibration:noArg shellies/DEVNAME/roller/0/command rc\ x_update:noArg shellies/DEVNAME/command update_fw\ x_mqttcom shellies/DEVNAME/command $EVTPART1 attr DEVICE readingList \ shellies/DEVNAME/roller/0/pos:.* {'pct' => 100-$EVENT}\ shellies/DEVNAME/status/0/rollers:.* power\ shellies/DEVNAME/online:.* online\ shellies/DEVNAME/announce:.* { json2nameValue($EVENT) }\ shellies/announce:.* { $EVENT =~ m,..id...DEVNAME...mac.*, ? json2nameValue($EVENT) : return }\ shellies/DEVNAME/roller/0:.* current\ shellies/DEVNAME/roller/0:open {{'state' => 'opening'}}\ shellies/DEVNAME/roller/0:close {{'state' => 'closing'}}\ shellies/DEVNAME/roller/0/pos:.* {'state' => 100-$EVENT}\ shellies/DEVNAME/input/1:.* input1\ shellies/DEVNAME/input/0:.* input0\ shellies/DEVNAME/relay/power:.* power\ shellies/DEVNAME/relay/energy:.* energy\ shellies/DEVNAME/temperature:.* temperature\ shellies/DEVNAME/overtemperature:.* overtemperature\ shellies/DEVNAME/roller/0/power:.* roller_0_power\ shellies/DEVNAME/roller/0/energy:.* roller_0_energy\ shellies/DEVNAME/temperature_f:.* temperature_f attr DEVICE devStateIcon .*/open:fts_shutter_up@red .*/close:fts_shutter_down@red true:10px-kreis-gruen false:10px-kreis-rot 0/stop:fts_shutter_100 100/stop:fts_shutter_10 9\d/stop:fts_shutter_10 8\d/stop:fts_shutter_20 7\d/stop:fts_shutter_30 6\d/stop:fts_shutter_40 5\d/stop:fts_shutter_50 4\d/stop:fts_shutter_60 3\d/stop:fts_shutter_70 2\d/stop:fts_shutter_80 1\d/stop:fts_shutter_90 0\d/stop:fts_shutter_100 set_.*:fts_shutter_updown attr DEVICE stateFormat \ online\ \ state/current 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 deletereading -q DEVICE (?!associatedWith|IODev).* attr DEVICE setStateList open close half stop pct attr DEVICE eventMap open:opens close:closes set DEVICE x_mqttcom announce set DEVICE attrTemplate speechcontrol_type_blind attr DEVICE model shelly25_roller_invert_1 setreading DEVICE attrTemplateVersion 20210126 # shelly2 using original firmware. # NOTE: a second device will be created for the second channel name:shelly2_split filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*shellies.* desc:shelly2 using original firmware.
NOTE: a second device will be created for the second channel order:A_11a set DEVICE attrTemplate shellyplug par:DEVNAME;Shelly2 name in the topic;{ AttrVal("DEVICE","readingList","") =~ m,shellies/([^/]*)/, ? $1 : undef } set DEVICE attrTemplate set_associatedWith \CHANNELS=2 \MAKECOPIES=1 defmod DEVICE_CH2 MQTT2_\DEVICE DEVICE_CH2 attr DEVICE_CH2 readingList shellies/DEVNAME/relay/1:.* state attr DEVICE_CH2 setList \ off:noArg shellies/DEVNAME/relay/1/command off\ on:noArg shellies/DEVNAME/relay/1/command on attr DEVICE,DEVICE_CH2 model shelly2_split set DEVICE,DEVICE_CH2 attrTemplate speechcontrol_type_switch setreading DEVICE,DEVICE_CH2 attrTemplateVersion 20220127 # shelly2.5 using original firmware. # Based on user 87insane contribution in https://forum.fhem.de/index.php/topic,94060.msg962167.html#msg962167 # NOTE: a second device will be created for the second channel name:shelly25_split filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*shellies.* desc:shelly2.5 using original firmware.
NOTE: a second device will be created for the second channel order:A_11a1 par:DEVNAME;Shelly2 name in the topic;{ AttrVal("DEVICE","readingList","") =~ m,shellies/([^/]*)/, ? $1 : undef } par:RADIO_SETUSERREADING;Set userreading for total energy consumption;{ undef } par:RADIO_DONOTSETUSERREADING;Do not set userreading for total energy consumption;{ undef } par:CALLSPEECHRECOGN;Set this to 0 to not set any speech recogn. related attributes;{ 1 } set DEVICE attrTemplate shelly1_w_energy_measuring \CALLSPEECHRECOGN=0 \RADIO_SETUSERREADING=RADIO_SETUSERREADING \RADIO_DONOTSETUSERREADING=RADIO_DONOTSETUSERREADING set DEVICE attrTemplate set_associatedWith \CHANNELS=2 \MAKECOPIES=1 defmod DEVICE_CH2 MQTT2_\DEVICE DEVICE_CH2 attr DEVICE_CH2 readingList shellies/DEVNAME/relay/1:.* state\ shellies/DEVNAME/relay/1:.* relay1\ shellies/DEVNAME/input/1:.* input1\ shellies/DEVNAME/online:.* online\ shellies/announce:.* { $EVENT =~ m,..id...DEVNAME...mac.*, ? json2nameValue($EVENT) : return }\ shellies/DEVNAME/announce:.* { json2nameValue($EVENT) }\ shellies/DEVNAME/relay/1/power:.* relay_1_power\ shellies/DEVNAME/relay/1/power:.* { my $compare = $EVTPART0 < 100 ? "off":"on"; ReadingsVal($NAME,"loadState","off") ne $compare ? { 'loadState' => $compare } : return }\ shellies/DEVNAME/temperature:.* temperature\ shellies/DEVNAME/overtemperature:.* overtemperature\ shellies/DEVNAME/temperature_f:.* temperature_f\ shellies/DEVNAME/relay/1/energy:.* relay_1_energy\ shellies/DEVNAME/relay/1/energy:.* {'relay_1_kWh' => sprintf("%.2f",$EVENT/60/1000)}\ shellies/DEVNAME/longpush/1:.* longpush_1\ shellies/DEVNAME/input_event/1:.* { json2nameValue($EVENT) } attr DEVICE_CH2 setList \ off:noArg shellies/DEVNAME/relay/1/command off\ on:noArg shellies/DEVNAME/relay/1/command on attr DEVICE_CH2 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_1_power","unknown"); my $temp = ReadingsVal($name,"temperature","-100");"
".FW_makeImage($onl)." ".FW_makeImage($light)." Aktuell: $cons W / Temp.: $temp °C"} attr DEVICE,DEVICE_CH2 model shelly25_split setreading DEVICE,DEVICE_CH2 attrTemplateVersion 20220127 option:{ CALLSPEECHRECOGN } set DEVICE,DEVICE_CH2 attrTemplate speechcontrol_type_switch # shelly4pro using original firmware name:shelly4pro_split filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*shellies.* desc:shelly4pro using original firmware
NOTE: for each of the second to fourth channel, a new device will be created order:A_14a1 par:DEVNAME;Shelly4Pro name in the topic;{ AttrVal("DEVICE","readingList","") =~ m,shellies/([^/]*)/, ? $1 : undef } set DEVICE attrTemplate shellyplug attr DEVICE getList \ power0:noArg shellies/DEVNAME/relay/0/power power0\ energy0:noArg shellies/DEVNAME/relay/0/energy energy0 attr DEVICE model shelly4pro_split setreading DEVICE attrTemplateVersion 20220127 set DEVICE attrTemplate set_associatedWith \CHANNELS=4 \MAKECOPIES=1 defmod DEVICE_CH2,DEVICE_CH3,DEVICE_CH4 MQTT2_\DEVICE DEVICE_channels attr DEVICE_CH2 readingList shellies/DEVNAME/relay/1:.* state attr DEVICE_CH2 setList \ off:noArg shellies/DEVNAME/relay/1/command off\ on:noArg shellies/DEVNAME/relay/1/command on attr DEVICE getList \ power1:noArg shellies/DEVNAME/relay/1/power power1\ energy1:noArg shellies/DEVNAME/relay/1/energy energy1 attr DEVICE_CH3 readingList shellies/DEVNAME/relay/2:.* state attr DEVICE_CH3 setList \ off:noArg shellies/DEVNAME/relay/2/command off\ on:noArg shellies/DEVNAME/relay/2/command on attr DEVICE_CH3 getList \ power2:noArg shellies/DEVNAME/relay/2/power power2\ energy2:noArg shellies/DDEVNAME/relay/2/energy energy2 attr DEVICE_CH4 readingList shellies/DEVNAME/relay/3:.* state attr DEVICE_CH4 setList \ off:noArg shellies/DEVNAME/relay/3/command off\ on:noArg shellies/DEVNAME/relay/3/command on attr DEVICE_CH4 getList \ power3:noArg shellies/DEVNAME/relay/3/power power3\ energy3:noArg shellies/DEVNAME/relay/3/energy energy3 set DEVICE,DEVICE_CH2,DEVICE_CH3,DEVICE_CH4 attrTemplate speechcontrol_type_switch # shelly4pro unified device using original firmware # source: https://forum.fhem.de/index.php/topic,97218.msg905689.html#msg905689 name:shelly4pro_unified filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*shellies.* desc:shelly4pro using original firmware
NOTE: UNTESTED! feedback is apreciated, please try also to add toggle commands
NOTE: only one device will be created. order:A_14b par:DEVNAME;Shelly4Pro name in the topic;{ AttrVal("DEVICE","readingList","") =~ m,shellies/([^/]*)/, ? $1 : undef } set DEVICE attrTemplate shellyplug attr DEVICE getList \ power0:noArg shellies/DEVNAME/relay/0/power power0\ energy0:noArg shellies/DEVNAME/relay/0/energy energy0\ power1:noArg shellies/DEVNAME/relay/1/power power1\ energy1:noArg shellies/DEVNAME/relay/1/energy energy1\ power2:noArg shellies/DEVNAME/relay/2/power power2\ energy2:noArg shellies/DDEVNAME/relay/2/energy energy2\ power3:noArg shellies/DEVNAME/relay/3/power power3\ energy3:noArg shellies/DEVNAME/relay/3/energy energy3 attr DEVICE readingList \ shellies/DEVNAME/relay/0:.* relay0\ shellies/DEVNAME/input/0:.* input0\ shellies/DEVNAME/relay/1:.* relay1\ shellies/DEVNAME/input/1:.* input1\ shellies/DEVNAME/relay/2:.* relay2\ shellies/DEVNAME/input/2:.* input2\ shellies/DEVNAME/relay/3:.* relay3\ shellies/DEVNAME/input/3:.* input3\ shellies/DEVNAME/online:.* online\ shellies/DEVNAME/announce:.* { json2nameValue($EVENT) }\ shellies/announce:.* { $EVENT =~ m,..id...DEVNAME...mac.*, ? json2nameValue($EVENT) : return }\ shellies/DEVNAME/relay/0/power:.* power0\ shellies/DEVNAME/relay/1/power:.* power1\ shellies/DEVNAME/relay/2/power:.* power2\ shellies/DEVNAME/relay/3/power:.* power3\ shellies/DEVNAME/relay/0/energy:.* energy0\ shellies/DEVNAME/relay/1/energy:.* energy1\ shellies/DEVNAME/relay/2/energy:.* energy2\ shellies/DEVNAME/relay/3/energy:.* energy3 attr DEVICE setList \ relay0:iconSwitch,on,li_wht_off,off,li_wht_on shellies/DEVNAME/relay/0/command $EVTPART1\ relay1:iconSwitch,on,li_wht_off,off,li_wht_on shellies/DEVNAME/relay/1/command $EVTPART1\ relay2:iconSwitch,on,li_wht_off,off,li_wht_on shellies/DEVNAME/relay/2/command $EVTPART1\ relay3:iconSwitch,on,li_wht_off,off,li_wht_on shellies/DEVNAME/relay/3/command $EVTPART1\ x_update:noArg shellies/DEVNAME/command update_fw\ x_mqttcom shellies/DEVNAME/command $EVTPART1 attr DEVICE webCmd relay0:relay1:relay2:relay3 attr DEVICE stateFormat R0: relay0 R1: relay1 R2: relay2 R3: relay3 attr DEVICE model shelly4pro_unified setreading DEVICE attrTemplateVersion 20200522 or prior #shellybulb using original firmware # some modifications by Rico, https://forum.fhem.de/index.php/topic,123486.msg1185455.html#msg1185455 name:shellybulb filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*shellies.* desc:shellybulb using original firmware
Tested with 1.49 order:A_15 par:DEVNAME;name of this shelly;{ AttrVal('DEVICE','readingList','') =~ m,shellies/([^/]+)/, ? $1 : undef } par:ICON;ICON as set, defaults to light_control;{ AttrVal('DEVICE','icon','light_control') } attr DEVICE icon ICON 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,'light_0_power','unknown'); ''.FW_makeImage($onl)." ".FW_makeImage($light)."
Verbrauch: $cons
"} attr DEVICE setList\ off:noArg shellies/DEVNAME/color/0/command off\ on:noArg shellies/DEVNAME/color/0/command on\ effect:selectnumbers,0,1,3,0,lin shellies/DEVNAME/color/0/set {"turn": "on","mode":"color","effect":$EVTPART1}\ pct:colorpicker,BRI,0,1,100 shellies/DEVNAME/color/0/set {"turn":"on","gain":$EVTPART1,"brightness":$EVTPART1}\ ct:colorpicker,CT,3000,10,6500 {$EVTPART1=3000 if $EVTPART1<3000;qq(shellies/DEVNAME/color/0/set {"turn":"on","mode":"white","temp":$EVTPART1})}\ rgb:colorpicker,RGB {return 'shellies/DEVNAME/color/0/command off' if $EVTPART1 eq '000000'; return 'shellies/DEVNAME/color/0/set {"turn":"on","mode":"white","temp":4000}' if $EVTPART1 eq 'FFFFFF'; $EVTPART1=~/(..)(..)(..)/; return if !defined $3; if($1 ne $2 || $2 ne $3){q(shellies/DEVNAME/color/0/set {"mode":"color","gain":"100","turn":"on","red":).hex($1).q(,"green":).hex($2).q(,"blue":).hex($3).'}'}else{q(shellies/DEVNAME/color/0/set {"turn":"on","mode":"white","brightness":).int(hex($1)/2.55).'}'}}\ x_update:noArg shellies/DEVNAME/command update_fw\ x_mqttcom shellies/DEVNAME/command $EVTPART1 deletereading -q DEVICE status_.* attr DEVICE readingList shellies/DEVNAME/color/0/status:.* {json2nameValue($EVENT,'',$JSONMAP)} attr DEVICE userReadings ct:temp.* {ReadingsVal($name,"temp",3000)}, rgb:red.* {if(ReadingsVal($name,'mode','') eq 'color'){sprintf("%02X%02X%02X", ReadingsVal($name,'red',99), ReadingsVal($name,'green',99), ReadingsVal($name,'blue',99))}else{my $a=sprintf("%02X",ReadingsVal($name,'brightness',0)*2.555);"$a$a$a"}} attr DEVICE webCmd on:off:pct:ct:rgb:effect attr DEVICE jsonMap brightness:pct set DEVICE x_mqttcom announce set DEVICE attrTemplate speechcontrol_type_light attr DEVICE model shellybulb setreading DEVICE attrTemplateVersion 20211116 # contributed by KurtK https://forum.fhem.de/index.php/topic,94495.msg1055093.html#msg1055093 # shellyduo using original firmware name:shellyduo filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*shellies.* desc:Shelly Duo using original firmware
Tested with firmware 20200320-123338/v1.6.2@514044b4
based on shellybulb and shelliergbw2 template order:A_15a par:DEVNAME;name of this shelly;{ AttrVal('DEVICE','readingList','') =~ m,shellies/([^/]+)/, ? $1 : undef } par:ICON;ICON as set, defaults to light_control;{ AttrVal('DEVICE','icon','light_control') } attr DEVICE icon ICON attr DEVICE setList\ off:noArg shellies/DEVNAME/light/0/command off\ on:noArg shellies/DEVNAME/light/0/command on\ pct:colorpicker,BRI,0,1,100 shellies/DEVNAME/light/0/set {"gain":"$EVTPART1","brightness":$EVTPART1}\ pct_on:colorpicker,BRI,0,1,100 shellies/DEVNAME/light/0/set {"turn":"on","gain":$EVTPART1,"brightness":$EVTPART1}\ ct:colorpicker,CT,3000,10,6500 {$EVTPART1=3000 if $EVTPART1<3000;qq(shellies/DEVNAME/color/0/set {"mode":"white","temp":$EVTPART1})}\ ct_on:colorpicker,CT,3000,10,6500 {$EVTPART1=3000 if $EVTPART1<3000;qq(shellies/DEVNAME/color/0/set {"turn":"on","mode":"white","temp":$EVTPART1})}\ x_update:noArg shellies/DEVNAME/command update_fw\ x_mqttcom shellies/DEVNAME/command $EVTPART1 deletereading -q DEVICE status_.* attr DEVICE readingList\ shellies/DEVNAME/light/0/status:.* {json2nameValue($EVENT,'',$JSONMAP)}\ shellies/DEVNAME/light/0/power:.* power\ shellies/DEVNAME/light/0/energy:.* energy\ shellies/DEVNAME/light/0:.* state\ shellies/DEVNAME/online:.* online\ shellies/announce:.* { $EVENT =~ m,..id...DEVNAME...mac.*, ? json2nameValue($EVENT) : return } attr DEVICE userReadings ct:temp.* {ReadingsVal($name,"temp",3000)} attr DEVICE webCmd on:off:pct:ct 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,'power','unknown'); ''.FW_makeImage($onl)." ".FW_makeImage($light)."
Verbrauch: $cons
"} attr DEVICE jsonMap brightness:pct set DEVICE x_mqttcom announce set DEVICE attrTemplate speechcontrol_type_light attr DEVICE model shellyduo setreading DEVICE attrTemplateVersion 20211022 #contributed by MrTom, https://forum.fhem.de/index.php/topic,94060.msg1135513.html#msg1135513 name:shellymotion filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*shellies.* desc:shellymotion using original firmware. order:A_16 par:DEVNAME;name of this shelly;{ AttrVal('DEVICE','readingList','') =~ m,shellies/([^/]+)/, ? $1 : undef } par:ICON;ICON as set, defaults to motion_detector;{ AttrVal('DEVICE','icon','motion_detector') } attr DEVICE icon ICON attr DEVICE devStateIcon {my $onl = ReadingsVal($name,'online','false') eq 'true'?'10px-kreis-gruen':'10px-kreis-rot'; \ my $moti = ReadingsVal($name,"motion","false") eq "true"?"people_sensor":"message_presence"; \ "".FW_makeImage($onl)." ".FW_makeImage($moti).""} attr DEVICE readingList shellies/DEVNAME/online:.* online\ shellies/DEVNAME/sensor/status:.* { json2nameValue($EVENT) }\ shellies/DEVNAME/announce:.* { json2nameValue($EVENT) }\ shellies/announce:.* { $EVENT =~ m,..id...DEVNAME...mac.*, ? json2nameValue($EVENT) : return } attr DEVICE setList x_update:noArg shellies/DEVNAME/command update_fw\ x_mqttcom shellies/DEVNAME/command $EVTPART1 attr DEVICE model shellymotion setreading DEVICE attrTemplateVersion 20210324 # shellyht using original firmware name:shellyht filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*shellies.* desc:shellyht using original firmware
Just adds stateFormat and icon order:A_161 par:DEVNAME;name of this shelly;{ AttrVal("DEVICE","readingList","") =~ m,shellies/([^/]+)/, ? $1 : undef } par:ICON;ICON as set, defaults to temperature_humidity;{ AttrVal("DEVICE","icon","temperature_humidity") } attr DEVICE icon ICON attr DEVICE setList \ x_update:noArg shellies/DEVNAME/command update_fw\ x_mqttcom shellies/DEVNAME/command $EVTPART1 attr DEVICE stateFormat T: temperature °C H: humidity % B: battery % set DEVICE x_mqttcom announce attr DEVICE model shellyht setreading DEVICE attrTemplateVersion 20200522 or prior # shellyflood using original firmware name:shellyflood filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*shellies.* desc:shellyht using original firmware
Just adds stateFormat and icon order:A_16a par:DEVNAME;name of this shelly;{ AttrVal("DEVICE","readingList","") =~ m,shellies/([^/]+)/, ? $1 : undef } par:ICON;ICON as set, defaults to humidity;{ AttrVal("DEVICE","icon","humidity") } attr DEVICE icon ICON attr DEVICE setList \ x_update:noArg shellies/DEVNAME/command update_fw\ x_mqttcom shellies/DEVNAME/command $EVTPART1 attr DEVICE readingList shellies/DEVICE/online:.* online\ shellies/DEVNAME/announce:.* { json2nameValue($EVENT,'',$JSONMAP) }\ shellies/DEVNAME/sensor/temperature:.* temperature\ shellies/DEVNAME/sensor/flood:.* flood\ shellies/DEVNAME/sensor/battery:.* batteryPercent\ shellies/DEVNAME/sensor/error:.* error\ shellies/DEVNAME/sensor/act_reasons:.* { json2nameValue($EVENT,'',$JSONMAP) } attr DEVICE jsonMap 1:report attr DEVICE stateFormat flood (bat batteryPercent%) deletereading -q DEVICE (?!associatedWith|IODev).* set DEVICE x_mqttcom announce attr DEVICE model shellyflood setreading DEVICE attrTemplateVersion 20211019 # shellygas using original firmware name:shellygas filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*shellies.* desc:shellygas using original firmware
Adds stateFormat, setlist, icon, devStateIcon order:A_16b par:DEVNAME;name of this shelly;{ AttrVal("DEVICE","readingList","") =~ m,shellies/([^/]+)/, ? $1 : undef } attr DEVICE icon feinstaub attr DEVICE devStateIcon none:ampel_gruen mild:ampel_gelb heavy:ampel_rot test:ampel_gruen attr DEVICE setList \ start_self_test:noArg shellies/DEVNAME/sensor/start_self_test\ mute:noArg shellies/DEVNAME/sensor/mute\ unmute:noArg shellies/DEVNAME/sensor/unmute\ x_update:noArg shellies/DEVNAME/command update_fw\ x_mqttcom shellies/DEVNAME/command $EVTPART1 attr DEVICE stateFormat gas deletereading -q DEVICE (?!associatedWith|IODev).* set DEVICE x_mqttcom announce attr DEVICE model shellygas setreading DEVICE attrTemplateVersion 20201103 # shellydw using original firmware # contributed by majestro84, https://forum.fhem.de/index.php/topic,94060.msg1054466.html#msg1054466 name:shellydw filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*shellies.* desc:shellydw using original firmware.
Note: can be configered als two- or three-state sensor. order:A_16b 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 devStateIcon open:fts_window_1w_open@red tilted:fts_window_1w_tilt@yellow closed:fts_window_1w@green attr DEVICE readingList shellies/DEVNAME/online:.* online\ shellies/DEVNAME/sensor/state:.* doorWindow\ shellies/DEVNAME/sensor/tilt:.* tilt\ shellies/DEVNAME/sensor/vibration:.* vibration\ shellies/DEVNAME/sensor/lux:.* lux\ shellies/DEVNAME/sensor/battery:.* batteryPercent\ shellies/DEVNAME/announce:.* { json2nameValue($EVENT) }\ shellies/announce:.* { $EVENT =~ m,..id...DEVNAME...mac.*, ? json2nameValue($EVENT) : return } attr DEVICE setList x_update:noArg shellies/DEVNAME/command update_fw\ x_mqttcom shellies/DEVNAME/command $EVTPART1 attr DEVICE userReadings state:(doorWindow|tilt).* { ReadingsVal($name,"doorWindow","") eq "close" ? 'closed' : ReadingsNum($name,"tilt",1) > 0 ? 'tilted' :'open' } 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 readingList shellies/DEVNAME/online:.* online\ shellies/DEVNAME/announce:.* { json2nameValue($EVENT) }\ shellies/DEVNAME/input/0:.* input_0\ shellies/DEVNAME/input/1:.* input_1\ shellies/DEVNAME/input/2:.* input_2\ shellies/DEVNAME/input_event/0:.* { json2nameValue($EVENT, '0_', $JSONMAP) }\ shellies/DEVNAME/input_event/1:.* { json2nameValue($EVENT, '1_', $JSONMAP) }\ shellies/DEVNAME/input_event/2:.* { json2nameValue($EVENT, '2_', $JSONMAP) } 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 20210108 #shelly2rgbw # contributed by dkreutz http://forum.fhem.de/index.php/topic,94060.msg944338.html#msg944338 # shellyrgbw2 color mode name:shelly2rgbw_color filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*shellies.* desc:shellyrgbw2 color mode
Tested with 1.5.0-rgbw2-hotfix1 order:A_17 par:DEVNAME;name of this shelly;{ AttrVal('DEVICE','readingList','') =~ m,shellies/([^/]+)/, ? $1 : undef } par:ICON;ICON as set, defaults to light_control;{ AttrVal('DEVICE','icon','light_control') } attr DEVICE icon ICON attr DEVICE setList\ off:noArg shellies/DEVNAME/color/0/command off\ on:noArg shellies/DEVNAME/color/0/command on\ brightness:colorpicker,BRI,0,1,255 shellies/DEVNAME/white/0/set {"mode":"white","brightness":$EVTPART1}\ white:colorpicker,BRI,0,1,255 shellies/DEVNAME/color/0/set {"white":$EVTPART1}\ gain:colorpicker,BRI,0,1,100 shellies/DEVNAME/color/0/set {"gain":"$EVTPART1"}\ rgb:colorpicker,RGB {$EVTPART1=~/(..)(..)(..)/;return if !defined $3;if($1 ne $2 || $2 ne $3){qq(shellies/DEVNAME/color/0/set {"mode":"color","gain":"100","red":).hex($1).qq(,"green":).hex($2).qq(,"blue":).hex($3).'}'}else{qq(shellies/DEVNAME/color/0/set {"turn":"on","mode":"white","brightness":).int(hex($1)/2.55).'}'}}\ white_on:colorpicker,BRI,0,1,100 shellies/DEVNAME/color/0/set {"turn":"on","white":$EVTPART1}\ gain_on:colorpicker,BRI,0,1,100 shellies/DEVNAME/color/0/set {"turn":"on","gain":$EVTPART1}\ rgb_on:colorpicker,RGB {$EVTPART1=~/(..)(..)(..)/;return if !defined $3;if($1 ne $2 || $2 ne $3){qq(shellies/DEVNAME/color/0/set {"turn":"on","mode":"color","gain":"100","red":).hex($1).qq(,"green":).hex($2).qq(,"blue":).hex($3).'}'}else{qq(shellies/DEVNAME/color/0/set {"turn":"on","mode":"white","brightness":).int(hex($1)/2.55).'}'}}\ effect:selectnumbers,0,1,6,0,lin shellies/DEVNAME/color/0/set {"effect":$EVTPART1}\ x_update:noArg shellies/DEVNAME/command update_fw\ x_mqttcom shellies/DEVNAME/command $EVTPART1 deletereading -q DEVICE status_.* attr DEVICE readingList \ shellies/DEVNAME/color/0/status:.* {json2nameValue($EVENT)}\ shellies/DEVNAME/color/0:.* state\ shellies/DEVNAME/online:.* online\ shellies/announce:.* { $EVENT =~ m,..id...DEVNAME...mac.*, ? json2nameValue($EVENT) : return } attr DEVICE userReadings rgb:red.* {if(ReadingsVal($name,"mode","") eq "color"){sprintf("%02X%02X%02X", ReadingsVal($name,"red",99), ReadingsVal($name,"green",99), ReadingsVal($name,"blue",99))}else{my $a=sprintf("%02X",ReadingsVal($name,"brightness",0)*2.555);"$a$a$a"}} attr DEVICE webCmd on:off:white:gain:rgb:effect attr DEVICE setStateList on off 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,'power','unknown'); ''.FW_makeImage($onl)." ".FW_makeImage($light)."
Verbrauch: $cons
"} set DEVICE x_mqttcom announce set DEVICE attrTemplate speechcontrol_type_light_255 attr DEVICE model shelly2rgbw_color setreading DEVICE attrTemplateVersion 20211022 #contributed by user sledge name:shelly2rgbw_4w_split filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*shellies.* desc:shelly2rgbw configured with 4 white channels, one device for each channel
Tested with v1.4.8 order:A_17a par:DEVNAME;name of this shelly;{ AttrVal("DEVICE","readingList","") =~ m,shellies/([^/]*)/, ? $1 : undef } par:ICON;ICON as set, defaults to light_control;{ AttrVal("DEVICE","icon","light_control") } attr DEVICE icon ICON attr DEVICE readingList shellies/DEVNAME/white/0/status:.* {json2nameValue($EVENT,'',$JSONMAP)}\ shellies/DEVNAME/white/0:.* state\ shellies/DEVNAME/white/0/set:.* { json2nameValue($EVENT) }\ shellies/DEVNAME/online:.* online\ shellies/announce:.* { $EVENT =~ m,..id...DEVNAME...mac.*, ? json2nameValue($EVENT) : return } attr DEVICE setList off:noArg shellies/DEVNAME/white/0/command off\ on:noArg shellies/DEVNAME/white/0/command on\ pct:colorpicker,BRI,0,1,100 shellies/DEVNAME/white/0/set {"mode":"white","brightness":"$EVTPART1"}\ pct_on:colorpicker,BRI,0,1,100 shellies/DEVNAME/white/0/set {"ison":"true","mode":"white","brightness":"$EVTPART1"}\ x_update:noArg shellies/DEVNAME/command update_fw\ x_mqttcom shellies/DEVNAME/command $EVTPART1 deletereading -q DEVICE (?!associatedWith|IODev).* setreading DEVICE attrTemplateVersion 20210103 attr DEVICE model shelly2rgbw_4w_split attr DEVICE setStateList on off attr DEVICE webCmd on:off:pct set DEVICE attrTemplate set_associatedWith \CHANNELS=4 \MAKECOPIES=1 set DEVICE x_mqttcom announce attr DEVICE autocreate 0 attr DEVICE_CH2 readingList shellies/DEVNAME/white/1/status:.* {json2nameValue($EVENT,'',$JSONMAP)}\ shellies/DEVNAME/white/1:.* state\ shellies/DEVNAME/white/1/set:.* { json2nameValue($EVENT) }\ shellies/DEVNAME/online:.* online attr DEVICE_CH2 setList off:noArg shellies/DEVNAME/white/1/command off\ on:noArg shellies/DEVNAME/white/1/command on\ pct:colorpicker,BRI,0,1,100 shellies/DEVNAME/white/1/set {"mode":"white","brightness":"$EVTPART1"}\ pct_on:colorpicker,BRI,0,1,100 shellies/DEVNAME/white/1/set {"ison":"true","mode":"white","brightness":"$EVTPART1"} attr DEVICE_CH3 readingList shellies/DEVNAME/white/2/status:.* {json2nameValue($EVENT,'',$JSONMAP)}\ shellies/DEVNAME/white/2:.* state\ shellies/DEVNAME/white/2/set:.* { json2nameValue($EVENT) }\ shellies/DEVNAME/online:.* online attr DEVICE_CH3 setList off:noArg shellies/DEVNAME/white/2/command off\ on:noArg shellies/DEVNAME/white/2/command on\ pct:colorpicker,BRI,0,1,100 shellies/DEVNAME/white/2/set {"mode":"white","brightness":"$EVTPART1"}\ pct_on:colorpicker,BRI,0,1,100 shellies/DEVNAME/white/2/set {"ison":"true","mode":"white","brightness":"$EVTPART1"} attr DEVICE_CH4 readingList shellies/DEVNAME/white/3/status:.* {json2nameValue($EVENT,'',$JSONMAP)}\ shellies/DEVNAME/white/3:.* state\ shellies/DEVNAME/white/3/set:.* { json2nameValue($EVENT) }\ shellies/DEVNAME/online:.* online attr DEVICE_CH4 setList off:noArg shellies/DEVNAME/white/3/command off\ on:noArg shellies/DEVNAME/white/3/command on\ pct:colorpicker,BRI,0,1,100 shellies/DEVNAME/white/3/set {"mode":"white","brightness":"$EVTPART1"}\ pct_on:colorpicker,BRI,0,1,100 shellies/DEVNAME/white/3/set {"ison":"true","mode":"white","brightness":"$EVTPART1"} set DEVICE,DEVICE_CH2,DEVICE_CH3,DEVICE_CH4 attrTemplate speechcontrol_type_light #shellydimmer # contributed by zeppelin, https://forum.fhem.de/index.php/topic,94495.msg994764.html#msg994764 name:shellydimmer filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*shellies.* desc:shellydimmer
Tested with 20191119-085746/master@e3a747f5 order:A_18 par:DEVNAME;name of this shelly;{ AttrVal("DEVICE","readingList","") =~ m,shellies/([^/]+)/, ? $1 : undef } par:ICON;ICON as set, defaults to light_control;{ AttrVal("DEVICE","icon","light_control") } attr DEVICE icon ICON attr DEVICE setList\ off:noArg shellies/DEVNAME/light/0/command off\ on:noArg shellies/DEVNAME/light/0/command on\ pct:slider,0,1,100 shellies/DEVNAME/light/0/set {"turn": "on","brightness": $EVTPART1}\ dimup:noArg { my $num=int((ReadingsNum($NAME,'pct',0)+4)/10)*10+10; return qq {shellies/DEVNAME/light/0/set {"turn": "on", "brightness": $num}}; }\ dimdown:noArg { my $num=int((ReadingsNum($NAME,'pct',0)+7)/10)*10-10; return qq {shellies/DEVNAME/light/0/set {"turn": "on", "brightness": $num}}; }\ x_mqttcom shellies/DEVNAME/command $EVTPART1 deletereading -q DEVICE status_.* attr DEVICE readingList \ shellies/DEVNAME/light/0/status:.* {json2nameValue($EVENT,'',$JSONMAP)}\ shellies/DEVNAME/light/0:.* state\ shellies/DEVNAME/light/0/power:.* light_0_power\ shellies/DEVNAME/light/0/energy:.* light_0_energy\ shellies/DEVNAME/temperature:.* temperature\ shellies/DEVNAME/temperature_f:.* temperature_f\ shellies/DEVNAME/online:.* online\ shellies/DEVNAME/overtemperature:.* overtemperature\ shellies/DEVNAME/overload:.* overload\ shellies/DEVNAME/loaderror:.* loaderror\ shellies/announce:.* { $EVENT =~ m,..id...DEVNAME...mac.*, ? json2nameValue($EVENT) : return } attr DEVICE webCmd pct:on:off attr DEVICE jsonMap brightness:pct attr DEVICE devStateIcon {my $lderr = ReadingsVal($name,"loaderror","true") eq "true"?"10px-kreis-rot":"10px-kreis-gruen"; my $light = ReadingsVal($name,"ison","false") eq "true"?"on":"off"; my $cons = ReadingsVal($name,"light_0_power","unknown"); FW_makeImage($lderr)."".FW_makeImage($light)."
Leistung: $cons
"} set DEVICE x_mqttcom announce set DEVICE attrTemplate speechcontrol_type_light attr DEVICE model shellydimmer setreading DEVICE attrTemplateVersion 20200831 ########################################### # SHELLY plus section # # shelly devices using the V2 MQTT API https://shelly-api-docs.shelly.cloud/gen2/Overview/RPCChannels#mqtt # Shelly Plus 1 using original firmware. name:shellyPlus_1 filter:TYPE=MQTT2_DEVICE desc:Early version of a base template for second generation shelly devices (names with "plus", without power measurement). NOTE: requires to activate generic status update in firmware settings (if not available: reset device to factory defaults).
NOTE: Please wait some seconds to allow Shelly device to complete reboot. par:DEV_TPC;Shelly name in the topic;{ AttrVal('DEVICE','devicetopic',AttrVal('DEVICE','readingList','')) =~ m<(shellies/[^/]+|shellyp(lus|ro4pm)[^/:_]{4,}+)> ? $1 : undef } par:CALLSPEECHRECOGN;Set this to 0 to not set any speech recogn. related attributes;{ 1 } order:A_20 par:ICON;ICON as set, defaults to message_socket;{ AttrVal('DEVICE','icon','message_socket') } deletereading -q DEVICE (?!associatedWith|IODev).* attr DEVICE icon ICON attr DEVICE devicetopic DEV_TPC attr DEVICE setList\ toggle:noArg $\DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Toggle","params": {"id":0}}\ off:noArg $\DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Set","params": {"id":0,"on":false}}\ on:noArg $\DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Set","params": {"id":0,"on":true}}\ on-for-timer $\DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Set","params": {"id":0,"on":true,"toggle_after":$EVTPART1}}\ off-for-timer $\DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Set","params": {"id":0,"on":false,"toggle_after":$EVTPART1}}\ x_update:noArg $\DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Shelly.Update","params": {"stage":"stable"}}\ x_reboot:noArg $\DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Shelly.Reboot"}\ x_eco:true,false $\DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Sys.SetConfig","params": {"config": {"device": {"eco_mode": $EVTPART1}}}} attr DEVICE readingList $\DEVICETOPIC/online:.* online\ $\DEVICETOPIC/events/rpc:.* { json2nameValue($EVENT,'',$JSONMAP) }\ $\DEVICETOPIC/status/mqtt:.* { json2nameValue($EVENT, 'mqtt_', $JSONMAP) }\ $\DEVICETOPIC/status/sys:.* { json2nameValue($EVENT, 'sys_', $JSONMAP) }\ $\DEVICETOPIC/status/switch_0:.* { $EVENT =~ s/"output":true/"state":"on"/g; $EVENT =~ s/"output":false/"state":"off"/g; json2nameValue($EVENT, 'switch_', $JSONMAP) }\ $\DEVICETOPIC/status/cloud:.* {}\ $\DEVICETOPIC/rpc:.* {}\ fhem2shelly/rpc:.* {} attr DEVICE devStateIcon {my $onl = ReadingsVal($name,'online','false') eq 'false'?'10px-kreis-rot':'10px-kreis-gruen'; $onl = FW_makeImage($onl); my $light = FW_makeImage(ReadingsVal($name,'state','off')); my $temp = ReadingsVal($name,'temperature','-100'); my $ip = ReadingsVal($name,'ip','none'); my $reb = ReadingsVal($name,'sys_restart_required','false') eq 'true'?' ... Notwendigen Reboot durchführen':''; qq(${onl}${light}$reb
Temp: $temp °C
)} attr DEVICE jsonMap switch_state:state switch_temperature_tC:temperature switch_temperature_tF:0 params_wifi_sta_ip:ip attr DEVICE setStateList on off toggle on-for-timer off-for-timer attr DEVICE webCmd : attr DEVICE model shellyPlus_1 setreading DEVICE attrTemplateVersion 20220118 set DEVICE x_reboot option:{ CALLSPEECHRECOGN } set DEVICE attrTemplate speechcontrol_type_switch # Shelly Plus 1PM using original firmware. name:shellyPlus_1pm filter:TYPE=MQTT2_DEVICE desc:Early version of a base template for second generation shelly devices (names with "plus", with power measurement). NOTE: requires to activate generic status update in firmware settings (if not available: reset device to factory defaults).
NOTE: Please wait some seconds to allow Shelly device to complete reboot. par:CALLSPEECHRECOGN;Set this to 0 to not set any speech recogn. related attributes;{ 1 } order:A_20a set DEVICE attrTemplate shellyPlus_1 \CALLSPEECHRECOGN=0 attr DEVICE devStateIcon {my $onl = ReadingsVal($name,'online','false') eq 'false'?'10px-kreis-rot':'10px-kreis-gruen'; $onl = FW_makeImage($onl); my $light = FW_makeImage(ReadingsVal($name,'state','off')); my $cons = ReadingsNum($name,'apower',0); my $total = round(ReadingsNum($name,'aenergy_total',0)/1000,3); my $temp = ReadingsVal($name,'temperature','-100'); my $ip = ReadingsVal($name,'ip','none'); my $reb = ReadingsVal($name,'sys_restart_required','false') eq 'true'?' ... Notwendigen Reboot durchführen':''; qq(${onl}${light}$reb
Verbrauch: $cons W / Total: $total kwh / Temp: $temp °C
)} attr DEVICE jsonMap switch_state:state switch_aenergy_total:aenergy_total switch_apower:apower switch_temperature_tC:temperature switch_temperature_tF:0 params_wifi_sta_ip:ip attr DEVICE model shellyPlus_1pm setreading DEVICE attrTemplateVersion 20220118 option:{ CALLSPEECHRECOGN } set DEVICE attrTemplate speechcontrol_type_switch name:shellypro4pm filter:TYPE=MQTT2_DEVICE desc:Incomlete first version of split template for second generation shelly devices (names with "plus", with power measurement). NOTE: as channels 2-4 do not work, only channel 2 is created for further testing... par:CALLSPEECHRECOGN;Set this to 0 to not set any speech recogn. related attributes;{ 1 } par:DEV_TPC;Shelly name in the topic;{ AttrVal('DEVICE','devicetopic',AttrVal('DEVICE','readingList','')) =~ m<(shellies/[^/]+|shellyp(lus|ro4pm)[^/:_]{4,}+)> ? $1 : undef } order:A_20d set DEVICE attrTemplate shellyPlus_1 \CALLSPEECHRECOGN=0 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'; $onl = FW_makeImage($onl); my $light = FW_makeImage(ReadingsVal($name,'state','off')); my $cons = ReadingsNum($name,'apower',0); my $total = round(ReadingsNum($name,'aenergy_total',0)/1000,1); my $temp = ReadingsVal($name,'temperature','-100'); my $ip = ReadingsVal($name,'ip','none'); qq(${onl}${light}
Verbrauch: $cons W / Total: $total kwh / Temp: $temp °C
)} attr DEVICE readingList $\DEVICETOPIC/online:.* online\ $\DEVICETOPIC/events/rpc:.* { return if $EVENT =~ m{switch:[1-3]}; $EVENT =~ s/"output":true/"state":"on"/g; $EVENT =~ s/"output":false/"state":"off"/g; json2nameValue($EVENT,'',$JSONMAP) }\ fhem2shelly/rpc:.* {} attr DEVICE setList toggle:noArg $\DEVICETOPIC/rpc {"id":1,"src":"fhem2shelly","method":"Switch.Toggle","params": {"id":0}}\ off:noArg $\DEVICETOPIC/rpc {"id":1,"src":"fhem2shelly","method":"Switch.Set","params": {"id":0,"on":false}}\ on:noArg $\DEVICETOPIC/rpc {"id":1,"src":"fhem2shelly","method":"Switch.Set","params": {"id":0,"on":true}}\ on-for-timer $\DEVICETOPIC/rpc {"id":1,"src":"fhem2shelly","method":"Switch.Set","params": {"id":0,"on":true,"toggle_after":$EVTPART1}}\ off-for-timer $\DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Set","params": {"id":0,"on":false,"toggle_after":$EVTPART1}}\ x_update:noArg $\DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Shelly.Update","params": {"stage":"stable"}}\ x_reboot:noArg $\DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Shelly.Reboot"} attr DEVICE jsonMap params_switch_0_state:state params_switch_0_aenergy_total:aenergy_total params_switch_0_apower:apower params_switch_0_temperature_tC:temperature params_switch_0_temperature_tF:0 params_wifi_sta_ip:ip loop:#:1:2:3 copy DEVICE DEVICE_CH# deleteattr DEVICE_CH# stateFormat deleteattr DEVICE_CH# devStateIcon attr DEVICE_CH# jsonMap params_switch_#_state:state params_switch_#_aenergy_total:aenergy_total params_switch_#_apower:apower params_switch_#_temperature_tC:temperature params_switch_#_temperature_tF:0 attr DEVICE_CH# readingList $\DEVICETOPIC/events/rpc:.* { return if $EVENT !~ m{switch:#}; $EVENT =~ s/"output":true/"state":"on"/g; $EVENT =~ s/"output":false/"state":"off"/g; json2nameValue($EVENT,'',$JSONMAP) } attr DEVICE_CH# setList toggle:noArg $\DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Toggle","params": {"id":#}}\ off:noArg $\DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Set","params": {"id":#,"on":false}}\ on:noArg $\DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Set","params": {"id":#,"on":true}}\ on-for-timer $\DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Set","params": {"id":#,"on":true,"toggle_after":$EVTPART1}}\ off-for-timer $\DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Set","params": {"id":#,"on":false,"toggle_after":$EVTPART1}} loop:END rename DEVICE_CH3 DEVICE_CH4 rename DEVICE_CH2 DEVICE_CH3 rename DEVICE_CH1 DEVICE_CH2 loop:#:2:3:4 defmod DEVICE_CH# MQTT2_\DEVICE DEVICE_CH# attr DEVICE_CH# devicetopic DEV_TPC loop:END set DEVICE attrTemplate set_associatedWith \CHANNELS=4 set DEVICE,DEVICE_CH2,DEVICE_CH3,DEVICE_CH4 attrTemplate speechcontrol_type_switch setreading DEVICE,DEVICE_CH2,DEVICE_CH3,DEVICE_CH4 attrTemplateVersion 20220115 attr DEVICE,DEVICE_CH2,DEVICE_CH3,DEVICE_CH4 model shellypro4pm name:shellyPlus_i4 filter:TYPE=MQTT2_DEVICE desc:Untested first version of template for second generation shelly device i4 (named with "plus"). par:DEV_TPC;Shelly name in the topic;{ AttrVal('DEVICE','devicetopic',AttrVal('DEVICE','readingList','')) =~ m<(shellies/[^/]+|shellyp(lus|ro4pm)[^/:_]{4,}+)> ? $1 : undef } par:CALLSPEECHRECOGN;Set this to 0 to not set any speech recogn. related attributes;{ 1 } order:A_20h par:ICON;ICON as set, defaults to fs20_S4A-2_1;{ AttrVal('DEVICE','icon','fs20_S4A-2_1') } deletereading -q DEVICE (?!associatedWith|IODev).* attr DEVICE icon ICON attr DEVICE devicetopic DEV_TPC attr DEVICE readingList $\DEVICETOPIC/online:.* online\ $\DEVICETOPIC/events/rpc:.* { $EVENT =~ m{params...*id..(\d).*event...([^"]+).} ? { state => "$1_$2" } : json2nameValue($EVENT,'',$JSONMAP) } attr DEVICE stateFormat \ online\ \ state attr DEVICE jsonMap switch_temperature_tC:temperature switch_temperature_tF:0 params_wifi_sta_ip:ip attr DEVICE model shellyPlus_i4 setreading DEVICE attrTemplateVersion 20220128 ########################################### # ESPurna # # ESP8266 devices using ESPurna firmware. # See project page for details: https://github.com/xoseperez/espurna/wiki name:ESPurna_single_relay filter:TYPE=MQTT2_DEVICE desc:ESPurna is a alternative firmware comparable to tasmota, see project page wiki.
NOTE: First experimental version, to contribute see Forum Thread. order:A_30 par:DEVNAME;Device's name in the topic tree;{ AttrVal("DEVICE","readingList","") =~ m,([^:/]+)/([^/]+)/, ? $1 : undef } attr DEVICE readingList DEVNAME/relay/0:.* relay_0\ DEVNAME/relay/0:.* { $EVENT ? {"state"=>"on"} : {"state"=>"off"} }\ DEVNAME/app:.* app\ DEVNAME/version:.* version\ DEVNAME/board:.* board\ DEVNAME/host:.* host\ DEVNAME/ssid:.* ssid\ DEVNAME/ip:.* ip\ DEVNAME/mac:.* mac\ DEVNAME/rssi:.* rssi\ DEVNAME/uptime:.* uptime\ DEVNAME/datetime:.* datetime\ DEVNAME/freeheap:.* freeheap\ DEVNAME/vcc:.* vcc\ DEVNAME/status:.* status\ DEVNAME/loadavg:.* loadavg attr DEVICE setList on DEVNAME/relay/0/set 1\ off DEVNAME/relay/0/set 0\ toggle DEVNAME/relay/0/set 2 attr DEVICE setStateList on off toggle attr DEVICE event-on-change-reading .* set DEVICE attrTemplate speechcontrol_type_switch attr DEVICE model ESPurna_single_relay setreading DEVICE attrTemplateVersion 20200522 or prior name:ESPurna_4socketUSB_unified filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*/relay/0.* desc:ESPurna is a alternative firmware comparable to tasmota, see project page wiki.
NOTE: Tested with 5-way multi socket ZHILDE_EU44_W, configures a single device with multi channels.
To contribute templates for ESPurna see Forum Thread. Template is for use without further configuration on ESP side, so especially no JSON is sent or relayPayload-xy is set! order:A_30d par:DEVNAME;Device's name in the topic tree;{ AttrVal("DEVICE","readingList","") =~ m,([^:/]+)/([^/]+)/, ? $1 : undef } par:ICON;ICON as set, defaults to hue_filled_outlet;{ AttrVal("DEVICE","icon","hue_filled_outlet") } attr DEVICE icon ICON 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 5.on:on:POWER5+off 5.off:off:POWER5+on attr DEVICE event-on-change-reading .* attr DEVICE readingList DEVNAME/relay/0:.* { $EVENT ? {"POWER1"=>"on"} : {"POWER1"=>"off"} }\ DEVNAME/relay/1:.* { $EVENT ? {"POWER2"=>"on"} : {"POWER2"=>"off"} }\ DEVNAME/relay/2:.* { $EVENT ? {"POWER3"=>"on"} : {"POWER3"=>"off"} }\ DEVNAME/relay/3:.* { $EVENT ? {"POWER4"=>"on"} : {"POWER4"=>"off"} }\ DEVNAME/relay/4:.* { $EVENT ? {"POWER5"=>"on"} : {"POWER5"=>"off"} }\ DEVNAME/status:.* { $EVENT ? {"LWT"=>"Online"} : {"LWT"=>"Offline"} }\ DEVNAME/app:.* app\ DEVNAME/version:.* version\ DEVNAME/board:.* board\ DEVNAME/host:.* host\ DEVNAME/ssid:.* ssid\ DEVNAME/ip:.* ip\ DEVNAME/mac:.* mac\ DEVNAME/rssi:.* rssi\ DEVNAME/uptime:.* uptime\ DEVNAME/datetime:.* datetime\ DEVNAME/freeheap:.* freeheap\ DEVNAME/vcc:.* vcc\ DEVNAME/loadavg:.* loadavg\ DEVNAME/desc:.* desc attr DEVICE setList on DEVNAME/relay/0/set 1\ off DEVNAME/relay/0/set 0\ toggle DEVNAME/relay/0/set 2\ POWER1:on,off,toggle DEVNAME/relay/0/set $EVTPART1\ POWER2:on,off,toggle DEVNAME/relay/1/set $EVTPART1\ POWER3:on,off,toggle DEVNAME/relay/2/set $EVTPART1\ POWER4:on,off,toggle DEVNAME/relay/3/set $EVTPART1\ POWER5:on,off,toggle DEVNAME/relay/4/set $EVTPART1\ Reboot:reboot DEVNAME/action/set $EVTPART1 attr DEVICE setStateList on off toggle attr DEVICE stateFormat LWT\ 1:POWER1\ 2:POWER2\ 3:POWER3\ 4:POWER4\ 5:POWER5\
\ ip set DEVICE attrTemplate speechcontrol_type_switch attr DEVICE model ESPurna_4socketUSB_unified setreading DEVICE attrTemplateVersion 20200522 or prior deletereading -q DEVICE relay_.* name:ESPurna_4socketUSB_split filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*/relay/4.* desc:ESPurna is a alternative firmware comparable to tasmota, see project page wiki.
To contribute templates for ESPurna see Forum Thread.
NOTE: Tested with 5-way multi socket ZHILDE_EU44_W, configures a seperate device for each channel.
NOTE: Template is for use without further configuration on ESP side, so especially no JSON is sent or relayPayload-xy is set! order:A_30c par:DEVNAME;Device's name in the topic tree;{ AttrVal("DEVICE","readingList","") =~ m,([^:/]+)/([^/]+)/, ? $1 : undef } par:ICON;ICON as set, defaults to hue_filled_outlet;{ AttrVal("DEVICE","icon","hue_filled_outlet") } attr DEVICE icon ICON attr DEVICE event-on-change-reading .* attr DEVICE setStateList on off toggle set DEVICE attrTemplate speechcontrol_type_switch attr DEVICE model ESPurna_4socketUSB_split attr DEVICE devStateIcon Online:10px-kreis-gruen Offline:10px-kreis-rot attr DEVICE stateFormat ip\ LWT\ \ state deletereading -q DEVICE (?!associatedWith|IODev).* setreading DEVICE attrTemplateVersion 20200531 set DEVICE attrTemplate set_associatedWith \CHANNELS=5 \MAKECOPIES=1 rename DEVICE_CH5 DEVICE_USB attr DEVICE_CH2 readingList DEVNAME/relay/1:.* { $EVENT ? {"state"=>"on"} : {"state"=>"off"} }\ DEVNAME/status:.* { $EVENT ? {"LWT"=>"Online"} : {"LWT"=>"Offline"} }\ DEVNAME/ip:.* ip attr DEVICE_CH3 readingList DEVNAME/relay/2:.* { $EVENT ? {"state"=>"on"} : {"state"=>"off"} }\ DEVNAME/status:.* { $EVENT ? {"LWT"=>"Online"} : {"LWT"=>"Offline"} }\ DEVNAME/ip:.* ip attr DEVICE_CH4 readingList DEVNAME/relay/3:.* { $EVENT ? {"state"=>"on"} : {"state"=>"off"} }\ DEVNAME/status:.* { $EVENT ? {"LWT"=>"Online"} : {"LWT"=>"Offline"} }\ DEVNAME/ip:.* ip attr DEVICE_USB readingList DEVNAME/relay/4:.* { $EVENT ? {"state"=>"on"} : {"state"=>"off"} }\ DEVNAME/status:.* { $EVENT ? {"LWT"=>"Online"} : {"LWT"=>"Offline"} }\ DEVNAME/ip:.* ip attr DEVICE readingList DEVNAME/relay/0:.* { $EVENT ? {"state"=>"on"} : {"state"=>"off"} }\ DEVNAME/app:.* app\ DEVNAME/version:.* version\ DEVNAME/board:.* board\ DEVNAME/host:.* host\ DEVNAME/ssid:.* ssid\ DEVNAME/ip:.* ip\ DEVNAME/mac:.* mac\ DEVNAME/rssi:.* rssi\ DEVNAME/uptime:.* uptime\ DEVNAME/datetime:.* datetime\ DEVNAME/freeheap:.* freeheap\ DEVNAME/vcc:.* vcc\ DEVNAME/status:.* { $EVENT ? {"LWT"=>"Online"} : {"LWT"=>"Offline"} }\ DEVNAME/loadavg:.* loadavg\ DEVNAME/desc:.* desc attr DEVICE_CH2 setList on DEVNAME/relay/1/set 1\ off DEVNAME/relay/1/set 0\ toggle DEVNAME/relay/1/set 2 attr DEVICE_CH3 setList on DEVNAME/relay/2/set 1\ off DEVNAME/relay/2/set 0\ toggle DEVNAME/relay/2/set 2 attr DEVICE_CH4 setList on DEVNAME/relay/3/set 1\ off DEVNAME/relay/3/set 0\ toggle DEVNAME/relay/3/set 2 attr DEVICE_USB setList on DEVNAME/relay/4/set 1\ off DEVNAME/relay/4/set 0\ toggle DEVNAME/relay/4/set 2 attr DEVICE setList on DEVNAME/relay/0/set 1\ off DEVNAME/relay/0/set 0\ toggle DEVNAME/relay/0/set 2\ Reboot:reboot DEVNAME/action/set $EVTPART1 attr DEVICE devStateIcon Online:10px-kreis-gruen Offline:10px-kreis-rot attr DEVICE stateFormat ip\ LWT\ \ state ############### #DP83848 based Ethernet Board # name:8channel_ethernet_board_split filter:TYPE=MQTT2_DEVICE desc:For use with some 8-channel ethernet boards. Might be usefull for other stuff based on TI's DP83848 ethernet chipset.
NOTE: First experimental version, for configuration and to contribute see Forum Thread. You have to configure MQTT first, might be found under http:///zm.cgi! order:W_03 par:STATETOPIC;Command topic prefix;{ AttrVal("DEVICE","readingList","") =~ m,([^:]+state[:])/, ? $1 : undef } par:CMNDTOPIC;Command topic prefix;{ AttrVal("DEVICE","readingList","") =~ m,([^:]+)state[:], ? "${1}ctr" : undef } par:ICON;ICON as set, defaults to on;{ AttrVal("DEVICE","icon","on") } attr DEVICE icon ICON attr DEVICE model 8channel_ethernet_board_split attr DEVICE setStateList on off deletereading -q DEVICE (?!associatedWith|IODev).* setreading DEVICE attrTemplateVersion 20211029 set DEVICE attrTemplate set_associatedWith \CHANNELS=8 \MAKECOPIES=1 defmod DEVICE_CH2,DEVICE_CH3,DEVICE_CH4,DEVICE_CH5,DEVICE_CH6,DEVICE_CH7,DEVICE_CH8 MQTT2_\DEVICE DEVICE_channels attr DEVICE readingList STATETOPIC.* { $EVENT =~ /output...([01])[01]{7}/;; my $newstate = $1 ? "on" : "off";; $newstate eq ReadingsVal($NAME,"state","unknown") ? return : {"state"=>$newstate} } attr DEVICE_CH2 readingList STATETOPIC.* { $EVENT =~ /output...[01]([01])[01]{6}/;; my $newstate = $1 ? "on" : "off";; $newstate eq ReadingsVal($NAME,"state","unknown") ? return : {"state"=>$newstate} } attr DEVICE_CH3 readingList STATETOPIC.* { $EVENT =~ /output...[01]{2}([01])[01]{5}/;; my $newstate = $1 ? "on" : "off";; $newstate eq ReadingsVal($NAME,"state","unknown") ? return : {"state"=>$newstate} } attr DEVICE_CH4 readingList STATETOPIC.* { $EVENT =~ /output...[01]{3}([01])[01]{4}/;; my $newstate = $1 ? "on" : "off";; $newstate eq ReadingsVal($NAME,"state","unknown") ? return : {"state"=>$newstate} } attr DEVICE_CH5 readingList STATETOPIC.* { $EVENT =~ /output...[01]{4}([01])[01]{3}/;; my $newstate = $1 ? "on" : "off";; $newstate eq ReadingsVal($NAME,"state","unknown") ? return : {"state"=>$newstate} } attr DEVICE_CH6 readingList STATETOPIC.* { $EVENT =~ /output...[01]{5}([01])[01]{2}/;; my $newstate = $1 ? "on" : "off";; $newstate eq ReadingsVal($NAME,"state","unknown") ? return : {"state"=>$newstate} } attr DEVICE_CH7 readingList STATETOPIC.* { $EVENT =~ /output...[01]{6}([01])[01]/;; my $newstate = $1 ? "on" : "off";; $newstate eq ReadingsVal($NAME,"state","unknown") ? return : {"state"=>$newstate} } attr DEVICE_CH8 readingList STATETOPIC.* { $EVENT =~ /output...[01]{7}([01])/;; my $newstate = $1 ? "on" : "off";; $newstate eq ReadingsVal($NAME,"state","unknown") ? return : {"state"=>$newstate} } attr DEVICE setList on:noArg CMNDTOPIC setr=1xxxxxxx\ off:noArg CMNDTOPIC setr=0xxxxxxx attr DEVICE_CH2 setList on:noArg CMNDTOPIC setr=x1xxxxxx\ off:noArg CMNDTOPIC setr=x0xxxxxx attr DEVICE_CH3 setList on:noArg CMNDTOPIC setr=xx1xxxxx\ off:noArg CMNDTOPIC setr=xx0xxxxx attr DEVICE_CH4 setList on:noArg CMNDTOPIC setr=xxx1xxxx\ off:noArg CMNDTOPIC setr=xxx0xxxx attr DEVICE_CH5 setList on:noArg CMNDTOPIC setr=xxxx1xxx\ off:noArg CMNDTOPIC setr=xxxx0xxx attr DEVICE_CH6 setList on:noArg CMNDTOPIC setr=xxxxx1xx\ off:noArg CMNDTOPIC setr=xxxxx0xx attr DEVICE_CH7 setList on:noArg CMNDTOPIC setr=xxxxxx1x\ off:noArg CMNDTOPIC setr=xxxxxx0x attr DEVICE_CH8 setList on:noArg CMNDTOPIC setr=xxxxxxx1\ off:noArg CMNDTOPIC setr=xxxxxxx0 set DEVICE,DEVICE_CH2,DEVICE_CH3,DEVICE_CH4,DEVICE_CH5,DEVICE_CH6,DEVICE_CH7,DEVICE_CH8 attrTemplate speechcontrol_type_switch name:8channel_ethernet_board_unified filter:TYPE=MQTT2_DEVICE desc:For use with some 8-channel ethernet boards. Might be usefull for other stuff based on TI's DP83848 ethernet chipset.
NOTE: First experimental version, for configuration and to contribute see Forum Thread. You have to configure MQTT first, might be found under http:///zm.cgi! order:W_03a par:STATETOPIC;Command topic prefix;{ AttrVal("DEVICE","readingList","") =~ m,([^:]+state[:])/, ? $1 : undef } par:CMNDTOPIC;Command topic prefix;{ AttrVal("DEVICE","readingList","") =~ m,([^:]+)state[:], ? "${1}ctr" : undef } par:ICON;ICON as set, defaults to on;{ AttrVal("DEVICE","icon","on") } attr DEVICE icon ICON attr DEVICE setStateList on off attr DEVICE jsonMap input:0 attr DEVICE readingList STATETOPIC.* { json2nameValue($EVENT,'',$JSONMAP) } attr DEVICE userReadings out1:output:.* { $event =~ m/(.).......$/;;ReadingsVal($name,"out1","unknown") ne $1 ? $1 : return }, out2:output:.* { $event =~ m/.(.)......$/;;;;ReadingsVal($name,"out2","unknown") ne $1 ? $1 : return }, out3:output:.* { $event =~ m/..(.).....$/;;ReadingsVal($name,"out3","unknown") ne $1 ? $1 : return }, out4:output:.* { $event =~ m/...(.)....$/;;ReadingsVal($name,"out4","unknown") ne $1 ? $1 : return }, out5:output:.* { $event =~ m/....(.)...$/;;ReadingsVal($name,"out5","unknown") ne $1 ? $1 : return }, out6:output:.* { $event =~ m/.....(.)..$/;;ReadingsVal($name,"out6","unknown") ne $1 ? $1 : return }, out7:output:.* { $event =~ m/......(.).$/;;ReadingsVal($name,"out7","unknown") ne $1 ? $1 : return }, out8:output:.* { $event =~ m/.......(.)$/;;ReadingsVal($name,"out8","unknown") ne $1 ? $1 : return } attr DEVICE setList out1:0,1 {my $command = $EVTPART1."xxxxxxx";; "CMNDTOPIC setr=$command"}\ out2:0,1 {my $command = "x".$EVTPART1."xxxxxx";; "CMNDTOPIC setr=$command"}\ out3:0,1 {my $command = "xx".$EVTPART1."xxxxx";; "CMNDTOPIC setr=$command"}\ out4:0,1 {my $command = "xxx".$EVTPART1."xxxx";; "CMNDTOPIC setr=$command"}\ out5:0,1 {my $command = "xxxx".$EVTPART1."xxx";; "CMNDTOPIC setr=$command"}\ out6:0,1 {my $command = "xxxxx".$EVTPART1."xx";; "CMNDTOPIC setr=$command"}\ out7:0,1 {my $command = "xxxxxx".$EVTPART1."x";; "CMNDTOPIC setr=$command"}\ out8:0,1 {"CMNDTOPIC setr=xxxxxxx".$EVTPART1} attr DEVICE model 8channel_ethernet_board_unified setreading DEVICE attrTemplateVersion 20200522 or prior ############### #Advantech ADAM6060 ethernet board # #specials: send retained messages, eventMap, event-on-change-reading and timestamp-on-change-reading via one-line Perl... # # input by cberl, see forum https://forum.fhem.de/index.php/topic,111429.0.html name:6channel_ethernet_board_6input_split filter:TYPE=MQTT2_DEVICE desc:For use with Advantech ADAM-6060-D 6-ch digital Input and 6-ch relay output.
NOTE: First experimental version, for configuration and to contribute see Forum Thread. You have to configure MQTT first with the Adam/Apax.Net Utility - cloud function: Set your broker and look for the topic; MQTT may not be available on all firmware revisions.
Split version - you'll get 6 independent devices. order:W_04 par:DEVNAME;Device's name in the topic tree;{ AttrVal('DEVICE','readingList','') =~ m,Advantech/([^/]+)/, ? $1 : undef } par:ICON;ICON as set, defaults to on;{ AttrVal('DEVICE','icon','on') } attr DEVICE icon ICON deletereading -q DEVICE (?!associatedWith|IODev).* attr DEVICE devStateIcon disconnect:rc_STOP@red connect:rc_STOP@green attr DEVICE readingList Advantech/DEVNAME/data:.* { $EVENT =~ s/true/"on"/g;; $EVENT =~ s/false/"off"/g;; my $rets = json2nameValue($EVENT,'',$JSONMAP);; my %cleaned = map { $_,$rets->{$_} } grep { ReadingsVal($NAME,$_,'unknown') ne $rets->{$_} } keys %{$rets};; return \%cleaned }\ Advantech/DEVNAME/Device_Status:.* { json2nameValue($EVENT) } attr DEVICE jsonMap do1:state do2:0 do3:0 do4:0 do5:0 do6:0 c:0 q:0 s:0 t:0 attr DEVICE setExtensionsEvent 1 attr DEVICE setList on:noArg Advantech/DEVNAME/ctl/do1:r {"v":true}\ off:noArg Advantech/DEVNAME/ctl/do1:r {"v":false} attr DEVICE stateFormat status\ state\
\ DigiIn\ di1\ di2\ di3\ di4\ di5\ di6 attr DEVICE webCmd : copy DEVICE DEVICE_CH2 defmod DEVICE_CH2 MQTT2_\DEVICE DEVICE_CH2 deleteattr DEVICE_CH2 stateFormat attr DEVICE_CH2 readingList Advantech/DEVNAME/data:.* { $EVENT =~ m/do2":(true)/g;; my $newstate = $1 ? 'on' : 'off';; $newstate eq ReadingsVal($NAME,'state','unknown') ? undef : {state=>$newstate} } attr DEVICE_CH2 setList on:noArg Advantech/DEVNAME/ctl/do2:r {"v":true}\ off:noArg Advantech/DEVNAME/ctl/do2:r {"v":false} loop:#:3:4:5:6 copy DEVICE_CH2 DEVICE_CH# attr DEVICE_CH# readingList Advantech/DEVNAME/data:.* { $EVENT =~ m/do#":(true)/g;; my $newstate = $1 ? 'on' : 'off';; $newstate eq ReadingsVal($NAME,'state','unknown') ? undef : {state=>$newstate} } attr DEVICE_CH# setList on:noArg Advantech/DEVNAME/ctl/do#:r {"v":true}\ off:noArg Advantech/DEVNAME/ctl/do#:r {"v":false} loop:END set DEVICE attrTemplate set_associatedWith \CHANNELS=6 set DEVICE,DEVICE_CH2,DEVICE_CH3,DEVICE_CH4,DEVICE_CH5,DEVICE_CH6 attrTemplate speechcontrol_type_switch setreading DEVICE,DEVICE_CH2,DEVICE_CH3,DEVICE_CH4,DEVICE_CH5,DEVICE_CH6 attrTemplateVersion 20211030 attr DEVICE,DEVICE_CH2,DEVICE_CH3,DEVICE_CH4,DEVICE_CH5,DEVICE_CH6 model 6channel_ethernet_board_6input_split name:6channel_ethernet_board_6input_unified filter:TYPE=MQTT2_DEVICE desc:desc:For use with Advantech ADAM-6060-D 6-ch digital Input and 6-ch relay output.
NOTE: First experimental version, for configuration and to contribute see Forum Thread. You have to configure MQTT first with the Adam/Apax.Net Utility - cloud function: Set your broker and look for the topic; MQTT may not be available on all firmware revisions. order:W_04a par:DEVNAME;Device's name in the topic tree;{ AttrVal("DEVICE","readingList","") =~ m,Advantech/([^/]+)/, ? $1 : undef } par:ICON;ICON as set, defaults to on;{ AttrVal("DEVICE","icon","on") } attr DEVICE icon ICON deletereading -q DEVICE (?!associatedWith|IODev).* attr DEVICE devStateIcon disconnect:rc_STOP@red connect:rc_STOP@green 2.on:on:do2+off 2.off:off:do2+on 3.on:on:do3+off 3.off:off:do3+on 4.on:on:do4+off 4.off:off:do4+on 5.on:on:do5+off 5.off:off:do5+on 6.on:on:do6+off 6.off:off:do6+on attr DEVICE readingList Advantech/DEVNAME/data:.* { $EVENT =~ s/true/"on"/g;; $EVENT =~ s/false/"off"/g;; my $rets = json2nameValue($EVENT,'',$JSONMAP);; my %cleaned = map { $_,$rets->{$_} } grep { ReadingsVal($NAME,$_,"unknown") ne $rets->{$_} } keys %{$rets};; return \%cleaned } \ Advantech/DEVNAME/Device_Status:.* { json2nameValue($EVENT) } attr DEVICE setExtensionsEvent 1 attr DEVICE jsonMap do1:state c:0 q:0 s:0 t:0 attr DEVICE setList on:noArg Advantech/DEVNAME/ctl/do1:r {"v":true}\ off:noArg Advantech/DEVNAME/ctl/do1:r {"v":false}\ do2:on,off {my $payload = $EVTPART1 eq "on" ? "true" : "false";; qq(Advantech/DEVNAME/ctl/do2:r {"v":$payload})}\ do3:on,off {my $payload = $EVTPART1 eq "on" ? "true" : "false";; qq(Advantech/DEVNAME/ctl/do3:r {"v":$payload})}\ do4:on,off {my $payload = $EVTPART1 eq "on" ? "true" : "false";; qq(Advantech/DEVNAME/ctl/do4:r {"v":$payload})}\ do5:on,off {my $payload = $EVTPART1 eq "on" ? "true" : "false";; qq(Advantech/DEVNAME/ctl/do5:r {"v":$payload})}\ do6:on,off {my $payload = $EVTPART1 eq "on" ? "true" : "false";; qq(Advantech/DEVNAME/ctl/do6:r {"v":$payload})} attr DEVICE stateFormat status\ state\ 2:do2\ 3:do3\ 4:do4\ 5:do5\ 6:do6\
\ DigiIn\ di1\ di2\ di3\ di4\ di5\ di6 attr DEVICE webCmd : set DEVICE attrTemplate speechcontrol_type_switch attr DEVICE model 6channel_ethernet_board_6input_unified setreading DEVICE attrTemplateVersion 20200602 ############### #dingtian 8ch relay board # #specials: event-on-change-reading and timestamp-on-change-reading via Perl... # # input by rico5588, see forum https://forum.fhem.de/index.php/topic,123709.msg1182787.html#msg1182787 name:8channel_relay_board_8di_split filter:TYPE=MQTT2_DEVICE desc:For use with dingtian 8-ch digital Input and 8-ch relay output ethernet board.
NOTE: First experimental version, for configuration and to contribute see Forum Thread. You have to configure MQTT first as described in product manual.
Split version - you'll get 8 independent devices. order:W_05 par:DEVNAME;Device's name in the topic tree;{ AttrVal('DEVICE','readingList','') =~ m,dingtian/([^/]+)/, ? $1 : undef } par:ICON;ICON as set, defaults to on;{ AttrVal('DEVICE','icon','on') } attr DEVICE icon ICON deletereading -q DEVICE (?!associatedWith|IODev).* attr DEVICE readingList /dingtian/DEVNAME/out/lwt_availability:.* LWT\ /dingtian/DEVNAME/out/(relay|input)[1-8]:.* {}\ /dingtian/DEVNAME/out/r1:.* { my $state = lc $EVENT; return if ReadingsVal($NAME,'state','unknown') eq $state; {state=>$state} }\ /dingtian/DEVNAME/out/i1:.* {my $state = lc $EVENT; return if ReadingsVal($NAME,'input','unknown') eq $state; {input=>$state}}\ /dingtian/DEVNAME/out/ip:.* ip\ /dingtian/DEVNAME/out/sn:.* sn\ /dingtian/DEVNAME/out/mac:.* mac\ /dingtian/DEVNAME/out/dicnt:.* dicnt\ /dingtian/DEVNAME/out/relay_cnt:.* relay_cnt attr DEVICE setExtensionsEvent 1 attr DEVICE setList on:noArg /dingtian/DEVNAME/in/r1 ON\ off:noArg /dingtian/DEVNAME/in/r1 OFF attr DEVICE webCmd : copy DEVICE DEVICE_CH2 defmod DEVICE_CH2 MQTT2_\DEVICE DEVICE_channels loop:#:3:4:5:6:7:8 copy DEVICE_CH2 DEVICE_CH# loop:END loop:chNo:2:3:4:5:6:7:8 attr DEVICE_CHchNo readingList /dingtian/DEVNAME/out/rchNo:.* { my $state = lc $EVENT; return if ReadingsVal($NAME,'state','unknown') eq $state; {state=>$state} }\ /dingtian/DEVNAME/out/ichNo:.* {my $state = lc $EVENT; return if ReadingsVal($NAME,'input','unknown') eq $state; {input=>$state}} attr DEVICE_CHchNo setList on:noArg /dingtian/DEVNAME/in/rchNo ON\ off:noArg /dingtian/DEVNAME/in/rchNo OFF loop:END set DEVICE attrTemplate set_associatedWith \CHANNELS=8 attr DEVICE devStateIcon {my $onl = ReadingsVal($name,'LWT','offline') eq 'online'?'10px-kreis-gruen':'10px-kreis-rot'; my $light = ReadingsVal($name,'state','off'); ''.FW_makeImage($onl)." ".FW_makeImage($light).""} set DEVICE,DEVICE_CH2,DEVICE_CH3,DEVICE_CH4,DEVICE_CH5,DEVICE_CH6,DEVICE_CH7,DEVICE_CH8 attrTemplate speechcontrol_type_switch setreading DEVICE,DEVICE_CH2,DEVICE_CH3,DEVICE_CH4,DEVICE_CH5,DEVICE_CH6,DEVICE_CH7,DEVICE_CH8 attrTemplateVersion 20211029 attr DEVICE,DEVICE_CH2,DEVICE_CH3,DEVICE_CH4,DEVICE_CH5,DEVICE_CH6,DEVICE_CH7,DEVICE_CH8 model 8channel_relay_board_8di_split ############### #ebusd # #ebus daemon device name:eBus_daemon_splitter filter:TYPE=MQTT2_DEVICE desc:Device containing all status messages from the ebus daemon itself
NOTE: acts also as a bridge device to split up the hardware on the bus into different mqtt2_devices
NOTE:
- for use with MQTT2_CLIENT use a copy of the Device with the same clientId than the IO, delete original's readingList after applying the template!
- this might change the devices CID
-To configure further parts of your ebus ecosystem, additional templates will be available, for details see Wiki, to see more info about the provided code, issue help attrTmqtt2_ebus_Utils. order:E_01a par:DEVTYPE;Internal TYPE of the device; { InternalVal("DEVICE",'TYPE',undef)} par:DEV_ID;base topic set ebus;{ AttrVal("DEVICE",'readingList','') =~ m,[^:]+:?(ebus[a-zA-Z][^/]*)[/].*:, ? $1 : 'ebusd' } par:ICON;ICON as set, defaults to sani_boiler_temp;{ AttrVal("DEVICE","icon","sani_boiler_temp") } { Svn_GetFile('contrib/AttrTemplate/99_attrTmqtt2_ebus_Utils.pm', 'FHEM/99_attrTmqtt2_ebus_Utils.pm', sub(){ CommandReload(undef, '99_attrTmqtt2_ebus_Utils') }) } { Svn_GetFile("contrib/AttrTemplate/mqtt2.ebus.template", "FHEM/lib/AttrTemplate/mqtt2.ebus.template", sub(){ AttrTemplate_Initialize() }) } attr DEVICE icon ICON modify DEVICE DEV_ID attr DEVICE autocreate 1 attr DEVICE bridgeRegexp (ebus\S[^/]*?)/(bai|\d+|cc|e7f|ehp|f\d\d|hc|hc\d+|he.|hmu|hwc|mc|mc.\d|omu|omu.\d|pms|rcc|rcc.\d|sc|sdr_p|solar|ui|uih|v\d\d|v81.\d|vd\d|vl\d|vr_\d\d|zeo)/.*:.* "$1_$2"\ (ebus\S[^/]*?)/(global|broadcast|general|scan[^/]+|memory)/.*:.* "$1" attr DEVICE readingList DEV_ID/scan[^/]+/.*:.* { $TOPIC =~ m,scan.([^/]+)/,; FHEM::aTm2u_ebus::j2nv($EVENT,"scan_${1}_") }\ DEV_ID/global/uptime:.* uptime\ DEV_ID/global/running:.* running\ DEV_ID/global/version:.* version\ DEV_ID/global/signal:.* signal\ DEV_ID/global/updatecheck:.* updatecheck\ DEV_ID/global/scan:.* scan\ DEV_ID/broadcast/datetime:.* { FHEM::aTm2u_ebus::j2nv($EVENT) } attr DEVICE userReadings formatedUptime:uptime.* {my $m = ReadingsVal($name,'uptime',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 stateFormat Status: \ 1:running\ Signal: \ 2:signal\
Uptime: formatedUptime attr DEVICE devStateIcon 1.true:it_net 1.false:it_net@red 2.true:lan_rs485 2.false:lan_rs485@red attr DEVICE setList getKnown:noArg DEV_ID/list onlyknown\ getAll:noArg DEV_ID/list set DEVICE getKnown attr DEVICE comment NOTE: additional templates and code have been downloaded from svn (contrib).
Pls. inform the maintainer, if the bridgeRegexp doesn't fit to all of your devices connected to the bus. farewell:template has been applied successfully.
NOTE: additional templates and code have been downloaded from svn (contrib).
To configure further parts of your ebus ecosystem, have a look at these templates and the Wiki, to see more info about the provided code, issue help attrTmqtt2_ebus_Utils. attr DEVICE model eBus_daemon_splitter setreading DEVICE attrTemplateVersion 20210715 name:ebus_update_files_from_svn filter:TYPE=MQTT2_DEVICE desc:template to download or update additional code and attrTemplates from svn. Might be usefull in case there had been some updates... order:E_01a1 { Svn_GetFile('contrib/AttrTemplate/99_attrTmqtt2_ebus_Utils.pm', 'FHEM/99_attrTmqtt2_ebus_Utils.pm', sub(){ CommandReload(undef, '99_attrTmqtt2_ebus_Utils') }) } { Svn_GetFile("contrib/AttrTemplate/mqtt2.ebus.template", "FHEM/lib/AttrTemplate/mqtt2.ebus.template", sub(){ AttrTemplate_Initialize() }) } farewell:Download has been initiated. You may find the wiki (https://wiki.fhem.de/wiki/EBUS-MQTT2) usefull; to see more info about the provided code, issue "help attrTmqtt2_ebus_Utils". ########################################### # ems-esp # The ems-esp device name:ems-esp_heater_device filter:TYPE=MQTT2_DEVICE desc:EMS-ESP is a open-source system to communicate with EMS (Energy Management System) based boilers, thermostats and other modules from manufacturers like Bosch, Buderus, Nefit, Junkers and Sieger, see project page. First version, to contribute see Forum Thread. order:E_02a par:DEV_ID;ID topic set, default is "ems-esp";{ AttrVal("DEVICE","readingList","") =~ m,[^/:]+/([^/]+), ? $1 : "ems-esp" } par:ICON;ICON as set, defaults to sani_boiler_temp;{ AttrVal("DEVICE","icon","sani_boiler_temp") } 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" 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) }\ DEV_ID/info:.* { json2nameValue($EVENT) }\ DEV_ID/status:.* { json2nameValue($EVENT) } attr DEVICE stateFormat Interface: \ LWT\ Signal: \ rssi %\
Uptime: formatedUptime\
IPAddress : ip attr DEVICE setList restart:noArg DEV_ID/restart attr DEVICE devStateIcon online:it_net offline:it_net@red 2.1:lan_rs485 2.0:lan_rs485@red attr DEVICE autocreate 1 attr DEVICE webCmd restart attr DEVICE model ems-esp_heater_device 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:serviceCode.* {BoilerStatus(ReadingsVal($name,'serviceCode',''),ReadingsVal($name,'serviceCodeNumber',''))} attr DEVICE comment userReadings need additional code, see https://forum.fhem.de/index.php/topic,104968.msg1180136.html#msg1180136 attr DEVICE model ems-esp_boiler setreading DEVICE attrTemplateVersion 20211017 #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 ############### #ESP Milight Hub #use this with Chris Mullins ESP-Milight-Hub. for further details visit https://github.com/sidoh/esp8266_milight_hub #recommended structure of the topic pattern milight/:device_id/:device_type/:group_id #as set in the settings section in the bridge's web interface # #The ESP-Milight-Hub bridge device #Atm there are no furter commands to be set to the esp itself name:esp_milight_hub_bridge filter:TYPE=MQTT2_DEVICE desc:use this with Chris Mullins ESP-Milight-Hub. for further details visit https://github.com/sidoh/esp8266_milight_hub
Recommended structure of the topic pattern milight/:device_id/:device_type/:group_id as set in the settings section in the bridge's web interface. order:X_01 farewell:template has been applied successfully.
Note: In case you not exclusively use FHEM to send MQTT commands to your devices, it's highly recommended to extend the ignoreRegexp of your IO device! Could be something like |milight/0x[0-9a-fA-F]{1,4}/.*/[0-8]. par:BASE_ID;BASE_ID typically is milight;{ AttrVal("DEVICE","readingList","") =~ m,([^:]+)/LWT:, ? $1 : undef } par:ICON;ICON as set, defaults to mqtt;{ AttrVal("DEVICE","icon","mqtt") } attr DEVICE icon ICON attr DEVICE bridgeRegexp BASE_ID/[^/]*at[^/]+/(0x[0-9a-fA-F]{1,4})/.*/([0-8])?.*:.* "milight_$1_$2" attr DEVICE autocreate 1 attr DEVICE readingList BASE_ID/LWT:.* { json2nameValue($EVENT) } attr DEVICE setStateList on off attr DEVICE stateFormat \ status\ Version: \ version attr DEVICE devStateIcon connected:10px-kreis-gruen disconnected.*:10px-kreis-rot set DEVICE attrTemplate do_general_mqtt_cleanup attr DEVICE model esp_milight_hub_bridge setreading DEVICE attrTemplateVersion 20200701 { AttrTemplate_Initialize() } #rgbw-bulb name:esp_milight_hub_rgbw_bulb prereq:{my @devices=devspec2array("model=esp_milight_hub_bridge");return 1 if $devices[0];return 0} filter:TYPE=MQTT2_DEVICE:FILTER=CID~milight.* desc:For use with X_01_esp_milight_hub_bridge
Basic elements to control a rgbw bulb. If you own a different type of bulb, this template could contain more options than your physical device might be able to handle. Just delete, what you don't need or use the full featured version to get extended options and then delete what you don't need... order:X_011 par:BASE_ID;BASE_ID typically is milight;{ AttrVal("DEVICE","readingList","") =~ m,([^:]+)/LWT/.*:, ? $1 : undef } par:GROUP_ID;number from 0 to 8 representing one of the channels of an original bridge or remote;{ AttrVal("DEVICE","readingList","") =~ m,[^/]+/[^/]+/[^/]+/([0-8]):, ? $1 : undef } par:REMOTE_ID;HEX number representing a specific remote or bridge;{ AttrVal("DEVICE","readingList","") =~ m,([^/]+)/(0x[0-9a-fA-F]{1\,4})/.*:, ? $2 : undef } par:BULB_TYPE;rgbw, cct, rgb_cct, rgb, fut089, ;{ AttrVal("DEVICE","readingList","") =~ m,[^/]+/[^/]+/[^/]+/([^/]+)/.*:, ? $1 : undef } par:ICON;ICON as set, defaults to light_control;{ AttrVal("DEVICE","icon","light_control") } attr DEVICE icon ICON deletereading -q DEVICE .*_.* attr DEVICE eventMap /set_white:Weiss/night_mode:Nacht/white_mode:white/ 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) }\ BASE_ID/states/REMOTE_ID/BULB_TYPE/0:.* { json2nameValue($EVENT) }\ BASE_ID/updates/REMOTE_ID/BULB_TYPE/GROUP_ID:.* { json2nameValue($EVENT) }\ BASE_ID/updates/REMOTE_ID/BULB_TYPE/0:.* { json2nameValue($EVENT) } attr DEVICE setList\ on:noArg BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"status":"ON"}\ on_transition:slider,3,10,3600 BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"status":"ON","transition":$EVTPART1}\ off:noArg BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"status":"OFF"}\ off_transition:slider,3,10,3600 BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"status":"OFF","transition":$EVTPART1}\ brightness:colorpicker,BRI,0,15,255 BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"$EVTPART0":"$EVTPART1"}\ hue:colorpicker,HUE,0,1,359 BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"$EVTPART0":"$EVTPART1"}\ command:uzsuSelectRadio,Weiss,Nacht BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"$EVTPART0":"$EVTPART1"} 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 comment To switch device also on when changing brightness, change payload pattern to {"status":"ON","$EVTPART0":"$EVTPART1"} or add a new element to setList, similar to brightness, e.g.brightness_on and change payload pattern as described. attr DEVICE setExtensionsEvent 1 set DEVICE attrTemplate speechcontrol_type_light_255 attr DEVICE model esp_milight_hub_rgbw_bulb setreading DEVICE attrTemplateVersion 20200522 or prior #rgbw-group name:esp_milight_hub_make_rgbw_group prereq:{my @devices=devspec2array("model=esp_milight_hub_bridge");;return 1 if $devices[0];;return 0} filter:TYPE=MQTT2_DEVICE:FILTER=CID~milight.* desc:For use with X_01_esp_milight_hub_bridge
Defines a new device based on the one the template is applied to.
Only basic elements to control a group of rgbw bulbs will be available. order:X_01a par:BASE_ID;BASE_ID typically is milight;{ AttrVal("DEVICE","readingList","") =~ m,([^/:]+)/[^/]*at[^/]+/.*:, ? $1 : undef } par:GROUP_ID;number from 0 to 8 representing one of the channels of an original bridge or remote;{ AttrVal("DEVICE","readingList","") =~ m,[^/]+/[^/]+/[^/]+/([0-8]):, ? $1 : undef } par:REMOTE_ID;HEX number representing a specific remote or bridge;{ AttrVal("DEVICE","readingList","") =~ m,([^/]+)/(0x[0-9a-fA-F]{1\,4})/.*:, ? $2 : undef } par:BULB_TYPE;rgbw, cct, rgb_cct, rgb, fut089, ;{ AttrVal("DEVICE","readingList","") =~ m,[^/]+/[^/]+/[^/]+/([^/]+)/.*:, ? $1 : undef } copy DEVICE milight_REMOTE_ID_0 deletereading -q milight_REMOTE_ID_0 .*_.* attr milight_REMOTE_ID_0 icon light_control attr milight_REMOTE_ID_0 eventMap /set_white:Weiss/night_mode:Nacht/white_mode:white/ attr milight_REMOTE_ID_0 devStateIcon {zigbee2mqtt_devStateIcon255($name)} attr milight_REMOTE_ID_0 webCmd brightness:hue:command attr milight_REMOTE_ID_0 readingList \ BASE_ID/states/REMOTE_ID/BULB_TYPE/0:.* { json2nameValue($EVENT) }\ BASE_ID/updates/REMOTE_ID/BULB_TYPE/0:.* { json2nameValue($EVENT) } attr milight_REMOTE_ID_0 setList\ on:noArg BASE_ID/REMOTE_ID/BULB_TYPE/0 {"status":"ON"}\ off:noArg BASE_ID/REMOTE_ID/BULB_TYPE/0_ID {"status":"OFF"}\ brightness:colorpicker,BRI,0,15,255 BASE_ID/REMOTE_ID/BULB_TYPE/0 {"$EVTPART0":"$EVTPART1"}\ hue:colorpicker,HUE,0,1,359 BASE_ID/REMOTE_ID/BULB_TYPE/0 {"$EVTPART0":"$EVTPART1"}\ command:uzsuSelectRadio,Weiss,Nacht BASE_ID/REMOTE_ID/BULB_TYPE/0 {"$EVTPART0":"$EVTPART1"} attr milight_REMOTE_ID_0 setStateList on off #attr milight_REMOTE_ID_0 userReadings rgb:color_r.* {sprintf("%02X%02X%02X", ReadingsVal($name,"color_r",255), ReadingsVal($name,"color_g",255), ReadingsVal($name,"color_b",255))} modify milight_REMOTE_ID_0 milight_REMOTE_ID_0 set DEVICE attrTemplate speechcontrol_type_light_255 attr milight_REMOTE_ID_0 model esp_milight_hub_make_rgbw_group setreading milight_REMOTE_ID_0 attrTemplateVersion 20200522 or prior #rgbw_cct-bulb name:esp_milight_hub_rgb_cct_bulb prereq:{my @devices=devspec2array("model=esp_milight_hub_bridge");;return 1 if $devices[0];;return 0} filter:TYPE=MQTT2_DEVICE:FILTER=CID~milight.* desc:For use with X_01_esp_milight_hub_bridge
NOTE: Development state is experimental!
Source: Forum order:X_01a1 par:BASE_ID;BASE_ID typically is milight;{ AttrVal("DEVICE","readingList","") =~ m,([^/:]+)/[^/]*at[^/]+/.*:, ? $1 : undef } par:GROUP_ID;number from 0 to 8 representing one of the channels of an original bridge or remote;{ AttrVal("DEVICE","readingList","") =~ m,[^/]+/[^/]+/[^/]+/([0-8]):, ? $1 : undef } par:REMOTE_ID;HEX number representing a specific remote or bridge;{ AttrVal("DEVICE","readingList","") =~ m,([^/]+)/(0x[0-9a-fA-F]{1\,4})/.*:, ? $2 : undef } par:BULB_TYPE;rgbw, cct, rgb_cct, rgb, fut089, ;{ AttrVal("DEVICE","readingList","") =~ m,[^/]+/[^/]+/[^/]+/([^/]+)/.*:, ? $1 : undef } par:ICON;ICON as set, defaults to light_control;{ AttrVal("DEVICE","icon","light_control") } attr DEVICE icon ICON deletereading -q DEVICE .*_.* attr DEVICE eventMap /set_white:Weiss/night_mode:Nacht/white_mode:white/on:on/off:off/ON:on/OFF:off/next_mode:Mode/mode_speed_up:Faster/mode_speed_down:Slower/level_up:Up/level_down:Down/ attr DEVICE devStateIcon {zigbee2mqtt_devStateIcon255($name)} attr DEVICE readingList \ BASE_ID/states/REMOTE_ID/BULB_TYPE/GROUP_ID:.* { json2nameValue($EVENT) }\ BASE_ID/states/REMOTE_ID/BULB_TYPE/0:.* { json2nameValue($EVENT) }\ BASE_ID/updates/REMOTE_ID/BULB_TYPE/GROUP_ID:.* { json2nameValue($EVENT) }\ BASE_ID/updates/REMOTE_ID/BULB_TYPE/0:.* { json2nameValue($EVENT) } attr DEVICE setList\ on:noArg BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"status":"ON"}\ off:noArg BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"status":"OFF"}\ brightness:colorpicker,BRI,0,15,255 BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"$EVTPART0":"$EVTPART1"}\ hue:colorpicker,HUE,0,1,359 BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"$EVTPART0":"$EVTPART1"}\ color_temp:colorpicker,CT,153,1,370 BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"$EVTPART0":"$EVTPART1"}\ saturation:colorpicker,BRI,0,1,100 BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"$EVTPART0":"$EVTPART1"}\ command:uzsuSelectRadio,Weiss,Nacht BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"$EVTPART0":"$EVTPART1"}\ program:uzsuSelectRadio,Mode,Faster,Slower BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"command":"$EVTPART1"}\ mode:select,0,1,2,3,4,5,6,7,8 BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"$EVTPART0":"$EVTPART1"}\ dim:uzsuSelectRadio,Up,Down BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"command":"$EVTPART1"} #attr DEVICE userReadings rgb:color_r.* {sprintf("%02X%02X%02X", ReadingsVal($name,"color_r",255), ReadingsVal($name,"color_g",255), ReadingsVal($name,"color_b",255))} attr DEVICE webCmd brightness:dim:hue:command:color_temp:program:saturation:mode attr DEVICE webCmdLabel brightness:dim\ :hue:command\ :color_temp:program\ :saturation:mode attr DEVICE setStateList on off # computed_color will send RGB = 255,255,255 when in white mode. This is useful for HomeAssistant where it always expects the color to be set. attr DEVICE comment To switch device also on when changing brightness, change payload pattern to {"status":"ON","$EVTPART0":"$EVTPART1"} or add a new element to setList, similar to brightness, e.g.brightness_on and change payload pattern as described. set DEVICE attrTemplate speechcontrol_type_light_255 attr DEVICE model esp_milight_hub_rgb_cct_bulb setreading DEVICE attrTemplateVersion 20200522 or prior #cct-only-bulb name:esp_milight_hub_cct_only_bulb prereq:{my @devices=devspec2array("model=esp_milight_hub_bridge");;return 1 if $devices[0];;return 0} filter:TYPE=MQTT2_DEVICE:FILTER=CID~milight.* desc:For use with X_01_esp_milight_hub_bridge
NOTE: Development state is experimental!
simple CCT device order:X_01b par:BASE_ID;BASE_ID typically is milight;{ AttrVal("DEVICE","readingList","") =~ m,([^/:]+)/[^/]*at[^/]+/.*:, ? $1 : undef } par:GROUP_ID;number from 0 to 8 representing one of the channels of an original bridge or remote;{ AttrVal("DEVICE","readingList","") =~ m,[^/]+/[^/]+/[^/]+/([0-8]):, ? $1 : undef } par:REMOTE_ID;HEX number representing a specific remote or bridge;{ AttrVal("DEVICE","readingList","") =~ m,([^/]+)/(0x[0-9a-fA-F]{1\,4})/.*:, ? $2 : undef } par:BULB_TYPE;rgbw, cct, rgb_cct, rgb, fut089, ;{ AttrVal("DEVICE","readingList","") =~ m,[^/]+/[^/]+/[^/]+/([^/]+)/.*:, ? $1 : undef } par:ICON;ICON as set, defaults to light_control;{ AttrVal("DEVICE","icon","light_control") } attr DEVICE icon ICON deletereading -q DEVICE .*_.* attr DEVICE eventMap /set_white:Weiss/night_mode:Nacht/white_mode:white/on:on/off:off/ON:on/OFF:off/next_mode:Mode/mode_speed_up:Faster/mode_speed_down:Slower/level_up:Up/level_down:Down/ attr DEVICE devStateIcon {zigbee2mqtt_devStateIcon255($name)} attr DEVICE readingList \ BASE_ID/states/REMOTE_ID/BULB_TYPE/GROUP_ID:.* { json2nameValue($EVENT) }\ BASE_ID/states/REMOTE_ID/BULB_TYPE/0:.* { json2nameValue($EVENT) }\ BASE_ID/updates/REMOTE_ID/BULB_TYPE/GROUP_ID:.* { json2nameValue($EVENT) }\ BASE_ID/updates/REMOTE_ID/BULB_TYPE/0:.* { json2nameValue($EVENT) } attr DEVICE setList\ on:noArg BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"status":"ON"}\ off:noArg BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"status":"OFF"}\ brightness:colorpicker,BRI,0,15,255 BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"$EVTPART0":"$EVTPART1"}\ command:uzsuSelectRadio,Weiss,Nacht BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"$EVTPART0":"$EVTPART1"}\ program:uzsuSelectRadio,Mode,Faster,Slower BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"command":"$EVTPART1"}\ mode:select,0,1,2,3,4,5,6,7,8 BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"$EVTPART0":"$EVTPART1"}\ dim:uzsuSelectRadio,Up,Down BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"command":"$EVTPART1"} attr DEVICE webCmd brightness:dim:command:program:mode attr DEVICE webCmdLabel :dim\ ::: attr DEVICE setStateList on off attr DEVICE comment To switch device also on when changing brightness, change payload pattern to {"status":"ON","$EVTPART0":"$EVTPART1"} or add a new element to setList, similar to brightness, e.g.brightness_on and change payload pattern as described. set DEVICE attrTemplate speechcontrol_type_light_255 attr DEVICE model esp_milight_hub_cct_only_bulb setreading DEVICE attrTemplateVersion 20200522 or prior #rgbw-bulb name:esp_milight_hub_max_features_bulb prereq:{my @devices=devspec2array("model=esp_milight_hub_bridge");;return 1 if $devices[0];;return 0} filter:TYPE=MQTT2_DEVICE:FILTER=CID~milight.* desc:For use with X_01_esp_milight_hub_bridge
Device could contain more options than your physical device might be able to handle. Just delete, what you don't need...
NOTE: Development state is experimental!
NOTE: regex not working to extract remote channel... Topic is something like milight/updates/0xABCD/rgbw/0 order:X_01x par:BASE_ID;BASE_ID typically is milight;{ AttrVal("DEVICE","readingList","") =~ m,([^/:]+)/[^/]*at[^/]+/.*:, ? $1 : undef } par:GROUP_ID;number from 0 to 8 representing one of the channels of an original bridge or remote;{ AttrVal("DEVICE","readingList","") =~ m,[^/]+/[^/]+/[^/]+/([0-8]):, ? $1 : undef } par:REMOTE_ID;HEX number representing a specific remote or bridge;{ AttrVal("DEVICE","readingList","") =~ m,([^/]+)/(0x[0-9a-fA-F]{1\,4})/.*:, ? $2 : undef } par:BULB_TYPE;rgbw, cct, rgb_cct, rgb, fut089, ;{ AttrVal("DEVICE","readingList","") =~ m,[^/]+/[^/]+/[^/]+/([^/]+)/.*:, ? $1 : undef } par:ICON;ICON as set, defaults to light_control;{ AttrVal("DEVICE","icon","light_control") } attr DEVICE icon ICON deletereading -q DEVICE .*_.* attr DEVICE devStateIcon {zigbee2mqtt_devStateIcon255($name,'hex',1)} attr DEVICE readingList \ BASE_ID/states/REMOTE_ID/BULB_TYPE/GROUP_ID:.* { json2nameValue($EVENT) }\ BASE_ID/states/REMOTE_ID/BULB_TYPE/0:.* { json2nameValue($EVENT) }\ BASE_ID/updates/REMOTE_ID/BULB_TYPE/GROUP_ID:.* { json2nameValue($EVENT) }\ BASE_ID/updates/REMOTE_ID/BULB_TYPE/0:.* { json2nameValue($EVENT) } attr DEVICE setExtensionsEvent 1 attr DEVICE setList \ on:noArg BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"status":"ON"}\ off:noArg BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"status":"OFF"}\ brightness:colorpicker,BRI,0,15,255 BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"$EVTPART0":"$EVTPART1"}\ hue:colorpicker,HUE,0,1,359 BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"$EVTPART0":"$EVTPART1"}\ color_temp:colorpicker,CT,153,1,370 BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"$EVTPART0":"$EVTPART1"}\ saturation:colorpicker,BRI,0,1,100 BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"$EVTPART0":"$EVTPART1"}\ command:uzsuSelectRadio,Weiss,Nacht BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"$EVTPART0":"$EVTPART1"}\ program:uzsuSelectRadio,Mode,Faster,Slower BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"command":"$EVTPART1"}\ mode:select,0,1,2,3,4,5,6,7,8 BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"$EVTPART0":"$EVTPART1"}\ dim:uzsuSelectRadio,Up,Down BASE_ID/REMOTE_ID/BULB_TYPE/GROUP_ID {"command":"$EVTPART1"} 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 webCmd on:off:brightness:dim:hue:command:color_temp:program:saturation:mode attr DEVICE webCmdLabel An:Aus\ :Helligkeit:Dimmen\ :HUE:Command\ :Farb-Temp:Programm\ :Sättigung:Modus attr DEVICE eventMap /set_white:Weiss/night_mode:Nacht/white_mode:white/on:on/off:off/ON:on/OFF:off/next_mode:Mode/mode_speed_up:Faster/mode_speed_down:Slower/level_up:Up/level_down:Down/ attr DEVICE comment To switch device also on when changing brightness, change payload pattern to {"status":"ON","$EVTPART0":"$EVTPART1"} or add a new element to setList, similar to brightness, e.g.brightness_on and change payload pattern as described. set DEVICE attrTemplate speechcontrol_type_light_255 attr DEVICE model esp_milight_hub_max_features_bulb setreading DEVICE attrTemplateVersion 20200522 or prior #remote for event generation only name:esp_milight_hub_remote_events_only prereq:{my @devices=devspec2array("model=esp_milight_hub_bridge");;return 1 if $devices[0];;return 0} filter:TYPE=MQTT2_DEVICE desc:For use with X_01_esp_milight_hub_bridge
See Forum Thread for examples how to control a MPD, HUEDevice bulbs or shutters by a MiLight remote. order:X_01y par:BASE_ID;BASE_ID typically is milight;{ AttrVal("DEVICE","readingList","") =~ m,([^/:]+)/[^/]*at[^/]+/.*:, ? $1 : undef } par:GROUP_ID;number from 0 to 8 representing one of the channels of an original bridge or remote;{ AttrVal("DEVICE","readingList","") =~ m,[^/]+/[^/]+/[^/]+/([0-8]):, ? $1 : undef } par:REMOTE_ID;HEX number representing a specific remote or bridge;{ AttrVal("DEVICE","readingList","") =~ m,([^/]+)/(0x[0-9a-fA-F]{1\,4})/.*:, ? $2 : undef } par:BULB_TYPE;rgbw, cct, rgb_cct, rgb, fut089, ;{ AttrVal("DEVICE","readingList","") =~ m,[^/]+/[^/]+/[^/]+/([^/]+)/.*:, ? $1 : undef } deletereading -q DEVICE .*_.* attr DEVICE readingList \ BASE_ID/states/REMOTE_ID/BULB_TYPE/GROUP_ID:.* { }\ BASE_ID/updates/REMOTE_ID/BULB_TYPE/GROUP_ID:.* { json2nameValue($EVENT) } attr DEVICE model esp_milight_hub_remote_events_only setreading DEVICE attrTemplateVersion 20200522 or prior ############### #OpenMQTTGateway #use this with an OpenMQTTGateway. For further details visit https://github.com/1technophile/OpenMQTTGateway/wiki #recommended structure of the topic pattern home/OpenMQTTGateway.*/.* #as set in the settings section in the GW's web interface # #OpenMQTTGateway - Microcontroller #Atm there are no furter commands to be set to the esp itself name:OpenMQTTGateway_MCU filter:TYPE=MQTT2_DEVICE desc:Use this with an OpenMQTTGateway. This template is meant to configure a bridge device showing some basic info about the microcontroller (mcu) itself. For further details visit https://github.com/1technophile/OpenMQTTGateway/wiki
Recommended structure of the topic pattern home/OpenMQTTGateway/.*.
NOTE: Early user version, not yet fully tested, just build according to https://forum.fhem.de/index.php/topic,103737.0.html
Adopt it to your needs! order:X_02 par:BASE_ID;BASE_ID typically is home;{ AttrVal("DEVICE","readingList","") =~ m,([^:]+)[/]O[^/]*M[^/]*G[^/]*[/].*:, ? $1 : undef } par:DEVNAME;DEVNAME typically contains OpenMQTTGateway;{ AttrVal("DEVICE","readingList","") =~ m,([^:]+)[/](O[^/]*M[^/]*G[^/]*)[/].*:, ? $2 : undef } par:DEVCID;CID of the device as written in the DEF; { InternalVal(AttrVal('DEVICE','IODev',InternalVal('DEVICE','IODev',undef)->{NAME}),'clientId','mosquitto') eq InternalVal('DEVICE','DEF','mosquitto') ? 'oMQTTgw_MCU' : InternalVal('DEVICE','DEF','mosquitto')} par:ICON;ICON as set, defaults to MQTT;{ AttrVal("DEVICE","icon","mqtt") } deletereading -q DEVICE (?!associatedWith|IODev).* attr DEVICE bridgeRegexp\ BASE_ID/DEVNAME/BTtoMQTT/([0-9A-Z]+)[:/].* "oMQTTgw_BT"\ BASE_ID/DEVNAME/433toMQTT[:/].* "oMQTTgw_433"\ BASE_ID/DEVNAME/IRtoMQTT[:/].* "oMQTTgw_IR"\ BASE_ID/DEVNAME/CLIMAtoMQTT/([a-zA-Z0-9]+)[:/].* "DEVNAME_$1" attr DEVICE readingList\ BASE_ID/DEVNAME/LWT:.* LWT\ BASE_ID/DEVNAME/version:.* version\ BASE_ID/DEVNAME/SYStoMQTT[:/].* { json2nameValue($EVENT,'Sys_')}\ BASE_ID/home_presence/.* {}\ homeassistant/.+?/config:.* { } attr DEVICE setList\ restart:noArg BASE_ID/DEVNAME/commands/MQTTtoSYS/config {"cmd":"restart"} attr DEVICE stateFormat \ LWT\ Version: version attr DEVICE icon ICON attr DEVICE devStateIcon online:10px-kreis-gruen offline.*:10px-kreis-rot attr DEVICE model OpenMQTTGateway_MCU setreading DEVICE attrTemplateVersion 20211207 { AttrTemplate_Initialize() } name:OpenMQTTGateway_BT_scanner prereq:{my @devices=devspec2array("model=OpenMQTTGateway_MCU");;return 1 if $devices[0];;return 0} filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*/O[^/]*M[^/]*G[^/]*/.* desc:use this with an OpenMQTTGateway. For further details visit https://github.com/1technophile/OpenMQTTGateway/wiki
Recommended structure of the topic pattern home/OpenMQTTGateway/.*.
NOTE: Initial version, not yet tested, just build according to https://forum.fhem.de/index.php/topic,103737.0.html
Adopt settings to your needs. order:X_02a par:BASE_ID;BASE_ID typically is home;{ AttrVal("DEVICE","readingList","") =~ m,([^:]+)[/]O[^/]*M[^/]*G[^/]*[/].*:, ? $1 : undef } par:DEVNAME;BASE_ID typically is home;{ AttrVal("DEVICE","readingList","") =~ m,([^:]+)[/](O[^/]*M[^/]*G[^/]*)[/].*:, ? $2 : undef } par:ICON;ICON as set, defaults to bluetooth;{ AttrVal("DEVICE","icon","bluetooth") } attr DEVICE readingList\ BASE_ID/DEVNAME/BTtoMQTT/([0-9A-Z]+):.* { $TOPIC =~ m,BTtoMQTT/([0-9A-Z]+),; json2nameValue($EVENT,"$1"."_") }\ BASE_ID/DEVNAME/BTtoMQTT/([0-9A-Z]+)/[^:]+:.* { $TOPIC =~ m,BTtoMQTT/([0-9A-Z]+)/([^:]+),; { "${1}_$2"=>$EVENT }}\ BASE_ID/home_presence/DEVNAME:.* { return unless $EVENT =~ m,(..):(..):(..):(..):(..):(..),; json2nameValue($EVENT,"BT_".uc($1.$2.$3.$4.$5.$6)."_"); {"last"=>uc($1.$2.$3.$4.$5.$6)}} attr DEVICE setList\ BT_scan_now:noArg BASE_ID/DEVNAME/commands/MQTTtoBT/config {"interval":0}\ BT_scan_interval:textField BASE_ID/DEVNAME/commands/MQTTtoBT/config {"interval":$EVTPART1}\ BT_blacklist:textField BASE_ID/DEVNAME/commands/MQTTtoBT/config {"black-list":[$EVTPART1]}\ BT_whitelist:textField BASE_ID/DEVNAME/commands/MQTTtoBT/config {"white-list":[$EVTPART1]}\ BT_minrssi:slider,-110,1,0 BASE_ID/DEVNAME/commands/MQTTtoBT/config {"minrssi":$EVTPART1}}\ deleteReadings:noArg {fhem "deletereading -q $NAME (?!associatedWith|attrTemplateVersion).* 86400"} attr DEVICE periodicCmd deleteReadings:1440 attr DEVICE stateFormat Last: last attr DEVICE model OpenMQTTGateway_BT_scanner setreading DEVICE attrTemplateVersion 20201208 name:OpenMQTTGateway_BT_gtag prereq:{my @devices=devspec2array("model=OpenMQTTGateway_MCU");return 1 if $devices[0];return 0} filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*/O[^/]*M[^/]*G[^/]*/.* desc:For detection of a bluetooth precence dongle like the gtag via OpenMQTTGateway. For further details visit https://github.com/1technophile/OpenMQTTGateway/wiki
Recommended structure of the topic pattern home/OpenMQTTGateway/.*.
NOTE: You'll be asked to provide the HEX address of your gtag. Best start with looking at what "OpenMQTTGateway_BT_scanner" povides, e.g. if you have a reading name like "6C697244245E_id", "6C697244245E" (without quotes) is what you want to enter...
NOTE: this will create a new device! order:X_02a1 par:ICON;ICON as set, defaults to rfid_tag;{ AttrVal("DEVICE","icon","rfid_tag") } par:BT_ID;Pls. enter your bluetooth device ID; {return} par:BASE_ID;BASE_ID typically is home;{ AttrVal("DEVICE","readingList","") =~ m,([^:]+)[/]O[^/]*M[^/]*G[^/]*[/].*:, ? $1 : return } par:NEWDEVROOM;Room of the calling device; {AttrVal("DEVICE","room","MQTT2_\DEVICE" )} defmod OMG_BT_ID MQTT2_\DEVICE BT_ID #attr OMG_BT_ID readingList READINGLISTOLD deletereading -q OMG_BT_ID (?!associatedWith|IODev).* attr OMG_BT_ID autocreate 0 attr OMG_BT_ID readingList\ BASE_ID/(O[^/]*M[^/]*G[^/]*)/BTtoMQTT/BT_ID:.* { $TOPIC =~ m,BASE_ID/(O[^/]*M[^/]*G[^/]*)/BTtoMQTT,; json2nameValue($EVENT, "${1}_") }\ BASE_ID/(O[^/]*M[^/]*G[^/]*)/BTtoMQTT/BT_ID:.* { $TOPIC =~ m,BASE_ID/(O[^/]*M[^/]*G[^/]*)/BTtoMQTT,; {"last_IO"=>"$1"}} attr OMG_BT_ID event-min-interval 300 attr OMG_BT_ID icon ICON attr OMG_BT_ID stateFormat Last IO: last_IO attr OMG_BT_ID room NEWDEVROOM { fhem "trigger $FW_wname JS:location.href='$FW_ME?detail=OMG_BT_ID'" if($cl && $cl->{TYPE} eq "FHEMWEB") } attr OMG_BT_ID model OpenMQTTGateway_BT_gtag set DEVICE attrTemplate set_IODev_in_channels SUBCHANNELS=OMG_BT_ID setreading OMG_BT_ID attrTemplateVersion 20211011 name:OpenMQTTGateway_BT_mi_flora_sensor prereq:{my @devices=devspec2array("model=OpenMQTTGateway_MCU");return 1 if $devices[0];return 0} filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*/O[^/]*M[^/]*G[^/]*/.* desc:use this with an OpenMQTTGateway. For further details visit https://github.com/1technophile/OpenMQTTGateway/wiki
Recommended structure of the topic pattern home/OpenMQTTGateway/.*.
NOTE: You'll be asked to provide the HEX address of your mi flora device. Best start with looking at what "OpenMQTTGateway_BT_scanner" povides, e.g. if you have a reading name like "6C697244245E_id", "6C697244245E" (without quotes) is what you want to enter...
NOTE: this will create a new device! order:X_02a2 par:BT_ID;Pls. enter your bluetooth device ID; {undef} par:BASE_ID;BASE_ID typically is home;{ AttrVal("DEVICE","readingList","") =~ m,([^:]+)[/]O[^/]*M[^/]*G[^/]*[/].*:, ? $1 : undef } par:NEWDEVROOM;Room of the calling device; {AttrVal("DEVICE","room","MQTT2_\DEVICE" )} defmod OMG_BT_ID MQTT2_\DEVICE BT_ID deletereading -q OMG_BT_ID (?!associatedWith|IODev).* attr OMG_BT_ID autocreate 0 attr OMG_BT_ID readingList\ BASE_ID/O[^/]*M[^/]*G[^/]*/BTtoMQTT/BT_ID:.* { json2nameValue($EVENT,'',$JSONMAP) } attr OMG_BT_ID event-min-interval 300 attr OMG_BT_ID event-on-change-reading temperature:0.2,moisture:0.2,rssi:5,distance:5,fertility:5,lux:5 attr OMG_BT_ID icon temperature_humidity attr OMG_BT_ID jsonMap tem:temperature hum:humidity moi:moisture fer:fertility servicedatauuid:0 servicedata:0 attr OMG_BT_ID stateFormat T: temperature°C, M: moisture%, L: lux, F: fertility attr OMG_BT_ID room NEWDEVROOM { fhem "trigger $FW_wname JS:location.href='$FW_ME?detail=OMG_BT_ID'" if($cl && $cl->{TYPE} eq "FHEMWEB") } attr OMG_BT_ID model OpenMQTTGateway_BT_mi_flora_sensor set DEVICE attrTemplate set_IODev_in_channels SUBCHANNELS=OMG_BT_ID setreading OMG_BT_ID attrTemplateVersion 20211011 name:OpenMQTTGateway_simple_RF433_switch prereq:{my @devices=devspec2array("model=OpenMQTTGateway_MCU");return 1 if $devices[0];return 0} filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*/O[^/]*M[^/]*G[^/]*/.* desc:use this with an OpenMQTTGateway. For further details visit https://github.com/1technophile/OpenMQTTGateway/wiki
Recommended structure of the topic pattern home/OpenMQTTGateway/.*.
NOTE: Initial version, not yet tested, just build according to https://forum.fhem.de/index.php/topic,103737.0.html
Adopt settings to your needs.
NOTE: this might create a new device! order:X_02a par:ONCOMMANDREGEX;ONCOMMANDREGEX typically is one or more Codes like 13027392|13519216|12585648|13349168;undef par:ON_COMMAND;ON_COMMAND typically is a set of parameters like "value":"13027392","protocol":4,"length":24,"delay":350;undef par:OFFCOMMANDREGEX;OFFCOMMANDREGEX typically is one or more Codes like 13381408|13226144|13381408|13599888;undef par:OFF_COMMAND;ON_COMMAND typically is a set of parameters like "value":"13381408","protocol":4,"length":24,"delay":350;undef par:BASE_ID;BASE_ID typically is home;{ AttrVal("DEVICE","readingList","") =~ m,([^:]+)[/]O[^/]*M[^/]*G[^/]*[/].*:, ? $1 : undef } par:DEVNAME;BASE_ID typically is home;{ AttrVal("DEVICE","readingList","") =~ m,([^:]+)[/](O[^/]*M[^/]*G[^/]*)[/].*:, ? $2 : undef } par:DEVCID;CID of the new device - try to read the last RF value; { ReadingsVal("DEVICE","value","unknown") } par:NEWDEVROOM;Room of the calling device; {AttrVal("DEVICE","room","MQTT2_\DEVICE" )} defmod OMG_DEVCID MQTT2_\DEVICE DEVCID deletereading -q OMG_DEVCID (?!associatedWith|IODev).* defmod OMG_DEVCID MQTT2_\DEVICE DEVCID attr OMG_DEVCID autocreate 0 attr OMG_DEVCID readingList\ BASE_ID/DEVNAME/433toMQTT:.* { $EVENT =~ m,..value..(ONCOMMANDREGEX)..protocol..\d..length..\d+..delay..\d+.,? {"state"=>"on"} : $EVENT =~ m,..value..(OFFCOMMANDREGEX)..protocol..\d..length..\d+..delay..\d+., ? {"state"=>"off"}:return }\ BASE_ID/DEVNAME/433toMQTT:.* { $EVENT =~ m,..value..([\d]+)..protocol..\d..length..\d+..delay..\d+.,? {"received_code"=>"$1"}:return } attr OMG_DEVCID setList\ on:noArg BASE_ID/DEVNAME/commands/MQTTto433 {ON_COMMAND}\ off:noArg BASE_ID/DEVNAME/commands/MQTTto433 {OFF_COMMAND} { fhem "trigger $FW_wname JS:location.href='$FW_ME?detail=OMG_DEVCID'" if($cl && $cl->{TYPE} eq "FHEMWEB") } farewell:template has been applied successfully. attr OMG_DEVCID room NEWDEVROOM attr OMG_DEVCID model OpenMQTTGateway_simple_RF433_switch set DEVICE attrTemplate set_IODev_in_channels SUBCHANNELS=OMG_DEVCID setreading OMG_DEVCID attrTemplateVersion 20211011 name:OpenMQTTGateway_bme prereq:{my @devices=devspec2array("model=OpenMQTTGateway_MCU");return 1 if $devices[0];return 0} filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*/O[^/]*M[^/]*G[^/]*/.* desc:use this with an OpenMQTTGateway. For further details visit https://github.com/1technophile/OpenMQTTGateway/wiki
Recommended structure of the topic pattern home/OpenMQTTGateway/.*.
NOTE: Initial version, not yet tested, just build according to https://forum.fhem.de/index.php/topic,103737.0.html
Adopt settings to your needs.
NOTE: this might create a new device! order:X_02b par:BASE_ID;BASE_ID typically is home;{ AttrVal("DEVICE","readingList","") =~ m,([^:]+)[/]O[^/]*M[^/]*G[^/]*[/].*:, ? $1 : undef } par:DEVNAME;BASE_ID typically is home;{ AttrVal("DEVICE","readingList","") =~ m,([^:]+)[/](O[^/]*M[^/]*G[^/]*)[/].*:, ? $2 : undef } deletereading -q DEVICE (?!associatedWith|IODev).* attr DEVICE autocreate 0 attr DEVICE readingList\ BASE_ID/DEVNAME/CLIMAtoMQTT/bme:.* { json2nameValue($EVENT, 'BME_') } attr DEVICE stateFormat BME_tempc °C - BME_hum % - hpa hPa attr DEVICE userReadings hpa:BME_pa.* {ReadingsVal($name,"BME_pa",0)/100} attr DEVICE model OpenMQTTGateway_bme setreading DEVICE attrTemplateVersion 20200522 or prior name:OpenMQTTGateway_ir prereq:{my @devices=devspec2array("model=OpenMQTTGateway_MCU");return 1 if $devices[0];return 0} filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*/O[^/]*M[^/]*G[^/]*/.* desc:use this with an OpenMQTTGateway. For further details visit https://github.com/1technophile/OpenMQTTGateway/wiki
Recommended structure of the topic pattern home/OpenMQTTGateway/.*.
NOTE: Initial version, not yet tested, just build according to https://forum.fhem.de/index.php/topic,103737.0.html
Adopt settings to your needs.
NOTE: this might create a new device! order:X_02c par:BASE_ID;BASE_ID typically is home;{ AttrVal("DEVICE","readingList","") =~ m,([^:]+)[/]O[^/]*M[^/]*G[^/]*[/].*:, ? $1 : undef } par:DEVNAME;BASE_ID typically is home;{ AttrVal("DEVICE","readingList","") =~ m,([^:]+)[/](O[^/]*M[^/]*G[^/]*)[/].*:, ? $2 : undef } deletereading -q DEVICE (?!associatedWith|IODev).* attr DEVICE autocreate 0 attr DEVICE readingList\ BASE_ID/DEVNAME/IRtoMQTT:.* { json2nameValue($EVENT) } attr DEVICE setList irsend:textField BASE_ID/DEVNAME/IRtoMQTT {"value":$EVTPART2,"protocol_name":"IR_$EVTPART1"} attr DEVICE comment irsend needs Infos about protocol and value (n decimal), so e.g."IR_NEC 1587664935" should be fine... attr DEVICE model OpenMQTTGateway_ir setreading DEVICE attrTemplateVersion 20200522 or prior name:OpenMQTTGateway_BT_temp_hum_sensor prereq:{my @devices=devspec2array("model=OpenMQTTGateway_MCU");return 1 if $devices[0];return 0} filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*/O[^/]*M[^/]*G[^/]*/.* desc:use this with an OpenMQTTGateway for temp/hum sensors like LYWSD03MMC and LYWSDCGQ. For further details visit https://github.com/1technophile/OpenMQTTGateway/wiki
Recommended structure of the topic pattern home/OpenMQTTGateway/.*.
NOTE: You'll be asked to provide the HEX address of your sensor. Best start with looking at what "OpenMQTTGateway_BT_scanner" povides, e.g. if you have a reading name like "6C697244245E_id", "6C697244245E" (without quotes) is what you want to enter...
NOTE: this will create a new device! order:X_02d par:BT_ID;Pls. enter your bluetooth device ID; {undef} par:BASE_ID;BASE_ID typically is home;{ AttrVal("DEVICE","readingList","") =~ m,([^:]+)[/]O[^/]*M[^/]*G[^/]*[/].*:, ? $1 : undef } #par:READINGLISTOLD;copy readingList to new device for later resolving parameters;{ AttrVal("DEVICE","readingList","")} par:NEWDEVROOM;Room of the calling device; {AttrVal("DEVICE","room","MQTT2_\DEVICE" )} defmod OMG_BT_ID MQTT2_\DEVICE BT_ID deletereading -q OMG_BT_ID (?!associatedWith|IODev).* attr OMG_BT_ID autocreate 0 attr OMG_BT_ID readingList\ BASE_ID/O[^/]*M[^/]*G[^/]*/BTtoMQTT/BT_ID:.* { json2nameValue($EVENT,'',$JSONMAP) } attr OMG_BT_ID event-min-interval 300 attr OMG_BT_ID event-on-change-reading batteryPercent,temperature:0.2,humidity:0.2,rssi:5,distance:5 attr OMG_BT_ID icon temperature_humidity attr OMG_BT_ID jsonMap batt:batteryPercent tempc:temperature tem:0 tempf:0 hum:humidity servicedatauuid:0 servicedata:0 attr OMG_BT_ID stateFormat T: temperature°C, H: humidity%rH attr OMG_BT_ID room NEWDEVROOM { fhem "trigger $FW_wname JS:location.href='$FW_ME?detail=OMG_BT_ID'" if($cl && $cl->{TYPE} eq "FHEMWEB") } attr OMG_BT_ID model OpenMQTTGateway_BT_temp_hum_sensor set DEVICE attrTemplate set_IODev_in_channels SUBCHANNELS=OMG_BT_ID setreading OMG_BT_ID attrTemplateVersion 20211011 ############### #OwnTracks # an OwnTracks device #contributed by Loredo #source post: https://forum.fhem.de/index.php/topic,99666.msg1019884.html#msg1019884 # modified by Otto123 name:owntracks_device desc:A device tracked by OwnTracks, basic Device for support Android and IOS filter:TYPE=MQTT2_DEVICE:FILTER=CID~owntracks.* order:O_01 par:TRACKER_ID;TrackerID;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,/([^/]+)/, ? $1 : undef } par:DEV_ID;DeviceID;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,/[^/]+/([^/:]+), ? $1 : undef } par:WHICHROOM;Actual room of the device, defaults to OwnTracks; {AttrVal("DEVICE","room","OwnTracks" )} attr DEVICE room WHICHROOM attr DEVICE icon location_sign attr DEVICE devicetopic owntracks/TRACKER_ID/DEV_ID attr DEVICE jsonMap\ acc:accuracy alt:altitude batt:batteryPercent lat:latitude lon:longitude vac:accuracyVertical vel:velocity\ _type:lastUpdateType tst:timestamp tid:trackerId attr DEVICE readingList\ $\DEVICETOPIC.* raw\ $\DEVICETOPIC:.* { json2nameValue($EVENT,'',$JSONMAP) }\ $\DEVICETOPIC/event:.* { json2nameValue($EVENT,'',$JSONMAP) }\ $\DEVICETOPIC/waypoints:.* { my (%h,$cnt); $EVENT=~ s/(\{[^[]*?})/$h{"waypoint_".++$cnt}=$1/ge; \%h } attr DEVICE getList\ location:noArg raw $\DEVICETOPIC/cmd {"_type":"cmd","action":"reportLocation"}\ waypoints:noArg raw $\DEVICETOPIC/cmd {"_type":"cmd","action":"waypoints"} attr DEVICE setList action:textField $\DEVICETOPIC/cmd {"_type":"cmd","action":$EVTPART1}\ config:textField $\DEVICETOPIC/cmd {"_type":"cmd","action":"setConfiguration","configuration":$EVTPART1}\ waypoints:textField $\DEVICETOPIC/cmd {"_type":"cmd","action":"setWaypoints","waypoints":{"_type":"waypoints","waypoints":[$EVTPART1]}}\ mode:Quite,Manual,Significant,Move { my %h=(Quite=>'-1',Manual=>'0',Significant=>'1',Move=>'2');fhem("set $NAME config ".qq({"_type":"configuration","monitoring":$h{$EVTPART1}})) }\ x_raw_payload:textField { my $payload = $EVENT; $payload =~ s/$EVTPART0 //; qq($\DEVICETOPIC/cmd $payload) } attr DEVICE userReadings\ location:lat.* {ReadingsNum($name,'latitude',0).','.ReadingsNum($name,'longitude',0)},\ connection:conn.* {my %h=(m=>'mobil',w=>'wifi',o=>'offline',e=>'unknown'); return $h{ReadingsVal('MQTT2_owntracks_mi6','conn','e')}},\ place:event.* {ReadingsVal($name,'event','') eq 'leave'?'away':(ReadingsVal($name,'desc','nowhere'))} deletereading -q DEVICE (?!associatedWith|IODev).* attr DEVICE model owntracks_device attr DEVICE comment https://owntracks.org/booklet/tech/json/ setreading DEVICE attrTemplateVersion 20201212_2 name:owntracks_extend_IOS desc:Extend the owntracks device for IOS Readings, use owntracks_device first filter:TYPE=MQTT2_DEVICE:FILTER=model=owntracks_.* order:O_02 par:JMAP;jsonMap;{my $s=AttrVal("DEVICE","jsonMap","");$s=~s/\n/\\\n/g;return $s} par:READINGLIST;ReadingList;{my $s=AttrVal("DEVICE","readingList","");$s=~s/\n/\\\n/g;return $s} par:GETLIST;GetList;{my $s=AttrVal("DEVICE","getList","");$s=~s/\n/\\\n/g;return $s} attr DEVICE jsonMap JMAP\ config__type:lastUpdateType event__type:lastUpdateType step__type:lastUpdateType beacon__type:lastUpdateType\ bs:batteryState p:pressure t:trigger cog:direction\ event_acc:event_accuracy event_lat:event_latitude event_lon:event_longitude\ event_t:event_trigger event_tid:event_trackerId event_tst:event_timestamp\ event_wtst:event_waypointCreationTimestamp\ step_steps:steps_count step_from:steps_timestampBegin step_to:steps_timestampEnd step_tst:steps_timestampReq\ beacon_acc:beacon_accuracy beacon_prox:beacon_proximity beacon_tst:beacon_timestampReq attr DEVICE readingList READINGLIST\ $\DEVICETOPIC/step:.* { json2nameValue($EVENT,'step_',$JSONMAP) }\ $\DEVICETOPIC/beacon:.* { json2nameValue($EVENT,'beacon_',$JSONMAP) }\ $\DEVICETOPIC/dump:.* { json2nameValue($EVENT,'config_',$JSONMAP) } attr DEVICE getList GETLIST\ steps:noArg raw $\DEVICETOPIC/cmd {"_type":"cmd","action":"reportSteps"}\ config:noArg raw $\DEVICETOPIC/cmd {"_type":"cmd","action":"dump"} name:roborock filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*valetudo[/].* desc:use this to control a rooted Xiamoni Vacuum / Roborock. For further details visit https://github.com/Hypfer/Valetudo

NOTE: Initial version, not yet fully tested, just build according to https://forum.fhem.de/index.php/topic,104804.0.html
order:X_03 par:BASE_ID;BASE_ID typically is valetudo;{ AttrVal("DEVICE","readingList","") =~ m,(valetudo)[/].*:, ? $1 : undef } par:DEVNAME;DEVNAME typically is rockrobo;{ AttrVal("DEVICE","readingList","") =~ m,valetudo[/]([^/]+)[/].*:, ? $1 : undef } { Svn_GetFile("contrib/AttrTemplate/99_attrTmqtt2_roborock_Utils.pm", "FHEM/99_attrTmqtt2_roborock_Utils.pm", sub(){CommandReload(undef, "99_attrTmqtt2_roborock_Utils")}) } deletereading -q DEVICE (?!associatedWith|IODev).* defmod DEVICE MQTT2_\DEVICE DEVNAME attr DEVICE icon vacuum_top attr DEVICE devStateIcon { '' } attr DEVICE readingList homeassistant/vacuum/valetudo_DEVNAME/config:.* { json2nameValue($EVENT) }\ BASE_ID/DEVNAME/state:.* { json2nameValue($EVENT) }\ BASE_ID/DEVNAME/attributes:.* { json2nameValue($EVENT) }\ BASE_ID/DEVNAME/map_data:.* {attrTmqtt2_roborock_valetudo2svg("map_data",$EVENT,"www/images/DEVNAME_map.svg")} attr DEVICE setList start:noArg BASE_ID/DEVNAME/command start\ charge:noArg BASE_ID/DEVNAME/command return_to_base\ stop:noArg BASE_ID/DEVNAME/command stop\ spot:noArg BASE_ID/DEVNAME/command clean_spot\ pause:noArg BASE_ID/DEVNAME/command pause\ locate:noArg BASE_ID/DEVNAME/command locate\ fan_power:min,medium,high,max,mop BASE_ID/DEVNAME/set_fan_speed $EVTPART1\ zone BASE_ID/DEVNAME/custom_command {"command":"zoned_cleanup","zone_ids":["$EVTPART1"]}\ goto BASE_ID/DEVNAME/custom_command {"command":"go_to","spot_id":"$EVTPART1"}\ load_map BASE_ID/DEVNAME/custom_command {"command":"load_map","name":"$EVTPART1"}\ store_map BASE_ID/DEVNAME/custom_command {"command":"store_map","name":"$EVTPART1"} attr DEVICE setStateList charge locate pause stop start attr DEVICE comment For original code for "attrTmqtt2_roborock_valetudo2svg()" see this forum thread. To display generated map seperately, define a weblink device:
define valetudo_map weblink htmlCode farewell:template has been applied successfully.
NOTE: additional code has been downloaded from svn (contrib).
Generated map will be shown as devStateIcon or define a weblink device: define valetudo_map weblink htmlCode .
For details, see this forum thread. NOTE: For use with rand256-Valetudo variant of the code with external map generator, change "svg" in devStateIcon code to "png", change readingList entry for map_data to "BASE_ID/DEVNAME/map_data:.* {}" and add the following line:
BASE_ID/DEVNAME/map:.* { WriteFile("www/images/DEVNAME_map.png",$EVENT);; {map=>"images/DEVNAME_map.png"} } attr DEVICE model roborock setreading DEVICE attrTemplateVersion 20200522 or prior # The rockrobo device for valetudo RE name:roborockRE filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*\/valetudo.* desc:use this for a rooted Xiamoni Vacuum / Roborock with valetudo RE installed. For details visit https://github.com/rand256/valetudo/wiki
NOTE: Only tested with Gen1, Forum Board MQTT
order:X_03a par:BASE_TOPIC; is typically valetudo; {(split '/',ReadingsVal("DEVICE",'subscriptions','valetudo/rockrobo'))[0]} par:DEV_ID; is typically rockrobo; {(split '/',ReadingsVal("DEVICE",'subscriptions','valetudo/rockrobo'))[1]} par:ICON;ICON as set defaults to vacuum_top;{ AttrVal("DEVICE","icon","vacuum_top") } { Svn_GetFile("contrib/AttrTemplate/99_roborockUtils.pm", "FHEM/99_roborockUtils.pm", sub(){CommandReload(undef, "99_roborockUtils")}) } defmod DEVICE MQTT2_\DEVICE DEV_ID attr DEVICE icon ICON attr DEVICE devicetopic BASE_TOPIC/DEV_ID attr DEVICE alias DEV_ID attr DEVICE readingList\ homeassistant/vacuum/BASE_TOPIC_DEV_ID/config:.* {}\ $\DEVICETOPIC/state:.* { json2nameValue($EVENT) }\ $\DEVICETOPIC/attributes:.* { json2nameValue($EVENT) }\ $\DEVICETOPIC/map_data:.* {}\ $\DEVICETOPIC/command_status:.* { json2nameValue($EVENT) }\ $\DEVICETOPIC/destinations:.* { valetudoREdest($EVENT) } attr DEVICE setList\ charge:noArg $\DEVICETOPIC/command return_to_base\ fan_power:whisper,min,medium,high,max,mop $\DEVICETOPIC/set_fan_speed $EVTPART1\ locate:noArg $\DEVICETOPIC/command locate\ pause:noArg $\DEVICETOPIC/command pause\ spot:noArg $\DEVICETOPIC/command clean_spot\ start:noArg $\DEVICETOPIC/command start\ stop:noArg $\DEVICETOPIC/command stop\ get_dest:noArg { $\DEVICETOPIC.valetudoRE($EVENT) }\ goto:textField { $\DEVICETOPIC.valetudoRE($EVENT) }\ map:textField { $\DEVICETOPIC.valetudoRE($EVENT) }\ reset_consumable:main,side,filter,sensor { $\DEVICETOPIC.valetudoRE($EVENT) }\ zone:{'multiple-strict,'.ReadingsVal($name,'zones','none')} { $\DEVICETOPIC.valetudoRE($EVENT) }\ x_raw_payload:textField { $\DEVICETOPIC.valetudoRE($EVENT) } attr DEVICE userReadings autoReturn:valetudo_state_name:.Idle {fhem("sleep $name:bin_in_time:.0 waitbin;set $name charge");return 'return'} attr DEVICE setStateList charge fan_power get_dest goto locate map pause reset_consumable spot start stop zone x_raw_payload attr DEVICE event-on-change-reading .* attr DEVICE model roborockRE setreading DEVICE attrTemplateVersion 20210510 # new valetudo Template contributed by Otto123, should replace the old valetudo/rockrobo Template name:valetudo filter:TYPE=MQTT2_DEVICE desc:use this to control a rooted vacuum with valetudo V2. For further details visit Hypfer/Valetudo

NOTE: tested with Dreame L10pro, Xiaomi Vacuum Gen1, details: Forum Thread order:X_03b par:BASE_TOPIC;BASE_TOPIC typically is valetudo;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,([^\/:]+)[\/].*, ? $1 : undef } par:DEV_ID;DEV_ID is random by Firmware;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[^\/]+\/([^\/:]+).*, ? $1 : undef } { $data{f}='99_valetudoUtils.pm';\ $data{u}="https://svn.fhem.de/trac/browser/trunk/fhem/contrib/AttrTemplate/$data{f}?format=txt";\ qx(wget -qO FHEM/$data{f} $data{u}); CommandReload(undef, $data{f});\ delete $data{f};delete $data{u};''} attr DEVICE alias DEV_ID attr DEVICE devicetopic BASE_TOPIC/DEV_ID attr DEVICE icon vacuum_top attr DEVICE readingList \ $\DEVICETOPIC/\x24state:.* _state\ $\DEVICETOPIC/(Att.*|Basic.*|Consum.*|Curr.*|Loc.*|Wifi.*)/[a-zA-Z\-_]+:.* { $TOPIC =~ m,$\DEVICETOPIC\/.*\/([a-zA-Z\-_]+),; $1 eq 'ips'? {"ip4"=> (split ',',$EVENT)[0]}:{"$1"=>$EVENT} }\ $\DEVICETOPIC/BatteryStateAttribute/level:.* batteryPercent\ $\DEVICETOPIC/BatteryStateAttribute/status:.* batteryState\ $\DEVICETOPIC/FanSpeedControlCapability/preset:.* fanSpeed\ $\DEVICETOPIC/GoToLocationCapability/presets:.* .locationsPresets\ $\DEVICETOPIC/GoToLocationCapability/go:.* {}\ $\DEVICETOPIC/MapData/map-data:.* {}\ $\DEVICETOPIC/MapData/segments:.* .segments\ $\DEVICETOPIC/StatusStateAttribute/status:.* { {"state"=>$EVENT,"cleanerState"=>$EVENT} }\ $\DEVICETOPIC/StatusStateAttribute/detail:.* stateDetail\ $\DEVICETOPIC/StatusStateAttribute/error:.* stateError\ $\DEVICETOPIC/WaterUsageControlCapability/preset:.* waterUsage\ $\DEVICETOPIC/ZoneCleaningCapability/presets:.* .zonesPresets\ $\DEVICETOPIC/ZoneCleaningCapability/start:.* {} attr DEVICE setList \ pause:noArg $\DEVICETOPIC/BasicControlCapability/operation/set PAUSE\ start:noArg $\DEVICETOPIC/BasicControlCapability/operation/set START\ stop:noArg $\DEVICETOPIC/BasicControlCapability/operation/set STOP\ charge:noArg $\DEVICETOPIC/BasicControlCapability/operation/set HOME\ clean_zone:{valetudo_w($name,'zones')} { valetudo_c($NAME,$EVENT) }\ fanSpeed:off,min,low,medium,high,turbo,max $\DEVICETOPIC/FanSpeedControlCapability/preset/set $EVTPART1\ waterUsage:off,min,low,medium,high,turbo,max $\DEVICETOPIC/WaterUsageControlCapability/preset/set $EVTPART1\ locate:PERFORM $\DEVICETOPIC/LocateCapability/locate/set $EVTPART1\ x_raw_payload:textField { valetudo_c($NAME,$EVENT) } attr DEVICE event-on-change-reading .* attr DEVICE timestamp-on-change-reading .* attr DEVICE setStateList operation clean_segment clean_zone goto fanSpeed waterUsage locate x_raw_payload attr DEVICE model valetudoV2 attr DEVICE stateFormat state setreading DEVICE attrTemplateVersion 20220121 option:{valetudo_f('DEVICE','MapSegmentation')} { CommandAttr_multiline( 'DEVICE','setList',q( clean_segment:{'multiple-strict,'.valetudo_w($name,'segments')} { valetudo_c($NAME,$EVENT) }) ) } option:{valetudo_f('DEVICE','GoToLocation')} { CommandAttr_multiline( 'DEVICE','setList',q( goto:{valetudo_w($name,'locations')} { valetudo_c($NAME,$EVENT) }) ) } option:{1} deletereading -q DEVICE (?!associatedWith|IODev).* # contributed by Otto123, source: https://forum.fhem.de/index.php/topic,94495.msg1062312.html#msg1062312 name:worx_landroid desc:Template for a Worx Landroid mower.
The complete Setup is described in this Forum Thread
Some Features requires support by model and firmware! filter:TYPE=MQTT2_DEVICE order:X_05 par:BASE_TOPIC;base topic: the Mower BoardID (2019: PRM100);{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[\b]?([^\/:]+)[\/].+, ? $1 : undef } par:DEV_ID;the MAC of the Mower (Device Info);{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[^\/]+[\/]([0-9A-Z]+), ? $1 : undef } par:ICON;ICON as set, defaults to scene_robo_lawnmower;{ AttrVal("DEVICE","icon","scene_robo_lawnmower") } defmod DEVICE MQTT2_\DEVICE deletereading -q DEVICE (?!associatedWith|IODev).* attr DEVICE icon ICON attr DEVICE devicetopic BASE_TOPIC/DEV_ID attr DEVICE alias Mower attr DEVICE event-on-change-reading .* attr DEVICE readingList $\DEVICETOPIC/commandOut:.* { json2nameValue($EVENT,'',$JSONMAP) } attr DEVICE jsonMap dat_rsi:wifiQuality dat_fw:firmware cfg_sn:SerialNumber\ dat_le:mowerErrorIndex dat_ls:mowerStatusIndex\ cfg_rd:mowerRainDelay cfg_sc_m:mowerActiveIndex cfg_sc_p:mowerTimeCorrection\ dat_bt_t:batteryTemperature dat_bt_v:batteryVoltage dat_bt_p:batteryPercent dat_bt_nr:batteryChargeCycle dat_bt_c:batteryCharging\ dat_st_b:totalBladeTime dat_st_d:totalDistance dat_st_wt:totalTime dat_st_bl:borderLength\ dat_dmp_1:directionPitch dat_dmp_2:directionRoll dat_dmp_3:directionYaw attr DEVICE setList mowerRainDelay:slider,0,30,1440 $\DEVICETOPIC/commandIn {"rd":$EVTPART1}\ mowerTimeCorrection:slider,-100,1,100 $\DEVICETOPIC/commandIn {"sc":{"p":$EVTPART1}}\ startBorderCut:noArg $\DEVICETOPIC/commandIn {"sc":{"ots":{"bc":1,"wtm":0}}}\ startOneTime:slider,10,10,720 $\DEVICETOPIC/commandIn {"sc":{"ots":{"bc":0,"wtm":$EVTPART1}}}\ startMower:noArg $\DEVICETOPIC/commandIn {"cmd":1}\ pauseMower:noArg $\DEVICETOPIC/commandIn {"cmd":2}\ stopMower:noArg $\DEVICETOPIC/commandIn {"cmd":3}\ PartyTime:slider,0,10,2880 $\DEVICETOPIC/commandIn {"sc":{"distm":$EVTPART1}}\ PartyMode:on,off { my %hash = ( 'on' => 2, 'off' => 1);qq($\DEVICETOPIC/commandIn {"sc":{"m":$hash{$EVTPART1}}})}\ x_raw_payload:textField { my $payload = $EVENT;$payload =~ s/$EVTPART0 //g; qq($\DEVICETOPIC/commandIn $payload)} attr DEVICE stateFormat Active: mowerActive, Status: mowerStatusTxt, Error: mowerErrorTxt attr DEVICE userReadings mowerActive:mowerActiveIndex:.* {my %activeState = (\ 0 => "No",\ 1 => "Yes",\ 2 => "Party"\ ); $activeState{ReadingsVal($name,"mowerActiveIndex","0")}},\ mowerStatusTxt:mowerStatusIndex.* {my %stateCodes = (\ 0 => "Idle",\ 1 => "Home",\ 2 => "Start sequence",\ 3 => "Leaving home",\ 4 => "Follow wire",\ 5 => "Searching home",\ 6 => "Searching wire",\ 7 => "Mowing",\ 8 => "Lifted",\ 9 => "Trapped",\ 10 => "Blade blocked",\ 11 => "Debug",\ 12 => "Remote control",\ 30 => "Going home",\ 31 => "Zone Training",\ 32 => "Edge cutting",\ 33 => "Searching zone",\ 34 => "Pause"\ ); $stateCodes{ReadingsVal($name,"mowerStatusIndex","0")}},\ mowerErrorTxt:mowerErrorIndex.* { my %errorCodes = (\ 0 => "No error",\ 1 => "Trapped",\ 2 => "Lifted",\ 3 => "Wire missing",\ 4 => "Outside wire",\ 5 => "Raining",\ 6 => "Close door to mow",\ 7 => "Close door to go home",\ 8 => "Blade motor blocked",\ 9 => "Wheel motor blocked",\ 10 => "Trapped timeout",\ 11 => "Upside down",\ 12 => "Battery low",\ 13 => "Reverse wire",\ 14 => "Charge error",\ 15 => "Timeout finding home",\ 16 => "Mower locked",\ 17 => "Battery temp out of range"\ ); $errorCodes{ReadingsVal($name,"mowerErrorIndex","0")}} attr DEVICE model worx_landroid_mower setreading DEVICE attrTemplateVersion 20210602 ########################################### # Instar 8015HD. # contributed by ToM_ToM #source post: https://forum.fhem.de/index.php/topic,94495.msg1065779.html#msg1065779 name:InstarCam filter:TYPE=MQTT2_DEVICE desc:for Instar Camera, source post: https://forum.fhem.de/index.php/topic,94495.msg1065779.html#msg1065779.
NOTE: This is an early version, developed for Instar 8015 HD. Other models may need different settings. order:M_10 par:DEVNAME;MAC address in the topic;{ AttrVal("DEVICE","readingList","") =~ m,instar/([^/]*)/, ? $1 : undef } attr DEVICE jsonMap area1val:area1 area1sensitivityval:area1sensitivity area2val:area2 area2sensitivityval:area2sensitivity area3val:area3 area3sensitivityval:area3sensitivity area4val:area4 area4sensitivityval:area4sensitivity pirval:pir alarmserverval:alarmserver alarmserver_ipval:alarmserver_ip alarmserver_portval:alarmserver_port alarmserver_pathval:alarmserver_path camera_ipval:camera_ip alarmsignalval:alarmsignal audioalarmval:audioalarm audioalarmsensitivityval:audioalarmsensitivity power_ledval:power_led wifi_ledval:wifi_led alarminval:alarmin alarminmodeval:alarminmode alarmoutval:alarmout emailval:email snapshot2sdval:snapshot2sd snapshot2ftpval:snapshot2ftp alarmsnapshots2emailval:alarmsnapshots2email alarmsnapshots2email_qtyval:alarmsnapshots2email_qty snapshot2sdval:snapshot2sd alarmsnapshots2sd_qtyval:alarmsnapshots2sd_qty snapshot2ftpval:snapshot2ftp alarmsnapshots2ftp_qtyval:alarmsnapshots2ftp_qty video2sdval:video2sd video2ftpval:video2ftp videolengthval:videolength attr DEVICE readingList instar/DEVNAME/status/alarm/actions/pir/enable:.* { json2nameValue($EVENT, 'pir', $JSONMAP) }\ instar/DEVNAME/status/alarm/area1/enable:.* { json2nameValue($EVENT, 'area1', $JSONMAP) }\ instar/DEVNAME/status/alarm/area1/sensitivity:.* { json2nameValue($EVENT, 'area1sensitivity', $JSONMAP) }\ instar/DEVNAME/status/alarm/area2/enable:.* { json2nameValue($EVENT, 'area2', $JSONMAP) }\ instar/DEVNAME/status/alarm/area2/sensitivity:.* { json2nameValue($EVENT, 'area2sensitivity', $JSONMAP) }\ instar/DEVNAME/status/alarm/area3/enable:.* { json2nameValue($EVENT, 'area3', $JSONMAP) }\ instar/DEVNAME/status/alarm/area3/sensitivity:.* { json2nameValue($EVENT, 'area3sensitivity', $JSONMAP) }\ instar/DEVNAME/status/alarm/area4/enable:.* { json2nameValue($EVENT, 'area4', $JSONMAP) }\ instar/DEVNAME/status/alarm/area4/sensitivity:.* { json2nameValue($EVENT, 'area4sensitivity', $JSONMAP) }\ instar/DEVNAME/status/alarm/alarmserver/enable:.* { json2nameValue($EVENT, 'alarmserver', $JSONMAP) }\ instar/DEVNAME/status/alarm/alarmserver/address:.* { json2nameValue($EVENT, 'alarmserver_ip', $JSONMAP) }\ instar/DEVNAME/status/alarm/alarmserver/port:.* { json2nameValue($EVENT, 'alarmserver_port', $JSONMAP) }\ instar/DEVNAME/status/alarm/alarmserver/path:.* { json2nameValue($EVENT, 'alarmserver_path', $JSONMAP) }\ instar/DEVNAME/status/network/config/ipaddr:.* { json2nameValue($EVENT, 'camera_ip', $JSONMAP) }\ instar/DEVNAME/status/alarm/actions/alarmsignal:.* { json2nameValue($EVENT, 'alarmsignal', $JSONMAP) }\ instar/DEVNAME/status/alarm/actions/audioalarm:.* { json2nameValue($EVENT, 'audioalarm', $JSONMAP) }\ instar/DEVNAME/status/alarm/actions/audioalarmsensitivity:.* { json2nameValue($EVENT, 'audioalarmsensitivity', $JSONMAP) }\ instar/DEVNAME/status/alarm/actions/alarmin:.* { json2nameValue($EVENT, 'alarmin', $JSONMAP) }\ instar/DEVNAME/status/alarm/actions/alarminmode:.* { json2nameValue($EVENT, 'alarmin', $JSONMAP) }\ instar/DEVNAME/status/alarm/actions/alarmout:.* { json2nameValue($EVENT, 'alarmout', $JSONMAP) }\ instar/DEVNAME/status/alarm/actions/email:.* { json2nameValue($EVENT, 'alarmsnapshots2email', $JSONMAP) }\ instar/DEVNAME/status/alarm/actions/alarmsnapshots/email:.* { json2nameValue($EVENT, 'alarmsnapshots2email_qty', $JSONMAP) }\ instar/DEVNAME/status/alarm/actions/snapshot2sd:.* { json2nameValue($EVENT, 'snapshot2sd', $JSONMAP) }\ instar/DEVNAME/status/alarm/actions/alarmsnapshots/sd:.* { json2nameValue($EVENT, 'alarmsnapshots2sd_qty', $JSONMAP) }\ instar/DEVNAME/status/alarm/actions/snapshot2ftp:.* { json2nameValue($EVENT, 'snapshot2ftp', $JSONMAP) }\ instar/DEVNAME/status/alarm/actions/alarmsnapshots/ftp:.* { json2nameValue($EVENT, 'alarmsnapshots2ftp_qty', $JSONMAP) }\ instar/DEVNAME/status/alarm/actions/video2sd:.* { json2nameValue($EVENT, 'video2sd', $JSONMAP) }\ instar/DEVNAME/status/alarm/actions/alarm/actions/video2ftp:.* { json2nameValue($EVENT, 'video2ftp', $JSONMAP) }\ instar/DEVNAME/status/alarm/actions/videolength:.* { json2nameValue($EVENT, 'videolength', $JSONMAP) }\ instar/DEVNAME/status/features/indicator/power:.* { json2nameValue($EVENT, 'power_led', $JSONMAP) }\ instar/DEVNAME/status/features/indicator/wifi:.* { json2nameValue($EVENT, 'wifi_led', $JSONMAP) } attr DEVICE setList pir:0,1 instar/DEVNAME/alarm/actions/pir/enable/raw $EVTPART1\ area1:0,1 instar/DEVNAME/alarm/area1/enable/raw $EVTPART1\ area1sensitivity:slider,1,1,100 instar/DEVNAME/alarm/area1/sensitivity/raw $EVTPART1\ area2:0,1 instar/DEVNAME/alarm/area2/enable/raw $EVTPART1\ area2sensitivity:slider,1,1,100 instar/DEVNAME/alarm/area2/sensitivity/raw $EVTPART1\ area3:0,1 instar/DEVNAME/alarm/area3/enable/raw $EVTPART1\ area3sensitivity:slider,1,1,100 instar/DEVNAME/alarm/area3/sensitivity/raw $EVTPART1\ area4:0,1 instar/DEVNAME/alarm/area4/enable/raw $EVTPART1\ area4sensitivity:slider,1,1,100 instar/DEVNAME/alarm/area4/sensitivity/raw $EVTPART1\ alarmserver:on,off instar/DEVNAME/alarm/alarmserver/enable/raw $EVTPART1\ alarmsignal:on,off instar/DEVNAME/alarm/actions/alarmsignal/raw $EVTPART1\ audioalarm:0,1 instar/DEVNAME/alarm/actions/audioalarm/raw $EVTPART1\ audioalarmsensitivity:slider,10,10,100 instar/DEVNAME/alarm/actions/audioalarmsensitivity/raw $EVTPART1\ alarmin:0,1 instar/DEVNAME/alarm/actions/alarmin/raw $EVTPART1\ alarminmode:0,1 instar/DEVNAME/alarm/actions/alarminmode/raw $EVTPART1\ alarmout:on,off instar/DEVNAME/alarm/actions/alarmout/raw $EVTPART1\ email:on,off instar/DEVNAME/alarm/actions/email/raw $EVTPART1\ alarmsnapshots2email_qty:slider,0,1,15 instar/DEVNAME/alarm/actions/alarmsnapshots/email/raw $EVTPART1\ snapshot2sd:on,off instar/DEVNAME/alarm/actions/snapshot2sd/raw $EVTPART1\ alarmsnapshots2sd_qty:slider,0,1,15 instar/DEVNAME/alarm/actions/alarmsnapshots/sd/raw $EVTPART1\ snapshot2ftp:on,off instar/DEVNAME/alarm/actions/snapshot2ftp/raw $EVTPART1\ alarmsnapshots2ftp_qty:slider,0,1,15 instar/DEVNAME/alarm/actions/alarmsnapshots/ftp/raw $EVTPART1\ video2sd:on,off instar/DEVNAME/alarm/actions/video2sd/raw $EVTPART1\ videolength:slider,15,15,60 instar/DEVNAME/alarm/actions/videolength/raw $EVTPART1\ power_led:on,off instar/DEVNAME/features/indicator/power/raw $EVTPART1\ wifi_led:on,off instar/DEVNAME/features/indicator/wifi/raw $EVTPART1 attr DEVICE model InstarCam setreading DEVICE attrTemplateVersion 20200628 ################################# # source: https://forum.fhem.de/index.php/topic,105222.0.html name:wallpanel_app filter:TYPE=MQTT2_DEVICE desc:For use with Android-App WallPanel (https://thanksmister.com/wallpanel-android/)
NOTE: Early version, might still be buggy, please provide feedback! order:X_15 par:DEVNAME;name of this wallpanel;{ AttrVal("DEVICE","readingList","") =~ m,wallpanel/([^/]+)/, ? $1 : undef } par:ICON;ICON as set, defaults to mqtt;{ AttrVal("DEVICE","icon","kindle") } attr DEVICE icon ICON attr DEVICE event-on-change-reading .* attr DEVICE jsonMap MOTION_value:motion FACE_value:face attr DEVICE readingList wallpanel/DEVNAME/state:.* { json2nameValue($EVENT) }\ wallpanel/DEVNAME/sensor/battery:.* { json2nameValue($EVENT) }\ wallpanel/DEVNAME/sensor/motion:.* { json2nameValue($EVENT, 'MOTION_', $JSONMAP) }\ wallpanel/DEVNAME/sensor/face:.* { json2nameValue($EVENT, 'FACE_', $JSONMAP) } attr DEVICE setList alert:textField wallpanel/DEVNAME/command {"eval": "alert('$EVTPART1');;"}\ audio:textField wallpanel/DEVNAME/command {"$EVTPART0": "$EVTPART1"}\ brightness:colorpicker,BRI,0,1,255 wallpanel/DEVNAME/command {"$EVTPART0": $EVTPART1}\ camera:noArg wallpanel/DEVNAME/command {"$EVTPART0": "true"}\ clearCache:noArg wallpanel/DEVNAME/command {"$EVTPART0": true}\ google:noArg wallpanel/DEVNAME/command {"url": "https://www.google.com"}\ relaunch:noArg wallpanel/DEVNAME/command {"$EVTPART0": true}\ reload:noArg wallpanel/DEVNAME/command {"$EVTPART0": true}\ screenoff:noArg wallpanel/DEVNAME/command {"wake": false}\ screenon:select,60,600,3600,86400 wallpanel/DEVNAME/command {"wake": true, "wakeTime": $EVTPART1}\ speak:textField {"wallpanel/DEVNAME/command {'$EVTPART0': '".substr($EVENT,5)."'}"}\ url:textField wallpanel/DEVNAME/command {"$EVTPART0": "$EVTPART1"}\ volume:slider,0,1,100 wallpanel/DEVNAME/command {"$EVTPART0": $EVTPART1} attr DEVICE comment For further info on configuration and available commands see project page. farewell:template has been applied successfully. For further info on configuration and available commands see project page. attr DEVICE model wallpanel_app setreading DEVICE attrTemplateVersion 20200921 name:weewx_weather_station filter:TYPE=MQTT2_DEVICE desc:See source post: https://forum.fhem.de/index.php/topic,108815.msg1027867.html#msg1027867 for details. For setting up weewx for MQTT use see https://github.com/weewx/weewx/wiki/mqtt order:X_20 par:BASE_ID;BASE_ID typically is weather;{ AttrVal("DEVICE","readingList","") =~ m,(weather)[/][^/]+[/].*:, ? $1 : undef } par:ICON;ICON as set, defaults to weather_station;{ AttrVal("DEVICE","icon","weather_station") } attr DEVICE icon ICON attr DEVICE event-on-change-reading .* attr DEVICE readingList BASE_ID/outTemp_C:.* temperature\ BASE_ID/cloudbase_meter:.* cloudbase\ BASE_ID/outHumidity:.* humidity\ BASE_ID/pressure_mbar:.* pressure\ BASE_ID/rain_mm:.* rainfall\ BASE_ID/barometer_mbar:.* barometer\ BASE_ID/dewpoint_C:.* dewpoint\ BASE_ID/rainTotal:.* rainTotal\ BASE_ID/heatindex_C:.* heatindex\ BASE_ID/dayRain_mm:.* day_rain\ BASE_ID/inDewpoint:.* in_dewpoint\ BASE_ID/altimeter_mbar:.* altimeter\ BASE_ID/appTemp_C:.* appTemp\ BASE_ID/windGust_mps:.* wind_gust\ BASE_ID/rain24_mm:.* rain_24h\ BASE_ID/hourRain_mm:.* rain_1h\ BASE_ID/windSpeed_mps:.* wind\ BASE_ID/rainRate_mm_per_hour:.* rainrate\ BASE_ID/windDir:.* winddir\ BASE_ID/inHumidity:.* in_humidity attr DEVICE stateFormat T: temperature°C, H: humidity%rH, P: barometer hPa deletereading -q DEVICE (?!associatedWith|IODev).* attr DEVICE model weewx_weather_station setreading DEVICE attrTemplateVersion 20200522 or prior #source post: https://forum.fhem.de/index.php/topic,98880.msg995308.html#msg995308 name:wled_controller filter:TYPE=MQTT2_DEVICE desc:To control a WLED device, see https://github.com/Aircoookie/WLED/wiki for details). order:W_01 { Svn_GetFile('contrib/AttrTemplate/99_attrT_WLED_Utils.pm', 'FHEM/99_attrT_WLED_Utils.pm', sub(){ CommandReload(undef, '99_attrT_WLED_Utils') }) } par:BASE_ID;BASE_ID typically is wled;{ AttrVal('DEVICE','readingList','') =~ m,([^:]+)[/][^/]+[/][^/]+:, ? $1 : undef } par:DEVNAME;Device name as configured;{ AttrVal('DEVICE','readingList','') =~ m,[^:]+[/]([^/]+)[/][^/]+:, ? $1 : undef } par:ICON;ICON as set, defaults to hue_filled_iris;{ AttrVal('DEVICE','icon','hue_filled_iris') } attr DEVICE icon ICON attr DEVICE setList\ on:noArg BASE_ID/DEVNAME on\ off:noArg BASE_ID/DEVNAME off\ toggle:noArg BASE_ID/DEVNAME t\ rgb:colorpicker,RGB BASE_ID/DEVNAME/col #$EVTPART1\ brightness:colorpicker,BRI,0,1,255 BASE_ID/DEVNAME/api A=$EVTPART1\ dimup:noArg BASE_ID/DEVNAME/api A=~10\ dimdown:noArg BASE_ID/DEVNAME/api A=~-10\ speed:colorpicker,BRI,0,1,255 BASE_ID/DEVNAME/api SX=$EVTPART1\ intensity:colorpicker,BRI,0,1,255 BASE_ID/DEVNAME/api IX=$EVTPART1\ effect:{'selectnumbers,0,1,'.ReadingsNum($name,'.effectscount',5).',0,lin'} BASE_ID/DEVNAME/api FX=$EVTPART1\ effectname:{'select,'.join(',',sort(split(',',ReadingsVal($name,'.effects','Solid,Police'))))} {FHEM::attrT_WLED_Utils::WLED_set($NAME,'effect',$EVTPART1)}\ effect_next:noArg BASE_ID/DEVNAME/api FX=~1\ effect_prev:noArg BASE_ID/DEVNAME/api FX=~-1\ effect_random:noArg BASE_ID/DEVNAME/api FX=r\ effect_reset:noArg BASE_ID/DEVNAME/api FX=0\ palette:{'selectnumbers,0,1,'.ReadingsNum($name,'.palettescount',5).',0,lin'} BASE_ID/DEVNAME/api FP=$EVTPART1\ palettename:{'select,'.join(',',sort(split(',',ReadingsVal($name,'.palettes','Default,Party'))))} {FHEM::attrT_WLED_Utils::WLED_set($NAME,'palette',$EVTPART1)}\ palette_next:noArg BASE_ID/DEVNAME/api FP=~1\ palette_prev:noArg BASE_ID/DEVNAME/api FP=~-1\ palette_random:noArg BASE_ID/DEVNAME/api FP=r\ palette_reset:noArg BASE_ID/DEVNAME/api FP=0\ preset:selectnumbers,0,1,15,0,lin BASE_ID/DEVNAME/api PL=$EVTPART1\ apiraw BASE_ID/DEVNAME/api $EVTPART1\ seg BASE_ID/DEVNAME/api {'seg':{'i':[$EVTPART1,[$EVTPART2]]}} attr DEVICE readingList \ BASE_ID/DEVNAME/status:.* LWT\ BASE_ID/DEVNAME/g:.* brightness\ BASE_ID/DEVNAME/g:.* {$EVENT ? {state => 'on'} : {state => 'off'}}\ BASE_ID/DEVNAME/c:.* {{rgb => substr($EVENT,1,6)}}\ BASE_ID/DEVNAME/v:.* {FHEM::attrT_WLED_Utils::WLED_get($NAME,$EVENT)} deletereading -q DEVICE (?!associatedWith|IODev).* attr DEVICE devStateIcon {ReadingsVal($name,'LWT','offline') eq 'offline' ? '.*:message_attention@red' : Color::devStateIcon($name,'rgb','rgb','brightness','state')} attr DEVICE webCmd rgb:brightness:effectname:speed:intensity:palettename:preset attr DEVICE webCmdLabel RGB:Brightness\ :Effect:Speed:Intensity\ :Palette:Preset attr DEVICE setStateList on off toggle dimdown dimup effect_prev effect_next effect_random palette_prev palette_next palette_random palette_reset effect_reset attr DEVICE comment For questions about the use of different widgets for color selection see discussion at https://forum.fhem.de/index.php/topic,98880.msg995308.html set DEVICE attrTemplate speechcontrol_type_light_255 farewell:template has been applied successfully.
Note: webCmd and eventMap are just examples; adopt this to your needs. attr DEVICE model wled_controller setreading DEVICE attrTemplateVersion 20211220 ########################################### # The sonos2mqtt bridge device (entire hex id of devices as bridgeRegexp) name:sonos2mqtt_bridge desc:The sonos2mqtt bridge device, Forum #111711 and Wiki filter:TYPE=MQTT2_DEVICE order:M_05 par:BASE_TOPIC;base topic set in configuration.yaml of the sonos2mqtt bridge;{ AttrVal("DEVICE","devicetopic",'sonos') } par:ICON;ICON as set, defaults to mqtt_bridge_2;{ AttrVal("DEVICE","icon","mqtt_bridge_2") } attr DEVICE icon ICON attr DEVICE bridgeRegexp\ BASE_TOPIC/(RINCON_[A-Z0-9]+)[:/].* "$1" attr DEVICE readingList\ BASE_TOPIC/connected:.* connected\ homeassistant/music_player/RINCON_([0-9A-Z]+)/sonos/config:.* { $TOPIC =~ m,(RINCON_[0-9A-Z]+),; { "config_$1"=>$EVENT }}\ BASE_TOPIC/status/[^/]+/avtransport:.* {}\ BASE_TOPIC/status/[^/]+/renderingcontrol:.* {} attr DEVICE model sonos2mqtt_bridge attr DEVICE devStateIcon 0:10px-kreis-rot 1:10px-kreis-gelb 2:10px-kreis-gruen attr DEVICE stateFormat connected attr DEVICE devicetopic BASE_TOPIC setreading DEVICE attrTemplateVersion 20210301 name:sonos2mqtt_bridge_comfort desc:The sonos2mqtt bridge adds 1 notify device for setup speakers, Forum #111711 and Wiki filter:TYPE=MQTT2_DEVICE order:M_05c { Svn_GetFile("contrib/AttrTemplate/99_sonos2mqttUtils.pm", "FHEM/99_sonos2mqttUtils.pm", sub(){ CommandReload(undef, "99_sonos2mqttUtils") }) } set DEVICE attrTemplate sonos2mqtt_bridge attr DEVICE getList Favorites:noArg Favorites {sonos2mqtt($NAME,$EVENT)} attr DEVICE setList PauseAll:noArg $\DEVICETOPIC/cmd/pauseall\ CheckSubscription:noArg $\DEVICETOPIC/cmd/check-subscriptions attr DEVICE userReadings favlist:Favorites.* {sonos2mqtt_ur($name,'favlist')},\ grouplist:Favorites.* {sonos2mqtt_ur($name,'grouplist')} {sonos2mqtt_setup('a:model=sonos2mqtt_bridge')} defmod n_configSonos notify global:DEFINED.MQTT2_RINCON_[A-Z0-9]+|MQTT2_RINCON_[A-Z0-9]+:IPAddress:.* {sonos2mqtt_nty($NAME,$EVENT)} setreading DEVICE attrTemplateVersion 20210303 name:sonos2mqtt_speaker desc:A basic sonos2mqtt speaker device, Forum #111711 and Wiki filter:TYPE=MQTT2_DEVICE order:M_05b par:BASE_TOPIC;base topic set in configuration.yaml of the sonos2mqtt bridge;{ AttrVal("DEVICE","devicetopic",'sonos') } par:DEV_ID;techname of the device ;{ AttrVal("DEVICE","readingList","") =~ m,[^\/]+[\/](RINCON_[0-9A-Z]+):.*, ? $1 : undef } par:ALIAS;friendly name as set in sonos gadget itself;{ ReadingsVal("DEVICE","name","unknown") } par:DEVNAME;friendly name, used for topic in lowercase;{ lc(ReadingsVal("DEVICE","name","unknown")) } par:ICON;ICON as set, defaults to audio_volume_low;{ AttrVal("DEVICE","icon","audio_volume_low") } attr DEVICE icon ICON attr DEVICE jsonMap volume_Master:volume mute_Master:mute attr DEVICE stateFormat transportState attr DEVICE readingList\ $\DEVICETOPIC/DEV_ID:.* { json2nameValue($EVENT,'',$JSONMAP) }\ $\DEVICETOPIC/DEV_ID/ZoneInfo:.* { json2nameValue($EVENT) } attr DEVICE setList\ x_raw_payload:textField { my $payload = $EVENT;$payload =~ s/$EVTPART0 //g; qq(BASE_TOPIC/DEV_ID/control $payload)} attr DEVICE devStateIcon (STOPPED|PAUSED_PLAYBACK):rc_PLAY:toggle PLAYING:rc_PAUSE:pause .*:refresh:play attr DEVICE alias ALIAS attr DEVICE model sonos2mqtt_speaker attr DEVICE devicetopic BASE_TOPIC attr DEVICE userReadings Master:groupName.* {(split(' \+',ReadingsVal($name,'groupName','')))[0]},\ isMaster:coordinatorUuid.* {ReadingsVal($name,'coordinatorUuid','') eq ReadingsVal($name,'uuid','')?1:0},\ inGroup:groupName.* {ReadingsVal($name,'groupName','') =~ / \+ /?1:0},\ inCouple:coordinatorUuid.* {(ReadingsVal($name,'coordinatorUuid','') ne ReadingsVal($name,'uuid','') and (index(ReadingsVal($name,'groupName',''), ReadingsVal($name,'name','')) != -1))?1:0},\ Input:currentTrack_TrackUri.* {sonos2mqtt_ur($name,'Input')} set DEVICE x_raw_payload {"command": "adv-command","input": {"cmd":"GetZoneInfo","reply":"ZoneInfo"}} setreading DEVICE attrTemplateVersion 20210303 ##### ### roon via mqtt extension ### #contributed by mferstl, https://forum.fhem.de/index.php/topic,94495.msg1149947.html#msg1149947 name:roon filter:TYPE=MQTT2_DEVICE desc:See doku for roon mqtt extension https://github.com/fjgalesloot/roon-extension-mqttf.
Note: preliminary version order:M_06 # first set the ZONE par:ZONENAME;ZONENAME is the roon zone you want to control attr DEVICE devicetopic ZONENAME # define up to ten internet radio stations attr DEVICE userattr radios attr DEVICE radios BR-KLASSIK, MDR Klassik, Klassik Radio: Barock # set readings attr DEVICE readingList .*roon.*/$\DEVICETOPIC/state:.* state\ .*roon.*/$\DEVICETOPIC/seek_position:.* track_position\ .*roon.*/$\DEVICETOPIC/now_playing/three_line/line1:.* track_name\ .*roon.*/$\DEVICETOPIC/now_playing/three_line/line2:.* track_artist\ .*roon.*/$\DEVICETOPIC/now_playing/three_line/line3:.* track_album\ .*roon.*/$\DEVICETOPIC/outputs/$\DEVICETOPIC/volume/value:.* volume\ .*roon.*/$\DEVICETOPIC/outputs/$\DEVICETOPIC/volume/is_muted:.* muted\ .*roon.*/$\DEVICETOPIC/settings/loop:.* loop\ .*roon.*/$\DEVICETOPIC/settings/shuffle:.* shuffle # setlist # Commands to use in FHEM are with capital first letter ; the "mute" setting is for alexa only attr DEVICE setList play roon/$\DEVICETOPIC/command play\ pause roon/$\DEVICETOPIC/command pause\ stop roon/$\DEVICETOPIC/command stop\ next roon/$\DEVICETOPIC/command next\ previous roon/$\DEVICETOPIC/command previous\ mute:on,off { my $mute = $EVTPART1 eq 'on' ? 'mute' : 'unmute';; "roon/$\DEVICETOPIC/outputs/$\DEVICETOPIC/volume/set $mute"}\ volume:slider,0,1,100 roon/$\DEVICETOPIC/outputs/$\DEVICETOPIC/volume/set $EVTPART1\ mute roon/$\DEVICETOPIC/outputs/$\DEVICETOPIC/volume/set mute\ channel:uzsuSelectRadio,1,2,3,4,5,6,7,8,9,10 { my @radios = split(/,/,AttrVal($NAME,"radios","BR-KLASSIK")) ;; "roon/$\DEVICETOPIC/browse/internet_radio ".$radios[$EVTPART1-1];; } # some Web commands attr DEVICE webCmd play:pause:stop:next:previous:mute:volume:radio set DEVICE attrTemplate speechcontrol_gdt_and_mapping GENERICDEVTYPE=media HOMEBRIDGEMAPPING="On:cmdOn=play,cmdOff=stop PlaybackController:playback,values=play;pause;stop;previous;next ChannelController:reading=radio,cmd=radio Volume=volume,maxValue=60,minStep=3,delay=true Mute:reading=muted,cmd=mute" setreading DEVICE attrTemplateVersion 20210420 ########################################### #source post: https://forum.fhem.de/index.php/topic,109946.0.html name:McLighting filter:TYPE=MQTT2_DEVICE desc:To control a McLighting device, see https://github.com/FabLab-Luenen/McLighting/wiki for details). order:m_01 par:BASE_ID;BASE_ID typically is CID of FHEM Device;{ AttrVal("DEVICE","readingList","") =~ m,(.+?)(?=:), ? $1 : undef } par:DEVNAME;DEVNAME is Hostname as configured in McLighting;{ AttrVal("DEVICE","readingList","") =~ m,(?:\:)(.*)(?:/out), ? $1 : undef } par:ICON;ICON as set, defaults to light_led_stripe_rgb;{ AttrVal("DEVICE","icon","light_led_stripe_rgb") } attr DEVICE icon ICON attr DEVICE setList\ on:noArg DEVNAME/in /on\ off:noArg DEVNAME/in /off\ rgb:colorpicker,RGB DEVNAME/in #$EVTPART1\ rgb_nr2:colorpicker,RGB DEVNAME/in ##$EVTPART1\ rgb_nr3:colorpicker,RGB DEVNAME/in ###$EVTPART1\ brightness:colorpicker,BRI,0,1,255 DEVNAME/in %$EVTPART1\ speed:colorpicker,BRI,0,1,255 DEVNAME/in ?$EVTPART1\ effect:selectnumbers,0,1,59,0,lin DEVNAME/in /$EVTPART1 attr DEVICE readingList \ DEVNAME/out:.* out\ home/DEVNAME_ha/state/out:.* { json2nameValue($EVENT) }\ DEVNAME/config:.* config attr DEVICE eventMap /effect 0:Static/effect 7:ColorWipeRandom/effect 11:Rainbow/effect 12:RainbowCycle/effect 33:ChaseRainbow/effect 39:ColorSweepRandom/ attr DEVICE devStateIcon {Color::devStateIcon( $name, "rgb", "rgb", "brightness", "state" )} attr DEVICE webCmd rgb:brightness:speed:effect attr DEVICE setStateList on off attr DEVICE userReadings rgb:color_b.* {Color::rgb2hex(ReadingsVal($name,"color_r",0),ReadingsVal($name,"color_g",0),ReadingsVal($name,"color_b",0))},\ rgb_nr2:color_b2.* {Color::rgb2hex(ReadingsVal($name,"color_r2",0),ReadingsVal($name,"color_g2",0),ReadingsVal($name,"color_b2",0))},\ rgb_nr3:color_b3.* {Color::rgb2hex(ReadingsVal($name,"color_r3",0),ReadingsVal($name,"color_g3",0),ReadingsVal($name,"color_b3",0))} attr DEVICE comment Note: FabLab-Luenen/McLighting v3.1 needed because of API changes\ Note: ENABLE_HOMEASSISTANT should be enabled, since more MQTT messages will be send \ Note: webCmd and eventMap are just examples - adopt this to your needs. attr DEVICE model McLighting setreading DEVICE attrTemplateVersion 20200522 or prior #source post: https://forum.fhem.de/index.php/topic,105457.msg993924.html#msg993924 name:go_eCharger_old filter:TYPE=MQTT2_DEVICE desc:Old version! See source post: https://forum.fhem.de/index.php/topic,105457.msg993924.html#msg993924 for details. For complete MQTT-API see https://go-e.co/app/api.pdf order:W_02o par:BASE_ID;BASE_ID typically is go-eCharger;{ AttrVal("DEVICE","readingList","") =~ m,(go-eCharger)[/][^/]+[/].*:, ? $1 : undef } par:SERIAL;Serial number;{ AttrVal("DEVICE","readingList","") =~ m,go-eCharger[/]([^/]+)[/].*:, ? $1 : undef } par:ICON;ICON as set, defaults to mqtt;{ AttrVal("DEVICE","icon","mqtt") } attr DEVICE icon ICON attr DEVICE event-on-change-reading .* attr DEVICE readingList BASE_ID/SERIAL/status:.* { json2nameValue($EVENT,'',$JSONMAP) }\ BASE_ID/SERIAL/ip:.* { json2nameValue($EVENT) } attr DEVICE setList Activation:0,1 BASE_ID/SERIAL/cmd/req alw=$EVTPART1\ Ampere:selectnumbers,1,1,22,1,lin BASE_ID/SERIAL/cmd/req amp=$EVTPART1 attr DEVICE jsonMap alw:Activation amp:Ampere tmp:temperature attr DEVICE stateFormat Status: charger_state \ ALW:Activation\ P_akt: energy_akt attr DEVICE devStateIcon ALW.1:status_open:Activation+0 ALW.0:status_locked:Activation+1 attr DEVICE userReadings charger_state:car.* { my $val = ReadingsVal($name,"car","none");; my %rets = ("none" => "-1","1" => "Ready","2" => "Charging","3" => "waiting for car","4" => "Charging finished",);; $rets{$val}}, energy_total:eto.* { ReadingsVal($name,"eto",0)*0.1 }, energy_akt:dws.* { ReadingsVal($name,"dws",0)*2.77 } deletereading -q DEVICE (?!associatedWith|IODev).* attr DEVICE model go_eCharger_old setreading DEVICE attrTemplateVersion 20200522 or prior #source post: https://forum.fhem.de/index.php/topic,105457.msg993924.html#msg993924 with myutils from https://forum.fhem.de/index.php/topic,115620.0.html name:go_eCharger filter:TYPE=MQTT2_DEVICE desc:New version, original source post: https://forum.fhem.de/index.php/topic,105457.msg993924.html#msg993924, uses myUtils code from https://forum.fhem.de/index.php/topic,115620.0.html. For complete MQTT-API see https://go-e.co/app/api.pdf order:W_02 par:BASE_ID;BASE_ID typically is go-eCharger;{ AttrVal("DEVICE",'readingList','') =~ m,(go-eCharger)[/][^/]+[/].*:, ? $1 : undef } par:SERIAL;Serial number;{ AttrVal("DEVICE",'readingList','') =~ m,go-eCharger[/]([^/]+)[/].*:, ? $1 : undef } par:ICON;ICON as set, defaults to mqtt;{ AttrVal("DEVICE",'icon','electric_car_icon') } { Svn_GetFile('contrib/AttrTemplate/99_attrT_go_e_Utils.pm', 'FHEM/99_attrT_go_e_Utils.pm', sub(){ CommandReload(undef, '99_attrT_go_e_Utils') }) } attr DEVICE icon ICON attr DEVICE readingList BASE_ID/SERIAL/status:.* { FHEM::attrT_go_e_Utils::j2rN_extended($NAME,$EVENT,1) }\ BASE_ID/SERIAL/ip:.* { json2nameValue($EVENT) } attr DEVICE setList Activation:0,1 BASE_ID/SERIAL/cmd/req alw=$EVTPART1\ Ampere:selectnumbers,1,1,22,1,lin BASE_ID/SERIAL/cmd/req amp=$EVTPART1\ Three_Phases:0,1 BASE_ID/SERIAL/cmd/req fsp=$EVTPART1 attr DEVICE stateFormat Status: charger_state \ ALW:Activation\ P_akt: energy_akt attr DEVICE devStateIcon ALW.1:status_open:Activation+0 ALW.0:status_locked:Activation+1 deletereading -q DEVICE (?!associatedWith|IODev).* attr DEVICE comment NOTE: additional code has been downloaded from svn (contrib).
There may be room for improvement, please adress any issues in https://forum.fhem.de/index.php/topic,115620.0.html; issue "help attrT_go_e_Utils" for more info about. farewell:template has been applied successfully.
NOTE: additional code has been downloaded from svn (contrib).
This is in early development stage, there may be room for improvement! Please adress any issues in https://forum.fhem.de/index.php/topic,115620.0.html. To see more info about the provided code, issue help attrT_go_e_Utils. attr DEVICE model go_eCharger setreading DEVICE attrTemplateVersion 20210804 ########################################### # provided as mqtt2_siedle.template by hydrotec name:SiedleGateway desc:
    This gateway connects Siedle In-Home Bus intercoms to home automation systems.
    FHEM Forum: Siedle SSS Türsprechanlage/Türöffner mit FHEM steuern
    NOTE: without guarantee

    Dieses Gateway bindet Siedle In-Home Bus Gegensprechanlagen an Hausautomatisierungssysteme an.
    FHEM Forum: Siedle SSS Türsprechanlage/Türöffner mit FHEM steuern
    HINWEIS: ohne Gewähr filter:TYPE=MQTT2_DEVICE:FILTER=CID~SiedleGateway.* order:S_743353_01 farewell:*template has been applied successfully*Vorlage wurde erfolgreich angewendet* par:BASE_TOPIC;base topic set in gateway;{ AttrVal("DEVICE","devicetopic","") =~ m,[\b]?([^/:]+)(/.+)?, ? $1 : AttrVal("DEVICE","readingList","") =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } defmod DEVICE MQTT2_\DEVICE SiedleGateway attr DEVICE devicetopic BASE_TOPIC attr DEVICE readingList\ $\DEVICETOPIC/state:.* state\ $\DEVICETOPIC/cmnd:.* {}\ $\DEVICETOPIC/cmnd/datagram:.* { json2nameValue($EVENT, 'cmnd_', $JSONMAP) }\ $\DEVICETOPIC/result:.* {}\ $\DEVICETOPIC/result/datagram:.* { json2nameValue($EVENT, 'exec_', $JSONMAP) } attr DEVICE event-on-change-reading .* attr DEVICE setList\ light:noArg $\DEVICETOPIC/exec $EVTPART0\ open:noArg $\DEVICETOPIC/exec $EVTPART0\ ring $\DEVICETOPIC/exec $EVTPART0_$EVTPART1\ playAudio $\DEVICETOPIC/playAudio $EVTPART1 attr DEVICE model SiedleGateway setreading DEVICE attrTemplateVersion 20210515