Hier meine finale Version des AttrTemplate für WLED:
#source post: https://forum.fhem.de/index.php/topic,98880.msg995308.html#msg995308
name:wled_controller
filter:TYPE=MQTT2_DEVICE
desc:To control a WLED device, see https://github.com/Aircoookie/WLED/wiki for details).
order:W_01
{ Svn_GetFile('contrib/AttrTemplate/99_attrT_WLED_Utils.pm', 'FHEM/99_attrT_WLED_Utils.pm', sub(){ CommandReload(undef, '99_attrT_WLED_Utils') }) }
par:BASE_ID;BASE_ID typically is wled;{ AttrVal('DEVICE','readingList','') =~ m,([^:]+)[/][^/]+[/][^/]+:, ? $1 : undef }
par:DEVNAME;Device name as configured;{ AttrVal('DEVICE','readingList','') =~ m,[^:]+[/]([^/]+)[/][^/]+:, ? $1 : undef }
par:ICON;ICON as set, defaults to hue_filled_iris;{ AttrVal('DEVICE','icon','hue_filled_iris') }
attr DEVICE icon ICON
attr DEVICE setList\
on:noArg BASE_ID/DEVNAME on\
off:noArg BASE_ID/DEVNAME off\
toggle:noArg BASE_ID/DEVNAME t\
rgb:colorpicker,RGB BASE_ID/DEVNAME/col #$EVTPART1\
brightness:colorpicker,BRI,0,1,255 BASE_ID/DEVNAME/api A=$EVTPART1\
dimup:noArg BASE_ID/DEVNAME/api A=~10\
dimdown:noArg BASE_ID/DEVNAME/api A=~-10\
speed:colorpicker,BRI,0,1,255 BASE_ID/DEVNAME/api SX=$EVTPART1\
intensity:colorpicker,BRI,0,1,255 BASE_ID/DEVNAME/api IX=$EVTPART1\
effect:{'selectnumbers,0,1,'.ReadingsNum($name,'.effectscount',5).',0,lin'} BASE_ID/DEVNAME/api FX=$EVTPART1\
effectname:{'select,'.join(',',sort(split(',',ReadingsVal($name,'.effects','Solid,Police'))))} {FHEM::attrT_WLED_Utils::WLED_set($NAME,'effect',$EVTPART1)}\
effect_next:noArg BASE_ID/DEVNAME/api FX=~1\
effect_prev:noArg BASE_ID/DEVNAME/api FX=~-1\
effect_random:noArg BASE_ID/DEVNAME/api FX=r\
effect_reset:noArg BASE_ID/DEVNAME/api FX=0\
palette:{'selectnumbers,0,1,'.ReadingsNum($name,'.palettescount',5).',0,lin'} BASE_ID/DEVNAME/api FP=$EVTPART1\
palettename:{'select,'.join(',',sort(split(',',ReadingsVal($name,'.palettes','Default,Party'))))} {FHEM::attrT_WLED_Utils::WLED_set($NAME,'palette',$EVTPART1)}\
palette_next:noArg BASE_ID/DEVNAME/api FP=~1\
palette_prev:noArg BASE_ID/DEVNAME/api FP=~-1\
palette_random:noArg BASE_ID/DEVNAME/api FP=r\
palette_reset:noArg BASE_ID/DEVNAME/api FP=0\
preset:selectnumbers,0,1,15,0,lin BASE_ID/DEVNAME/api PL=$EVTPART1\
apiraw BASE_ID/DEVNAME/api $EVTPART1\
seg BASE_ID/DEVNAME/api {'seg':{'i':[$EVTPART1,[$EVTPART2]]}}
attr DEVICE readingList \
BASE_ID/DEVNAME/status:.* LWT\
BASE_ID/DEVNAME/g:.* brightness\
BASE_ID/DEVNAME/g:.* {$EVENT ? {state => 'on'} : {state => 'off'}}\
BASE_ID/DEVNAME/c:.* {{rgb => substr($EVENT,1,6)}}\
BASE_ID/DEVNAME/v:.* {FHEM::attrT_WLED_Utils::WLED_get($NAME,$EVENT)}
deletereading -q DEVICE (?!associatedWith|IODev).*
attr DEVICE devStateIcon {ReadingsVal($name,'LWT','offline') eq 'offline' ? '.*:message_attention@red' : Color::devStateIcon($name,'rgb','rgb','brightness','state')}
attr DEVICE webCmd rgb:brightness:effectname:speed:intensity:palettename:preset
attr DEVICE webCmdLabel RGB:Brightness\
:Effect:Speed:Intensity\
:Palette:Preset
attr DEVICE setStateList on off toggle dimdown dimup effect_prev effect_next effect_random palette_prev palette_next palette_random palette_reset effect_reset
attr DEVICE comment For questions about the use of different widgets for color selection see discussion at https://forum.fhem.de/index.php/topic,98880.msg995308.html
set DEVICE attrTemplate speechcontrol_type_light_255
farewell:template has been applied successfully. <br>Note: webCmd and eventMap are just examples; adopt this to your needs.
attr DEVICE model wled_controller
setreading DEVICE attrTemplateVersion 20211220 or prior
Die dazu passende Moduldatei befindet sich im Anhang.
@Beta-User: Sofern von Dir für gut erachtet könnte diese Version dann Einzug ins SVN halten.
Danke.
Gruß
Dan