########################################### # $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 par:IODEVNAME;Name of the IO-Device; { AttrVal("DEVICE","IODev",undef) } par:DEVTYPE;TYPE of the device; { InternalVal("DEVICE","TYPE",undef)} par:DEVCID;CID of the device as written in the DEF; { InternalVal(AttrVal("DEVICE","IODev",""),"clientId","mosquitto") eq InternalVal("DEVICE","DEF","mosquitto") ? "MQTT2_GeneralBridge" : InternalVal("DEVICE","DEF","mosquitto")} par:NEWDEVROOM;Room of the calling device; {AttrVal("DEVCID","room","MQTT2_\DEVICE" )} par:ICON;ICON as set, defaults to mqtt;{ AttrVal("DEVICE","icon","mqtt_bridge_2") } attr DEVICE icon ICON defmod DEVCID MQTT2_\DEVICE DEVCID attr DEVCID bridgeRegexp \ (tele|cmnd)[/]([^/]+)[/].*:.* "$2"\ shellies[/]([^/]+)[/].*:.* "$1"\ (ESPClient_[^/]+)[/].*:.* "$1"\ valetudo[/]([^/]+)[/].*:.* "$1"\ [^/]+[/](ems-esp[^/]+)[/].*:.* "$1"\ wallpanel[/]([^/]+)[/].*:.* "$1"\ (wled)[/]([^/]+)[/].*:.* "$1_$2"\ (go-eCharger)[/]([^/]+)[/].*:.* "go_eCharger_$2"\ (owntracks)[/]([^/:]+)[/]([^/:]+).*:.* "$1_$2$3" attr DEVCID autocreate 1 attr DEVCID comment Do not use very open bridgeRegexp expressions! This might lead to irritating results... attr DEVCID room NEWDEVROOM attr DEVCID setStateList on off deleteAttr DEVICE readingList deletereading -q DEVICE (?!associatedWith).* deleteAttr DEVCID readingList deletereading -q DEVCID (?!associatedWith).* setreading DEVCID associatedWith DEVICE { fhem "trigger $FW_wname JS:location.href='$FW_ME?detail=DEVCID'" if($cl && $cl->{TYPE} eq "FHEMWEB") } farewell:template has been applied successfully. Be carefull when extending the brigeRegexp! attr DEVCID model MQTT2_CLIENT_general_bridge ########################################### # 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 par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","readingList","") =~ m,[\b]?([^/:]+)[/].*:, ? $1 : undef } attr DEVICE devicetopic BASE_TOPIC attr DEVICE bridgeRegexp\ $\DEVICETOPIC/([A-Za-z0-9._]*)[/]?.*:.* "zigbee_$1" attr DEVICE getList\ devicelist:noArg log $\DEVICETOPIC/bridge/config/devices\ 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/log:.*\"type\".\"devices\".\"message\".* devices\ $\DEVICETOPIC/bridge/log:.* log\ $\DEVICETOPIC/bridge/networkmap:.* {}\ $\DEVICETOPIC/bridge/networkmap/graphviz:.* graphviz\ $\DEVICETOPIC/bridge/networkmap/raw:.* raw\ $\DEVICETOPIC/bridge/config:.* { json2nameValue($EVENT) } 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. attr DEVICE model zigbee2mqtt_bridge # 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","readingList","") =~ m,[\b]?([^/:]+)[/].*:, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","readingList","") =~ m,[^/]+[/]([^/]+).*:, ? $1 : undef } par:ICON;ICON as set, defaults to light_control;{ 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).* 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 # 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","readingList","") =~ m,[\b]?([^/:]+)[/].*:, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ 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 speech_recognition_type_light_255 attr DEVICE model zigbee2mqtt_light_dimmer # 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","readingList","") =~ m,[\b]?([^/:]+)[/].*:, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ 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:color_temp 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_temp:colorpicker,CT,154,2,500 $\DEVICETOPIC/set {"$EVTPART0":"$EVTPART1"} set DEVICE attrTemplate speech_recognition_type_light_255 attr DEVICE model zigbee2mqtt_light_cct #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","readingList","") =~ m,[\b]?([^/:]+)[/].*:, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ 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 speech_recognition_type_light_255 attr DEVICE model zigbee2mqtt_light_rgb_hex 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","readingList","") =~ m,[\b]?([^/:]+)[/].*:, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ 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 speech_recognition_type_light_255 attr DEVICE model zigbee2mqtt_light_rgb_rgb #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","readingList","") =~ m,[\b]?([^/:]+)[/].*:, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ 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_temp:warm:white: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"}\ warm:noArg $\DEVICETOPIC/set {"brightness": 200 , "color_temp": 360}\ white:noArg $\DEVICETOPIC/set {"brightness": 254, "color_temp": 250}\ color_temp:colorpicker,CT,250,1,454 $\DEVICETOPIC/set {"$EVTPART0":"$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))} set DEVICE attrTemplate speech_recognition_type_light_255 attr DEVICE model zigbee2mqtt_light_rgbw_hex #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","readingList","") =~ m,[\b]?([^/:]+)[/].*:, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ 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 speech_recognition_type_light_255 attr DEVICE model zigbee2mqtt_light_rgbw_rgb #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","readingList","") =~ m,[\b]?([^/:]+)[/].*:, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ 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_temp: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"}\ color_temp:colorpicker,CT,154,2,500 $\DEVICETOPIC/set {"$EVTPART0":"$EVTPART1"}\ hex:colorpicker,HEX,0,15,255 $\DEVICETOPIC/set {"color":{"$EVTPART0":"#$EVTPART1"}} set DEVICE attrTemplate speech_recognition_type_light_255 attr DEVICE model zigbee2mqtt_light_rgbcct_hex #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","readingList","") =~ m,[\b]?([^/:]+)[/].*:, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ 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_temp: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_temp:colorpicker,CT,154,2,500 $\DEVICETOPIC/set {"$EVTPART0":"$EVTPART1"}\ color:colorpicker,RGB {"$\DEVICETOPIC/set ".zigbee2mqtt_RGB2JSON($EVTPART1)} set DEVICE attrTemplate speech_recognition_type_light_255 attr DEVICE model zigbee2mqtt_light_rgbcct_rgb 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","readingList","") =~ m,[\b]?([^/:]+)[/].*:, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ 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 name:zigbee2mqtt_hueMotionSensor filter:TYPE=MQTT2_DEVICE:FILTER=CID=zigbee.* order:L_04 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 speech_recognition_gdt_and_mapping GENERICDEVTYPE=motion HOMEBRIDGEMAPPING="MotionDetected=state,values=motion:1;nomotion:0" attr DEVICE model zigbee2mqtt_hueMotionSensor name:zigbee2mqtt_plug filter:TYPE=MQTT2_DEVICE:FILTER=CID=zigbee.* desc: Should work e.g. with Osram smart+plug
Untested updated version order:L_05 par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","readingList","") =~ m,[\b]?([^/:]+)[/].*:, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ 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"}\ attr DEVICE setStateList on off set DEVICE attrTemplate speech_recognition_type_switch attr DEVICE model zigbee2mqtt_plug name:zigbee2mqtt_plug_w_energy_measuring filter:TYPE=MQTT2_DEVICE:FILTER=CID=zigbee.* desc: Preliminary version reserved for plugs with energy measuring features like innr SP 120
NOTE: needs to be completed! order:L_05a par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","readingList","") =~ m,[\b]?([^/:]+)[/].*:, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","readingList","") =~ m,[^/]+[/]([^/]+).*:, ? $1 : undef } par:ICON;ICON as set, defaults to message_socket;{ AttrVal("DEVICE","icon","message_socket") } attr DEVICE icon ICON set DEVICE attrTemplate zigbee2mqtt_smart+plug #missing readingList with sth. comparable to shellies/shellyplug-s-123456/relay/0/power:.* { my $limit = 100;; my $compare = $EVTPART0<$limit ? "off":"on";; ReadingsVal($NAME,"loadState","on") eq $compare ? undef: {loadState => $compare} } #and additional devStateIcon set DEVICE attrTemplate speech_recognition_type_switch attr DEVICE model zigbee2mqtt_plug_w_energy_measuring # 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","readingList","") =~ m,[\b]?([^/:]+)[/].*:, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ 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"}\ attr DEVICE setStateList on off deletereading -q DEVICE (?!associatedWith).* attr DEVICE comment Channel 1 for DEVICE, see also DEVICE_CH2 setreading DEVICE associatedWith DEVICE_CH2 set DEVICE attrTemplate speech_recognition_type_switch attr DEVICE model zigbee2mqtt_2channel_split copy DEVICE DEVICE_CH2 attr DEVICE_CH2 comment Channel 2 for DEVICE setreading DEVICE_CH2 associatedWith DEVICE attr DEVICE_CH2 setList \ on:noArg $\DEVICETOPIC/l2/set {"state":"ON"}\ off:noArg $\DEVICETOPIC/l2/set {"state":"OFF"} attr DEVICE_CH2 setStateList on off toggle deletereading -q DEVICE_CH2 (?!associatedWith).* attr DEVICE_CH2 jsonMap state_l1:0 state_l2:state state:0 consumption:0 linkquality:0 power:0 temperature:0 set DEVICE_CH2 attrTemplate speech_recognition_type_switch attr DEVICE_CH2 model zigbee2mqtt_2channel_split # 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:L_05d par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","readingList","") =~ m,[\b]?([^/:]+)[/].*:, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ 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"} 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"} 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 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","readingList","") =~ m,[\b]?([^/:]+)[/].*:, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","readingList","") =~ m,[^/]+[/]([^/]+).*:, ? $1 : undef } attr DEVICE devStateIcon open:fts_window_1w_open@red close:fts_window_1w@green #attr DEVICE genericDeviceType contact 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).* set DEVICE attrTemplate speech_recognition_gdt_and_mapping GENERICDEVTYPE=contact HOMEBRIDGEMAPPING= "ContactSensorState=state,values=closed:CONTACT_DETECTED;;open:CONTACT_NOT_DETECTED" attr DEVICE model zigbee2mqtt_ContactSensor 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","readingList","") =~ m,[\b]?([^/:]+)[/].*:, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ 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) } deletereading -q DEVICE (?!associatedWith).* attr DEVICE model zigbee2mqtt_TempHumHpaSensor #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","readingList","") =~ m,[\b]?([^/:]+)[/].*:, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ 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) } deletereading -q DEVICE (?!associatedWith).* attr DEVICE model zigbee2mqtt_TempHumSensor #source post: https://forum.fhem.de/index.php/topic,94495.msg898198.html#msg898198 name:zigbee2mqtt_Human_Motion_Sensor desc: Human motion sensor via zigbee2mqtt
Tested with: Xiaomi Aqara RTCGQ11LM Human Motion Sensor filter:TYPE=MQTT2_DEVICE:FILTER=CID=zigbee.* order:L_08 par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","readingList","") =~ m,[\b]?([^/:]+)[/].*:, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ 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: occupancy Luminance: illuminance attr DEVICE readingList $\DEVICETOPIC:.* { json2nameValue($EVENT) } deletereading -q DEVICE (?!associatedWith).* attr DEVICE model zigbee2mqtt_Human_Motion_Sensor #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_08a par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","readingList","") =~ m,[\b]?([^/:]+)[/].*:, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ 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: occupancy T: temperature attr DEVICE readingList $\DEVICETOPIC:.* { json2nameValue($EVENT) } deletereading -q DEVICE (?!associatedWith).* attr DEVICE model zigbee2mqtt_TempMotion_sensor #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","readingList","") =~ m,[\b]?([^/:]+)[/].*:, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ 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).* attr DEVICE model zigbee2mqtt_Motion_Sensor #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","readingList","") =~ m,[\b]?([^/:]+)[/].*:, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ 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).* attr DEVICE model zigbee2mqtt_Water_Leak_Sensor #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","readingList","") =~ m,[\b]?([^/:]+)[/].*:, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ 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).* set DEVICE attrTemplate speech_recognition_type_switch attr DEVICE model zigbee2mqtt_Light_Switch #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_12 par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","readingList","") =~ m,[\b]?([^/:]+)[/].*:, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ 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) } deletereading -q DEVICE (?!associatedWith).* attr DEVICE model zigbee2mqtt_Wireless_Button 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","readingList","") =~ m,[\b]?([^/:]+)[/].*:, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ 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).* attr DEVICE model zigbee2mqtt_wireless_button_old 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","readingList","") =~ m,[\b]?([^/:]+)[/].*:, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","readingList","") =~ m,[^/]+[/]([^/]+).*:, ? $1 : undef } attr DEVICE stateFormat Action: action attr DEVICE devicetopic BASE_TOPIC/DEV_ID attr DEVICE readingList $\DEVICETOPIC:.* { json2nameValue($EVENT) } deletereading -q DEVICE (?!associatedWith).* attr DEVICE model zigbee2mqtt_aqara_cube #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","readingList","") =~ m,[\b]?([^/:]+)[/].*:, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ 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).* attr DEVICE model zigbee2mqtt_AlarmSensor ########################################### # 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: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.:.* { json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/UPTIME:.* { json2nameValue($EVENT,'',$JSONMAP) }\ STATTOPIC/POWER1:.* state\ STATTOPIC/RESULT:.* { json2nameValue($EVENT,'',$JSONMAP) } deletereading -q DEVICE (?!associatedWith).* 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 set DEVICE attrTemplate speech_recognition_type_switch attr DEVICE model tasmota_basic_state_power1 # 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 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",undef)} attr DEVICE readingList \ TELETOPIC/LWT:.* LWT\ TELETOPIC/STATE:.* { json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/SENSOR:.* { json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/INFO.:.* { json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/UPTIME:.* { json2nameValue($EVENT,'',$JSONMAP) }\ STATTOPIC/POWER1:.* state\ STATTOPIC/RESULT:.* { json2nameValue($EVENT,'',$JSONMAP) } deletereading -q DEVICE (?!associatedWith).* 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 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, "POWER2", "off") . " "\ . sprintf("%.1f°C ",ReadingsVal($name,"SI7021_Temperature",0))\ . sprintf("%.0f%%",ReadingsVal($name,"SI7021_Humidity",0))\ } attr DEVICE readingList \ TELETOPIC/LWT:.* LWT\ TELETOPIC/STATE:.* { json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/SENSOR:.* { json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/INFO.:.* { json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/UPTIME:.* { json2nameValue($EVENT,'',$JSONMAP) }\ STATTOPIC/POWER1:.* state\ STATTOPIC/POWER2:.* POWER2\ STATTOPIC/RESULT:.* { json2nameValue($EVENT,'',$JSONMAP) } attr DEVICE devStateIcon {\ my $state = lc ReadingsVal($name, "POWER2", "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,"SI7021_Temperature",0),\ ReadingsVal($name,"SI7021_Humidity",0)\ ) . "
"\ } attr DEVICE model tasmota_1ch+motion+SI7021 name:tasmota_POW filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*(tele|cmnd|stat).* desc:Applies to Sonoff POW devices
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 } set DEVICE attrTemplate tasmota_basic_state_power1 attr DEVICE setList \ off:noArg CMNDTOPIC/POWER1 0\ on:noArg CMNDTOPIC/POWER1 1\ toggle:noArg CMNDTOPIC/POWER1 2 attr DEVICE devStateIcon {my $onl = ReadingsVal($name,"LWT","false") eq "Online"?"10px-kreis-gruen":"10px-kreis-rot"; my $light = ReadingsVal($name,"state","off");"".FW_makeImage($onl)." ".FW_makeImage($light)." uptime: ".ReadingsVal($name,"Uptime",undef).sprintf(" aktuell: %.1f W Tag: %.2f kWh Gestern: %.3f kWh Gesamt: %.4f kWh", ReadingsVal($name,"ENERGY_Power","-1"), ReadingsVal($name,"ENERGY_Today","-1"), ReadingsVal($name,"ENERGY_Yesterday","-1"), ReadingsVal($name,"ENERGY_Total","-1"))} attr DEVICE stateFormat {sprintf("aktuell: %.1f W Tag: %.2f kWh Gestern: %.3f kWh Gesamt: %.4f kWh", ReadingsVal($name,"ENERGY_Power","-1"), ReadingsVal($name,"ENERGY_Today","-1"), ReadingsVal($name,"ENERGY_Yesterday","-1"), ReadingsVal($name,"ENERGY_Total","-1"))} deletereading -q DEVICE (?!associatedWith).* attr DEVICE setStateList on off toggle attr DEVICE webCmd : attr DEVICE model tasmota_POW # 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 set DEVICE attrTemplate tasmota_POW par:CMNDTOPIC;Command topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}cmnd$3" : undef } attr DEVICE comment Channel 1 for DEVICE, see also DEVICE_CH2 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 setreading DEVICE_CH2 associatedWith DEVICE attr DEVICE_CH2 devStateIcon on:usb:off off:usb@red:on attr DEVICE_CH2 setStateList on off toggle #set DEVICE_CH2 attrTemplate speech_recognition_alaxaName_firstrun attr DEVICE,DEVICE_CH2 model tasmota_POW_USB_split # 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 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:state Dimmer:0 Channel_1:0 Channel_2:0 Channel_3:0 HSBColor:0 POWER2:0 setreading DEVICE associatedWith DEVICE_CH2 deletereading -q DEVICE (?!associatedWith).* 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) } 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).* set DEVICE_CH2 attrTemplate speech_recognition_type_light_255 attr DEVICE,DEVICE_CH2 model tasmota_plug_with_rgbw_split #tasmota device with Infrared-circuit name:tasmota_ir desc:Demonstrates multiple options how to configure tasmota devices as IR remote control extension.
Forum Thread
Tasmota IRremote Commands
Simple IR-circuit
set irsend 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"} attr DEVICE readingList \ TELETOPIC/INFO.:.* { json2nameValue($EVENT) }\ 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 #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;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 } 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.:.* { json2nameValue($EVENT) }\ 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 # 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.:.* { json2nameValue($EVENT) }\ TELETOPIC/RESULT:.* { 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 # 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 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.:.* { json2nameValue($EVENT) }\ 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 # 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 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 } attr DEVICE comment Channel 1 for DEVICE, see also DEVICE_CH2 setreading DEVICE associatedWith DEVICE_CH2 set DEVICE attrTemplate speech_recognition_type_switch copy DEVICE DEVICE_CH2 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 comment Channel 2 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 attr DEVICE_CH2 setStateList on off toggle #set DEVICE_CH2 attrTemplate speech_recognition_alaxaName_firstrun attr DEVICE,DEVICE_CH2 model tasmota_2channel_split #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",undef)} set DEVICE attrTemplate tasmota_set_lowercase_texts_and_state1 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 defmod configure_DEVICEattrTemplate_at at +00:00:20 set IO_DEV publish CMNDTOPIC/Backlog ShutterOpenDuration1 20;; ShutterCloseDuration1 20;; ShutterInvert1 1;; SaveData 1;; attr DEVICE setList \ close:noArg CMNDTOPIC/ShutterClose1\ open:noArg CMNDTOPIC/ShutterOpen1\ half:noArg CMNDTOPIC/ShutterSetHalfway1 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.:.* { json2nameValue($EVENT) }\ 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 stateFormat \ LWT\ \ state deletereading -q DEVICE (?!associatedWith).* 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. # set DEVICE attrTemplate speech_recognition_type_blind farewell:template has been applied successfully. Now it's recommended to set shutter's open and close duration and 50% position, see short instruction in comment attribute or the
Tasmota wiki. attr DEVICE model tasmota_2ch_shutter_invert_1 # 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: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",undef)} set DEVICE attrTemplate tasmota_2ch_shutter_invert_1 defmod configure_DEVICEattrTemplate_at at +00:00:20 set IO_DEV publish CMNDTOPIC/Backlog ShutterOpenDuration1 20;; ShutterCloseDuration1 20;; ShutterInvert1 0;; SaveData 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 set DEVICE attrTemplate speech_recognition_type_blind attr DEVICE model tasmota_2ch_shutter_invert_0 # 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 } set DEVICE attrTemplate tasmota_2channel_split attr DEVICE comment Channel 1 for DEVICE, see also DEVICE_CH2, DEVICE_CH3 and DEVICE_CH4 setreading DEVICE associatedWith DEVICE_CH2,DEVICE_CH3,DEVICE_CH4 setreading DEVICE_CH2 associatedWith DEVICE,DEVICE_CH3,DEVICE_CH4 attr DEVICE_CH2 comment Channel 2 for DEVICE, see also DEVICE, DEVICE_CH3 and DEVICE_CH4 #attr DEVICE_CH2 jsonMap POWER2:state Dimmer:pct POWER1:0 POWER3:0 POWER4: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 #create device for CH3 copy DEVICE DEVICE_CH3 #attr DEVICE_CH2 jsonMap POWER3:state Dimmer:pct POWER1:0 POWER2:0 POWER4: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:0setreading DEVICE_CH3 associatedWith DEVICE,DEVICE_CH2,DEVICE_CH4 attr DEVICE comment Channel 3 for DEVICE, see also DEVICE, DEVICE_CH2 and DEVICE_CH4 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 DEVICE_CH4 #attr DEVICE_CH2 jsonMap POWER4:state Dimmer:pct POWER1:0 POWER2:0 POWER3: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 setreading DEVICE_CH4 associatedWith DEVICE,DEVICE_CH2,DEVICE_CH3 attr DEVICE_CH4 comment Channel 4 for DEVICE, see also DEVICE, DEVICE_CH2 and DEVICE_CH3 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 # 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",undef)} 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).* # 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 set DEVICE attrTemplate speech_recognition_type_switch # 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.:.* { 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 copy DEVICE DEVICE_CH2 attr DEVICE_CH2 setStateList on off toggle copy DEVICE_CH2 DEVICE_CH3 copy DEVICE_CH2 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 # attr DEVICE_CH2 setList \ off:noArg CMNDTOPIC/POWER2 0\ on:noArg CMNDTOPIC/POWER2 1\ toggle:noArg CMNDTOPIC/POWER2 2 attr DEVICE_CH3 setList \ off:noArg CMNDTOPIC/POWER3 0\ on:noArg CMNDTOPIC/POWER3 1\ toggle:noArg CMNDTOPIC/POWER3 2 attr DEVICE_USB setList \ off:noArg CMNDTOPIC/POWER4 0\ on:noArg CMNDTOPIC/POWER4 1\ toggle:noArg CMNDTOPIC/POWER4 2 # attr DEVICE_CH2 readingList \ TELETOPIC/LWT:.* LWT\ TELETOPIC/INFO.:.* { json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/STATE:.* { json2nameValue($EVENT,'state_',$JSONMAP) }\ STATTOPIC/STATUS:.* { json2nameValue($EVENT,'',$JSONMAP) }\ STATTOPIC/POWER2:.* state attr DEVICE_CH3 readingList \ TELETOPIC/LWT:.* LWT\ TELETOPIC/INFO.:.* { json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/STATE:.* { json2nameValue($EVENT,'state_',$JSONMAP) }\ STATTOPIC/STATUS:.* { json2nameValue($EVENT,'',$JSONMAP) }\ STATTOPIC/POWER3:.* state attr DEVICE_USB readingList \ TELETOPIC/LWT:.* LWT\ TELETOPIC/INFO.:.* { json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/STATE:.* { json2nameValue($EVENT,'state_',$JSONMAP) }\ STATTOPIC/STATUS:.* { json2nameValue($EVENT,'',$JSONMAP) }\ STATTOPIC/POWER4:.* state # # 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 #set DEVICE_CH2 attrTemplate speech_recognition_general_naming_master_template #set DEVICE_CH3 attrTemplate speech_recognition_general_naming_master_template #set DEVICE_USB attrTemplate speech_recognition_general_naming_master_template farewell:Template has been applied successfully. Wait some seconds for reboot to complete and watch readings get populated. attr DEVICE,DEVICE_CH2,DEVICE_CH3,DEVICE_USB model tasmota_3socketUSB_channel_split # 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.:.* { 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 # 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.:.* { 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 # 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.:.* { 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 #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).* 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 speech_recognition_type_light attr DEVICE model tasmota_rgb_led_controller 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).* 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\ 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.:.* { 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") ? undef :{"saturation"=>$2} : undef }\ 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 speech_recognition_type_light attr DEVICE model tasmota_rgbw_led name:tasmota_rgbwct_led 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\ 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 speech_recognition_type_light attr DEVICE model tasmota_rgbwct_led 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).* 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 attr DEVICE readingList \ TELETOPIC/LWT:.* LWT\ TELETOPIC/STATE:.* { json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/SENSOR:.* { json2nameValue($EVENT,'',$JSONMAP) }\ TELETOPIC/INFO.:.* { 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",undef,"pct","state")} attr DEVICE setStateList on off toggle set DEVICE attrTemplate speech_recognition_type_light attr DEVICE model tasmota_cct_led #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).* 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 speech_recognition_type_light attr DEVICE model tasmota_TuyaMCU_dimmer 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",undef)} 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",undef) } 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",undef)} set IO_DEV publish CMNDTOPIC/SetOption26 0 attr DEVICE userReadings state:POWER:.* { lc(ReadingsVal($name,"POWER","")) } ########################################### # SHELLY # # shelly1 using original firmware. name:shelly1 filter:TYPE=MQTT2_DEVICE par:DEVNAME;Shelly1 name in the topic;{ AttrVal("DEVICE","readingList","") =~ m,shellies/([^/]*)/, ? $1 : undef } 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) : undef } 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).* set DEVICE x_mqttcom announce set DEVICE attrTemplate speech_recognition_type_switch attr DEVICE model shelly1 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 } set DEVICE attrTemplate shelly1 attr DEVICE getList power:noArg shellies/DEVNAME/relay/power power attr DEVICE model shellyplug #contributed by 87insane, https://forum.fhem.de/index.php/topic,94060.msg934614.html#msg934614 # shelly1pm using original firmware. name:shelly1_w_energy_meassuring filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*shellies.* order:A_10b desc:Applies to single relay Shelly devices offering energy meassuring like Shelly 1PM or Shelly Plug S par:DEVNAME;Shelly1 name in the topic;{ AttrVal("DEVICE","readingList","") =~ m,shellies/([^/]*)/, ? $1 : undef } attr DEVICE setList\ relay0:on,off,toggle shellies/DEVNAME/relay/0/command $EVTPART1\ off:noArg shellies/DEVNAME/relay/0/command off\ on:noArg shellies/DEVNAME/relay/0/command on\ 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) : undef }\ 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 } : undef }\ shellies/DEVNAME/temperature:.* temperature\ 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 : deletereading -q DEVICE (?!associatedWith).* set DEVICE x_mqttcom announce set DEVICE attrTemplate speech_recognition_type_switch attr DEVICE model shelly1_w_energy_meassuring name:shelly1_w_energy_meassuring_washer_example filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*shellies.* order:A_10b1 desc:Example how to configure a single relay Shelly device offering energy meassuring 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_meassuring 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_meassuring_washer_example # 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) : undef }\ 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).* attr DEVICE setStateList open close stop set DEVICE x_mqttcom announce set DEVICE attrTemplate speech_recognition_type_blind attr DEVICE model shelly2_roller # 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) : undef }\ 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 attr DEVICE devStateIcon { my $amp = ReadingsVal($name,"online","false") eq "false" ? "rot" : ReadingsVal($name,"new_fw","false") eq "true" ? "gelb" : "gruen";; my $con = ReadingsVal($name,"state","undef");; $con = 100 - $con if $con =~ /\d+/;; my $pic = $con eq "opening" ? 'fts_shutter_up@red' : $con eq "closing" ? 'fts_shutter_down@red' : $con eq "100" ? 'fts_shutter_100' : $con =~ /(\d)\d/ ? 'fts_shutter_'.$1.'0' : $con =~ /\b\d\b/ ? 'fts_shutter_10' : 'fts_shutter_updown';; my $show = "$amp" eq "gelb" ? "".FW_makeImage("10px-kreis-".$amp)."" : "".FW_makeImage("10px-kreis-".$amp)."";; "
$show ".FW_makeImage($pic)."
"} 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).* attr DEVICE setStateList open close half stop pct set DEVICE x_mqttcom announce set DEVICE attrTemplate speech_recognition_type_blind attr DEVICE model shelly25_roller_invert_0 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) : undef }\ 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 attr DEVICE devStateIcon { my $amp = ReadingsVal($name,"online","false") eq "false" ? "rot" : ReadingsVal($name,"new_fw","false") eq "true" ? "gelb" : "gruen";; my $con = ReadingsVal($name,"state","undef");; my $pic = $con eq "opening" ? 'fts_shutter_up@red' : $con eq "closing" ? 'fts_shutter_down@red' : $con eq "100" ? 'fts_shutter_100' : $con =~ /(\d)\d/ ? 'fts_shutter_'.$1.'0' : $con =~ /\b\d\b/ ? 'fts_shutter_10' : 'fts_shutter_updown';; my $show = "$amp" eq "gelb" ? "".FW_makeImage("10px-kreis-".$amp)."" : "".FW_makeImage("10px-kreis-".$amp)."";; "
$show ".FW_makeImage($pic)."
"} 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).* attr DEVICE setStateList open close half stop pct set DEVICE x_mqttcom announce #set DEVICE attrTemplate speech_recognition_type_blind attr DEVICE model shelly25_roller_invert_1 # 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 } attr DEVICE comment Channel 1 for DEVICE, see also DEVICE_CH2 copy DEVICE DEVICE_CH2 attr DEVICE_CH2 readingList shellies/DEVNAME/relay/1:.* state attr DEVICE_CH2 comment Channel 2 for DEVICE setreading DEVICE_CH2 associatedWith DEVICE attr DEVICE_CH2 setList \ off:noArg shellies/DEVNAME/relay/1/command off\ on:noArg shellies/DEVNAME/relay/1/command on attr DEVICE model shelly2_split attr DEVICE_CH2 model shelly2_split # 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 } set DEVICE attrTemplate shellyplug attr DEVICE comment Channel 1 for DEVICE, see also DEVICE_CH2 attr DEVICE devStateIcon {my $onl = ReadingsVal($name,"online","false") eq "false"?"10px-kreis-rot" : ReadingsVal($name,"new_fw","false") eq "true" ? "10px-kreis-gelb" : "10px-kreis-gruen";; my $light = ReadingsVal($name,"state","off");; my $cons = ReadingsVal($name,"relay_0_power","unknown");; my $temp = ReadingsVal($name,"temperature","-100");;"
".FW_makeImage($onl)." ".FW_makeImage($light)." Aktuell: $cons W / Temp.: $temp °C
"} attr DEVICE readingList shellies/DEVNAME/relay/0:.* state\ shellies/DEVNAME/relay/0:.* relay_0\ shellies/DEVNAME/input/0:.* input_0\ shellies/DEVNAME/online:.* online\ shellies/DEVNAME/announce:.* { json2nameValue($EVENT) }\ shellies/announce:.* { $EVENT =~ m,..id...DEVNAME...mac.*, ? json2nameValue($EVENT) : undef }\ shellies/DEVNAME/relay/0/power:.* relay_0_power\ shellies/DEVNAME/relay/0/energy:.* {'relay_0_energy' => sprintf("%.2f",$EVENT/60/1000)}\ shellies/DEVNAME/temperature:.* temperature\ shellies/DEVNAME/overtemperature:.* overtemperature\ shellies/DEVNAME/longpush/0:.* longpush_0 copy DEVICE DEVICE_CH2 attr DEVICE_CH2 readingList shellies/DEVNAME/relay/1:.* state\ shellies/DEVNAME/relay/1:.* relay_1\ shellies/DEVNAME/input/1:.* input_1\ shellies/DEVNAME/online:.* online\ shellies/DEVNAME/announce:.* { json2nameValue($EVENT) }\ shellies/announce:.* { $EVENT =~ m,..id...DEVNAME...mac.*, ? json2nameValue($EVENT) : undef }\ shellies/DEVNAME/relay/1/power:.* relay_1_power\ shellies/DEVNAME/relay/1/energy:.* {'relay_1_energy' => sprintf("%.2f",$EVENT/60/1000)}\ shellies/DEVNAME/temperature:.* temperature\ shellies/DEVNAME/overtemperature:.* overtemperature\ shellies/DEVNAME/longpush/1:.* longpush_1 attr DEVICE_CH2 comment Channel 2 for DEVICE setreading DEVICE_CH2 associatedWith DEVICE 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 "true"?"10px-kreis-gruen":"10px-kreis-rot";; 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 model shelly25_split # 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 comment Channel 1 for DEVICE, see also DEVICE_CH2, DEVICE_CH3 and DEVICE_CH4 setreading DEVICE associatedWith DEVICE_CH2,DEVICE_CH3,DEVICE_CH4 copy DEVICE DEVICE_CH2 attr DEVICE_CH2 readingList shellies/DEVNAME/relay/1:.* state setreading DEVICE_CH2 associatedWith DEVICE,DEVICE_CH3,DEVICE_CH4 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 comment Channel 2 for DEVICE, see also DEVICE, DEVICE_CH3 and DEVICE_CH4 copy DEVICE DEVICE_CH3 attr DEVICE_CH3 readingList shellies/DEVNAME/relay/2:.* state setreading DEVICE_CH3 associatedWith DEVICE,DEVICE_CH2,DEVICE_CH4 attr DEVICE_CH3 setList \ off:noArg shellies/DEVNAME/relay/2/command off\ on:noArg shellies/DEVNAME/relay/2/command on attr DEVICE getList \ power2:noArg shellies/DEVNAME/relay/2/power power2\ energy2:noArg shellies/DDEVNAME/relay/2/energy energy2 attr DEVICE comment Channel 3 for DEVICE, see also DEVICE, DEVICE_CH2 and DEVICE_CH4 copy DEVICE DEVICE_CH4 attr DEVICE_CH4 readingList shellies/DEVNAME/relay/3:.* state setreading DEVICE_CH4 associatedWith DEVICE,DEVICE_CH2,DEVICE_CH3 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 attr DEVICE_CH4 comment Channel 4 for DEVICE, see also DEVICE, DEVICE_CH2 and DEVICE_CH3 attr DEVICE model shelly4pro_split attr DEVICE_CH2 model shelly4pro_split attr DEVICE_CH3 model shelly4pro_split attr DEVICE_CH4 model shelly4pro_split # 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) : undef }\ 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 # shellybulb using original firmware 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 setList\ off:noArg shellies/DEVNAME/color/0/command off\ on:noArg shellies/DEVNAME/color/0/command on\ pct:colorpicker,BRI,0,1,100 shellies/DEVNAME/color/0/set {"gain":"$EVTPART1","brightness":"$EVTPART1"}\ pct_on: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);"shellies/DEVNAME/color/0/set {\"mode\":\"white\",\"temp\":\"$EVTPART1\"}"}\ ct_on:colorpicker,CT,3000,10,6500 {$EVTPART1=3000 if ($EVTPART1<3000);"shellies/DEVNAME/color/0/set {\"turn\":\"on\",\"mode\":\"white\",\"temp\":\"$EVTPART1\"}"}\ rgb:colorpicker,RGB {$EVTPART1=~/(..)(..)(..)/;if($1 ne $2 || $2 ne $3){"shellies/DEVNAME/color/0/set {\"mode\":\"color\",\"gain\":\"100\",\"red\":".hex($1).",\"green\":".hex($2).",\"blue\":".hex($3)."}"}else{"shellies/DEVNAME/color/0/set {\"turn\":\"on\",\"mode\":\"white\",\"brightness\":".int(hex($1)/2.55)."}"}}\ rgb_on:colorpicker,RGB {$EVTPART1=~/(..)(..)(..)/;if($1 ne $2 || $2 ne $3){"shellies/DEVNAME/color/0/set {\"turn\":\"on\",\"mode\":\"color\",\"gain\":\"100\",\"red\":".hex($1).",\"green\":".hex($2).",\"blue\":".hex($3)."}"}else{"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 #attr DEVICE genericDeviceType light attr DEVICE jsonMap brightness:pct set DEVICE x_mqttcom announce set DEVICE attrTemplate speech_recognition_type_light attr DEVICE model shellybulb # 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_16 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 # 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: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/DEVNAME/online:.* online\ shellies/DEVNAME/sensor/temperature:.* temperature\ shellies/DEVNAME/sensor/flood:.* flood\ shellies/DEVNAME/sensor/battery:.* batteryPercent attr DEVICE stateFormat flood (bat batteryPercent%) deletereading -q DEVICE (?!associatedWith).* set DEVICE x_mqttcom announce attr DEVICE model shellyflood #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\ white:colorpicker,BRI,0,1,100 shellies/DEVNAME/color/0/set {"white":"$EVTPART1"}\ gain:colorpicker,BRI,0,1,100 shellies/DEVNAME/color/0/set {"gain":"$EVTPART1"}\ rgb:colorpicker,RGB {$EVTPART1=~/(..)(..)(..)/;if($1 ne $2 || $2 ne $3) {"shellies/DEVNAME/color/0/set {\"mode\":\"color\",\"red\":".hex($1).",\"green\":".hex($2).",\"blue\":".hex($3)."}"}else{"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=~/(..)(..)(..)/;if($1 ne $2 || $2 ne $3) {"shellies/DEVNAME/color/0/set {\"turn\":\"on\",\"mode\":\"color\",\"gain\":\"100\",\"red\":".hex($1).",\"green\":".hex($2).",\"blue\":".hex($3)."}"}else{"shellies/DEVNAME/color/0/set {\"turn\":\"on\",\"mode\":\"white\",\"brightness\":".int(hex($1)/2.55)."}"}}\ effect:select,0,1,2,3 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/announce:.* { $EVENT =~ m,..id...DEVNAME...mac.*, ? json2nameValue($EVENT) : undef } 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 speech_recognition_type_light attr DEVICE model shelly2rgbw_color #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) : undef } 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).* setreading DEVICE associatedWith DEVICE_CH1,DEVICE_CH2,DEVICE_CH4 attr DEVICE webCmd on:off:pct set DEVICE x_mqttcom announce attr DEVICE jsonMap brightness:pct set DEVICE attrTemplate speech_recognition_type_light attr DEVICE model shelly2rgbw_4w_split attr DEVICE comment Channel 1 for DEVICE, see also DEVICE_CH2, DEVICE_CH3 and DEVICE_CH4 attr DEVICE autocreate 0 attr DEVICE setStateList on off copy DEVICE DEVICE_CH2 setreading DEVICE_CH2 associatedWith DEVICE,DEVICE_CH3,DEVICE_CH4 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_CH2 setStateList on off copy DEVICE DEVICE_CH3 setreading DEVICE_CH3 associatedWith DEVICE,DEVICE_CH2,DEVICE_CH4 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_CH3 setStateList on off copy DEVICE DEVICE_CH4 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"} setreading DEVICE_CH4 associatedWith DEVICE,DEVICE_CH2,DEVICE_CH3 attr DEVICE_CH4 setStateList on off #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}\ x_mqttcom shellies/DEVNAME/command $EVTPART1 deletereading -q DEVICE status_.* attr DEVICE readingList \ shellies/DEVNAME/light/0/status:.* {json2nameValue($EVENT,'',$JSONMAP)}\ shellies/DEVNAME/temperature:.* temperature\ shellies/DEVNAME/temperature_f:.* temperature_f\ shellies/DEVNAME/overtemperature:.* overtemperature\ shellies/DEVNAME/overload:.* overload\ shellies/DEVNAME/loaderror:.* loaderror\ shellies/announce:.* { $EVENT =~ m,..id...DEVNAME...mac.*, ? json2nameValue($EVENT) : undef } 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 speech_recognition_type_light attr DEVICE model shellydimmer ########################################### # 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 speech_recognition_type_switch attr DEVICE model ESPurna_single_relay 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 speech_recognition_type_switch attr DEVICE model ESPurna_4socketUSB_unified 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 speech_recognition_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).* copy DEVICE DEVICE_CH2 copy DEVICE DEVICE_CH3 copy DEVICE DEVICE_CH4 copy DEVICE DEVICE_USB setreading DEVICE_CH2 associatedWith DEVICE,DEVICE_CH3,DEVICE_CH4,DEVICE_USB setreading DEVICE_CH3 associatedWith DEVICE,DEVICE_CH2,DEVICE_CH4,DEVICE_USB setreading DEVICE_CH4 associatedWith DEVICE,DEVICE_CH2,DEVICE_CH3,DEVICE_USB setreading DEVICE_USB associatedWith DEVICE,DEVICE_CH2,DEVICE_CH3,DEVICE_CH4 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 setreading DEVICE associatedWith DEVICE_CH2,DEVICE_CH4,DEVICE_CH4,DEVICE_USB ############### #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 set DEVICE attrTemplate speech_recognition_type_switch deletereading -q DEVICE (?!associatedWith).* copy DEVICE DEVICE_CH2 copy DEVICE DEVICE_CH3 copy DEVICE DEVICE_CH4 copy DEVICE DEVICE_CH5 copy DEVICE DEVICE_CH6 copy DEVICE DEVICE_CH7 copy DEVICE DEVICE_CH8 setreading DEVICE associatedWith DEVICE_CH1,DEVICE_CH2,DEVICE_CH3,DEVICE_CH4,DEVICE_CH5,DEVICE_CH6,DEVICE_CH7,DEVICE_CH8 setreading DEVICE_CH2 associatedWith DEVICE,DEVICE_CH1,DEVICE_CH3,DEVICE_CH4,DEVICE_CH5,DEVICE_CH6,DEVICE_CH7,DEVICE_CH8 setreading DEVICE_CH3 associatedWith DEVICE,DEVICE_CH1,DEVICE_CH2,DEVICE_CH4,DEVICE_CH5,DEVICE_CH6,DEVICE_CH7,DEVICE_CH8 setreading DEVICE_CH4 associatedWith DEVICE,DEVICE_CH1,DEVICE_CH2,DEVICE_CH3,DEVICE_CH5,DEVICE_CH6,DEVICE_CH7,DEVICE_CH8 setreading DEVICE_CH5 associatedWith DEVICE,DEVICE_CH1,DEVICE_CH2,DEVICE_CH3,DEVICE_CH4,DEVICE_CH6,DEVICE_CH7,DEVICE_CH8 setreading DEVICE_CH6 associatedWith DEVICE,DEVICE_CH1,DEVICE_CH2,DEVICE_CH3,DEVICE_CH4,DEVICE_CH5,DEVICE_CH7,DEVICE_CH8 setreading DEVICE_CH7 associatedWith DEVICE,DEVICE_CH1,DEVICE_CH2,DEVICE_CH3,DEVICE_CH4,DEVICE_CH5,DEVICE_CH6,DEVICE_CH8 setreading DEVICE_CH8 associatedWith DEVICE,DEVICE_CH1,DEVICE_CH2,DEVICE_CH3,DEVICE_CH4,DEVICE_CH5,DEVICE_CH6,DEVICE_CH7 attr DEVICE readingList STATETOPIC.* { $EVENT =~ /output...([01])[01]{7}/;; my $newstate = $1 ? "on" : "off";; $newstate eq ReadingsVal($NAME,"state","unknown") ? undef : {"state"=>$newstate} } attr DEVICE_CH2 readingList STATETOPIC.* { $EVENT =~ /output...[01]([01])[01]{6}/;; my $newstate = $1 ? "on" : "off";; $newstate eq ReadingsVal($NAME,"state","unknown") ? undef : {"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") ? undef : {"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") ? undef : {"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") ? undef : {"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") ? undef : {"state"=>$newstate} } attr DEVICE_CH7 readingList STATETOPIC.* { $EVENT =~ /output...[01]{6}([01])[01]/;; my $newstate = $1 ? "on" : "off";; $newstate eq ReadingsVal($NAME,"state","unknown") ? undef : {"state"=>$newstate} } attr DEVICE_CH8 readingList STATETOPIC.* { $EVENT =~ /output...[01]{7}([01])/;; my $newstate = $1 ? "on" : "off";; $newstate eq ReadingsVal($NAME,"state","unknown") ? undef : {"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 setreading DEVICE associatedWith DEVICE_CH1,DEVICE_CH2,DEVICE_CH3,DEVICE_CH4,DEVICE_CH5,DEVICE_CH6,DEVICE_CH7,DEVICE_CH8 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",undef) ne $1 ? $1 : undef }, out2:output:.* { $event =~ m/.(.)......$/;;;;ReadingsVal($name,"out2",undef) ne $1 ? $1 : undef }, out3:output:.* { $event =~ m/..(.).....$/;;ReadingsVal($name,"out3",undef) ne $1 ? $1 : undef }, out4:output:.* { $event =~ m/...(.)....$/;;ReadingsVal($name,"out4",undef) ne $1 ? $1 : undef }, out5:output:.* { $event =~ m/....(.)...$/;;ReadingsVal($name,"out5",undef) ne $1 ? $1 : undef }, out6:output:.* { $event =~ m/.....(.)..$/;;ReadingsVal($name,"out6",undef) ne $1 ? $1 : undef }, out7:output:.* { $event =~ m/......(.).$/;;ReadingsVal($name,"out7",undef) ne $1 ? $1 : undef }, out8:output:.* { $event =~ m/.......(.)$/;;ReadingsVal($name,"out8",undef) ne $1 ? $1 : undef } 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 ############### #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 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..*?)/(bai|\d+|cc|e7f|ehp|f\d\d|hc|he.|hmu|hwc|mc|mc.\d|omu|omu.\d|pms|rcc|rcc.\d|sc|sdr_p|ui|uih|v\d\d|v81.\d|vd\d|vl\d|vr_\d\d|zeo)/.*:.* "$1_$2"\ (ebus..*?)/(global|broadcast|general|scan([^/]*))/.*:.* "$1" 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). 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. attr DEVICE model eBus_daemon_splitter ########################################### # 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:BASE_ID;base topic set, default is "home";{ AttrVal("DEVICE","readingList","") =~ m,([^/:]+)/, ? $1 : "home" } 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 \ BASE_ID/DEV_ID/(sensors|sm_data|hp_data|thermostat_data).*:.* "ems_esp_$1"\ BASE_ID/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",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 BASE_ID/DEV_ID/start:.* LWT\ BASE_ID/DEV_ID/heartbeat:.* { json2nameValue($EVENT,'',$JSONMAP) } attr DEVICE stateFormat Interface: \ LWT\ Signal: \ rssid %\
Uptime: formatedUptime\
IPAddress : IP attr DEVICE setList restart:noArg BASE_ID/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 name:ems-esp_boiler filter:TYPE=MQTT2_DEVICE desc:To configure a boiler device for use with an EMS-ESP
.Forum Thread order:E_02b par:BASEPATH;base topic set in the ESP including "ems-esp";{ AttrVal("DEVICE","readingList","") =~ m,([^:]*ems-esp)/boiler_data:, ? "$1" : undef } attr DEVICE readingList BASEPATH/boiler_data { json2nameValue($EVENT,'',$JSONMAP) }\ BASEPATH/shower_data:.* { json2nameValue($EVENT,'',$JSONMAP) }\ BASEPATH/mixing_data:.* { json2nameValue($EVENT,'',$JSONMAP) }\ BASEPATH/tapwater_active:.* tapwater_active\ BASEPATH/heating_active:.* heating_active attr DEVICE model ems-esp_boiler #ems-esp thermostat device name:ems-esp_thermostat_read-only filter:TYPE=MQTT2_DEVICE desc:To configure a simple read-only thermostat (e.g. CT200) for use with an EMS-ESP.
Forum Thread
order:E_02c par:BASEPATH;base topic set in the ESP including "ems-esp";{ AttrVal("DEVICE","readingList","") =~ m,([^:]*ems-esp)/thermostat_data:, ? "$1" : undef } par:ICON;ICON as set, defaults to temp_control;{ AttrVal("DEVICE","icon","temp_control") } attr DEVICE icon ICON attr DEVICE devStateIcon auto:time_automatic manual:time_manual_mode attr DEVICE jsonMap hc1_mode:mode hc1_seltemp:desired-temp hc1_daytemp:daytemp hc1_nighttemp:nighttemp hc1_holidayttemp:holidaytemp attr DEVICE readingList BASEPATH/thermostat_data:.* { json2nameValue($EVENT, '', $JSONMAP) } attr DEVICE stateFormat mode\ desired-temp °C attr DEVICE webCmd : attr DEVICE model ems-esp_thermostat_read-only name:ems-esp_thermostat_simple filter:TYPE=MQTT2_DEVICE desc:To configure a simple thermostat (e.g. RC300) for use with an EMS-ESP.
Forum Thread
order:E_02c1 par:BASEPATH;base topic set in the ESP including "ems-esp";{ AttrVal("DEVICE","readingList","") =~ m,([^:]*ems-esp)/thermostat_data:, ? "$1" : undef } par:ICON;ICON as set, defaults to temp_control;{ AttrVal("DEVICE","icon","temp_control") } attr DEVICE icon ICON 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 BASEPATH/thermostat_data:.* { json2nameValue($EVENT, '', $JSONMAP) } attr DEVICE setList mode:uzsuSelectRadio,auto,manual BASEPATH/thermostat_cmd_mode1 $EVTPART1\ desired-temp:slider,15.0,0.5,30.0,1 BASEPATH/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 speech_recognition_type_thermostat attr DEVICE model ems-esp_thermostat_simple name:ems-esp_thermostat_RC35_type filter:TYPE=MQTT2_DEVICE desc:To configure a thermostat comparable to RC35 for use with an EMS-ESP
.Forum Thread order:E_02c1 par:BASEPATH;base topic set in the ESP including "ems-esp";{ AttrVal("DEVICE","readingList","") =~ m,([^:]*ems-esp)/thermostat_data:, ? "$1" : undef } set DEVICE attrTemplate ems-esp_thermostat_simple attr DEVICE setList mode:uzsuSelectRadio,auto,manual BASEPATH/thermostat_cmd_mode1 $EVTPART1\ desired-temp:slider,15.0,0.5,30.0,1 BASEPATH/thermostat_cmd_temp1 $EVTPART1\ daytemp:slider,15.0,0.5,30.0,1 BASEPATH/thermostat_cmd_daytemp1 $EVTPART1\ nighttemp:slider,15.0,0.5,30.0,1 BASEPATH/thermostat_cmd_nighttemp1 $EVTPART1\ holidaytemp:slider,15.0,0.5,30.0,1 BASEPATH/thermostat_cmd_holidayttemp1 $EVTPART1 set DEVICE attrTemplate speech_recognition_type_thermostat attr DEVICE model ems-esp_thermostat_RC35_type ############### #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 par:BASE_ID;BASE_ID typically is milight;{ AttrVal("DEVICE","readingList","") =~ m,([^/]+)[/][^/]*at[^/]+[/].*:, ? $1 : undef } attr DEVICE bridgeRegexp BASE_ID/[^/]*at[^/]+/(0x[0-9a-fA-F]{1,4})/.*/([0-8])?.*:.* "milight_$1_$2" attr DEVICE autocreate 1 attr DEVICE setStateList on off attr DEVICE stateFormat \ status\ Version: \ version attr DEVICE devStateIcon connected:10px-kreis-gruen disconnected.*:10px-kreis-rot attr DEVICE model esp_milight_hub_bridge { 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,([^/]+)[/][^/]*at[^/]+[/].*:, ? $1 : undef } par:GROUP_ID;number from 0 to 4 representing one of the channels of an original bridge or remote;{ AttrVal("DEVICE","readingList","") =~ m,[^/]+[/][^/]+[/][^/]+[/]([0-4]):, ? $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 speech_recognition_type_light_255 attr DEVICE model esp_milight_hub_rgbw_bulb #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: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 speech_recognition_type_light_255 attr milight_REMOTE_ID_0 model esp_milight_hub_make_rgbw_group #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 4 representing one of the channels of an original bridge or remote;{ AttrVal("DEVICE","readingList","") =~ m,[^/]+[/][^/]+[/][^/]+[/]([0-4]):, ? $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 speech_recognition_type_light_255 attr DEVICE model esp_milight_hub_rgb_cct_bulb #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 4 representing one of the channels of an original bridge or remote;{ AttrVal("DEVICE","readingList","") =~ m,[^/]+[/][^/]+[/][^/]+[/]([0-4]):, ? $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 speech_recognition_type_light_255 attr DEVICE model esp_milight_hub_cct_only_bulb #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 4 representing one of the channels of an original bridge or remote;{ AttrVal("DEVICE","readingList","") =~ m,[^/]+[/][^/]+[/][^/]+[/]([0-4]):, ? $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 speech_recognition_type_light_255 attr DEVICE model esp_milight_hub_max_features_bulb #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 4 representing one of the channels of an original bridge or remote;{ AttrVal("DEVICE","readingList","") =~ m,[^/]+[/][^/]+[/][^/]+[/]([0-4]):, ? $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 ############### #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. 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 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",""),"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).* 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_')}\ homeassistant/[^/]*sensor/[^/]+/config:.* { $EVENT =~ m,DEVNAME, ? json2nameValue($EVENT,"HASS_") : undef } 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 { 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 } attr DEVICE readingList\ BASE_ID/DEVNAME/BTtoMQTT/([0-9A-Z]+):.* { $TOPIC =~ m,BTtoMQTT/([0-9A-Z]+),;;json2nameValue($EVENT,"$1"."_") }\ BASE_ID/home_presence/DEVNAME:.* { return undef 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).*"} attr DEVICE stateFormat Last: last attr DEVICE model OpenMQTTGateway_BT_scanner 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: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 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:READINGLISTOLD;copy readingList to new device for later resolving parameters;{ AttrVal("DEVICE","readingList","")} 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 #attr OMG_BT_ID readingList READINGLISTOLD deletereading -q OMG_BT_ID (?!associatedWith).* 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 temperature_humidity 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 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).* 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 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).* 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"}:undef }\ BASE_ID/DEVNAME/433toMQTT:.* { $EVENT =~ m,..value..([\d]+)..protocol..\d..length..\d+..delay..\d+.,? {"received_code"=>"$1"}:undef } 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 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).* 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 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).* 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 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 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 oMQTTgw_BT #attr OMG_BT_ID readingList READINGLISTOLD deletereading -q OMG_BT_ID (?!associatedWith).* 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 tem:temperature 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 ############### #OwnTracks # an OwnTracks device #contributed by Loredo #source post: https://forum.fhem.de/index.php/topic,94495.msg1020111.html#msg1020111 name:owntracks_device desc:A device tracked by OwnTracks filter:TYPE=MQTT2_DEVICE:FILTER=CID=owntracks.* order:O_01 par:TRACKER_ID;TrackerID;{ AttrVal("DEVICE","readingList","") =~ m,[^/:]+[/]([^/:]+).*:, ? $1 : undef } par:DEV_ID;DeviceID;{ 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 jsonMap\ _type:lastUpdateType acc:accuracy alt:altitude batt:batteryPercent bs:batteryState cog:direction conn:connection lat:latitude lon:longitude rad:radius\ p:pressure t:trigger tid:trackerId tst:timestamp vac:accuracyVertical vel:velocity\ event__type:lastUpdateType 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__type:lastUpdateType step_steps:steps_count step_from:steps_timestampBegin step_to:steps_timestampEnd step_tst:steps_timestampReq\ beacon__type:lastUpdateType beacon_acc:beacon_accuracy beacon_prox:beacon_proximity beacon_tst:beacon_timestampReq\ waypoints__type:lastUpdateType waypoints__creator:waypoints_creator\ config__type:lastUpdateType attr DEVICE readingList\ owntracks/TRACKER_ID/DEV_ID:.* { json2nameValue($EVENT,'',$JSONMAP) }\ owntracks/TRACKER_ID/DEV_ID/event:.* { json2nameValue($EVENT,'event_',$JSONMAP) }\ owntracks/TRACKER_ID/DEV_ID/step:.* { json2nameValue($EVENT,'step_',$JSONMAP) }\ owntracks/TRACKER_ID/DEV_ID/beacon:.* { json2nameValue($EVENT,'beacon_',$JSONMAP) }\ owntracks/TRACKER_ID/DEV_ID/waypoints:.* { json2nameValue($EVENT,'waypoints_',$JSONMAP) }\ owntracks/TRACKER_ID/DEV_ID/dump:.* { json2nameValue($EVENT,'config_',$JSONMAP) } attr DEVICE getList\ location:noArg raw owntracks/TRACKER_ID/DEV_ID/cmd {"_type":"cmd","action":"reportLocation"}\ steps:noArg raw owntracks/TRACKER_ID/DEV_ID/cmd {"_type":"cmd","action":"reportSteps"}\ config:noArg raw owntracks/TRACKER_ID/DEV_ID/cmd {"_type":"cmd","action":"dump"}\ waypoints:noArg raw owntracks/TRACKER_ID/DEV_ID/cmd {"_type":"cmd","action":"waypoints"} attr DEVICE setList\ config owntracks/TRACKER_ID/DEV_ID/cmd {"_type":"cmd","action":"setConfiguration","configuration":$EVTPART1}\ waypoints owntracks/TRACKER_ID/DEV_ID/cmd {"_type":"cmd","action":"setWaypoints","waypoints":{"_type":"waypoints","waypoints":$EVTPART1}\ action owntracks/TRACKER_ID/DEV_ID/cmd {"_type":"cmd","action":"action",$EVTPART1} deletereading -q DEVICE (?!associatedWith).* attr DEVICE model owntracks_device 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).* 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 # 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: Experimental, 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/mywallpanel/command {"wake": false}\ screenon:select,60,600,3600,86400 wallpanel/wz_tablet/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 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).* attr DEVICE model weewx_weather_station #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 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 status on\ off:noArg BASE_ID/DEVNAME status off\ toggle:noArg BASE_ID/DEVNAME status t\ rgb:colorpicker,RGB BASE_ID/DEVNAME/col #$EVTPART1\ brightness:colorpicker,BRI,0,1,255 BASE_ID/DEVNAME\ speed:colorpicker,BRI,0,1,255 BASE_ID/DEVNAME/api http://DEVNAME/win&SX=$EVTPART1\ intensity:colorpicker,BRI,0,1,255 BASE_ID/DEVNAME/api http://DEVNAME/win&IX=$EVTPART1\ palette:selectnumbers,0,1,46,0,lin BASE_ID/DEVNAME/api http://DEVNAME/win&FP=$EVTPART1\ effect:selectnumbers,0,1,101,0,lin BASE_ID/DEVNAME/api http://DEVNAME/win&FX=$EVTPART1\ loadPreset:selectnumbers,0,1,3,0,lin BASE_ID/DEVNAME/api http://DEVNAME/win&PL=$EVTPART1 attr DEVICE readingList \ BASE_ID/DEVNAME/g:.* brightness\ BASE_ID/DEVNAME/c:.* {{"rgb"=>substr("$EVENT",1,6)}}\ BASE_ID/DEVNAME/v:.* api\ BASE_ID/DEVNAME/v:.* {$EVENT =~ m,(?<=)([\d]+)(?=<\/sx>), ? $1 eq ReadingsVal($NAME,"speed","unknown") ? undef : {"speed"=>$1} : undef }\ BASE_ID/DEVNAME/v:.* {$EVENT =~ m,(?<=)([\d]+)(?=<\/ix>), ? $1 eq ReadingsVal($NAME,"intensity","unknown") ? undef : {"intensity"=>$1} : undef }\ BASE_ID/DEVNAME/v:.* {$EVENT =~ m,(?<=)([\d]+)(?=<\/fp>), ? $1 eq ReadingsVal($NAME,"palette","unknown") ? undef : {"palette"=>$1} : undef }\ BASE_ID/DEVNAME/v:.* {$EVENT =~ m,(?<=)([\d]+)(?=<\/fx>), ? $1 eq ReadingsVal($NAME,"effect","unknown") ? undef :{"effect"=>"$1"} : undef } deletereading -q DEVICE (?!associatedWith).* attr DEVICE devStateIcon {Color::devStateIcon( $name, "rgb", "rgb", "brightness", "state" )} attr DEVICE eventMap /effect 0:Solid/effect 2:Breathe/effect 63:Pride/effect 48:Police/ attr DEVICE webCmd rgb:brightness:Solid:Breathe:Pride:Police attr DEVICE setStateList on off toggle 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 speech_recognition_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 #source post: https://forum.fhem.de/index.php/topic,105457.msg993924.html#msg993924 name:go_eCharger filter:TYPE=MQTT2_DEVICE desc: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_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","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).* attr DEVICE model go_eCharger