Shelly 1 Plus schalten

Begonnen von mkraus81, 13 September 2022, 08:02:29

Vorheriges Thema - Nächstes Thema

mkraus81

Hi,

ich habe ein Shelly 1 Plus... und bekomme auch den Status, Reading usw. angezeigt
was ich aber nicht hinbekomme ist da Schalten über MQTT...
vielleicht kann mir jemand sagen wo das Problem liegt

hier meine Raw-Def

defmod shellyplus1_fussbodenheizung MQTT2_DEVICE shellyplus1_fussbodenheizung
attr shellyplus1_fussbodenheizung IODev m2s
attr shellyplus1_fussbodenheizung alias Pumpe Fußbodenheizung
attr shellyplus1_fussbodenheizung 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>)}
attr shellyplus1_fussbodenheizung devicetopic shellyplus1_fussbodenheizung:shellies
attr shellyplus1_fussbodenheizung genericDeviceType switch
attr shellyplus1_fussbodenheizung getList in_mode:noArg in_mode $DEVICETOPIC/rpc {"id": 1,"src":"$DEVICETOPIC", "method": "Switch.GetConfig", "params": {"id": 0}}
attr shellyplus1_fussbodenheizung group Steckdosen
attr shellyplus1_fussbodenheizung icon sani_pump
attr shellyplus1_fussbodenheizung 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 shellyplus1_fussbodenheizung model shellyPlus_1
attr shellyplus1_fussbodenheizung 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:.* {}
attr shellyplus1_fussbodenheizung room Keller
attr shellyplus1_fussbodenheizung 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 shellyplus1_fussbodenheizung setStateList on off toggle on-for-timer off-for-timer
attr shellyplus1_fussbodenheizung webCmd on:off


in den Shelly Einstellungen für MQTT habe ich
MQTT Prefix: shellies
Client Id: shellyplus1_fussbodenheizung

Gruß
Marcel

Beta-User

Das Attribut devicetopic sieht komisch aus. Mach mal das ":shellies" weg.
Wenn das nichts hilft, bitte mal löschen und zeigen, was autocreate macht.
Server: HP-elitedesk@Debian 12, aktuelles FHEM@ConfigDB | CUL_HM (VCCU) | MQTT2: MiLight@ESP-GW, BT@OpenMQTTGw | MySensors: seriell, v.a. 2.3.1@RS485 | ZWave | ZigBee@deCONZ | SIGNALduino | MapleCUN | RHASSPY
svn: u.a MySensors, Weekday-&RandomTimer, Twilight,  div. attrTemplate-files

mkraus81

devicetopic scheint aber richtig zu sein...
denn nur damit funktioniert z.B. die Status-Anzeige usw...
wenn ich z.B. nur die ClientId als DeviceTopic eintrage, geht es nicht
und er legt dann noch weitere Einträge in der ReadingList an

isy

#3
Bei mir sind beide Felder im MQTT Menü auf die ID des Shelly gesetzt.
Den Check  bei "Generic Status......" nicht vergessen.
Ein Weg wird erst zu einem Weg, wenn man ihn geht

mkraus81

das sind die Einstellungen im Shelly (siehe Anhang)

und das Ergebnis in Fhem




Beta-User

...ich meinte nach dem Löschen...

Nochmal: devicetopic ist kaputt, allerdings "anders herum", also den Teil vor dem Doppelpunkt bitte löschen. CID in setList funktioniert jedenfalls nicht, auch nicht über den Umweg devicetopic...

(Und dann wird hoffentlich auch klarer, dass der Vorschlag von isy Sinn macht, die Einstellungen nochmal zu überdenken).
Server: HP-elitedesk@Debian 12, aktuelles FHEM@ConfigDB | CUL_HM (VCCU) | MQTT2: MiLight@ESP-GW, BT@OpenMQTTGw | MySensors: seriell, v.a. 2.3.1@RS485 | ZWave | ZigBee@deCONZ | SIGNALduino | MapleCUN | RHASSPY
svn: u.a MySensors, Weekday-&RandomTimer, Twilight,  div. attrTemplate-files

isy

Und dann gab es noch den Tipp, den automatisch vergebenen Namen des Shelly nicht zu ändern, sondern erst in FHEM.
Ein Weg wird erst zu einem Weg, wenn man ihn geht

mkraus81

VIELEN DANK!!!!

ich habe nun MQTT DeviceId usw. im Shelly gelöscht... so dass der Standard verwendet wird
dann das Device nochmal neuerstellt... und nun funktioniert auch alles!!!!

Beta-User

Zitat von: isy am 13 September 2022, 09:23:00
Und dann gab es noch den Tipp, den automatisch vergebenen Namen des Shelly nicht zu ändern, sondern erst in FHEM.
...man könnte das ergänzen zu: In der Regel ist etwas faul, wenn man bei den attrTemplate aufgefordert wird, irgendwelche technischen Parameter (wie Topic-Bestandteile) einzugeben...
Server: HP-elitedesk@Debian 12, aktuelles FHEM@ConfigDB | CUL_HM (VCCU) | MQTT2: MiLight@ESP-GW, BT@OpenMQTTGw | MySensors: seriell, v.a. 2.3.1@RS485 | ZWave | ZigBee@deCONZ | SIGNALduino | MapleCUN | RHASSPY
svn: u.a MySensors, Weekday-&RandomTimer, Twilight,  div. attrTemplate-files