Shelly RGBW2 in FHEM per MQTT

Begonnen von musicnrw, 27 Januar 2026, 19:33:46

Vorheriges Thema - Nächstes Thema

musicnrw

Ich habe jetzt meinen Shelly RGBW2 per MQTT in FHEM eingebunden, was sowiet funktioniert - das Gerät wird unter MQTT_Device angezeigt.
Ich möchte nun das spezifische Template, für die Nutzung der spezifischen Shelly-Funktionen zuweisen per
set attrTemplate shelly2rgbw_color (so habe ich es zumindest in einem Youtube-Video gefunden, welches genau für diesen Shelly-Typ die Einbindung per MQTT zeigt).
Leider ist aber in der Liste der Templates (in "meinem" FHEM) kein passendes für den Shelly RGBW2 enthalten.
Woran liegt das, was kann ich tun?

Sidey

Hallo,

vor diesem Problem stand ich auch.
Es gibt meiner Meinung nach bisher kein Template dafür.

Ich habe dann selbst was angelegt, aber es gibt mit der Farbauswahl noch Schwierigkeiten.
Vielleicht hilft es dir ja als Startpunkt.

define Lichtvoute MQTT2_DEVICE shellyplusrgbwpm-30c92258cc98

attr Lichtvoute devStateIcon {my $onl = ReadingsVal($name,'online','false') eq 'false'?'10px-kreis-rot':'10px-kreis-gruen';; $onl = FW_makeImage($onl);; my $light = FW_makeImage(ReadingsVal($name,'state','off'));; my $cons = ReadingsNum($name,'apower',0);; my $total = round(ReadingsNum($name,'aenergy_total',0)/1000,3);; my $temp = ReadingsVal($name,'temperature','-100');; my $ip = ReadingsVal($name,'ip','none');; my $reb = ReadingsVal($name,'sys_restart_required','false') eq 'true'?'<a href="/fhem?cmd.dummy=set '.$name.' x_reboot&XHR=1"> ... Notwendigen Reboot durchführen</a>':'';; qq(<a href="http://$ip" target="_blank">${onl}</a><a href="/fhem?cmd.dummy=set $name toggle&XHR=1">${light}</a>$reb<div>Verbrauch: $cons W / Total: $total kwh / Temp: $temp °C</div>)}
attr Lichtvoute devicetopic zuhause/1OG/Buero/lichtvoute
attr Lichtvoute event-min-interval .*:3600
attr Lichtvoute event-on-change-reading .*
attr Lichtvoute event-on-update-reading .*
attr Lichtvoute genericDeviceType light

attr Lichtvoute icon light_control
attr Lichtvoute jsonMap rgb_1:rot rgb_2:green rgb_3:blue rgb_4:white aenergy_total:aenergy_total temperature_tC:temperature temperature_tF:0 params_wifi_sta_ip:ip result_in_mode:in_mode brightness:pct\

attr Lichtvoute model shellyPlus_1pm
attr Lichtvoute readingList $DEVICETOPIC/status/rgbw_0:.*  { json2nameValue($EVENT,'',$JSONMAP) }\
$DEVICETOPIC/online:.* online\
$DEVICETOPIC/status/wifi:.* { json2nameValue($EVENT) }\
$DEVICETOPIC/status/plusrgbwpm:.* plusrgbwpm\
$DEVICETOPIC/status/sys:.* { json2nameValue($EVENT) }\
$DEVICETOPIC/events/rpc:.* { json2nameValue($EVENT,'',$JSONMAP) }
attr Lichtvoute room Buero,MQTT2_DEVICE
attr Lichtvoute setList toggle:noArg           $DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"RGBW.Toggle","params": {"id":0}}\
off:noArg              $DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"RGBW.Set","params": {"id":0,"on":false}}\
on:noArg               $DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"RGBW.Set","params": {"id":0,"on":true}}\
rgb:colorpicker,RGB   {$EVTPART1=~/(..)(..)(..)/;;my @a=(hex($1),hex($2),hex($3));;if($1 ne $2 || $2 ne $3) {qq($DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"RGBW.Set","params": {"id":0,"on":true,"white":0,"rgb":[$a[0],$a[1],$a[2]]}})}else{qq($DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"RGBW.Set","params": {"id":0,"on":true,"white":255,"rgb":[$a[0],$a[1],$a[2]]}})}}\
white:colorpicker,BRI,0,5,255 $DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"RGBW.Set","params": {"id":0,"on":true,"white":$EVTPART1}}\\
pct:colorpicker,BRI,0,5,100 $DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"RGBW.Set","params": {"id":0,"on":true,"brightness":$EVTPART1}}\\
transition_duration:colorpicker,BRI,1,1,10 $DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"RGBW.Set","params": {"id":0,"on":true,"transition_duration":$EVTPART1}}\\
toggle_after:colorpicker,BRI,1,1,10 $DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"RGBW.Set","params": {"id":0,"on":true,"toggle_after":$EVTPART1}}\\
on-for-timer                        $DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"RGBW.Set","params": {"id":0,"on":true,"toggle_after":$EVTPART1}}\
brightness:colorpicker,BRI,0,1,100  $DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"RGBW.Set","params": {"id":0,"brightness":$EVTPART1}}\
x_update:noArg                      $DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"Shelly.Update","params": {"stage":"stable"}}\
x_reboot:noArg                      $DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"Shelly.Reboot"}\

attr Lichtvoute userReadings state {(ReadingsVal("Lichtvoute","output","false") eq "true") ? "on" : "off"}
attr Lichtvoute webCmd on:off:white:rgb

Signalduino, Homematic, Raspberry Pi, Mysensors, MQTT, Alexa, Docker, AlexaFhem,zigbee2mqtt

Maintainer von: SIGNALduino, fhem-docker, alexa-fhem-docker, fhempy-docker