Liebe Gemeinde
Es ist nun einige Monate her, dass ich mit den Versuchen Shellies in FHEM mittels mqtt einzubinden begonnen hatte.
Sämtliche Einträge im Forum, welche ich gefunden habe, haben leider nicht gefruchtet.
Unterdessen bin ich absolut frustriert.
Aus diesem Grund eröffne ich dieses Thema mit der bitte nur Shelly Pro (siehe Anhang) Beiträge einzustellen.
Ich möchte gerne die folgende Modelle in Betrieb nehmen:
- Shelly Pro 1
- Shelly Pro 2
- Shelly Pro 3
- Shelly Pro 4 (scheint soweit zu funktionieren)
Ich bin bereit für die Person die mir helfen möchte und kann die Anschaffung der Komponenten finanziell zu übernehmen.
Vielen Dank
Sind das nicht "einfach" Geräte mit 2nd Gen.-Kommunikation? Dann müßten eigentlich die entsprechenden aktuellen "plus"-templates passen...
Ich frage mal ganz dumm... DIe Pro Serie kann doch - genauso wie die nicht-Pros - MQTT. Wo konkret sind also die Schwierigkeiten die Geräte in FHEM einzubinden?
Zitat von: KernSani am 25 Januar 2023, 17:34:07
Ich frage mal ganz dumm... DIe Pro Serie kann doch - genauso wie die nicht-Pros - MQTT. Wo konkret sind also die Schwierigkeiten die Geräte in FHEM einzubinden?
Du hast vermutlich noch nie gesehen, wie speziell das ist, was da via MQTT bei den 2nd Gen.-Geräten kommt...
Beschreibung siehe https://shelly-api-docs.shelly.cloud/gen2/ComponentsAndServices/Mqtt/
(https://shelly-api-docs.shelly.cloud/gen2/ComponentsAndServices/Mqtt/)Wie man damit umgehen kann (als Vorschlag) ist in der mqtt2.template-File zu finden ;) .
Du kannst und solltest dich anhand der Templates durchwurschteln, um die grundsätzliche Struktur etc. zu verstehen - habe ich auch gemacht.
Es gibt auch mehrere Wege, insbesondere Mehrkanal-Geräte einzubinden. Letztendlich scheint Best-Practice zu sein, auch weitere Kanäle eines Geräte als eigenes MQTT2-Device zu definieren. Insbesondere ist wichtig, welches Topic du in den Shellys definierst; ich habe hier als Präfix nicht "shellies" sonder "Shelly" und dann den Shelly-Namen, den ich selbst vergeben habe.
Als Beispiel hänge ich dir von einem Pro 3 den Kanal 0 an:
defmod GAR_Deckenlicht MQTT2_DEVICE GAR_Shelly
attr GAR_Deckenlicht IODev MQTT2_Client_energy_fhem
attr GAR_Deckenlicht alias Deckenlicht Garage
attr GAR_Deckenlicht comment http://192.168.7.41/#/switch/0/overview
attr GAR_Deckenlicht devicetopic Shelly/GAR_Shelly
attr GAR_Deckenlicht event-on-change-reading .*
attr GAR_Deckenlicht genericDeviceType light
attr GAR_Deckenlicht group Licht
attr GAR_Deckenlicht homebridgeMapping On=state
attr GAR_Deckenlicht icon light_wall_2
attr GAR_Deckenlicht jsonMap switch_state:state\
switch_voltage:voltage\
switch_current:current\
switch_apower:power\
switch_temperature_tC:temperature\
switch_temperature_tF:0\
switch_source:source\
switch_id:0\
switch_dst:0\
switch_method:0\
switch_params_switch_0_id:0\
switch_params_switch_0_source:source\
switch_params_switch_0_state:state\
switch_params_switch_0_temperature_tC:temperature\
switch_params_switch_0_temperature_tFreq_dst:0\
req_dst:0\
req_id:0\
req_method:0\
req_params_id:0\
req_result_aenergy_by_minute_1:switch_aenergy_by_minute_1\
req_result_aenergy_by_minute_2:switch_aenergy_by_minute_2\
req_result_aenergy_by_minute_3:switch_aenergy_by_minute_3\
req_result_aenergy_minute_ts:switch_aenergy_minute_ts\
req_result_aenergy_total:switch_aenergy_total\
req_result_apower:power\
req_result_current:current\
req_result_id:0\
req_result_state:state\
req_result_pf:0\
req_result_source:source\
req_result_temperature_tC:temperature\
req_result_temperature_tF:0\
req_result_voltage:voltage\
req_src:0
attr GAR_Deckenlicht readingList $DEVICETOPIC/online:.* online\
$DEVICETOPIC/status/sys:.* { json2nameValue($EVENT) }\
$DEVICETOPIC/status/cloud:.* { json2nameValue($EVENT) }\
$DEVICETOPIC/status/mqtt:.* { json2nameValue($EVENT) }\
$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)}\
attr GAR_Deckenlicht room Garage
attr GAR_Deckenlicht 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}}
attr GAR_Deckenlicht siriName Deckenleuchte
attr GAR_Deckenlicht webCmd state
attr GAR_Deckenlicht widgetOverride state:uzsuToggle,on,off
Das ist jetzt nicht alles genau wie im Template und kann auch sicherlich noch vereinfacht werden, ist aber für meine Integration genau passend.
Hier der dazu passende Kanal 1:
defmod GAR_Aussenlicht MQTT2_DEVICE
attr GAR_Aussenlicht IODev MQTT2_Client_energy_fhem
attr GAR_Aussenlicht alexaName Wandlicht Garage
attr GAR_Aussenlicht alias Wandlicht Garage
attr GAR_Aussenlicht comment http://192.168.7.41/#/switch/1/overview
attr GAR_Aussenlicht devicetopic Shelly/GAR_Shelly
attr GAR_Aussenlicht event-on-change-reading .*
attr GAR_Aussenlicht event-on-update-reading switch_apower,switch_current,switch_energy,switch_voltage,temperature
attr GAR_Aussenlicht genericDeviceType light
attr GAR_Aussenlicht group Licht
attr GAR_Aussenlicht homebridgeMapping On=state
attr GAR_Aussenlicht icon building_carport_light
attr GAR_Aussenlicht jsonMap switch_state:state\
switch_voltage:voltage\
switch_current:current\
switch_apower:power\
switch_temperature_tC:temperature\
switch_temperature_tF:0\
switch_source:source\
switch_dst:0\
switch_method:0\
switch_id:0\
switch_params_switch_1_id:0\
switch_params_switch_1_source:source\
switch_params_switch_1_state:state\
switch_params_switch_1_temperature_tC:temperature\
switch_params_switch_1_temperature_tFreq_dst:0\
req_dst:0\
req_id:0\
req_method:0\
req_params_id:0\
req_result_aenergy_by_minute_1:switch_aenergy_by_minute_1\
req_result_aenergy_by_minute_2:switch_aenergy_by_minute_2\
req_result_aenergy_by_minute_3:switch_aenergy_by_minute_3\
req_result_aenergy_minute_ts:switch_aenergy_minute_ts\
req_result_aenergy_total:switch_aenergy_total\
req_result_apower:power\
req_result_current:current\
req_result_id:0\
req_result_state:state\
req_result_pf:0\
req_result_source:source\
req_result_temperature_tC:temperature\
req_result_temperature_tF:0\
req_result_voltage:voltage\
req_src:0
attr GAR_Aussenlicht readingList $DEVICETOPIC/online:.* online\
$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,'switch_',$JSONMAP) }\
$DEVICETOPIC/status/switch.1:.* { $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\":1};; $EVENT =~ s/"output":true/"state":"on"/g;; $EVENT =~ s/"output":false/"state":"off"/g;; json2nameValue($EVENT, 'req_', $JSONMAP)}
attr GAR_Aussenlicht room Garage,Homekit
attr GAR_Aussenlicht 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}}\
status-request:noArg $DEVICETOPIC/rpc {"id":1,"src":"$DEVICETOPIC","method":"Switch.GetStatus","params": {"id":1}}
attr GAR_Aussenlicht siriName Wandleuchte
attr GAR_Aussenlicht webCmd state
attr GAR_Aussenlicht widgetOverride state:uzsuToggle,on,off
Und hier der dazu passende Kanal 2:
defmod GAR_Aussensteckdose MQTT2_DEVICE
attr GAR_Aussensteckdose IODev MQTT2_Client_energy_fhem
attr GAR_Aussensteckdose alexaName Außensteckdosen Garage
attr GAR_Aussensteckdose alias Außensteckdosen Garage
attr GAR_Aussensteckdose comment http://192.168.7.41/#/switch/2/overview
attr GAR_Aussensteckdose devicetopic Shelly/GAR_Shelly
attr GAR_Aussensteckdose event-on-change-reading .*
attr GAR_Aussensteckdose event-on-update-reading switch_apower,switch_current,switch_energy,switch_voltage,temperature
attr GAR_Aussensteckdose genericDeviceType outlet
attr GAR_Aussensteckdose group Steckdosen
attr GAR_Aussensteckdose homebridgeMapping On=state
attr GAR_Aussensteckdose icon building_carport_light
attr GAR_Aussensteckdose jsonMap switch_state:state\
switch_voltage:voltage\
switch_current:current\
switch_apower:power\
switch_temperature_tC:temperature\
switch_temperature_tF:0\
switch_source:source\
switch_dst:0\
switch_method:0\
switch_params_switch_2_id:0\
switch_params_switch_2_source:source\
switch_params_switch_2_state:state\
switch_params_switch_2_temperature_tC:temperature\
switch_params_switch_2_temperature_tFreq_dst:0\
switch_id:0\
req_id:0\
req_method:0\
req_params_id:0\
req_result_aenergy_by_minute_1:switch_aenergy_by_minute_1\
req_result_aenergy_by_minute_2:switch_aenergy_by_minute_2\
req_result_aenergy_by_minute_3:switch_aenergy_by_minute_3\
req_result_aenergy_minute_ts:switch_aenergy_minute_ts\
req_result_aenergy_total:switch_aenergy_total\
req_result_apower:power\
req_result_current:current\
req_result_id:0\
req_result_state:state\
req_result_pf:0\
req_result_source:source\
req_result_temperature_tC:temperature\
req_result_temperature_tF:0\
req_result_voltage:voltage\
req_src:0
attr GAR_Aussensteckdose readingList $DEVICETOPIC/online:.* online\
$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,'switch_',$JSONMAP) }\
$DEVICETOPIC/status/switch.2:.* { $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\":2};; $EVENT =~ s/"output":true/"state":"on"/g;; $EVENT =~ s/"output":false/"state":"off"/g;; json2nameValue($EVENT, 'req_', $JSONMAP)}
attr GAR_Aussensteckdose room Garage,Homekit
attr GAR_Aussensteckdose 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}}\
status-request:noArg $DEVICETOPIC/rpc {"id":1,"src":"$DEVICETOPIC","method":"Switch.GetStatus","params": {"id":2}}
attr GAR_Aussensteckdose siriName Außensteckdosen vorne
attr GAR_Aussensteckdose webCmd state
attr GAR_Aussensteckdose widgetOverride state:uzsuToggle,on,off
Hallo,
mal ne ganz blöde Frage. Warum benutzt Du nicht das Shelly Modul? https://forum.fhem.de/index.php?topic=110714.0
Grüße Jörg
... damit funktioniert bspw. der Pro 3 nicht. Und ich persönlich habe mich daher für den Weg, alles über MQTT2 anzubinden, entschieden; dies hat auch den Vorteil, dass ich noch andere Systeme, die MQTT verstehen, ebenfalls anbinden konnte.
Vielen Dank für eure Hilfe und vor allem auch für das Listing @Ralli.
Entschuldigt wenn ich so spät antworte. Wir hatten Semesterabschluss und ich war mit Prüfungskorrekturen eingedeckt.
Unterdessen habe ich auch rausgefunden, dass der ShellyPro3 gar nicht funktioniert. Der wird retourniert.
Mit dem ShellyPro1 konnte ich unterdessen die gewünschten Parameter einstellen und er funktioniert einwandfrei. Wow.. bin echt erleichtert.
Beim ShellyPro2 habe ich ein Problem mit dem ersten Kanal. Er shaltet zwar jedoch bekomme ich nicht die korrekte Rückmeldung. Wenn ich das Listing anschaue meldet er mir STATE set_off (oder set_on) und nicht off oder on.
Vermutlich ist es etwas kleines aber ich stehe schon wieder an.
Anbei die Informationen:
Internals:
CID shellypro2_30c6f78120fc
DEF shellypro2_30c6f78120fc
FUUID 63f3963e-f33f-0f0b-7a51-6f48862df72b0045
IODev MQTT2
LASTInputDev MQTT2
MQTT2_CONN MQTT2_192.168.11.157_54818
MQTT2_MSGCNT 30
MQTT2_TIME 2023-02-20 16:55:44
MSGCNT 30
NAME MQTT2_shellypro2_30c6f78120fc
NR 3194
STATE set_off
TYPE MQTT2_DEVICE
eventCount 28
JSONMAP:
params_switch_0_temperature_tC temperature
params_switch_0_temperature_tF 0
params_wifi_sta_ip ip
req_result_in_mode in_mode
switch_state state
switch_temperature_tC temperature
switch_temperature_tF 0
READINGS:
2023-02-20 16:48:15 IODev MQTT2
2023-02-20 16:45:47 associatedWith MQTT2_shellypro2_30c6f78120fc_CH2,MQTT2_shellypro2_30c6f78120fc_CH3,MQTT2_shellypro2_30c6f78120fc_CH4
2023-02-20 16:45:56 attrTemplateVersion 20220304
2023-02-20 16:55:44 dst shellypro2-30c6f78120fc/events
2023-02-20 16:55:44 method NotifyStatus
2023-02-20 16:48:31 online true
2023-02-20 16:45:57 params_events_1_component sys
2023-02-20 16:45:57 params_events_1_event scheduled_restart
2023-02-20 16:45:57 params_events_1_time_ms 997
2023-02-20 16:45:57 params_events_1_ts 1676907957.39
2023-02-20 16:48:31 params_mqtt_connected true
2023-02-20 16:55:44 params_switch_0_id 0
2023-02-20 16:55:44 params_switch_0_output false
2023-02-20 16:55:44 params_switch_0_source MQTT
2023-02-20 16:48:35 params_switch_1_id 1
2023-02-20 16:48:35 params_switch_1_output false
2023-02-20 16:48:35 params_switch_1_source MQTT
2023-02-20 16:46:12 params_sys_available_updates_stable_version 0.13.0
2023-02-20 16:55:44 params_ts 1676908544.39
2023-02-20 16:55:44 src shellypro2-30c6f78120fc
2023-02-20 16:55:43 state set_off
2023-02-20 16:45:56 x_reboot set
Attributes:
comment Channel 1 for MQTT2_shellypro2_30c6f78120fc, see also MQTT2_shellypro2_30c6f78120fc_CH2, MQTT2_shellypro2_30c6f78120fc_CH3 and MQTT2_shellypro2_30c6f78120fc_CH4
devStateIcon {my $onl = ReadingsVal($name,'online','false') eq 'false'?'10px-kreis-rot':'10px-kreis-gruen'; $onl = FW_makeImage($onl); my $light = FW_makeImage(ReadingsVal($name,'state','off')); my $temp = ReadingsVal($name,'temperature','-100'); my $ip = ReadingsVal($name,'ip','none'); my $reb = ReadingsVal($name,'sys_restart_required','false') eq 'true'?'<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>Temp: $temp °C</div>)}
devicetopic shellypro2-30c6f78120fc
getList in_mode:noArg in_mode $DEVICETOPIC/rpc {"id": 1,"src":"$DEVICETOPIC", "method": "Switch.GetConfig", "params": {"id": 0}}
group Versuchsschaltungen
icon message_socket
jsonMap switch_state:state switch_temperature_tC:temperature switch_temperature_tF:0 params_wifi_sta_ip:ip params_switch_0_temperature_tC:temperature params_switch_0_temperature_tF:0 req_result_in_mode:in_mode
model shellyPlus_1
readingList $DEVICETOPIC/online:.* online
$DEVICETOPIC/events/rpc:.* { json2nameValue($EVENT,'',$JSONMAP) }
$DEVICETOPIC/status/mqtt:.* { json2nameValue($EVENT, 'mqtt_', $JSONMAP) }
$DEVICETOPIC/status/sys:.* { json2nameValue($EVENT, 'sys_', $JSONMAP) }
$DEVICETOPIC/status/switch_0:.* { $EVENT =~ s/"output":true/"state":"on"/g; $EVENT =~ s/"output":false/"state":"off"/g; json2nameValue($EVENT, 'switch_', $JSONMAP) }
$DEVICETOPIC/status/cloud:.* {}
$DEVICETOPIC/rpc:.* { json2nameValue($EVENT, 'req_', $JSONMAP, 'in_mode')}
$DEVICETOPIC/status/input_0:.* { json2nameValue($EVENT, 'input_', $JSONMAP) }
fhem2shelly/rpc:.* {}
shellypro2_30c6f78120fc:shellypro2-30c6f78120fc/online:.* online
shellypro2_30c6f78120fc:shellypro2-30c6f78120fc/status/mqtt:.* { json2nameValue($EVENT) }
shellypro2_30c6f78120fc:shellypro2-30c6f78120fc/events/rpc:.* { json2nameValue($EVENT) }
shellypro2_30c6f78120fc:shellypro2-30c6f78120fc/status/sys:.* { json2nameValue($EVENT) }
shellypro2_30c6f78120fc:shellypro2-30c6f78120fc/status/switch_0:.* { json2nameValue($EVENT) }
room MQTT2_DEVICE
setList toggle:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Toggle","params": {"id":0}}
off:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Set","params": {"id":0,"on":false}}
on:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Set","params": {"id":0,"on":true}}
on-for-timer $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Set","params": {"id":0,"on":true,"toggle_after":$EVTPART1}}
off-for-timer $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Set","params": {"id":0,"on":false,"toggle_after":$EVTPART1}}
in_mode:toggle,flip,detached {fhem("sleep 0.2; get $NAME in_mode"); my $val = $EVTPART1 ne 'toggle' ? $EVTPART1 : ReadingsVal($NAME,'in_mode','flip') eq 'flip' ? 'detached':'flip'; qq($DEVICETOPIC/rpc {"id":1,"src":"fhem2shelly","method":"Switch.SetConfig","params": {"id":0, "config": {"in_mode": "$val"}}})}
x_update:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Shelly.Update","params": {"stage":"stable"}}
x_reboot:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Shelly.Reboot"}
x_eco:true,false $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Sys.SetConfig","params": {"config": {"device": {"eco_mode": $EVTPART1}}}}
setStateList on off toggle on-for-timer off-for-timer
webCmd :
Vielen Dank für eure Geduld und Hilfe.
..irgendwas ist da sehr komisch...: Die automatisch ergänzten Teile der readingList dürfte es eigentlich nicht geben (die mit CID: vorne).
Irgendwas verhindert, dass das korrekt ausgewertet wird, daher bleiben die Readings auf den set_-Anweisungen und die Rückmeldung wird nicht korrekt ausgewertet.
Auf die Schnelle noch keine Idee. FHEM ist aktuell? (Wenn ja, sollte sich Rudi das ggf. mal ansehen).
EDIT: Rudi schreibt hier, dass ggf. "deviceTopic" falsch wäre, da war aber - anders als hier - die CID mit drin: https://forum.fhem.de/index.php/topic,132263.msg1264284.html#msg1264284 (https://forum.fhem.de/index.php/topic,132263.msg1264284.html#msg1264284)
Vielen Dank für eure gross Unterstützung.
Unterdessen konnte ich funktionierende Konfigurationen erstellen.
Folgende Parameter sind für mich sinnvoll:
event-on-change-reading state:on,state:off (somit erhalte ich nur die Symbole, die ich möchte)
devStateIcon (Dort möchte ich gerne ein individuelles Icon benützen z.B. sani_water_hot@red sani_water_hot@green)
Ich stelle mal meine Auflistung ein... vielleicht findet ihr Optimierungsmöglichkeiten für die ich natürlich sehr dankbar bin.
# ****************** ShellyPro-Templates ******************
# ****************** Shelly Pro 1 - Start ******************
define DEVICE_Pro1 MQTT2_DEVICE shellypro1_DEVICE_Pro1_Serial
attr DEVICE_Pro1 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') eq 'off'?'FS20.off':'FS20.on';; $light = FW_makeImage($light); my $show = '<a href="';$show .= $onl eq "gelb" ? "/fhem?cmd.dummy=set $name x_update&XHR=1\">" : "http://".ReadingsVal($name,"ip","none").' "target="_blank">'; $show .= FW_makeImage("10px-kreis-".$onl)."</a>"; "<div> $show <a href=\"/fhem?cmd.dummy=set $name toggle&XHR=1\">".FW_makeImage($light)."</a></div>" }
attr DEVICE_Pro1 devicetopic shellypro1-DEVICE_Pro1_Serial
attr DEVICE_Pro1 event-on-change-reading state:on,state:off
attr DEVICE_Pro1 getList in_mode:noArg in_mode $DEVICETOPIC/rpc {"id": 1,"src":"$DEVICETOPIC", "method": "Switch.GetConfig", "params": {"id": 0}}
attr DEVICE_Pro1 group Versuchsschaltungen
attr DEVICE_Pro1 icon message_socket
attr DEVICE_Pro1 jsonMap switch_state:state switch_temperature_tC:temperature switch_temperature_tF:0 params_wifi_sta_ip:ip params_switch_0_temperature_tC:temperature params_switch_0_temperature_tF:0 req_result_in_mode:in_mode
attr DEVICE_Pro1 model shellyPro_1
attr DEVICE_Pro1 readingList $DEVICETOPIC/online:.* online\
$DEVICETOPIC/events/rpc:.* { json2nameValue($EVENT,'',$JSONMAP) }\
$DEVICETOPIC/status/mqtt:.* { json2nameValue($EVENT, 'mqtt_', $JSONMAP) }\
$DEVICETOPIC/status/sys:.* { json2nameValue($EVENT, 'sys_', $JSONMAP) }\
$DEVICETOPIC/status/switch_0:.* { $EVENT =~ s/"output":true/"state":"on"/g;; $EVENT =~ s/"output":false/"state":"off"/g;; json2nameValue($EVENT, 'switch_', $JSONMAP) }\
$DEVICETOPIC/status/cloud:.* {}\
$DEVICETOPIC/rpc:.* { json2nameValue($EVENT, 'req_', $JSONMAP, 'in_mode')}\
$DEVICETOPIC/status/input_0:.* { json2nameValue($EVENT, 'input_', $JSONMAP) }\
fhem2shelly/rpc:.* {}\
shellypro1_DEVICE_Pro1_Serial:shellypro1-DEVICE_Pro1_Serial/online:.* online\
shellypro1_DEVICE_Pro1_Serial:shellypro1-DEVICE_Pro1_Serial/status/mqtt:.* { json2nameValue($EVENT) }\
shellypro1_DEVICE_Pro1_Serial:shellypro1-DEVICE_Pro1_Serial/events/rpc:.* { json2nameValue($EVENT) }\
shellypro1_DEVICE_Pro1_Serial:shellypro1-DEVICE_Pro1_Serial/status/sys:.* { json2nameValue($EVENT) }\
shellypro1_DEVICE_Pro1_Serial:shellypro1-DEVICE_Pro1_Serial/status/switch_0:.* { json2nameValue($EVENT) }
attr DEVICE_Pro1 room MQTT2_DEVICE
attr DEVICE_Pro1 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}}\
in_mode:toggle,flip,detached {fhem("sleep 0.2;; get $NAME in_mode");; my $val = $EVTPART1 ne 'toggle' ? $EVTPART1 : ReadingsVal($NAME,'in_mode','flip') eq 'flip' ? 'detached':'flip';; qq($DEVICETOPIC/rpc {"id":1,"src":"fhem2shelly","method":"Switch.SetConfig","params": {"id":0, "config": {"in_mode": "$val"}}})}\
x_update:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Shelly.Update","params": {"stage":"stable"}}\
x_reboot:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Shelly.Reboot"}\
x_eco:true,false $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Sys.SetConfig","params": {"config": {"device": {"eco_mode": $EVTPART1}}}}
attr DEVICE_Pro1 setStateList on off toggle on-for-timer off-for-timer
attr DEVICE_Pro1 webCmd :
define FileLog_DEVICE_Pro1 FileLog ./log/DEVICE_Pro1-%Y.log DEVICE_Pro1
attr FileLog_DEVICE_Pro1 logtype text
attr FileLog_DEVICE_Pro1 room MQTT2_DEVICE
# ****************** Shelly Pro 1 - Ende ******************
# ****************** Shelly Pro 2 - Start ******************
# ------------------ Shelly Pro 2 - Kanal 1 - Start ------------------
define DEVICE_Pro2 MQTT2_DEVICE DEVICE_Pro2_Serial
attr DEVICE_Pro2 IODev MQTT2
attr DEVICE_Pro2 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') eq 'off'?'FS20.off':'FS20.on';; $light = FW_makeImage($light); my $show = '<a href="';$show .= $onl eq "gelb" ? "/fhem?cmd.dummy=set $name x_update&XHR=1\">" : "http://".ReadingsVal($name,"ip","none").' "target="_blank">'; $show .= FW_makeImage("10px-kreis-".$onl)."</a>"; "<div> $show <a href=\"/fhem?cmd.dummy=set $name toggle&XHR=1\">".FW_makeImage($light)."</a></div>" }
attr DEVICE_Pro2 devicetopic shellypro2-DEVICE_Pro2_Serial
attr DEVICE_Pro2 event-on-change-reading state:on,state:off
attr DEVICE_Pro2 group Versuchsschaltungen
attr DEVICE_Pro2 jsonMap\
switch_state:state\
switch_voltage:voltage\
switch_current:current\
switch_apower:power\
switch_temperature_tC:temperature\
switch_temperature_tF:0\
switch_source:source\
switch_id:0\
switch_dst:0\
switch_method:0\
switch_params_switch_0_id:0\
switch_params_switch_0_source:source\
switch_params_switch_0_state:state\
switch_params_switch_0_temperature_tC:temperature\
switch_params_switch_0_temperature_tFreq_dst:0\
req_dst:0\
req_id:0\
req_method:0\
req_params_id:0\
req_result_aenergy_by_minute_1:switch_aenergy_by_minute_1\
req_result_aenergy_by_minute_2:switch_aenergy_by_minute_2\
req_result_aenergy_by_minute_3:switch_aenergy_by_minute_3\
req_result_aenergy_minute_ts:switch_aenergy_minute_ts\
req_result_aenergy_total:switch_aenergy_total\
req_result_apower:power\
req_result_current:current\
req_result_id:0\
req_result_state:state\
req_result_pf:0\
req_result_source:source\
req_result_temperature_tC:temperature\
req_result_temperature_tF:0\
req_result_voltage:voltage\
req_src:0
attr DEVICE_Pro2 readingList $DEVICETOPIC/online:.* online\
$DEVICETOPIC/status/sys:.* { json2nameValue($EVENT) }\
$DEVICETOPIC/status/cloud:.* { json2nameValue($EVENT) }\
$DEVICETOPIC/status/mqtt:.* { json2nameValue($EVENT) }\
$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)}\
\
DEVICE_Pro2_Serial:shellypro2-DEVICE_Pro2_Serial/online:.* online
attr DEVICE_Pro2 room MQTT2_DEVICE
attr DEVICE_Pro2 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}}
attr DEVICE_Pro2 webCmd :
define FileLog_DEVICE_Pro2 FileLog ./log/DEVICE_Pro2-%Y.log DEVICE_Pro2
attr FileLog_DEVICE_Pro2 logtype text
attr FileLog_DEVICE_Pro2 room MQTT2_DEVICE
# ------------------ Shelly Pro 2 - Kanal 1 - Ende ------------------
# ------------------ Shelly Pro 2 - Kanal 2 - Start ------------------
define DEVICE_Pro2_CH2 MQTT2_DEVICE
attr DEVICE_Pro2_CH2 comment Channel 2 for DEVICE_Pro2, see also DEVICE_Pro2, DEVICE_Pro2_CH3 and DEVICE_Pro2_CH4
attr DEVICE_Pro2_CH2 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') eq 'off'?'FS20.off':'FS20.on';; $light = FW_makeImage($light); my $show = '<a href="';$show .= $onl eq "gelb" ? "/fhem?cmd.dummy=set $name x_update&XHR=1\">" : "http://".ReadingsVal($name,"ip","none").' "target="_blank">'; $show .= FW_makeImage("10px-kreis-".$onl)."</a>"; "<div> $show <a href=\"/fhem?cmd.dummy=set $name toggle&XHR=1\">".FW_makeImage($light)."</a></div>" }
attr DEVICE_Pro2_CH2 devicetopic shellypro2-DEVICE_Pro2_Serial
attr DEVICE_Pro2_CH2 event-on-change-reading state:on,state:off
attr DEVICE_Pro2_CH2 getList in_mode:noArg in_mode $DEVICETOPIC/rpc {"id": 1,"src":"$DEVICETOPIC", "method": "Switch.GetConfig", "params": {"id": 0}}
attr DEVICE_Pro2_CH2 group Versuchsschaltungen
attr DEVICE_Pro2_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 DEVICE_Pro2_CH2 model shellypro4pm
attr DEVICE_Pro2_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) }\
DEVICE_Pro2_Serial:shellypro2-DEVICE_Pro2_Serial/online:.* online
attr DEVICE_Pro2_CH2 room MQTT2_DEVICE
attr DEVICE_Pro2_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 DEVICE_Pro2_CH2 setStateList on off toggle on-for-timer off-for-timer
attr DEVICE_Pro2_CH2 webCmd :
# ------------------ Shelly Pro 2 - Kanal 2 - Ende ------------------
# ****************** Shelly Pro 2 - Ende ******************
# ****************** Shelly Pro 3 - Start ******************
# ------------------ Shelly Pro 3 - Kanal 1 - Start ------------------
define DEVICE_Pro3 MQTT2_DEVICE shellypro3_DEVICE_Pro3_Serial
attr DEVICE_Pro3 IODev MQTT2
attr DEVICE_Pro3 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') eq 'off'?'FS20.off':'FS20.on';; $light = FW_makeImage($light); my $show = '<a href="';$show .= $onl eq "gelb" ? "/fhem?cmd.dummy=set $name x_update&XHR=1\">" : "http://".ReadingsVal($name,"ip","none").' "target="_blank">'; $show .= FW_makeImage("10px-kreis-".$onl)."</a>"; "<div> $show <a href=\"/fhem?cmd.dummy=set $name toggle&XHR=1\">".FW_makeImage($light)."</a></div>" }
attr DEVICE_Pro3 devicetopic shellypro3-DEVICE_Pro3_Serial
attr DEVICE_Pro3 event-on-change-reading state:on,state:off
attr DEVICE_Pro3 group Versuchsschaltungen
attr DEVICE_Pro3 jsonMap\
switch_state:state\
switch_voltage:voltage\
switch_current:current\
switch_apower:power\
switch_temperature_tC:temperature\
switch_temperature_tF:0\
switch_source:source\
switch_id:0\
switch_dst:0\
switch_method:0\
switch_params_switch_0_id:0\
switch_params_switch_0_source:source\
switch_params_switch_0_state:state\
switch_params_switch_0_temperature_tC:temperature\
switch_params_switch_0_temperature_tFreq_dst:0\
req_dst:0\
req_id:0\
req_method:0\
req_params_id:0\
req_result_aenergy_by_minute_1:switch_aenergy_by_minute_1\
req_result_aenergy_by_minute_2:switch_aenergy_by_minute_2\
req_result_aenergy_by_minute_3:switch_aenergy_by_minute_3\
req_result_aenergy_minute_ts:switch_aenergy_minute_ts\
req_result_aenergy_total:switch_aenergy_total\
req_result_apower:power\
req_result_current:current\
req_result_id:0\
req_result_state:state\
req_result_pf:0\
req_result_source:source\
req_result_temperature_tC:temperature\
req_result_temperature_tF:0\
req_result_voltage:voltage\
req_src:0
attr DEVICE_Pro3 model shellyPro_3
attr DEVICE_Pro3 readingList $DEVICETOPIC/online:.* online\
$DEVICETOPIC/status/sys:.* { json2nameValue($EVENT) }\
$DEVICETOPIC/status/cloud:.* { json2nameValue($EVENT) }\
$DEVICETOPIC/status/mqtt:.* { json2nameValue($EVENT) }\
$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)}\
\
shellypro3_DEVICE_Pro3_Serial:shellypro3-DEVICE_Pro3_Serial/online:.* online
attr DEVICE_Pro3 room MQTT2_DEVICE
attr DEVICE_Pro3 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}}
attr DEVICE_Pro3 webCmd :
define FileLog_DEVICE_Pro3 FileLog ./log/DEVICE_Pro3-%Y.log DEVICE_Pro3
attr FileLog_DEVICE_Pro3 logtype text
attr FileLog_DEVICE_Pro3 room MQTT2_DEVICE
# ------------------ Shelly Pro 3 - Kanal 1 - Ende ------------------
# ------------------ Shelly Pro 3 - Kanal 2 - Start ------------------
define DEVICE_Pro3_CH2 MQTT2_DEVICE
attr DEVICE_Pro3_CH2 IODev MQTT2
attr DEVICE_Pro3_CH2 comment Channel 2 for DEVICE_Pro3, see also DEVICE_Pro3, DEVICE_Pro3_CH3 and DEVICE_Pro3_CH4
attr DEVICE_Pro3_CH2 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') eq 'off'?'FS20.off':'FS20.on';; $light = FW_makeImage($light); my $show = '<a href="';$show .= $onl eq "gelb" ? "/fhem?cmd.dummy=set $name x_update&XHR=1\">" : "http://".ReadingsVal($name,"ip","none").' "target="_blank">'; $show .= FW_makeImage("10px-kreis-".$onl)."</a>"; "<div> $show <a href=\"/fhem?cmd.dummy=set $name toggle&XHR=1\">".FW_makeImage($light)."</a></div>" }
attr DEVICE_Pro3_CH2 devicetopic shellypro3-DEVICE_Pro3_Serial
attr DEVICE_Pro3_CH2 attr event-on-change-reading state:on,state:off
attr DEVICE_Pro3_CH2 group Versuchsschaltungen
attr DEVICE_Pro3_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 DEVICE_Pro3_CH2 model shellyPro_3
attr DEVICE_Pro3_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) }
attr DEVICE_Pro3_CH2 room MQTT2_DEVICE
attr DEVICE_Pro3_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 DEVICE_Pro3_CH2 webCmd :
# ------------------ Shelly Pro 3 - Kanal 2 - Ende ------------------
# ------------------ Shelly Pro 3 - Kanal 3 - Start ------------------
define DEVICE_Pro3_CH3 MQTT2_DEVICE
attr DEVICE_Pro3_CH3 IODev MQTT2
attr DEVICE_Pro3_CH3 comment Channel 3 for DEVICE_Pro3, see also DEVICE_Pro3, DEVICE_Pro3_CH2 and DEVICE_Pro3_CH4
attr DEVICE_Pro3_CH3 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') eq 'off'?'FS20.off':'FS20.on';; $light = FW_makeImage($light); my $show = '<a href="';$show .= $onl eq "gelb" ? "/fhem?cmd.dummy=set $name x_update&XHR=1\">" : "http://".ReadingsVal($name,"ip","none").' "target="_blank">'; $show .= FW_makeImage("10px-kreis-".$onl)."</a>"; "<div> $show <a href=\"/fhem?cmd.dummy=set $name toggle&XHR=1\">".FW_makeImage($light)."</a></div>" }
attr DEVICE_Pro3_CH3 devicetopic shellypro3-DEVICE_Pro3_Serial
attr DEVICE_Pro3_CH3 attr event-on-change-reading state:on,state:off
attr DEVICE_Pro3_CH3 group Versuchsschaltungen
attr DEVICE_Pro3_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 DEVICE_Pro3_CH3 model shellyPro_3
attr DEVICE_Pro3_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) }
attr DEVICE_Pro3_CH3 room MQTT2_DEVICE
attr DEVICE_Pro3_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 DEVICE_Pro3_CH3 webCmd :
# ------------------ Shelly Pro 3 - Kanal 3 - Ende ------------------
# ****************** Shelly Pro 3 - Ende ******************
Was natürlich toll wäre ist ein entsprechendes Template welches die Grundbedürfnisse abdeckt. Ich habe ein paar Versuche gewagt, scheitere jedoch an meinen Fähigkeiten.
Grüsse aus der Schweiz
@vic: Tut mir leid, aber ich finde diese "funktionierende Konfiguration" sehr irritierend.
V.a. stellt sich die Frage, warum man manches doppelt braucht. Beispiel:
attr DEVICE_Pro1 readingList $DEVICETOPIC/online:.* online\
shellypro1_DEVICE_Pro1_Serial:shellypro1-DEVICE_Pro1_Serial/online:.* online\
Warum einmal mit $DEVICETOPIC und dann nochmal? Noch komischer wird das, wenn einem json2nameValue() mit weiteren Argumenten aufgerufen wird und einmal ohne.
Warum werden die 2. Zeilen überhaupt angelegt? Hast du das manuell gemacht? Warum?!?
Von daher sehe ich mich grade nicht in der Lage, daraus was allgemeingültiges zu basteln.
Vielen Dank für deine Antwort Beta-User
Bitte entschuldigt alle, dass ich jeweils so spät antworte. Ich bin nebst Arbeit mit Betreuung und Spitalaufenthalten komplett zugemüllt und kann daher nicht sofort reagieren.
@Beta-User: Zu deiner Frage woher... Ich habe ausgehende von Vorschlägen in Kombination mit dem ShellyPro4pm-Template so weit gebastelt bis es funktionierte. Ich bin keine Programmier-Hero und jeweils sehr froh gewesen wenn ein funktionierendes Template zur Verfügung stand. Die aufgelistete Funktion funktioniert so wie ich es gerne hätte. Mein Bedürfnis ist lediglich Ein, Aus, Toggle und entsprechende Rückmeldungen. Also nichts komplexes. Mir ist bewusst, dass meine Vorgehensweise absolut dilettantisch ist. Mit den vielen Möglichkeiten und Funktionen bin ich schlichtweg überfordert. Darum bin ich auf eure Hilfe angewiesen und ausserordentlich dankbar.
Im Moment sieht der Code folgendermassen aus:
# ****************** Shelly Pro 1 - Start ******************
define DEVICE_Pro1 MQTT2_DEVICE shellypro1_DEVICE_Pro1_Serial
setuuid DEVICE_Pro1 641c1699-f33f-0f0b-0e50-afcd1c263ddbc307
attr DEVICE_Pro1 alias SH_AKT_253_Test
attr DEVICE_Pro1 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') eq 'off'?'FS20.off':'FS20.on';;;; $light = FW_makeImage($light);; my $show = '<a href="';;$show .= $onl eq "gelb" ? "/fhem?cmd.dummy=set $name x_update&XHR=1\">" : "http://".ReadingsVal($name,"ip","none").' "target="_blank">';; $show .= FW_makeImage("10px-kreis-".$onl)."</a>";; "<div> $show <a href=\"/fhem?cmd.dummy=set $name toggle&XHR=1\">".FW_makeImage($light)."</a></div>" }
attr DEVICE_Pro1 devicetopic shellypro1-DEVICE_Pro1_Serial
attr DEVICE_Pro1 event-on-change-reading state:on state:off
attr DEVICE_Pro1 getList in_mode:noArg in_mode $DEVICETOPIC/rpc {"id": 1,"src":"$DEVICETOPIC", "method": "Switch.GetConfig", "params": {"id": 0}}
attr DEVICE_Pro1 group Versuchsschaltungen
attr DEVICE_Pro1 icon message_socket
attr DEVICE_Pro1 jsonMap switch_state:state\
switch_source:source\
switch_id:0\
switch_dst:0\
switch_method:0\
switch_params_switch_0_id:0\
switch_params_switch_0_source:source\
switch_params_switch_0_state:state\
req_dst:0\
req_id:0\
req_method:0\
req_params_id:0\
req_result_id:0\
req_result_state:state\
req_result_pf:0\
req_result_source:source\
req_src:0
attr DEVICE_Pro1 model shellyPro_1
attr DEVICE_Pro1 readingList $DEVICETOPIC/online:.* online\
$DEVICETOPIC/status/sys:.* { json2nameValue($EVENT) }\
$DEVICETOPIC/status/cloud:.* { json2nameValue($EVENT) }\
$DEVICETOPIC/status/mqtt:.* { json2nameValue($EVENT) }\
$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)}
attr DEVICE_Pro1 room MQTT2_DEVICE
attr DEVICE_Pro1 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}}\
in_mode:toggle,flip,detached {fhem("sleep 0.2;; get $NAME in_mode");; my $val = $EVTPART1 ne 'toggle' ? $EVTPART1 : ReadingsVal($NAME,'in_mode','flip') eq 'flip' ? 'detached':'flip';; qq($DEVICETOPIC/rpc {"id":1,"src":"fhem2shelly","method":"Switch.SetConfig","params": {"id":0, "config": {"in_mode": "$val"}}})}\
x_update:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Shelly.Update","params": {"stage":"stable"}}\
x_reboot:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Shelly.Reboot"}
attr DEVICE_Pro1 setStateList on off toggle on-for-timer off-for-timer
attr DEVICE_Pro1 webCmd :
define FileLog_DEVICE_Pro1 FileLog ./log/DEVICE_Pro1-%Y.log DEVICE_Pro1
setuuid FileLog_DEVICE_Pro1 641c1699-f33f-0f0b-ecf0-1c19c355e21c2ad6
attr FileLog_DEVICE_Pro1 logtype text
attr FileLog_DEVICE_Pro1 room MQTT2_DEVICE
# ****************** Shelly Pro 1 - Ende ******************
Vielen Dank für eure Hilfe
Guten Tag liebe Gemeinde
Die ShellyPro-Serie scheint gut zu funktionieren.
Leider habe ich ein Symptom festgestellt welches störend ist.
Wenn bei einem beliebigen Shelly mit on einschaltet wird und anschliessend nochmals der Befehl on ausgelöst wird bleibt der state auf set_on hängen.
Als Zwischenlösung habe ich folgendes devStateIcon eingetragen:
{my $onl = ReadingsVal($name,'online','false') eq 'false'?'10px-kreis-rot':'10px-kreis-gruen'; $onl = FW_makeImage($onl); my $light = ReadingsVal($name,'state','off') eq 'off'?'FS20.off':ReadingsVal($name,'state','off') eq 'set_off' ? 'FS20.off':ReadingsVal($name,'state','off') eq 'on' ? 'FS20.on':ReadingsVal($name,'state','off') eq 'set_on' ? 'FS20.on':'FS20.on';; $light = FW_makeImage($light); 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>Temp: $temp °C</div>)}
Wobei vom Original der Teil
my $light = FW_makeImage(ReadingsVal($name,'state','off'));
mit dem folgenden
my $light = ReadingsVal($name,'state','off') eq 'off'?'FS20.off':ReadingsVal($name,'state','off') eq 'set_off' ? 'FS20.off':ReadingsVal($name,'state','off') eq 'on' ? 'FS20.on':ReadingsVal($name,'state','off') eq 'set_on' ? 'FS20.on':'FS20.on';; $light = FW_makeImage($light);
ausgetauscht wurde.
Kennt ihr eine elegantere Lösung?
Danke für eure Angaben
Zitat von: vic am 09 Oktober 2023, 10:01:32Kennt ihr eine elegantere Lösung?
Weiß nicht recht...
Dein workaround "berichtigt" (?) die Anzeige auf den Soll-Wert.
Eigentlich sollte der Shelly zurückmelden, wohin er geschaltet hat. Tut er das nicht (bzw. bei zu schneller Wiederholung nicht mehr), ist was anderes faul, entweder die firmware auf dem Shelly oder die WLAN- oder MQTT-Verbindung.
Vielleicht ist es auch nicht optimal, den internen toggle-Befehl des Shelly zu nutzen beim Klick auf das Symbol?
Würde das gerne klären, bevor wir am attrTemplate was ändern.
Hallo in die Runde,
ich hab tatsächlich ein ähnliches Problem mit einem ShellyPro 3. Dieser hängt direkt an einem MQTT2 im Fhem. Kommunikation funktioniert (zumindest was die ReadList angeht) anscheinend soweit. Auch wenn ich ein "on" und ein "off" vermisse (da steht dann "true" oder "false"). Schaltungen, die über das Webinterface ausgelöst werden werden problemlos erkannt. Allerdings tu ich mich mit der SetList schwer ...
Von daher - das Device sieht wie folgt aus:
Internals:
CID shellypro3_xxxx
DEF shellypro3_xxxx
FUUID 66d1b2a7-f33f-dea8-4e85-02473f2d1c1d22ed
IODev myMQTTBroker
LASTInputDev myMQTTBroker
MSGCNT 215
NAME ShellyPro3_Heizstab
NR 65
STATE x_mqttcom
TYPE MQTT2_DEVICE
eventCount 216
myMQTTBroker_CONN myMQTTBroker_192.168.181.4_55605
myMQTTBroker_MSGCNT 215
myMQTTBroker_TIME 2024-12-05 17:27:19
READINGS:
2024-12-05 11:14:44 IODev myMQTTBroker
2024-12-05 17:27:19 dst SP3-H/events
2024-12-05 17:27:19 method NotifyStatus
2024-12-05 11:14:51 online true
2024-12-05 11:14:51 params_bthome_errors_1 bluetooth_disabled
2024-12-05 11:14:51 params_cloud_connected false
2024-12-05 11:14:51 params_eth_ip 192.168.181.4
2024-11-24 22:57:07 params_events_1_cfg_rev 12
2024-11-24 22:59:22 params_events_1_component sys
2024-11-24 22:59:22 params_events_1_event scheduled_restart
2024-11-24 22:59:22 params_events_1_msg success
2024-11-24 22:59:22 params_events_1_progress_percent 99
2024-11-24 22:57:07 params_events_1_restart_required true
2024-11-24 22:59:22 params_events_1_time_ms 2931
2024-11-24 22:59:22 params_events_1_ts 1732485562.69
2024-12-05 11:14:51 params_input_0_id 0
2024-12-05 11:14:51 params_input_0_state false
2024-12-05 11:14:51 params_input_1_id 1
2024-12-05 11:14:51 params_input_1_state false
2024-12-05 11:14:51 params_input_2_id 2
2024-12-05 11:14:51 params_input_2_state false
2024-12-05 11:14:51 params_mqtt_connected true
2024-12-05 17:27:19 params_switch_0_id 0
2024-12-05 17:22:07 params_switch_0_output false
2024-12-05 17:22:07 params_switch_0_source WS_in
2024-12-05 17:27:19 params_switch_0_temperature_tC 42.25
2024-12-05 17:27:19 params_switch_0_temperature_tF 108.05
2024-12-05 17:27:19 params_switch_1_id 1
2024-12-05 17:19:00 params_switch_1_output false
2024-12-05 17:19:00 params_switch_1_source WS_in
2024-12-05 17:27:19 params_switch_1_temperature_tC 42.25
2024-12-05 17:27:19 params_switch_1_temperature_tF 108.05
2024-12-05 17:27:19 params_switch_2_id 2
2024-12-05 17:19:04 params_switch_2_output false
2024-12-05 17:19:04 params_switch_2_source WS_in
2024-12-05 17:27:19 params_switch_2_temperature_tC 42.25
2024-12-05 17:27:19 params_switch_2_temperature_tF 108.05
2024-11-24 22:57:30 params_sys_available_updates_stable_version 1.4.4
2024-12-05 11:14:51 params_sys_cfg_rev 12
2024-12-05 11:14:51 params_sys_fs_free 200704
2024-12-05 11:14:51 params_sys_fs_size 524288
2024-12-05 11:14:51 params_sys_kvs_rev 0
2024-12-05 11:14:51 params_sys_mac xxxx
2024-12-05 11:14:51 params_sys_ram_free 150356
2024-12-05 11:14:51 params_sys_ram_size 251816
2024-12-05 11:14:51 params_sys_reset_reason 3
2024-12-05 11:14:51 params_sys_restart_required false
2024-12-05 11:14:51 params_sys_schedule_rev 0
2024-12-05 11:14:51 params_sys_time 11:14
2024-12-05 11:14:51 params_sys_unixtime 1733393691
2024-12-05 11:14:51 params_sys_uptime 908136
2024-12-05 11:14:51 params_sys_webhook_rev 0
2024-12-05 17:27:19 params_ts 1733416039.68
2024-12-05 11:14:51 params_wifi_rssi 0
2024-12-05 11:14:51 params_wifi_status disconnected
2024-12-05 11:14:51 params_ws_connected false
2024-12-05 17:27:19 src shellypro3-xxxx
2024-12-05 17:15:46 state x_mqttcom
Attributes:
readingList shellypro3_xxxx:SP3-H/online:.* online
shellypro3_xxxx:SP3-H/events/rpc:.* { json2nameValue($EVENT) }
room MQTT2_DEVICE
verbunden ist das Ganze via LAN. und ja, ich weiß, Datenschutztechnisch ein Supergau, das alles hier zu veröffentlichen ... aber was solls ... muss ja weiterkommen ...
Hoffe, dass ihr da eine Idee habt.
FHEM-Version ist diese hier:
Latest Revision: 29398
File Rev Last Change
fhem.pl 29388 2024-12-01 10:31:48Z rudolfkoenig
96_allowed.pm 26004 2022-04-29 19:06:05Z rudolfkoenig
95_Astro.pm 29078 2024-08-17 17:47:08Z phenning
98_autocreate.pm 29378 2024-11-30 18:25:51Z rudolfkoenig
98_dummy.pm 25606 2022-02-01 10:43:57Z rudolfkoenig
55_DWD_OpenData.pm 28557 2024-02-25 22:00:54Z jensb
91_eventTypes.pm 23471 2021-01-04 19:24:21Z rudolfkoenig
01_FHEMWEB.pm 29383 2024-11-30 20:02:55Z rudolfkoenig
92_FileLog.pm 29319 2024-10-30 17:18:26Z rudolfkoenig
98_Fronius.pm 21787 2022-07-13 13:53:55Z michael.winkler
98_help.pm 27491 2023-04-27 17:22:30Z betateilchen
10_MQTT2_DEVICE.pm 29379 2024-11-30 18:28:54Z rudolfkoenig
00_MQTT2_SERVER.pm 28986 2024-06-18 18:46:17Z rudolfkoenig
91_notify.pm 28610 2024-03-07 09:53:25Z rudolfkoenig
58_RPI_1Wire.pm 28388 2024-01-16 21:41:43Z Adimarantis
76_SolarForecast.pm 29384 2024-11-30 20:03:15Z DS_Starter
99_SUNRISE_EL.pm 24249 2021-04-14 05:45:49Z rudolfkoenig
98_SVG.pm 29055 2024-08-05 18:37:21Z rudolfkoenig
98_telnet.pm 25754 2022-02-27 16:49:52Z rudolfkoenig
99_Utils.pm 28529 2024-02-18 11:42:21Z rudolfkoenig
98_version.pm 26611 2022-10-28 16:32:29Z betateilchen
AttrTemplate.pm 27145 2023-01-29 11:48:19Z rudolfkoenig
Blocking.pm 23268 2020-12-01 11:48:48Z rudolfkoenig
Color.pm 20813 2019-12-22 18:42:10Z justme1968
DevIo.pm 29109 2024-08-26 13:38:19Z rudolfkoenig
GPUtils.pm 19666 2019-06-20 11:17:29Z CoolTux
HttpUtils.pm 28894 2024-05-21 09:00:43Z rudolfkoenig
Meta.pm 26889 2022-12-23 15:04:11Z CoolTux
RTypes.pm 10476 2016-01-12 21:03:33Z borisneubert
SetExtensions.pm 25286 2021-12-03 10:16:56Z rudolfkoenig
TcpServerUtils.pm 28227 2023-11-29 12:33:32Z rudolfkoenig
UConv.pm 21159 2020-02-09 14:04:27Z loredo
fhemweb.js 29073 2024-08-16 16:33:42Z rudolfkoenig
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.
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
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.
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...
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
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.
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.
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
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:
ShellyConfig.png
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:
ShellyTemplates.jpg
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:
Aktualisierungen.png
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.
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".)
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?
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.
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.
Wo muss ich das genau ändern?
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).
Ich werde es ausprobieren.
Nun habe ich den Shelly Pro3 einmal zusammengebaut - nach bestem Amateurswissen:
define shellypro3_SchuppenWest_fce8c0dbded4_CH0 MQTT2_DEVICE shellypro3_SchuppenWest_fce8c0dbded4
setuuid shellypro3_SchuppenWest_fce8c0dbded4_CH0 681069e5-f33f-2cfb-ac82-8af1ad6d620e918c
attr shellypro3_SchuppenWest_fce8c0dbded4_CH0 alias shellypro3_SchuppenWest_CH0
attr shellypro3_SchuppenWest_fce8c0dbded4_CH0 devicetopic shellypro3-SchuppenWest-fce8c0dbded4
attr shellypro3_SchuppenWest_fce8c0dbded4_CH0 event-on-update-reading switch_0_output.*,switch_0_temperature_tC.*
attr shellypro3_SchuppenWest_fce8c0dbded4_CH0 jsonMap params_switch_0_state:state
attr shellypro3_SchuppenWest_fce8c0dbded4_CH0 model shellypro3
attr shellypro3_SchuppenWest_fce8c0dbded4_CH0 readingList $DEVICETOPIC/status/switch_0:.* { json2nameValue($EVENT, 'switch_0_', $JSONMAP) }\
$DEVICETOPIC/status/sys:.* { json2nameValue($EVENT, 'sys_', $JSONMAP) }\
$DEVICETOPIC/online:.* online\
$DEVICETOPIC/status/mqtt:.* { json2nameValue($EVENT, 'mqtt_', $JSONMAP) }\
$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,'',$JSONMAP) }\
$DEVICETOPIC/status/cloud:.* { json2nameValue($EVENT, 'cloud_', $JSONMAP) }\
$DEVICETOPIC/events/rpc:.* { json2nameValue($EVENT, 'rpc_', $JSONMAP) }
attr shellypro3_SchuppenWest_fce8c0dbded4_CH0 room NEW_Device
attr shellypro3_SchuppenWest_fce8c0dbded4_CH0 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}}\
toggle:noArg $DEVICETOPIC/rpc {"id":1,"src":"fhem2shelly","method":"Switch.Toggle","params": {"id":0}}\
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}}
define shellypro3_SchuppenWest_fce8c0dbded4_CH1 MQTT2_DEVICE
setuuid shellypro3_SchuppenWest_fce8c0dbded4_CH1 6810c700-f33f-2cfb-6495-254d99026f903623
attr shellypro3_SchuppenWest_fce8c0dbded4_CH1 alias shellypro3_SchuppenWest_CH1
attr shellypro3_SchuppenWest_fce8c0dbded4_CH1 devicetopic shellypro3-SchuppenWest-fce8c0dbded4
attr shellypro3_SchuppenWest_fce8c0dbded4_CH1 event-on-update-reading switch_1_output.*,switch_1_temperature_tC.*
attr shellypro3_SchuppenWest_fce8c0dbded4_CH1 jsonMap params_switch_1_state:state
attr shellypro3_SchuppenWest_fce8c0dbded4_CH1 model shellypro3
attr shellypro3_SchuppenWest_fce8c0dbded4_CH1 readingList $DEVICETOPIC/status/switch_1:.* { json2nameValue($EVENT, 'switch_1_', $JSONMAP) }\
$DEVICETOPIC/status/sys:.* { json2nameValue($EVENT, 'sys_', $JSONMAP) }\
$DEVICETOPIC/online:.* online\
$DEVICETOPIC/status/mqtt:.* { json2nameValue($EVENT, 'mqtt_', $JSONMAP) }\
$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/cloud:.* { json2nameValue($EVENT, 'cloud_', $JSONMAP) }\
$DEVICETOPIC/events/rpc:.* { json2nameValue($EVENT, 'rpc_', $JSONMAP) }
attr shellypro3_SchuppenWest_fce8c0dbded4_CH1 room NEW_Device
attr shellypro3_SchuppenWest_fce8c0dbded4_CH1 setList 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}}\
toggle:noArg $DEVICETOPIC/rpc {"id":1,"src":"fhem2shelly","method":"Switch.Toggle","params": {"id":1}}\
on-for-timer $DEVICETOPIC/rpc {"id":1,"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}}
define shellypro3_SchuppenWest_fce8c0dbded4_CH2 MQTT2_DEVICE
setuuid shellypro3_SchuppenWest_fce8c0dbded4_CH2 6810c8e5-f33f-2cfb-7343-faf49eb556aa6a51
attr shellypro3_SchuppenWest_fce8c0dbded4_CH2 alias shellypro3_SchuppenWest_CH2
attr shellypro3_SchuppenWest_fce8c0dbded4_CH2 devicetopic shellypro3-SchuppenWest-fce8c0dbded4
attr shellypro3_SchuppenWest_fce8c0dbded4_CH2 event-on-update-reading switch_2_output.*,switch_2_temperature_tC.*
attr shellypro3_SchuppenWest_fce8c0dbded4_CH2 jsonMap params_switch_2_state:state
attr shellypro3_SchuppenWest_fce8c0dbded4_CH2 model shellypro3
attr shellypro3_SchuppenWest_fce8c0dbded4_CH2 readingList $DEVICETOPIC/status/switch_2:.* { json2nameValue($EVENT, 'switch_2_', $JSONMAP) }\
$DEVICETOPIC/status/sys:.* { json2nameValue($EVENT, 'sys_', $JSONMAP) }\
$DEVICETOPIC/online:.* online\
$DEVICETOPIC/status/mqtt:.* { json2nameValue($EVENT, 'mqtt_', $JSONMAP) }\
$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/cloud:.* { json2nameValue($EVENT, 'cloud_', $JSONMAP) }\
$DEVICETOPIC/events/rpc:.* { json2nameValue($EVENT, 'rpc_', $JSONMAP) }
attr shellypro3_SchuppenWest_fce8c0dbded4_CH2 room NEW_Device
attr shellypro3_SchuppenWest_fce8c0dbded4_CH2 setList 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}}\
toggle:noArg $DEVICETOPIC/rpc {"id":1,"src":"fhem2shelly","method":"Switch.Toggle","params": {"id":2}}\
on-for-timer $DEVICETOPIC/rpc {"id":1,"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}}
Ich sehe die Schalter in FHEM und kann sie bedienen, und sie zeigen Änderungen an, die von woanders getriggert werden:
ShellyinFHEM.png
Habe ich da grundlegende Fehler gemacht?
Nun benötige ich noch eine Lösung für meinen Dimmer Shelly Pro 2PM. Soll der auch mit dem geänderten Template laufen (statt "shellyp(lus|ro4pm)" "shellyp(lus|ro.pm)" )?
Zitat von: stobor am 29 April 2025, 15:07:08Habe ich da grundlegende Fehler gemacht?
Wenn das bedienbar ist und die updates da sind, wenn von woanders her geschaltet wird, würde ich erst mal sagen: nein.
Zitat von: stobor am 29 April 2025, 15:07:08Nun benötige ich noch eine Lösung für meinen Dimmer Shelly Pro 2PM. Soll der auch mit dem geänderten Template laufen (statt "shellyp(lus|ro4pm)" "shellyp(lus|ro.pm)" )?
Jein.
Vermutlich würde das für on/off gehen, aber dimmen ist da halt nicht vorgesehen.
Die bennante Änderungen in "shellyPlus_2pm_split" vorgenommen sollte zumindest die passende Anzahl Kanäle liefern. (Notiz an mich selbst: Das sind schon 2 von 3 mehrkanaligen...)
Welche Topic/Payload-Kombi jeweils für's Dimmen erforderlich ist, sollte in der Doku stehen.
Falls du das generisch in die attrTemplate-file einpflegen könntest (bzw. den passenden Schnippsel liefern), würde ich das ins svn übernehmen ;) .
Zitat von: stobor am 29 April 2025, 15:07:08Nun habe ich den Shelly Pro3 einmal zusammengebaut - nach bestem Amateurswissen:
Dem, was ich dir am 26.04. auf deine PM hin geschickt habe, ist nichts hinzuzufügen.
Das klappt bei mir einwandfrei:
https://forum.fhem.de/index.php?topic=131836.msg1260078#msg1260078
Hallo Ralli,
ja, vielen Dank auch dafür, doch damit lief es bei mir nicht.
Zitat von: Beta-User am 29 April 2025, 15:21:11Zitat von: stobor am 29 April 2025, 15:07:08Habe ich da grundlegende Fehler gemacht?
Wenn das bedienbar ist und die updates da sind, wenn von woanders her geschaltet wird, würde ich erst mal sagen: nein.
Zitat von: stobor am 29 April 2025, 15:07:08Nun benötige ich noch eine Lösung für meinen Dimmer Shelly Pro 2PM. Soll der auch mit dem geänderten Template laufen (statt "shellyp(lus|ro4pm)" "shellyp(lus|ro.pm)" )?
Jein.
Vermutlich würde das für on/off gehen, aber dimmen ist da halt nicht vorgesehen.
Die bennante Änderungen in "shellyPlus_2pm_split" vorgenommen sollte zumindest die passende Anzahl Kanäle liefern. (Notiz an mich selbst: Das sind schon 2 von 3 mehrkanaligen...)
Welche Topic/Payload-Kombi jeweils für's Dimmen erforderlich ist, sollte in der Doku stehen.
Falls du das generisch in die attrTemplate-file einpflegen könntest (bzw. den passenden Schnippsel liefern), würde ich das ins svn übernehmen ;) .
Ich bin da vermutlich nicht so der Template- oder Schnipsel-Profi.
Aber den Dimmer Shelly Pro 2PM habe ich nun so zum Laufen bekommen:
define shellyprodm2pm_SchuppenWest_a0dd6c9f62d4_CH0 MQTT2_DEVICE shellyprodm2pm_SchuppenWest_a0dd6c9f62d4
setuuid shellyprodm2pm_SchuppenWest_a0dd6c9f62d4_CH0 68122d5f-f33f-2cfb-c8ab-6279b3912e3cb6c6
attr shellyprodm2pm_SchuppenWest_a0dd6c9f62d4_CH0 alias shellyprodm2pm_SchuppenWest_CH0
attr shellyprodm2pm_SchuppenWest_a0dd6c9f62d4_CH0 devStateIcon {my $light = ReadingsVal($name,"light_0_output","false") eq "true"?"on":"off";;;; my $cons = ReadingsVal($name,"light_0_apower","unknown");;;; my $pct = ReadingsNum($name,"pct",0);;;;my $temp = ReadingsNum($name,"light_0_temperature_tC",0);;;; "<a href=\"/fhem?cmd.dummy=set $name toggle&XHR=1\">".FW_makeImage($light)."</a><div>Leistung: $cons W ($pct %), T: $temp C</div>"}
attr shellyprodm2pm_SchuppenWest_a0dd6c9f62d4_CH0 devicetopic shellyprodm2pm-SchuppenWest-a0dd6c9f62d4
attr shellyprodm2pm_SchuppenWest_a0dd6c9f62d4_CH0 event-on-change-reading light_0_apower,light_0_output,light_0_temperature_tC,light_0_brightness,light_0_voltage,pct
attr shellyprodm2pm_SchuppenWest_a0dd6c9f62d4_CH0 icon light_control
attr shellyprodm2pm_SchuppenWest_a0dd6c9f62d4_CH0 jsonMap light_0_brightness:pct
attr shellyprodm2pm_SchuppenWest_a0dd6c9f62d4_CH0 model shellydimmer
attr shellyprodm2pm_SchuppenWest_a0dd6c9f62d4_CH0 readingList $DEVICETOPIC/online:.* online\
$DEVICETOPIC/status/ble:.* ble\
$DEVICETOPIC/status/cloud:.* { json2nameValue($EVENT, 'cloud_', $JSONMAP) }\
$DEVICETOPIC/status/eth:.* { json2nameValue($EVENT, 'eth_', $JSONMAP) }\
$DEVICETOPIC/status/input_0:.* { json2nameValue($EVENT, 'input_0_', $JSONMAP) }\
$DEVICETOPIC/status/input_1:.* { json2nameValue($EVENT, 'input_1_', $JSONMAP) }\
$DEVICETOPIC/status/input_2:.* { json2nameValue($EVENT, 'input_2_', $JSONMAP) }\
$DEVICETOPIC/status/input_3:.* { json2nameValue($EVENT, 'input_3_', $JSONMAP) }\
$DEVICETOPIC/status/light_0:.* { json2nameValue($EVENT, 'light_0_', $JSONMAP) }\
$DEVICETOPIC/status/light_1:.* { json2nameValue($EVENT, 'light_1_', $JSONMAP) }\
$DEVICETOPIC/status/mqtt:.* { json2nameValue($EVENT, 'mqtt_', $JSONMAP) }\
$DEVICETOPIC/status/sys:.* { json2nameValue($EVENT, 'sys_', $JSONMAP) }\
$DEVICETOPIC/status/wifi:.* { json2nameValue($EVENT, 'wifi_', $JSONMAP) }\
$DEVICETOPIC/status/ws:.* { json2nameValue($EVENT, 'ws_', $JSONMAP) }\
$DEVICETOPIC/events/rpc:.* { json2nameValue($EVENT, 'rpc_', $JSONMAP) }
attr shellyprodm2pm_SchuppenWest_a0dd6c9f62d4_CH0 room NEW_Device
attr shellyprodm2pm_SchuppenWest_a0dd6c9f62d4_CH0 setList off:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Light.Set","params": {"id":0,"on":false}}\
on:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Light.Set","params": {"id":0,"on":true}}\
toggle:noArg $DEVICETOPIC/rpc {"id":1,"src":"fhem2shelly","method":"Light.Toggle","params": {"id":0}}\
on-for-timer $DEVICETOPIC/rpc {"id":1,"src":"fhem2shelly","method":"Light.Set","params": {"id":0,"on":true,"toggle_after":$EVTPART1}}\
off-for-timer $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Light.Set","params": {"id":0,"on":false,"toggle_after":$EVTPART1}}\
pct:slider,0,1,100 $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Light.Set","params": {"id":0,"brightness":$EVTPART1}}
define shellyprodm2pm_SchuppenWest_a0dd6c9f62d4_CH1 MQTT2_DEVICE
setuuid shellyprodm2pm_SchuppenWest_a0dd6c9f62d4_CH1 681241cd-f33f-2cfb-540c-2335c6779ffe1475
attr shellyprodm2pm_SchuppenWest_a0dd6c9f62d4_CH1 alias shellyprodm2pm_SchuppenWest_CH1
attr shellyprodm2pm_SchuppenWest_a0dd6c9f62d4_CH1 devStateIcon {my $light = ReadingsVal($name,"light_1_output","false") eq "true"?"on":"off";;;; my $cons = ReadingsVal($name,"light_1_apower","unknown");;;; my $pct = ReadingsNum($name,"pct",0);;;;my $temp = ReadingsNum($name,"light_1_temperature_tC",0);;;; "<a href=\"/fhem?cmd.dummy=set $name toggle&XHR=1\">".FW_makeImage($light)."</a><div>Leistung: $cons W ($pct %), T: $temp C</div>"}
attr shellyprodm2pm_SchuppenWest_a0dd6c9f62d4_CH1 devicetopic shellyprodm2pm-SchuppenWest-a0dd6c9f62d4
attr shellyprodm2pm_SchuppenWest_a0dd6c9f62d4_CH1 event-on-change-reading light_1_apower,light_1_output,light_1_temperature_tC,light_1_brightness,light_1_voltage,pct
attr shellyprodm2pm_SchuppenWest_a0dd6c9f62d4_CH1 icon light_control
attr shellyprodm2pm_SchuppenWest_a0dd6c9f62d4_CH1 jsonMap light_1_brightness:pct
attr shellyprodm2pm_SchuppenWest_a0dd6c9f62d4_CH1 model shellydimmer
attr shellyprodm2pm_SchuppenWest_a0dd6c9f62d4_CH1 readingList $DEVICETOPIC/online:.* online\
$DEVICETOPIC/status/ble:.* ble\
$DEVICETOPIC/status/cloud:.* { json2nameValue($EVENT, 'cloud_', $JSONMAP) }\
$DEVICETOPIC/status/eth:.* { json2nameValue($EVENT, 'eth_', $JSONMAP) }\
$DEVICETOPIC/status/input_0:.* { json2nameValue($EVENT, 'input_0_', $JSONMAP) }\
$DEVICETOPIC/status/input_1:.* { json2nameValue($EVENT, 'input_1_', $JSONMAP) }\
$DEVICETOPIC/status/input_2:.* { json2nameValue($EVENT, 'input_2_', $JSONMAP) }\
$DEVICETOPIC/status/input_3:.* { json2nameValue($EVENT, 'input_3_', $JSONMAP) }\
$DEVICETOPIC/status/light_0:.* { json2nameValue($EVENT, 'light_0_', $JSONMAP) }\
$DEVICETOPIC/status/light_1:.* { json2nameValue($EVENT, 'light_1_', $JSONMAP) }\
$DEVICETOPIC/status/mqtt:.* { json2nameValue($EVENT, 'mqtt_', $JSONMAP) }\
$DEVICETOPIC/status/sys:.* { json2nameValue($EVENT, 'sys_', $JSONMAP) }\
$DEVICETOPIC/status/wifi:.* { json2nameValue($EVENT, 'wifi_', $JSONMAP) }\
$DEVICETOPIC/status/ws:.* { json2nameValue($EVENT, 'ws_', $JSONMAP) }\
$DEVICETOPIC/events/rpc:.* { json2nameValue($EVENT, 'rpc_', $JSONMAP) }
attr shellyprodm2pm_SchuppenWest_a0dd6c9f62d4_CH1 room NEW_Device
attr shellyprodm2pm_SchuppenWest_a0dd6c9f62d4_CH1 setList off:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Light.Set","params": {"id":1,"on":false}}\
on:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Light.Set","params": {"id":1,"on":true}}\
toggle:noArg $DEVICETOPIC/rpc {"id":1,"src":"fhem2shelly","method":"Light.Toggle","params": {"id":1}}\
on-for-timer $DEVICETOPIC/rpc {"id":1,"src":"fhem2shelly","method":"Light.Set","params": {"id":1,"on":true,"toggle_after":$EVTPART1}}\
off-for-timer $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Light.Set","params": {"id":1,"on":false,"toggle_after":$EVTPART1}}\
pct:slider,0,1,100 $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Light.Set","params": {"id":1,"brightness":$EVTPART1}}
(hier auch ein Dank an gsbox, der mir mit seiner Lösung Inspirationen geliefert hat.)