Shelly Pro - Serie anbinden

Begonnen von vic, 25 Januar 2023, 17:21:49

Vorheriges Thema - Nächstes Thema

Ralli

Ich habe für jeden Kanal meines Pro 3 ein eigenes Device angelegt.

Damit für das Device für Kanal 0  auch nur die dafür bestimmten Informationen verarbeitet, habe ich folgendes in der readingList:

attr ShellyPro3_Heizstab readingList $DEVICETOPIC/events/rpc:.* { return if $EVENT !~ m{switch:0};; $EVENT =~ s/"output":true/"state":"on"/g;; $EVENT =~ s/"output":false/"state":"off"/g;; json2nameValue($EVENT,'switch_',$JSONMAP) }\
$DEVICETOPIC/status/switch.0:.* { $EVENT =~ s/"output":true/"state":"on"/g;; $EVENT =~ s/"output":false/"state":"off"/g;; json2nameValue($EVENT, 'switch_', $JSONMAP) }\
$DEVICETOPIC/rpc:.* { return if $EVENT !~ m{\"result\":\{\"id\":0};; $EVENT =~ s/"output":true/"state":"on"/g;; $EVENT =~ s/"output":false/"state":"off"/g;; json2nameValue($EVENT, 'req_', $JSONMAP)}

Dazu passend folgendes in der setList:

attr ShellyPro3_Heizstab setList toggle:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Toggle","params": {"id":0}}\
off:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Set","params": {"id":0,"on":false}}\
on:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Set","params": {"id":0,"on":true}}\
on-for-timer $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Set","params": {"id":0,"on":true,"toggle_after":$EVTPART1}}\
off-for-timer $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Set","params": {"id":0,"on":false,"toggle_after":$EVTPART1}}\
status-request:noArg $DEVICETOPIC/rpc {"id":1,"src":"$DEVICETOPIC","method":"Switch.GetStatus","params": {"id":0}}

Selbstredend muss das Attribut devicetopic entsprechend gesetzt sein, damit es in readingList und setList entsprechend verarbeitet wird. Für die Kanäle 1 und 2 müssen die Eintragungen angepasst werden.

Damit geht nicht nur on und off sondern auch on-for-timer, off-for-timer und status-request.
Gruß,
Ralli

Proxmox 8.4 Cluster mit HP ED800G2i7, Intel NUC11TNHi7+NUC7i5BNH, virtualisiertes fhem 6.4 dev, virtualisierte RaspberryMatic (3.83.6.20250705) mit HB-RF-ETH 1.3.0 / RPI-RF-MOD, HM-LAN-GW (1.4.1) und HMW-GW, FRITZBOX 7490 (07.59), FBDECT, Siri und Alexa

hazelnut

Hallo Ralli,

ok, du übergibst also einen kompletten JSON-String?! darf ich fragen - das "fhem2shelly" ist dein MQTT2_SERVER?

Ich werd wohl was Zeit brauchen das zu verstehen... vielen, vielen Dank aber erst einmal!!

...und ich melde mich :-)

Hazelnut

Ralli

Zitat von: hazelnut am 05 Dezember 2024, 22:43:46darf ich fragen - das "fhem2shelly" ist dein MQTT2_SERVER?

Das ist irgendein Name, mit dem der Absender dieses publish beim MQTT-Server benannt wird.
Gruß,
Ralli

Proxmox 8.4 Cluster mit HP ED800G2i7, Intel NUC11TNHi7+NUC7i5BNH, virtualisiertes fhem 6.4 dev, virtualisierte RaspberryMatic (3.83.6.20250705) mit HB-RF-ETH 1.3.0 / RPI-RF-MOD, HM-LAN-GW (1.4.1) und HMW-GW, FRITZBOX 7490 (07.59), FBDECT, Siri und Alexa

Beta-User

Zitat von: Ralli am 06 Dezember 2024, 07:14:10Absender dieses publish beim MQTT-Server benannt wird.
Es geht nach meiner Erinnerung weniger um den Server, sondern um die Rückmeldeinfo für den Absender, ob sein Befehl angekommen ist. Daher wird in den attrTemplate zu den 2nd gen Shelly dieser Pfad nicht ausgewertet, sondern nur die Schaltinfo, die über einen anderen Topic kommen sollte...
Server: HP-elitedesk@Debian 12, aktuelles FHEM@ConfigDB | CUL_HM (VCCU) | MQTT2: ZigBee2mqtt, MiLight@ESP-GW, BT@OpenMQTTGw | ZWave | SIGNALduino | MapleCUN | RHASSPY
svn: u.a Weekday-&RandomTimer, Twilight,  div. attrTemplate-files, MySensors

hazelnut

Hallo noch einmal,

so, ich hatte am Wochenende etwas Zeit, mich damit zu beschäftigen... und es dauerte nicht lange, bis ich beim Pearl nicht weiterkomme.

Beim Anpassen der readingList hattest du ja (fast) diesen String hier:

attr ShellyPro3_Pumpe readingList $DEVICETOPIC/events/rpc:.* { return if $EVENT !~ m{switch:0};; $EVENT =~ s/"output":true/"state":"on"/g;; $EVENT =~ s/"output":false/"state":"off"/g;; json2nameValue($EVENT,'switch_',$JSONMAP) }\
$DEVICETOPIC/status/switch.0:.* { $EVENT =~ s/"output":true/"state":"on"/g;; $EVENT =~ s/"output":false/"state":"off"/g;; json2nameValue($EVENT, 'switch_', $JSONMAP) }\
$DEVICETOPIC/rpc:.* { return if $EVENT !~ m{\"result\":\{\"id\":0};; $EVENT =~ s/"output":true/"state":"on"/g;; $EVENT =~ s/"output":false/"state":"off"/g;; json2nameValue($EVENT, 'req_', $JSONMAP)}

wie dir vielleicht aufgefallen ist, habe ich den Name geändert. Das Devicetopic ist hinterlegt und sollte passen.

Wenn ich die Reading-List einfügen möchte, schmeißt er mir den folgenden Fehler:

syntax error at (eval 169468) line 1, near "0:"
syntax error at (eval 169468) line 1, near "rpc:"
syntax error at (eval 169468) line 1, near ")}"

zumindest dem Bauch nach kann ich damit nichts anfangen, da das in deinem Quelltext plausibel aussieht und auch die Klammern eigentlich stimmen. Zeilenumbrüche habe ich so, wie sie oben im Attribut sind.

Kann es sein, dass es die es die Readings nicht in der Form gibt? Weil in meiner Ausgabe steht aktuell sowas hier:

params_switch_0_output

false

der zugehörige ReadingList - Eintrag (hat fhem selber angelegt) sieht so aus:

shellypro3_a0dd6ca1bxxx:SP3-P/online:.* online
shellypro3_a0dd6ca1bxxx:SP3-P/events/rpc:.* { json2nameValue($EVENT) }


Kannst du mir da weiterhelfen?

Danke

Hazel

Beta-User

Zitat von: hazelnut am 16 Dezember 2024, 14:42:11Das Devicetopic ist hinterlegt und sollte passen.
Das würde ich bezweifeln, sonst würde nicht der /events/rpc-Topic nochmal automatisch angelegt.
Server: HP-elitedesk@Debian 12, aktuelles FHEM@ConfigDB | CUL_HM (VCCU) | MQTT2: ZigBee2mqtt, MiLight@ESP-GW, BT@OpenMQTTGw | ZWave | SIGNALduino | MapleCUN | RHASSPY
svn: u.a Weekday-&RandomTimer, Twilight,  div. attrTemplate-files, MySensors

passibe

Wo fügst du die denn ein? Das, was da steht muss entweder in die raw definition oder über das Plus-Symbol oben eingefügt werden.

Willst du es direkt in das Attribut reinkopieren brauchst du
$DEVICETOPIC/events/rpc:.* { return if $EVENT !~ m{switch:0}; $EVENT =~ s/"output":true/"state":"on"/g; $EVENT =~ s/"output":false/"state":"off"/g; json2nameValue($EVENT,'switch_',$JSONMAP) }
$DEVICETOPIC/status/switch.0:.* { $EVENT =~ s/"output":true/"state":"on"/g; $EVENT =~ s/"output":false/"state":"off"/g; json2nameValue($EVENT, 'switch_', $JSONMAP) }
$DEVICETOPIC/rpc:.* { return if $EVENT !~ m{\"result\":\{\"id\":0}; $EVENT =~ s/"output":true/"state":"on"/g; $EVENT =~ s/"output":false/"state":"off"/g; json2nameValue($EVENT, 'req_', $JSONMAP)}

Ich kriege da jedenfalls direkt beim Einfügen keine Fehlermeldung. Im Betrieb, keine Ahnung – habe keinen Shelly Pro. Der Perl-Code an sich ist aber korrekt.

Falls es immer noch nicht funktioniert: Gib uns bitte mal ein List vom ShellyPro3_Pumpe device.

hazelnut

#22
So ihr lieben,

@Beta-User: du hattest recht. Beim Device-Topic lag letztendlich auch der Fehler. Habe die noch mal völlig neu angelegt (im Gerät und dann auch so übernommen) und dann hat es fast wie von allein funktioniert. Wie genau? ;-)

Ok, also,
(1) erst mal im FHEM alles wegputzen, was da bisher an nicht funktionierenden Spielerein da war.
(2) das Device-Topic im Shelly (in meinem Fall neu) hinterlegen.
(3) FHEM erkennt das Device ...
(4) Template zuordnen (bei mir gab es auf dem Raspi ein Template für "shellypro4pm", was ich verwendet habe)
(5) nach dem magische Dinge passieren sind 3 Kanäle neu angelegt: *_CH4, *_CH3, *_CH2, die sich auch schon (z.T.) schalten lassen
(6) beim Schalten von *_CH4 passiert nichts - klar - der ShellyPro 3 hat ja auch nur 3 Kanäle (offensichtlich wird bei Kanal 4 angefangen und dann runtergezählt) also sind ein paar Attribute anzupassen:

Im Attribut jsonMap ist
*_switch_3_* in
*_switch_0_* zu ändern. Ähnlich ist es in den Attributen readingList und setList. Auch hier ist die jeweilige 3 durch eine 0 zu ersetzen. Ich hab auch den Kommentar (Attribut comment) noch angepasst und natürlich auch ein rename auf *_CH1 durchgeführt

Damit läuft es :-)

Vielen Dank an euch und eure Geduld!!!

Der Fehler saß also mal wieder vor dem Bildschirm, hat aber dazu gelernt und ich hoffe, meine Beschreibung hier hilft dem Einen oder der Anderen

Hazel

stobor

#23
Ich komme hier irgendwie nicht weiter.

Meinen Shelly Pro 3 (3 Schaltausgänge auf Hutschiene) bekomme ich über MQTT2 einfach nicht angesteuert.

Das Gerät wird per Autocreate in FHEM angelegt, sobald ich über die Shelly-eigene Weboberfläche die Ausgänge schalte.
Ein list shellypro3_SchuppenWest_fce8c0dbded4 liefert dann:
Internals:
  CFGFN     
  CID        shellypro3_SchuppenWest_fce8c0dbded4
  DEF        shellypro3_SchuppenWest_fce8c0dbded4
  FUUID      680fdd05-f33f-2cfb-6712-b95791d0592d0c41
  IODev      MQTT2
  LASTInputDev MQTT2
  MQTT2_CONN MQTT2_192.168.179.16_50740
  MQTT2_MSGCNT 8
  MQTT2_TIME 2025-04-28 21:54:54
  MSGCNT    8
  NAME      shellypro3_SchuppenWest_fce8c0dbded4
  NR        1829
  STATE      ???
  TYPE      MQTT2_DEVICE
  eventCount 12
  READINGS:
    2025-04-28 21:54:45  IODev          MQTT2
    2025-04-28 21:54:54  dst            shellypro3-SchuppenWest-fce8c0dbded4/events
    2025-04-28 21:54:54  id              2
    2025-04-28 21:54:54  method          NotifyStatus
    2025-04-28 21:54:54  output          false
    2025-04-28 21:54:49  params_switch_0_id 0
    2025-04-28 21:54:49  params_switch_0_output false
    2025-04-28 21:54:49  params_switch_0_source WS_in
    2025-04-28 21:54:50  params_switch_1_id 1
    2025-04-28 21:54:50  params_switch_1_output false
    2025-04-28 21:54:50  params_switch_1_source WS_in
    2025-04-28 21:54:54  params_switch_2_id 2
    2025-04-28 21:54:54  params_switch_2_output false
    2025-04-28 21:54:54  params_switch_2_source WS_in
    2025-04-28 21:54:54  params_ts      1745870094.83
    2025-04-28 21:54:54  source          WS_in
    2025-04-28 21:54:54  src            shellypro3-fce8c0dbded4
    2025-04-28 21:54:54  temperature_tC  36.7
    2025-04-28 21:54:54  temperature_tF  98.1
  hmccu:
Attributes:
  readingList shellypro3_SchuppenWest_fce8c0dbded4:shellypro3-SchuppenWest-fce8c0dbded4/events/rpc:.* { json2nameValue($EVENT) }
shellypro3_SchuppenWest_fce8c0dbded4:shellypro3-SchuppenWest-fce8c0dbded4/status/switch_0:.* { json2nameValue($EVENT) }
shellypro3_SchuppenWest_fce8c0dbded4:shellypro3-SchuppenWest-fce8c0dbded4/status/switch_1:.* { json2nameValue($EVENT) }
shellypro3_SchuppenWest_fce8c0dbded4:shellypro3-SchuppenWest-fce8c0dbded4/status/switch_2:.* { json2nameValue($EVENT) }
  room      NEW_Device

DerShelly selbst ist so für MQTT konfiguriert:
Du darfst diesen Dateianhang nicht ansehen.

In FHEM ist der MQTT2 Server so eingebunden:
define MQTT2 MQTT2_SERVER 1883 global
setuuid MQTT2 65f71cee-f33f-2cfb-513b-74b885280db7c7fc
attr MQTT2 autocreate simple
attr MQTT2 group MQTT
attr MQTT2 icon mqtt
attr MQTT2 room MQTT
attr MQTT2 verbose 0

Einen Shelly Pro 4PM nutze ich bereits erfolgreich:
define MQTT2_shellypro4pm_34987a690b90 MQTT2_DEVICE shellypro4pm_34987a690b90
setuuid MQTT2_shellypro4pm_34987a690b90 65f9b194-f33f-2cfb-4124-a781ba64c0a9166f
attr MQTT2_shellypro4pm_34987a690b90 alias Terrasse_Shelly_CH0
attr MQTT2_shellypro4pm_34987a690b90 comment Channel 1 for MQTT2_shellypro4pm_34987a690b90, see also MQTT2_shellypro4pm_34987a690b90_CH2, MQTT2_shellypro4pm_34987a690b90_CH3 and MQTT2_shellypro4pm_34987a690b90_CH4
attr MQTT2_shellypro4pm_34987a690b90 devStateIcon {\
my $onl = ReadingsVal($name,'online','false') eq 'false'?'10px-kreis-rot': ReadingsVal($name,'new_fw','false') eq 'true' ? '10px-kreis-gelb' : '10px-kreis-gruen';; \
$onl = FW_makeImage($onl);; \
my $light = FW_makeImage(ReadingsVal($name,'state','off'));; \
my $cons = ReadingsNum($name,'apower',0);; \
my $total = round(ReadingsNum($name,'aenergy_total',0)/1000,1);; \
my $temp = ReadingsVal($name,'temperature','n.a.');; \
my $ip = ReadingsVal($name,'sta_ip','none');; \
qq(<a href="http://$ip" target="_blank">${onl}</a><a href="/fhem?cmd.dummy=set $name toggle&XHR=1">${light}</a><div>Verbrauch: $cons W / Total: $total kwh / Temp: $temp °C</div>)\
}
attr MQTT2_shellypro4pm_34987a690b90 devicetopic shellypro4pm-34987a690b90
attr MQTT2_shellypro4pm_34987a690b90 getList in_mode:noArg in_mode $DEVICETOPIC/rpc {"id": 1,"src":"$DEVICETOPIC", "method": "Switch.GetConfig", "params": {"id": 0}}
attr MQTT2_shellypro4pm_34987a690b90 icon message_socket
attr MQTT2_shellypro4pm_34987a690b90 jsonMap params_switch_0_state:state params_switch_0_aenergy_total:aenergy_total params_switch_0_apower:apower params_switch_0_temperature_tC:temperature params_switch_0_temperature_tF:0 params_wifi_sta_ip:ip
attr MQTT2_shellypro4pm_34987a690b90 model shellypro4pm
attr MQTT2_shellypro4pm_34987a690b90 readingList $DEVICETOPIC/online:.* online\
  $DEVICETOPIC/events/rpc:.* { return if $EVENT =~ m{switch:[1-3]};; $EVENT =~ s/"output":true/"state":"on"/g;; $EVENT =~ s/"output":false/"state":"off"/g;; json2nameValue($EVENT,'',$JSONMAP) }\
  $DEVICETOPIC/status/switch.0:.* { json2nameValue($EVENT, '', $JSONMAP) }\
  $DEVICETOPIC/status/mqtt:.* { json2nameValue($EVENT, '', $JSONMAP) }\
  fhem2shelly/rpc:.* {}\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/status/ble:.* ble\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/status/cloud:.* { json2nameValue($EVENT) }\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/status/eth:.* { json2nameValue($EVENT) }\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/status/input_0:.* { json2nameValue($EVENT) }\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/status/input_1:.* { json2nameValue($EVENT) }\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/status/input_2:.* { json2nameValue($EVENT) }\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/status/input_3:.* { json2nameValue($EVENT) }\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/status/sys:.* { json2nameValue($EVENT) }\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/status/ui:.* ui\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/status/wifi:.* { json2nameValue($EVENT) }\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/status/ws:.* { json2nameValue($EVENT) }\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/status/knx:.* knx\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/status/bthome:.* { json2nameValue($EVENT) }\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/status/switch_0:.* { json2nameValue($EVENT) }\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/events/rpc:.* { json2nameValue($EVENT) }\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/status/switch_1:.* { json2nameValue($EVENT) }\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/status/switch_3:.* { json2nameValue($EVENT) }\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/status/switch_2:.* { json2nameValue($EVENT) }\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/status/mqtt:.* { json2nameValue($EVENT) }\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/online:.* online
attr MQTT2_shellypro4pm_34987a690b90 room Terrasse,Aussen,MQTT,Shelly
attr MQTT2_shellypro4pm_34987a690b90 setList toggle:noArg $DEVICETOPIC/rpc {"id":1,"src":"fhem2shelly","method":"Switch.Toggle","params": {"id":0}}\
  off:noArg $DEVICETOPIC/rpc {"id":1,"src":"fhem2shelly","method":"Switch.Set","params": {"id":0,"on":false}}\
  on:noArg $DEVICETOPIC/rpc {"id":1,"src":"fhem2shelly","method":"Switch.Set","params": {"id":0,"on":true}}\
  on-for-timer $DEVICETOPIC/rpc {"id":1,"src":"fhem2shelly","method":"Switch.Set","params": {"id":0,"on":true,"toggle_after":$EVTPART1}}\
  off-for-timer $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Set","params": {"id":0,"on":false,"toggle_after":$EVTPART1}}\
  x_update:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Shelly.Update","params": {"stage":"stable"}}\
  x_reboot:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Shelly.Reboot"}
attr MQTT2_shellypro4pm_34987a690b90 setStateList on off toggle on-for-timer off-for-timer
attr MQTT2_shellypro4pm_34987a690b90 webCmd :
#attr MQTT2_shellypro4pm_34987a690b90 disable 1


define MQTT2_shellypro4pm_34987a690b90_CH2 MQTT2_DEVICE
setuuid MQTT2_shellypro4pm_34987a690b90_CH2 65f9b26b-f33f-2cfb-6be1-8510dd9b2eee010c
attr MQTT2_shellypro4pm_34987a690b90_CH2 IODev MQTT2
attr MQTT2_shellypro4pm_34987a690b90_CH2 alias Terrasse_Shelly_CH1
attr MQTT2_shellypro4pm_34987a690b90_CH2 comment Channel 2 for MQTT2_shellypro4pm_34987a690b90, see also MQTT2_shellypro4pm_34987a690b90, MQTT2_shellypro4pm_34987a690b90_CH3 and MQTT2_shellypro4pm_34987a690b90_CH4
attr MQTT2_shellypro4pm_34987a690b90_CH2 devStateIcon {\
my $light = FW_makeImage(ReadingsVal($name,'state','off'));; \
my $cons = ReadingsNum($name,'apower',0);; \
my $total = round(ReadingsNum($name,'aenergy_total',0)/1000,1);; \
my $temp = ReadingsVal($name,'temperature','n.a.');; \
my $ip = ReadingsVal($name,'sta_ip','none');; \
qq(<a href="/fhem?cmd.dummy=set $name toggle&XHR=1">${light}</a><div>Verbrauch: $cons W / Total: $total kwh / Temp: $temp °C</div>)\
}
attr MQTT2_shellypro4pm_34987a690b90_CH2 devicetopic shellypro4pm-34987a690b90
attr MQTT2_shellypro4pm_34987a690b90_CH2 getList in_mode:noArg in_mode $DEVICETOPIC/rpc {"id": 1,"src":"$DEVICETOPIC", "method": "Switch.GetConfig", "params": {"id": 0}}
attr MQTT2_shellypro4pm_34987a690b90_CH2 icon message_socket
attr MQTT2_shellypro4pm_34987a690b90_CH2 jsonMap params_switch_1_state:state params_switch_1_aenergy_total:aenergy_total params_switch_1_apower:apower params_switch_1_temperature_tC:temperature params_switch_1_temperature_tF:0
attr MQTT2_shellypro4pm_34987a690b90_CH2 model shellypro4pm
attr MQTT2_shellypro4pm_34987a690b90_CH2 readingList $DEVICETOPIC/events/rpc:.* { return if $EVENT !~ m{switch:1};; $EVENT =~ s/"output":true/"state":"on"/g;; $EVENT =~ s/"output":false/"state":"off"/g;; json2nameValue($EVENT,'',$JSONMAP) }\
  $DEVICETOPIC/status/switch.1:.* { json2nameValue($EVENT, '', $JSONMAP) }\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/status/ble:.* ble\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/status/cloud:.* { json2nameValue($EVENT) }\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/status/eth:.* { json2nameValue($EVENT) }\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/status/input_0:.* { json2nameValue($EVENT) }\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/status/input_1:.* { json2nameValue($EVENT) }\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/status/input_2:.* { json2nameValue($EVENT) }\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/status/input_3:.* { json2nameValue($EVENT) }\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/status/sys:.* { json2nameValue($EVENT) }\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/status/ui:.* ui\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/status/wifi:.* { json2nameValue($EVENT) }\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/status/ws:.* { json2nameValue($EVENT) }
attr MQTT2_shellypro4pm_34987a690b90_CH2 room Aussen,MQTT,Shelly,Terrasse
attr MQTT2_shellypro4pm_34987a690b90_CH2 setList toggle:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Toggle","params": {"id":1}}\
  off:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Set","params": {"id":1,"on":false}}\
  on:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Set","params": {"id":1,"on":true}}\
  on-for-timer $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Set","params": {"id":1,"on":true,"toggle_after":$EVTPART1}}\
  off-for-timer $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Set","params": {"id":1,"on":false,"toggle_after":$EVTPART1}}
attr MQTT2_shellypro4pm_34987a690b90_CH2 setStateList on off toggle on-for-timer off-for-timer
attr MQTT2_shellypro4pm_34987a690b90_CH2 webCmd :
#attr MQTT2_shellypro4pm_34987a690b90_CH2 disable 1


define MQTT2_shellypro4pm_34987a690b90_CH3 MQTT2_DEVICE
setuuid MQTT2_shellypro4pm_34987a690b90_CH3 65f9b26b-f33f-2cfb-3ef4-f1f6016a733e854f
attr MQTT2_shellypro4pm_34987a690b90_CH3 IODev MQTT2
attr MQTT2_shellypro4pm_34987a690b90_CH3 alias Terrasse_Shelly_CH2
attr MQTT2_shellypro4pm_34987a690b90_CH3 comment Channel 3 for MQTT2_shellypro4pm_34987a690b90, see also MQTT2_shellypro4pm_34987a690b90, MQTT2_shellypro4pm_34987a690b90_CH2 and MQTT2_shellypro4pm_34987a690b90_CH4
attr MQTT2_shellypro4pm_34987a690b90_CH3 devStateIcon {\
my $light = FW_makeImage(ReadingsVal($name,'state','off'));; \
my $cons = ReadingsNum($name,'apower',0);; \
my $total = round(ReadingsNum($name,'aenergy_total',0)/1000,1);; \
my $temp = ReadingsVal($name,'temperature','n.a.');; \
my $ip = ReadingsVal($name,'sta_ip','none');; \
qq(<a href="/fhem?cmd.dummy=set $name toggle&XHR=1">${light}</a><div>Verbrauch: $cons W / Total: $total kwh / Temp: $temp °C</div>)\
}
attr MQTT2_shellypro4pm_34987a690b90_CH3 devicetopic shellypro4pm-34987a690b90
attr MQTT2_shellypro4pm_34987a690b90_CH3 getList in_mode:noArg in_mode $DEVICETOPIC/rpc {"id": 1,"src":"$DEVICETOPIC", "method": "Switch.GetConfig", "params": {"id": 0}}
attr MQTT2_shellypro4pm_34987a690b90_CH3 icon message_socket
attr MQTT2_shellypro4pm_34987a690b90_CH3 jsonMap params_switch_2_state:state params_switch_2_aenergy_total:aenergy_total params_switch_2_apower:apower params_switch_2_temperature_tC:temperature params_switch_2_temperature_tF:0
attr MQTT2_shellypro4pm_34987a690b90_CH3 model shellypro4pm
attr MQTT2_shellypro4pm_34987a690b90_CH3 readingList $DEVICETOPIC/events/rpc:.* { return if $EVENT !~ m{switch:2};; $EVENT =~ s/"output":true/"state":"on"/g;; $EVENT =~ s/"output":false/"state":"off"/g;; json2nameValue($EVENT,'',$JSONMAP) }\
  $DEVICETOPIC/status/switch.2:.* { json2nameValue($EVENT, '', $JSONMAP) }\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/status/ble:.* ble\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/status/cloud:.* { json2nameValue($EVENT) }\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/status/eth:.* { json2nameValue($EVENT) }\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/status/input_0:.* { json2nameValue($EVENT) }\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/status/input_1:.* { json2nameValue($EVENT) }\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/status/input_2:.* { json2nameValue($EVENT) }\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/status/input_3:.* { json2nameValue($EVENT) }\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/status/sys:.* { json2nameValue($EVENT) }\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/status/ui:.* ui\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/status/wifi:.* { json2nameValue($EVENT) }\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/status/ws:.* { json2nameValue($EVENT) }
attr MQTT2_shellypro4pm_34987a690b90_CH3 room Aussen,MQTT,Shelly,Terrasse
attr MQTT2_shellypro4pm_34987a690b90_CH3 setList toggle:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Toggle","params": {"id":2}}\
  off:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Set","params": {"id":2,"on":false}}\
  on:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Set","params": {"id":2,"on":true}}\
  on-for-timer $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Set","params": {"id":2,"on":true,"toggle_after":$EVTPART1}}\
  off-for-timer $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Set","params": {"id":2,"on":false,"toggle_after":$EVTPART1}}
attr MQTT2_shellypro4pm_34987a690b90_CH3 setStateList on off toggle on-for-timer off-for-timer
attr MQTT2_shellypro4pm_34987a690b90_CH3 webCmd :
#attr MQTT2_shellypro4pm_34987a690b90_CH3 disable 1


define MQTT2_shellypro4pm_34987a690b90_CH4 MQTT2_DEVICE
setuuid MQTT2_shellypro4pm_34987a690b90_CH4 65f9b26b-f33f-2cfb-bc19-99bd10ef515f39bb
attr MQTT2_shellypro4pm_34987a690b90_CH4 IODev MQTT2
attr MQTT2_shellypro4pm_34987a690b90_CH4 alias Terrasse_Shelly_CH3
attr MQTT2_shellypro4pm_34987a690b90_CH4 comment Channel 4 for MQTT2_shellypro4pm_34987a690b90, see also MQTT2_shellypro4pm_34987a690b90, MQTT2_shellypro4pm_34987a690b90_CH2 and MQTT2_shellypro4pm_34987a690b90_CH3
attr MQTT2_shellypro4pm_34987a690b90_CH4 devStateIcon {\
my $light = FW_makeImage(ReadingsVal($name,'state','off'));; \
my $cons = ReadingsNum($name,'apower',0);; \
my $total = round(ReadingsNum($name,'aenergy_total',0)/1000,1);; \
my $temp = ReadingsVal($name,'temperature','n.a.');; \
my $ip = ReadingsVal($name,'sta_ip','none');; \
qq(<a href="/fhem?cmd.dummy=set $name toggle&XHR=1">${light}</a><div>Verbrauch: $cons W / Total: $total kwh / Temp: $temp °C</div>)\
}
attr MQTT2_shellypro4pm_34987a690b90_CH4 devicetopic shellypro4pm-34987a690b90
attr MQTT2_shellypro4pm_34987a690b90_CH4 getList in_mode:noArg in_mode $DEVICETOPIC/rpc {"id": 1,"src":"$DEVICETOPIC", "method": "Switch.GetConfig", "params": {"id": 0}}
attr MQTT2_shellypro4pm_34987a690b90_CH4 icon message_socket
attr MQTT2_shellypro4pm_34987a690b90_CH4 jsonMap params_switch_3_state:state params_switch_3_aenergy_total:aenergy_total params_switch_3_apower:apower params_switch_3_temperature_tC:temperature params_switch_3_temperature_tF:0
attr MQTT2_shellypro4pm_34987a690b90_CH4 model shellypro4pm
attr MQTT2_shellypro4pm_34987a690b90_CH4 readingList $DEVICETOPIC/events/rpc:.* { return if $EVENT !~ m{switch:3};; $EVENT =~ s/"output":true/"state":"on"/g;; $EVENT =~ s/"output":false/"state":"off"/g;; json2nameValue($EVENT,'',$JSONMAP) }\
  $DEVICETOPIC/status/switch.3:.* { json2nameValue($EVENT, '', $JSONMAP) }\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/status/ble:.* ble\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/status/cloud:.* { json2nameValue($EVENT) }\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/status/eth:.* { json2nameValue($EVENT) }\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/status/input_0:.* { json2nameValue($EVENT) }\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/status/input_1:.* { json2nameValue($EVENT) }\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/status/input_2:.* { json2nameValue($EVENT) }\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/status/input_3:.* { json2nameValue($EVENT) }\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/status/sys:.* { json2nameValue($EVENT) }\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/status/ui:.* ui\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/status/wifi:.* { json2nameValue($EVENT) }\
shellypro4pm_34987a690b90:shellypro4pm-34987a690b90/status/ws:.* { json2nameValue($EVENT) }
attr MQTT2_shellypro4pm_34987a690b90_CH4 room Aussen,MQTT,Shelly,Terrasse
attr MQTT2_shellypro4pm_34987a690b90_CH4 setList toggle:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Toggle","params": {"id":3}}\
  off:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Set","params": {"id":3,"on":false}}\
  on:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Set","params": {"id":3,"on":true}}\
  on-for-timer $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Set","params": {"id":3,"on":true,"toggle_after":$EVTPART1}}\
  off-for-timer $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Set","params": {"id":3,"on":false,"toggle_after":$EVTPART1}}
attr MQTT2_shellypro4pm_34987a690b90_CH4 setStateList on off toggle on-for-timer off-for-timer
attr MQTT2_shellypro4pm_34987a690b90_CH4 webCmd :
#attr MQTT2_shellypro4pm_34987a690b90_CH4 disable 1

FHEM selbst bietet leider kein Template für den Pro3 an:
Du darfst diesen Dateianhang nicht ansehen.


Wie bekomme ich nur den Pro3 an den Start?
Ich habe schon verschiedenste Optionen aus diversen Forenbeiträgen probiert, doch aus FHEM heraus kann ich die Schalter nicht ansprechen. FHEM selber zeigt aber die Zustandsänderungen zumindest in den Readings an (nicht jedoch visuell über die Icons/Buttons).

Men letzter Versuch ist dieses hier:

define shellypro3_SchuppenWest_fce8c0dbded4 MQTT2_DEVICE shellypro3_SchuppenWest_fce8c0dbded4
setuuid shellypro3_SchuppenWest_fce8c0dbded4 680fdd05-f33f-2cfb-6712-b95791d0592d0c41
attr shellypro3_SchuppenWest_fce8c0dbded4 devicetopic shellypro3_SchuppenWest_fce8c0dbded4
attr shellypro3_SchuppenWest_fce8c0dbded4 readingList shellypro3_SchuppenWest_fce8c0dbded4/events/rpc:.* { return if $EVENT !~ m{switch:0};;;; $EVENT =~ s/"output":true/"state":"on"/g;;;; $EVENT =~ s/"output":false/"state":"off"/g;;;; json2nameValue($EVENT,'switch_',$JSONMAP) }\
shellypro3_SchuppenWest_fce8c0dbded4/status/switch.0:.* { $EVENT =~ s/"output":true/"state":"on"/g;;;; $EVENT =~ s/"output":false/"state":"off"/g;;;; json2nameValue($EVENT, 'switch_', $JSONMAP) }\
shellypro3_SchuppenWest_fce8c0dbded4/rpc:.* { return if $EVENT !~ m{\"result\":\{\"id\":0};;;; $EVENT =~ s/"output":true/"state":"on"/g;;;; $EVENT =~ s/"output":false/"state":"off"/g;;;; json2nameValue($EVENT, 'req_', $JSONMAP)}\
\
shellypro3_SchuppenWest_fce8c0dbded4:shellypro3-SchuppenWest-fce8c0dbded4/events/rpc:.* { json2nameValue($EVENT) }\
shellypro3_SchuppenWest_fce8c0dbded4:shellypro3-SchuppenWest-fce8c0dbded4/status/switch_0:.* { json2nameValue($EVENT) }\
shellypro3_SchuppenWest_fce8c0dbded4:shellypro3-SchuppenWest-fce8c0dbded4/status/switch_2:.* { json2nameValue($EVENT) }\
shellypro3_SchuppenWest_fce8c0dbded4:shellypro3-SchuppenWest-fce8c0dbded4/status/switch_1:.* { json2nameValue($EVENT) }
attr shellypro3_SchuppenWest_fce8c0dbded4 room NEW_Device
attr shellypro3_SchuppenWest_fce8c0dbded4 setList toggle:noArg shellypro3_SchuppenWest_fce8c0dbded4/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Toggle","params": {"id":0}}\
off:noArg shellypro3_SchuppenWest_fce8c0dbded4/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Set","params": {"id":0,"on":false}}\
on:noArg shellypro3_SchuppenWest_fce8c0dbded4/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Set","params": {"id":0,"on":true}}\
on-for-timer shellypro3_SchuppenWest_fce8c0dbded4/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Set","params": {"id":0,"on":true,"toggle_after":$EVTPART1}}\
off-for-timer shellypro3_SchuppenWest_fce8c0dbded4/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Set","params": {"id":0,"on":false,"toggle_after":$EVTPART1}}\
status-request:noArg shellypro3_SchuppenWest_fce8c0dbded4/rpc {"id":1,"src":"$DEVICETOPIC","method":"Switch.GetStatus","params": {"id":0}}
define FileLog_shellypro3_SchuppenWest_fce8c0dbded4 FileLog ./log/shellypro3_SchuppenWest_fce8c0dbded4-%Y-%m.log shellypro3_SchuppenWest_fce8c0dbded4
setuuid FileLog_shellypro3_SchuppenWest_fce8c0dbded4 680fdd05-f33f-2cfb-9ce5-a7b3f961c9d3b74a
attr FileLog_shellypro3_SchuppenWest_fce8c0dbded4 logtype text
attr FileLog_shellypro3_SchuppenWest_fce8c0dbded4 room NEW_Device

Drücke ich in FHEM on oder off, ändert sich zwar das Lampensymbol in FHEM, aber der Shelly rührt sich nicht. Führe ich Befehle auf der WebGUI des shelly aus, zeigt FHEM Aktualisierungen an:
Du darfst diesen Dateianhang nicht ansehen.

In der Log-Datei steht dies:
[code]2025-04-28_22:42:06 shellypro3_SchuppenWest_fce8c0dbded4 method: NotifyStatus
2025-04-28_22:42:06 shellypro3_SchuppenWest_fce8c0dbded4 src: shellypro3-fce8c0dbded4
2025-04-28_22:42:06 shellypro3_SchuppenWest_fce8c0dbded4 params_switch_0_output: false
2025-04-28_22:42:06 shellypro3_SchuppenWest_fce8c0dbded4 dst: shellypro3-SchuppenWest-fce8c0dbded4/events
2025-04-28_22:42:06 shellypro3_SchuppenWest_fce8c0dbded4 params_switch_0_source: WS_in
2025-04-28_22:42:06 shellypro3_SchuppenWest_fce8c0dbded4 id: 0
2025-04-28_22:42:06 shellypro3_SchuppenWest_fce8c0dbded4 temperature_tC: 38.8
2025-04-28_22:42:06 shellypro3_SchuppenWest_fce8c0dbded4 temperature_tF: 101.8
2025-04-28_22:42:06 shellypro3_SchuppenWest_fce8c0dbded4 output: false
2025-04-28_22:42:06 shellypro3_SchuppenWest_fce8c0dbded4 source: WS_in
2025-04-28_22:47:34 shellypro3_SchuppenWest_fce8c0dbded4 on
2025-04-28_22:47:36 shellypro3_SchuppenWest_fce8c0dbded4 off
2025-04-28_22:49:29 shellypro3_SchuppenWest_fce8c0dbded4 params_switch_0_source: WS_in
2025-04-28_22:49:29 shellypro3_SchuppenWest_fce8c0dbded4 params_switch_0_id: 0
2025-04-28_22:49:29 shellypro3_SchuppenWest_fce8c0dbded4 params_switch_0_output: true
2025-04-28_22:49:29 shellypro3_SchuppenWest_fce8c0dbded4 dst: shellypro3-SchuppenWest-fce8c0dbded4/events
2025-04-28_22:49:29 shellypro3_SchuppenWest_fce8c0dbded4 method: NotifyStatus
2025-04-28_22:49:29 shellypro3_SchuppenWest_fce8c0dbded4 params_ts: 1745873369.80
2025-04-28_22:49:29 shellypro3_SchuppenWest_fce8c0dbded4 src: shellypro3-fce8c0dbded4
2025-04-28_22:49:29 shellypro3_SchuppenWest_fce8c0dbded4 id: 0
2025-04-28_22:49:29 shellypro3_SchuppenWest_fce8c0dbded4 temperature_tF: 104.3
2025-04-28_22:49:29 shellypro3_SchuppenWest_fce8c0dbded4 temperature_tC: 40.1
2025-04-28_22:49:29 shellypro3_SchuppenWest_fce8c0dbded4 output: true
2025-04-28_22:49:29 shellypro3_SchuppenWest_fce8c0dbded4 source: WS_in
2025-04-28_22:50:05 shellypro3_SchuppenWest_fce8c0dbded4 params_switch_0_id: 0
2025-04-28_22:50:05 shellypro3_SchuppenWest_fce8c0dbded4 params_switch_0_temperature_tC: 41.12
2025-04-28_22:50:05 shellypro3_SchuppenWest_fce8c0dbded4 dst: shellypro3-SchuppenWest-fce8c0dbded4/events
2025-04-28_22:50:05 shellypro3_SchuppenWest_fce8c0dbded4 params_ts: 1745873405.77
2025-04-28_22:50:05 shellypro3_SchuppenWest_fce8c0dbded4 method: NotifyStatus
2025-04-28_22:50:05 shellypro3_SchuppenWest_fce8c0dbded4 src: shellypro3-fce8c0dbded4
2025-04-28_22:50:05 shellypro3_SchuppenWest_fce8c0dbded4 params_switch_0_temperature_tF: 106.02
2025-04-28_22:50:05 shellypro3_SchuppenWest_fce8c0dbded4 id: 0
2025-04-28_22:50:05 shellypro3_SchuppenWest_fce8c0dbded4 temperature_tF: 106.0
2025-04-28_22:50:05 shellypro3_SchuppenWest_fce8c0dbded4 temperature_tC: 41.1
2025-04-28_22:50:05 shellypro3_SchuppenWest_fce8c0dbded4 output: true
2025-04-28_22:50:05 shellypro3_SchuppenWest_fce8c0dbded4 source: WS_in
2025-04-28_22:50:05 shellypro3_SchuppenWest_fce8c0dbded4 id: 1
2025-04-28_22:50:05 shellypro3_SchuppenWest_fce8c0dbded4 temperature_tC: 41.1
2025-04-28_22:50:05 shellypro3_SchuppenWest_fce8c0dbded4 temperature_tF: 106.0
2025-04-28_22:50:05 shellypro3_SchuppenWest_fce8c0dbded4 output: false
2025-04-28_22:50:05 shellypro3_SchuppenWest_fce8c0dbded4 source: WS_in
2025-04-28_22:50:05 shellypro3_SchuppenWest_fce8c0dbded4 temperature_tC: 41.1
2025-04-28_22:50:05 shellypro3_SchuppenWest_fce8c0dbded4 temperature_tF: 106.0
2025-04-28_22:50:05 shellypro3_SchuppenWest_fce8c0dbded4 id: 2
2025-04-28_22:50:05 shellypro3_SchuppenWest_fce8c0dbded4 source: WS_in
2025-04-28_22:50:05 shellypro3_SchuppenWest_fce8c0dbded4 output: true
2025-04-28_22:50:05 shellypro3_SchuppenWest_fce8c0dbded4 params_switch_1_id: 1
2025-04-28_22:50:05 shellypro3_SchuppenWest_fce8c0dbded4 dst: shellypro3-SchuppenWest-fce8c0dbded4/events
2025-04-28_22:50:05 shellypro3_SchuppenWest_fce8c0dbded4 params_switch_1_temperature_tC: 41.12
2025-04-28_22:50:05 shellypro3_SchuppenWest_fce8c0dbded4 src: shellypro3-fce8c0dbded4
2025-04-28_22:50:05 shellypro3_SchuppenWest_fce8c0dbded4 params_switch_1_temperature_tF: 106.02
2025-04-28_22:50:05 shellypro3_SchuppenWest_fce8c0dbded4 method: NotifyStatus
2025-04-28_22:50:05 shellypro3_SchuppenWest_fce8c0dbded4 params_ts: 1745873405.77
2025-04-28_22:50:05 shellypro3_SchuppenWest_fce8c0dbded4 src: shellypro3-fce8c0dbded4
2025-04-28_22:50:05 shellypro3_SchuppenWest_fce8c0dbded4 dst: shellypro3-SchuppenWest-fce8c0dbded4/events
2025-04-28_22:50:05 shellypro3_SchuppenWest_fce8c0dbded4 params_switch_2_id: 2
2025-04-28_22:50:05 shellypro3_SchuppenWest_fce8c0dbded4 method: NotifyStatus
2025-04-28_22:50:05 shellypro3_SchuppenWest_fce8c0dbded4 params_ts: 1745873405.77
2025-04-28_22:50:05 shellypro3_SchuppenWest_fce8c0dbded4 params_switch_2_temperature_tF: 106.02
2025-04-28_22:50:05 shellypro3_SchuppenWest_fce8c0dbded4 params_switch_2_temperature_tC: 41.12
[/code]



Ich würde mich freuen, weiterführende Hilfe zu bekommen.
Intel NUC (Ubuntu 22.04.2 LTS (GNU/Linux 5.15.0-113-generic x86_64))  mit CUL V3.2 (FW 1.57 CUL868) für FS20 und CCU3 für HM(IP) + Arduino Mega (Firmata) - FHEM Revision: 29534 - FS20, HM(IP), MQTT, Philips HUE, ModBus

Beta-User

Zitat von: stobor am 28 April 2025, 22:24:13Ich würde mich freuen, weiterführende Hilfe zu bekommen.
Hmmm, es ist halt nicht so einfach, für jedes neue Modell, das auf den Markt kommt ein 100% passendes attrTemplate bereitzustellen...

Vorab wäre meine grundsätzliche Empfehlung, mit "devicetopic" zu arbeiten - dann wäre readingList und setList (indirekt) einheitlich mit Bindestrichen ausgestattet ;) .

Ansonsten sollte es gehen, einfach das 4ch-attrTemplate zu nehmen und dann den 4. Channel zu löschen.

(Habe wenig Neigung, ein generalisiertes attrTemplate zu generieren, das eine beliebige Anzahl Channels "könnte".)
Server: HP-elitedesk@Debian 12, aktuelles FHEM@ConfigDB | CUL_HM (VCCU) | MQTT2: ZigBee2mqtt, MiLight@ESP-GW, BT@OpenMQTTGw | ZWave | SIGNALduino | MapleCUN | RHASSPY
svn: u.a Weekday-&RandomTimer, Twilight,  div. attrTemplate-files, MySensors

stobor

Meinst Du, das shellypro4pm Template als Basis? Das hatte ich auch schon probiert, das läuft aber auch nicht.

Ich versuche gerade, die Handhabung etwas zu verstehen, und taste mich langsam an die Konfiguration heran. Ich probiere zunächst einmal einen Kanal anzusteuern:

Immerhin gibt es jetzt schon ein Reading (state), welches den Zustand von Kanal 0 anzeigt und anstatt true/false on/off verwendet. Der Zustand wird mir dann auch gleich in FHEM über das Lampensymbol angezeigt. Ich habe dafür jsonMap params_switch_0_state:state gesetzt:

define shellypro3_SchuppenWest_fce8c0dbded4 MQTT2_DEVICE shellypro3_SchuppenWest_fce8c0dbded4
setuuid shellypro3_SchuppenWest_fce8c0dbded4 681069e5-f33f-2cfb-ac82-8af1ad6d620e918c
attr shellypro3_SchuppenWest_fce8c0dbded4 alias shellypro3_SchuppenWest_CH0
attr shellypro3_SchuppenWest_fce8c0dbded4 jsonMap params_switch_0_state:state
attr shellypro3_SchuppenWest_fce8c0dbded4 readingList shellypro3_SchuppenWest_fce8c0dbded4:shellypro3-SchuppenWest-fce8c0dbded4/status/switch_0:.* { json2nameValue($EVENT, 'switch_0_', $JSONMAP) }\
shellypro3_SchuppenWest_fce8c0dbded4:shellypro3-SchuppenWest-fce8c0dbded4/status/switch_1:.* { json2nameValue($EVENT, 'switch_1_', $JSONMAP) }\
shellypro3_SchuppenWest_fce8c0dbded4:shellypro3-SchuppenWest-fce8c0dbded4/status/switch_2:.* { json2nameValue($EVENT, 'switch_2_', $JSONMAP) }\
shellypro3_SchuppenWest_fce8c0dbded4:shellypro3-SchuppenWest-fce8c0dbded4/status/sys:.* { json2nameValue($EVENT, 'sys_', $JSONMAP) }\
shellypro3_SchuppenWest_fce8c0dbded4:shellypro3-SchuppenWest-fce8c0dbded4/online:.* online\
shellypro3_SchuppenWest_fce8c0dbded4:shellypro3-SchuppenWest-fce8c0dbded4/status/mqtt:.* { json2nameValue($EVENT, 'mqtt_', $JSONMAP) }\
shellypro3_SchuppenWest_fce8c0dbded4:shellypro3-SchuppenWest-fce8c0dbded4/events/rpc:.* {  return if $EVENT !~ m{switch:0};;;; $EVENT =~ s/"output":true/"state":"on"/g;;;; $EVENT =~ s/"output":false/"state":"off"/g;;;; json2nameValue($EVENT,'',$JSONMAP) }\
shellypro3_SchuppenWest_fce8c0dbded4:shellypro3-SchuppenWest-fce8c0dbded4/status/cloud:.* { json2nameValue($EVENT, 'cloud_', $JSONMAP) }
attr shellypro3_SchuppenWest_fce8c0dbded4 room NEW_Device
attr shellypro3_SchuppenWest_fce8c0dbded4 setList off:noArg $DEVICETOPIC/rpc    {"id":0,"src":"fhem2shelly","method":"Switch.Set","params":    {"id":0,"on":false}}\
on:noArg $DEVICETOPIC/rpc      {"id":0,"src":"fhem2shelly","method":"Switch.Set","params":    {"id":0,"on":true}}
define FileLog_shellypro3_SchuppenWest_fce8c0dbded4 FileLog ./log/shellypro3_SchuppenWest_fce8c0dbded4-%Y-%m.log shellypro3_SchuppenWest_fce8c0dbded4
setuuid FileLog_shellypro3_SchuppenWest_fce8c0dbded4 681069e5-f33f-2cfb-98be-1004cc49e07affab
attr FileLog_shellypro3_SchuppenWest_fce8c0dbded4 logtype text
attr FileLog_shellypro3_SchuppenWest_fce8c0dbded4 room NEW_Device

Ich kann allerdings den Anschluss nicht über FHEM schalten. Tippe ich auf on/off in FHEM, wird in FHEM zwar das Lampensymbol geändert, aber der Shelly schaltet nicht.

Ein-/Ausschalten über den Shelly direkt, sieht im FHEM Event-Log so aus:
2025-04-29 12:26:55 MQTT2_DEVICE shellypro3_SchuppenWest_fce8c0dbded4 params_ts: 1745922415.78
2025-04-29 12:26:55 MQTT2_DEVICE shellypro3_SchuppenWest_fce8c0dbded4 params_switch_0_id: 0
2025-04-29 12:26:55 MQTT2_DEVICE shellypro3_SchuppenWest_fce8c0dbded4 on
2025-04-29 12:26:55 MQTT2_DEVICE shellypro3_SchuppenWest_fce8c0dbded4 method: NotifyStatus
2025-04-29 12:26:55 MQTT2_DEVICE shellypro3_SchuppenWest_fce8c0dbded4 src: shellypro3-fce8c0dbded4
2025-04-29 12:26:55 MQTT2_DEVICE shellypro3_SchuppenWest_fce8c0dbded4 params_switch_0_source: HTTP_in
2025-04-29 12:26:55 MQTT2_DEVICE shellypro3_SchuppenWest_fce8c0dbded4 dst: shellypro3-SchuppenWest-fce8c0dbded4/events
2025-04-29 12:26:55 MQTT2_DEVICE shellypro3_SchuppenWest_fce8c0dbded4 switch_0_temperature_tC: 40.3
2025-04-29 12:26:55 MQTT2_DEVICE shellypro3_SchuppenWest_fce8c0dbded4 switch_0_output: true
2025-04-29 12:26:55 MQTT2_DEVICE shellypro3_SchuppenWest_fce8c0dbded4 switch_0_id: 0
2025-04-29 12:26:55 MQTT2_DEVICE shellypro3_SchuppenWest_fce8c0dbded4 switch_0_source: HTTP_in
2025-04-29 12:26:55 MQTT2_DEVICE shellypro3_SchuppenWest_fce8c0dbded4 switch_0_temperature_tF: 104.6
2025-04-29 12:26:58 MQTT2_DEVICE shellypro3_SchuppenWest_fce8c0dbded4 params_switch_0_source: HTTP_in
2025-04-29 12:26:58 MQTT2_DEVICE shellypro3_SchuppenWest_fce8c0dbded4 dst: shellypro3-SchuppenWest-fce8c0dbded4/events
2025-04-29 12:26:58 MQTT2_DEVICE shellypro3_SchuppenWest_fce8c0dbded4 src: shellypro3-fce8c0dbded4
2025-04-29 12:26:58 MQTT2_DEVICE shellypro3_SchuppenWest_fce8c0dbded4 params_switch_0_id: 0
2025-04-29 12:26:58 MQTT2_DEVICE shellypro3_SchuppenWest_fce8c0dbded4 params_ts: 1745922418.67
2025-04-29 12:26:58 MQTT2_DEVICE shellypro3_SchuppenWest_fce8c0dbded4 off
2025-04-29 12:26:58 MQTT2_DEVICE shellypro3_SchuppenWest_fce8c0dbded4 method: NotifyStatus
2025-04-29 12:26:58 MQTT2_DEVICE shellypro3_SchuppenWest_fce8c0dbded4 switch_0_temperature_tF: 104.6
2025-04-29 12:26:58 MQTT2_DEVICE shellypro3_SchuppenWest_fce8c0dbded4 switch_0_id: 0
2025-04-29 12:26:58 MQTT2_DEVICE shellypro3_SchuppenWest_fce8c0dbded4 switch_0_source: HTTP_in
2025-04-29 12:26:58 MQTT2_DEVICE shellypro3_SchuppenWest_fce8c0dbded4 switch_0_temperature_tC: 40.3
2025-04-29 12:26:58 MQTT2_DEVICE shellypro3_SchuppenWest_fce8c0dbded4 switch_0_output: false

Über on/off in FHEM:
2025-04-29 12:27:52 MQTT2_DEVICE shellypro3_SchuppenWest_fce8c0dbded4 on
2025-04-29 12:27:55 MQTT2_DEVICE shellypro3_SchuppenWest_fce8c0dbded4 off

Leider funktioniert das Anzeigen des MQTT Traffics am MQTT2 Server in FHEM eher unzuverlässig (mal kommt gar nichts, mal bricht die Liste ab). Schalte ich über Shelly direkt ein und aus:
12:30:28.884
shellypro3_SchuppenWest_fce8c0dbded4
shellypro3-SchuppenWest-fce8c0dbded4/events/rpc
{"src":"shellypro3-fce8c0dbded4","dst":"shellypro3-SchuppenWest-fce8c0dbded4/events","method":"NotifyStatus","params":{"ts":1745922628.88,"switch:0":{"id":0,"output":true,"source":"HTTP_in"}}}
12:30:28.947
shellypro3_SchuppenWest_fce8c0dbded4
shellypro3-SchuppenWest-fce8c0dbded4/status/switch_0
{"id":0, "source":"HTTP_in", "output":true,"temperature":{"tC":39.9, "tF":103.8}}
12:30:32.773
shellypro3_SchuppenWest_fce8c0dbded4
shellypro3-SchuppenWest-fce8c0dbded4/events/rpc
{"src":"shellypro3-fce8c0dbded4","dst":"shellypro3-SchuppenWest-fce8c0dbded4/events","method":"NotifyStatus","params":{"ts":1745922632.76,"switch:0":{"id":0,"output":false,"source":"HTTP_in"}}}
12:30:32.789
shellypro3_SchuppenWest_fce8c0dbded4
shellypro3-SchuppenWest-fce8c0dbded4/status/switch_0
{"id":0, "source":"HTTP_in", "output":false,"temperature":{"tC":40.0, "tF":104.0}}

Drücke ich on/off in FHEM:
12:31:38.709
SENT
shellypro3_SchuppenWest_fce8c0dbded4/rpc
{"id":0,"src":"fhem2shelly","method":"Switch.Set","params": {"id":0,"on":true}}
12:31:40.722
SENT
shellypro3_SchuppenWest_fce8c0dbded4/rpc
{"id":0,"src":"fhem2shelly","method":"Switch.Set","params": {"id":0,"on":false}}

Hat Dazu jemand eine Hilfe?
Intel NUC (Ubuntu 22.04.2 LTS (GNU/Linux 5.15.0-113-generic x86_64))  mit CUL V3.2 (FW 1.57 CUL868) für FS20 und CCU3 für HM(IP) + Arduino Mega (Firmata) - FHEM Revision: 29534 - FS20, HM(IP), MQTT, Philips HUE, ModBus

stobor

Oh, ich habe gerade gesehen, dass DEVICETOPIC fehlte. Jetzt kann ich zumindest Ch0 mit FHEM schalten und auch den Shelly-Zustand sehen. Ich arbeite mich einmal weiter voran und berichte.
Intel NUC (Ubuntu 22.04.2 LTS (GNU/Linux 5.15.0-113-generic x86_64))  mit CUL V3.2 (FW 1.57 CUL868) für FS20 und CCU3 für HM(IP) + Arduino Mega (Firmata) - FHEM Revision: 29534 - FS20, HM(IP), MQTT, Philips HUE, ModBus

Beta-User

Zitat von: stobor am 29 April 2025, 12:33:17Meinst Du, das shellypro4pm Template als Basis? Das hatte ich auch schon probiert, das läuft aber auch nicht.
https://svn.fhem.de/trac/browser/trunk/fhem/FHEM/lib/AttrTemplate/mqtt2.template#L3945

Da muss statt "shellyp(lus|ro4pm)" "shellyp(lus|ro.pm)" stehen, dann sollte der Parameter entsprechend aufgelöst werden können.
Server: HP-elitedesk@Debian 12, aktuelles FHEM@ConfigDB | CUL_HM (VCCU) | MQTT2: ZigBee2mqtt, MiLight@ESP-GW, BT@OpenMQTTGw | ZWave | SIGNALduino | MapleCUN | RHASSPY
svn: u.a Weekday-&RandomTimer, Twilight,  div. attrTemplate-files, MySensors

stobor

Wo muss ich das genau ändern?
Intel NUC (Ubuntu 22.04.2 LTS (GNU/Linux 5.15.0-113-generic x86_64))  mit CUL V3.2 (FW 1.57 CUL868) für FS20 und CCU3 für HM(IP) + Arduino Mega (Firmata) - FHEM Revision: 29534 - FS20, HM(IP), MQTT, Philips HUE, ModBus

Beta-User

In der Kopie der Datei auf deiner FHEM-Server-Festplatte?

Dabei darauf achten, dass du die Rechte nicht verbiegst, danach AttrTemplate neu einlesen läßt (siehe https://wiki.fhem.de/wiki/AttrTemplate#Eigene_Templates_entwickeln).
Server: HP-elitedesk@Debian 12, aktuelles FHEM@ConfigDB | CUL_HM (VCCU) | MQTT2: ZigBee2mqtt, MiLight@ESP-GW, BT@OpenMQTTGw | ZWave | SIGNALduino | MapleCUN | RHASSPY
svn: u.a Weekday-&RandomTimer, Twilight,  div. attrTemplate-files, MySensors