Shelly PlusPlugS in FHEM einbinden

Begonnen von Maxl, 05 Februar 2024, 08:17:54

Vorheriges Thema - Nächstes Thema

Maxl

Hallo,

versuche neue Shelly Steckdosenschalter in FHEM einzubinden, alle Readings laufen auf jedoch kann ich keine Commands an das Device senden, es reagiert nichts. Ich hätte auch bereits alle Templates durchprobiert, leider kein Glück. Kann mir jemand sagen wie man die Dinger ansteuern muß? Leider bin ich im Forum nicht ganz fündig geworden nur der Hinweis mit "Plus1PM" soll es funktionieren, bei mir leider nicht, gibt es inzwischen ein Template?

define MQTT2_shellyplusplugs_d48afc58cf34 MQTT2_DEVICE shellyplusplugs_d48afc58cf34
attr MQTT2_shellyplusplugs_d48afc58cf34 devStateIcon {my $onl = ReadingsVal($name,'online','false') eq 'false'?'10px-kreis-rot':'10px-kreis-gruen';; $onl = FW_makeImage($onl);; my $light = FW_makeImage(ReadingsVal($name,'state','off'));; my $cons = ReadingsNum($name,'apower',0);; my $total = round(ReadingsNum($name,'aenergy_total',0)/1000,3);; my $temp = ReadingsVal($name,'temperature','-100');; my $ip = ReadingsVal($name,'ip','none');; my $reb = ReadingsVal($name,'sys_restart_required','false') eq 'true'?'<a href="/fhem?cmd.dummy=set '.$name.' x_reboot&XHR=1"> ... Notwendigen Reboot durchführen</a>':'';; qq(<a href="http://$ip" target="_blank">${onl}</a><a href="/fhem?cmd.dummy=set $name toggle&XHR=1">${light}</a>$reb<div>Verbrauch: $cons W / Total: $total kwh / Temp: $temp °C</div>)}
attr MQTT2_shellyplusplugs_d48afc58cf34 devicetopic shellyplusplugs
attr MQTT2_shellyplusplugs_d48afc58cf34 getList in_mode:noArg in_mode $DEVICETOPIC/rpc {"id": 1,"src":"$DEVICETOPIC", "method": "Switch.GetConfig", "params": {"id": 0}}
attr MQTT2_shellyplusplugs_d48afc58cf34 icon message_socket
attr MQTT2_shellyplusplugs_d48afc58cf34 jsonMap switch_state:state switch_aenergy_total:aenergy_total switch_apower:apower 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 result_in_mode:in_mode
attr MQTT2_shellyplusplugs_d48afc58cf34 model shellyPlus_1pm
attr MQTT2_shellyplusplugs_d48afc58cf34 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:.* {}\
shellyplusplugs_d48afc58cf34:shellyplusplugs-d48afc58cf34/debug/log:.* log\
shellyplusplugs_d48afc58cf34:shellyplusplugs-d48afc58cf34/events/rpc:.* { json2nameValue($EVENT) }
attr MQTT2_shellyplusplugs_d48afc58cf34 room MQTT2_DEVICE
attr MQTT2_shellyplusplugs_d48afc58cf34 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 MQTT2_shellyplusplugs_d48afc58cf34 setStateList on off toggle on-for-timer off-for-timer
attr MQTT2_shellyplusplugs_d48afc58cf34 webCmd :
#   CFGFN     
#   CID        shellyplusplugs_d48afc58cf34
#   DEF        shellyplusplugs_d48afc58cf34
#   FUUID      65c08880-f33f-7117-da30-4b9394b82543fe99
#   IODev      MQTT2_FHEM_Server
#   LASTInputDev MQTT2_FHEM_Server
#   MQTT2_FHEM_Server_CONN MQTT2_FHEM_Server_192.168.1.62_63314
#   MQTT2_FHEM_Server_MSGCNT 20
#   MQTT2_FHEM_Server_TIME 2024-02-05 08:09:00
#   MSGCNT     20
#   NAME       MQTT2_shellyplusplugs_d48afc58cf34
#   NR         69
#   STATE      set_toggle
#   TYPE       MQTT2_DEVICE
#   eventCount 36
#   JSONMAP:
#     params_switch_0_temperature_tC temperature
#     params_switch_0_temperature_tF 0
#     params_wifi_sta_ip ip
#     result_in_mode in_mode
#     switch_aenergy_total aenergy_total
#     switch_apower apower
#     switch_state state
#     switch_temperature_tC temperature
#     switch_temperature_tF 0
#   OLDREADINGS:
#   READINGS:
#     2024-02-05 08:04:32   IODev           MQTT2_FHEM_Server
#     2024-02-05 08:06:27   attrTemplateVersion 20220303
#     2024-02-05 08:09:00   dst             shellyplusplugs-d48afc58cf34/events
#     2024-02-05 08:09:00   log             shellyplusplugs-d48afc58cf34 4494 1707116940.599 2|shelly_notification:161 Status change of switch:0: {"id":0,"aenergy":{"by_minute":[0.000,0.000,0.000],"minute_ts":1707116939,"total":0.000}}
#
#     2024-02-05 08:09:00   method          NotifyStatus
#     2024-02-05 08:09:00   params_switch_0_aenergy_by_minute_1 0.000
#     2024-02-05 08:09:00   params_switch_0_aenergy_by_minute_2 0.000
#     2024-02-05 08:09:00   params_switch_0_aenergy_by_minute_3 0.000
#     2024-02-05 08:09:00   params_switch_0_aenergy_minute_ts 1707116939
#     2024-02-05 08:09:00   params_switch_0_aenergy_total 0.000
#     2024-02-05 08:07:47   params_switch_0_apower 0
#     2024-02-05 08:07:47   params_switch_0_current 0
#     2024-02-05 08:09:00   params_switch_0_id 0
#     2024-02-05 08:07:47   params_switch_0_output false
#     2024-02-05 08:07:47   params_switch_0_source WS_in
#     2024-02-05 08:07:47   params_switch_0_voltage 0
#     2024-02-05 08:09:00   params_ts       1707116940.58
#     2024-02-05 08:09:00   src             shellyplusplugs-d48afc58cf34
#     2024-02-05 08:07:36   state           set_toggle
#     2024-02-05 08:06:27   x_reboot        set
#
setstate MQTT2_shellyplusplugs_d48afc58cf34 set_toggle
setstate MQTT2_shellyplusplugs_d48afc58cf34 2024-02-05 08:04:32 IODev MQTT2_FHEM_Server
setstate MQTT2_shellyplusplugs_d48afc58cf34 2024-02-05 08:06:27 attrTemplateVersion 20220303
setstate MQTT2_shellyplusplugs_d48afc58cf34 2024-02-05 08:09:00 dst shellyplusplugs-d48afc58cf34/events
setstate MQTT2_shellyplusplugs_d48afc58cf34 2024-02-05 08:09:00 log shellyplusplugs-d48afc58cf34 4494 1707116940.599 2|shelly_notification:161 Status change of switch:0: {"id":0,"aenergy":{"by_minute":[0.000,0.000,0.000],"minute_ts":1707116939,"total":0.000}}\

setstate MQTT2_shellyplusplugs_d48afc58cf34 2024-02-05 08:09:00 method NotifyStatus
setstate MQTT2_shellyplusplugs_d48afc58cf34 2024-02-05 08:09:00 params_switch_0_aenergy_by_minute_1 0.000
setstate MQTT2_shellyplusplugs_d48afc58cf34 2024-02-05 08:09:00 params_switch_0_aenergy_by_minute_2 0.000
setstate MQTT2_shellyplusplugs_d48afc58cf34 2024-02-05 08:09:00 params_switch_0_aenergy_by_minute_3 0.000
setstate MQTT2_shellyplusplugs_d48afc58cf34 2024-02-05 08:09:00 params_switch_0_aenergy_minute_ts 1707116939
setstate MQTT2_shellyplusplugs_d48afc58cf34 2024-02-05 08:09:00 params_switch_0_aenergy_total 0.000
setstate MQTT2_shellyplusplugs_d48afc58cf34 2024-02-05 08:07:47 params_switch_0_apower 0
setstate MQTT2_shellyplusplugs_d48afc58cf34 2024-02-05 08:07:47 params_switch_0_current 0
setstate MQTT2_shellyplusplugs_d48afc58cf34 2024-02-05 08:09:00 params_switch_0_id 0
setstate MQTT2_shellyplusplugs_d48afc58cf34 2024-02-05 08:07:47 params_switch_0_output false
setstate MQTT2_shellyplusplugs_d48afc58cf34 2024-02-05 08:07:47 params_switch_0_source WS_in
setstate MQTT2_shellyplusplugs_d48afc58cf34 2024-02-05 08:07:47 params_switch_0_voltage 0
setstate MQTT2_shellyplusplugs_d48afc58cf34 2024-02-05 08:09:00 params_ts 1707116940.58
setstate MQTT2_shellyplusplugs_d48afc58cf34 2024-02-05 08:09:00 src shellyplusplugs-d48afc58cf34
setstate MQTT2_shellyplusplugs_d48afc58cf34 2024-02-05 08:07:36 state set_toggle
setstate MQTT2_shellyplusplugs_d48afc58cf34 2024-02-05 08:06:27 x_reboot set

FHEM auf Raspberry mit HM, HMC und AVR Netios.

frickelpiet

Hallo Maxl,

versuch mal, dass Attribut devicetopic anzupassen. Das muss so aussehen:

attr MQTT2_shellyplusplugs_d48afc58cf34 devicetopic shellyplusplugs-d48afc58cf34
Bei mir hat das funktioniert. (NB: Ist mein erstes MQTT-Device...)

Guckst du hier: https://forum.fhem.de/index.php?msg=1277962

Grüße
Piet