Shelly PlusPlugS settings für FHEM

Begonnen von Snocksman, 19 August 2024, 09:20:27

Vorheriges Thema - Nächstes Thema

Snocksman

Hallo zusammen,

Ich habe mir einen zusätzlichen Shelly Plug S bestellt... Dachte ich zumindest... Nachdem ich mich auf das Webinterface verbunden habe, fiel direkt auf: Oh, sieht ein bisschen anders aus als gewohnt und da steht auch nicht Shelly Plug S, sondern Shelly PlusPlug S. Erstmal habe ich mir nicht viel dabei gedacht, aber dann... Ups, die MQTT Settings sind ja viel umfangreicher... Egal, erstmal alles so lassen und einfach den FHEM-MQTT-Server eintragen und nen reboot ausführen.

Danach hat FHEM das Device auch gefunden. Als AttribTemplate habe ich dann shellyPlus 1pm ausgewählt, da der Zwischenstecker auch power measurement macht.

Das Problem... Nachdem das Device anfänglich gefunden wird, tut sich weiter nichts. Ich kann es aus FHEM heraus nicht schalten und auch, wenn ich am Gerät schalte, bekommt FHEM die änderung nicht mit...

Muss ich da in den MQTT-Settings am Shelly was spezielles einstellen, damit das sauber läuft...?  ???


Edit: Hier noch das Device, wie ich es aktuell in FHEM habe:
define MQTT2_shellyplusplugs_fcb4670c9098 MQTT2_DEVICE shellyplusplugs_fcb4670c9098
attr MQTT2_shellyplusplugs_fcb4670c9098 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_fcb4670c9098 devicetopic shellyplusplugs
attr MQTT2_shellyplusplugs_fcb4670c9098 genericDeviceType switch
attr MQTT2_shellyplusplugs_fcb4670c9098 getList in_mode:noArg in_mode $DEVICETOPIC/rpc {"id": 1,"src":"$DEVICETOPIC", "method": "Switch.GetConfig", "params": {"id": 0}}
attr MQTT2_shellyplusplugs_fcb4670c9098 icon message_socket
attr MQTT2_shellyplusplugs_fcb4670c9098 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_fcb4670c9098 model shellyPlus_1pm
attr MQTT2_shellyplusplugs_fcb4670c9098 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_fcb4670c9098:shellyplusplugs-fcb4670c9098/events/rpc:.* { json2nameValue($EVENT) }\
shellyplusplugs_fcb4670c9098:shellyplusplugs-fcb4670c9098/status/sys:.* { json2nameValue($EVENT) }\
shellyplusplugs_fcb4670c9098:shellyplusplugs-fcb4670c9098/status/switch_0:.* { json2nameValue($EVENT) }\
shellyplusplugs_fcb4670c9098:shellyplusplugs-fcb4670c9098/online:.* online\
shellyplusplugs_fcb4670c9098:shellyplusplugs-fcb4670c9098/status/ble:.* ble\
shellyplusplugs_fcb4670c9098:shellyplusplugs-fcb4670c9098/status/cloud:.* { json2nameValue($EVENT) }\
shellyplusplugs_fcb4670c9098:shellyplusplugs-fcb4670c9098/status/ffs:.* { json2nameValue($EVENT) }\
shellyplusplugs_fcb4670c9098:shellyplusplugs-fcb4670c9098/status/mqtt:.* { json2nameValue($EVENT) }\
shellyplusplugs_fcb4670c9098:shellyplusplugs-fcb4670c9098/status/plugs_ui:.* plugs_ui\
shellyplusplugs_fcb4670c9098:shellyplusplugs-fcb4670c9098/status/wifi:.* { json2nameValue($EVENT) }\
shellyplusplugs_fcb4670c9098:shellyplusplugs-fcb4670c9098/status/ws:.* { json2nameValue($EVENT) }
attr MQTT2_shellyplusplugs_fcb4670c9098 room MQTT2_DEVICE
attr MQTT2_shellyplusplugs_fcb4670c9098 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_fcb4670c9098 setStateList on off toggle on-for-timer off-for-timer
attr MQTT2_shellyplusplugs_fcb4670c9098 webCmd :
#   CID        shellyplusplugs_fcb4670c9098
#   DEF        shellyplusplugs_fcb4670c9098
#   FUUID      66c2ebf8-f33f-e448-8db2-d43797a163582599
#   IODev      MQTT2_FHEM_Server
#   LASTInputDev MQTT2_FHEM_Server
#   MQTT2_FHEM_Server_CONN MQTT2_FHEM_Server_192.168.1.109_50860
#   MQTT2_FHEM_Server_MSGCNT 98
#   MQTT2_FHEM_Server_TIME 2024-08-19 09:24:58
#   MSGCNT     98
#   NAME       MQTT2_shellyplusplugs_fcb4670c9098
#   NR         882
#   STATE      set_toggle
#   TYPE       MQTT2_DEVICE
#   eventCount 120
#   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-08-19 08:55:42   IODev           MQTT2_FHEM_Server
#     2024-08-19 09:20:58   aenergy_by_minute_1 0.000
#     2024-08-19 09:20:58   aenergy_by_minute_2 0.000
#     2024-08-19 09:20:58   aenergy_by_minute_3 0.000
#     2024-08-19 09:20:58   aenergy_minute_ts 1724052060
#     2024-08-19 09:20:58   aenergy_total   0.002
#     2024-08-19 09:20:58   apower          0.0
#     2024-08-19 09:01:04   attrTemplateVersion 20220303
#     2024-08-19 09:04:43   available_updates_beta_version 1.4.2-beta1
#     2024-08-19 09:04:28   ble             {}
#     2024-08-19 09:04:43   cfg_rev         17
#     2024-08-19 09:04:29   connected       true
#     2024-08-19 09:20:58   current         0.000
#     2024-08-19 09:24:58   dst             shellyplusplugs-fcb4670c9098/events
#     2024-08-19 09:04:43   fs_free         106496
#     2024-08-19 09:04:43   fs_size         393216
#     2024-08-19 09:20:58   id              0
#     2024-08-19 09:04:43   kvs_rev         0
#     2024-08-19 09:04:43   mac             FCB4670C9098
#     2024-08-19 09:24:58   method          NotifyStatus
#     2024-08-19 09:21:52   online          true
#     2024-08-19 09:20:58   output          false
#     2024-08-19 09:21:52   params_cloud_connected false
#     2024-08-19 09:02:35   params_events_1_cfg_rev 16
#     2024-08-19 09:03:07   params_events_1_component sys
#     2024-08-19 09:03:07   params_events_1_event scheduled_restart
#     2024-08-19 09:02:35   params_events_1_restart_required false
#     2024-08-19 09:03:07   params_events_1_time_ms 996
#     2024-08-19 09:03:07   params_events_1_ts 1724050988.51
#     2024-08-19 09:21:52   params_mqtt_connected true
#     2024-08-19 09:24:58   params_switch_0_aenergy_by_minute_1 0.000
#     2024-08-19 09:24:58   params_switch_0_aenergy_by_minute_2 0.000
#     2024-08-19 09:24:58   params_switch_0_aenergy_by_minute_3 0.000
#     2024-08-19 09:24:58   params_switch_0_aenergy_minute_ts 1724052300
#     2024-08-19 09:24:58   params_switch_0_aenergy_total 0.002
#     2024-08-19 09:21:52   params_switch_0_apower 0.0
#     2024-08-19 09:21:52   params_switch_0_current 0.000
#     2024-08-19 09:24:58   params_switch_0_id 0
#     2024-08-19 09:21:52   params_switch_0_output false
#     2024-08-19 09:21:52   params_switch_0_source init
#     2024-08-19 09:21:52   params_switch_0_temperature_tC 38.8
#     2024-08-19 09:21:52   params_switch_0_temperature_tF 101.9
#     2024-08-19 09:21:52   params_switch_0_voltage 0.0
#     2024-08-19 09:22:06   params_sys_available_updates_beta_version 1.4.2-beta1
#     2024-08-19 09:21:52   params_sys_cfg_rev 18
#     2024-08-19 09:21:52   params_sys_fs_free 106496
#     2024-08-19 09:21:52   params_sys_fs_size 393216
#     2024-08-19 09:21:52   params_sys_kvs_rev 0
#     2024-08-19 09:21:52   params_sys_mac  FCB4670C9098
#     2024-08-19 09:21:52   params_sys_ram_free 144872
#     2024-08-19 09:21:52   params_sys_ram_size 254080
#     2024-08-19 09:21:52   params_sys_reset_reason 3
#     2024-08-19 09:21:52   params_sys_restart_required false
#     2024-08-19 09:21:52   params_sys_schedule_rev 0
#     2024-08-19 09:21:52   params_sys_uptime 4
#     2024-08-19 09:21:52   params_sys_webhook_rev 0
#     2024-08-19 09:24:58   params_ts       1724052300.00
#     2024-08-19 09:21:52   params_wifi_rssi -50
#     2024-08-19 09:21:52   params_wifi_ssid Snocksland
#     2024-08-19 09:21:52   params_wifi_sta_ip 192.168.1.109
#     2024-08-19 09:21:52   params_wifi_status got ip
#     2024-08-19 09:21:52   params_ws_connected false
#     2024-08-19 09:04:29   plugs_ui        {}
#     2024-08-19 09:04:43   ram_free        143980
#     2024-08-19 09:04:43   ram_size        254032
#     2024-08-19 09:04:43   reset_reason    3
#     2024-08-19 09:04:43   restart_required false
#     2024-08-19 09:04:29   rssi            -48
#     2024-08-19 09:04:43   schedule_rev    0
#     2024-08-19 09:20:58   source          init
#     2024-08-19 09:24:58   src             shellyplusplugs-fcb4670c9098
#     2024-08-19 09:04:29   ssid            Snocksland
#     2024-08-19 09:04:29   sta_ip          192.168.1.109
#     2024-08-19 09:10:12   state           set_toggle
#     2024-08-19 09:04:29   status          got ip
#     2024-08-19 09:20:58   temperature_tC  38.9
#     2024-08-19 09:20:58   temperature_tF  102.0
#     2024-08-19 09:04:43   time            09:04
#     2024-08-19 09:04:28   ts              0
#     2024-08-19 09:04:43   unixtime        1724051085
#     2024-08-19 09:04:43   uptime          19
#     2024-08-19 09:20:58   voltage         0.0
#     2024-08-19 09:04:43   webhook_rev     0
#     2024-08-19 09:01:04   x_reboot        set
#
setstate MQTT2_shellyplusplugs_fcb4670c9098 set_toggle
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 08:55:42 IODev MQTT2_FHEM_Server
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:20:58 aenergy_by_minute_1 0.000
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:20:58 aenergy_by_minute_2 0.000
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:20:58 aenergy_by_minute_3 0.000
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:20:58 aenergy_minute_ts 1724052060
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:20:58 aenergy_total 0.002
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:20:58 apower 0.0
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:01:04 attrTemplateVersion 20220303
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:04:43 available_updates_beta_version 1.4.2-beta1
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:04:28 ble {}
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:04:43 cfg_rev 17
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:04:29 connected true
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:20:58 current 0.000
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:24:58 dst shellyplusplugs-fcb4670c9098/events
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:04:43 fs_free 106496
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:04:43 fs_size 393216
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:20:58 id 0
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:04:43 kvs_rev 0
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:04:43 mac FCB4670C9098
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:24:58 method NotifyStatus
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:21:52 online true
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:20:58 output false
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:21:52 params_cloud_connected false
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:02:35 params_events_1_cfg_rev 16
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:03:07 params_events_1_component sys
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:03:07 params_events_1_event scheduled_restart
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:02:35 params_events_1_restart_required false
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:03:07 params_events_1_time_ms 996
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:03:07 params_events_1_ts 1724050988.51
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:21:52 params_mqtt_connected true
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:24:58 params_switch_0_aenergy_by_minute_1 0.000
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:24:58 params_switch_0_aenergy_by_minute_2 0.000
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:24:58 params_switch_0_aenergy_by_minute_3 0.000
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:24:58 params_switch_0_aenergy_minute_ts 1724052300
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:24:58 params_switch_0_aenergy_total 0.002
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:21:52 params_switch_0_apower 0.0
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:21:52 params_switch_0_current 0.000
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:24:58 params_switch_0_id 0
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:21:52 params_switch_0_output false
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:21:52 params_switch_0_source init
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:21:52 params_switch_0_temperature_tC 38.8
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:21:52 params_switch_0_temperature_tF 101.9
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:21:52 params_switch_0_voltage 0.0
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:22:06 params_sys_available_updates_beta_version 1.4.2-beta1
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:21:52 params_sys_cfg_rev 18
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:21:52 params_sys_fs_free 106496
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:21:52 params_sys_fs_size 393216
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:21:52 params_sys_kvs_rev 0
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:21:52 params_sys_mac FCB4670C9098
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:21:52 params_sys_ram_free 144872
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:21:52 params_sys_ram_size 254080
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:21:52 params_sys_reset_reason 3
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:21:52 params_sys_restart_required false
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:21:52 params_sys_schedule_rev 0
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:21:52 params_sys_uptime 4
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:21:52 params_sys_webhook_rev 0
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:24:58 params_ts 1724052300.00
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:21:52 params_wifi_rssi -50
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:21:52 params_wifi_ssid Snocksland
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:21:52 params_wifi_sta_ip 192.168.1.109
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:21:52 params_wifi_status got ip
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:21:52 params_ws_connected false
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:04:29 plugs_ui {}
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:04:43 ram_free 143980
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:04:43 ram_size 254032
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:04:43 reset_reason 3
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:04:43 restart_required false
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:04:29 rssi -48
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:04:43 schedule_rev 0
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:20:58 source init
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:24:58 src shellyplusplugs-fcb4670c9098
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:04:29 ssid Snocksland
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:04:29 sta_ip 192.168.1.109
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:10:12 state set_toggle
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:04:29 status got ip
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:20:58 temperature_tC 38.9
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:20:58 temperature_tF 102.0
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:04:43 time 09:04
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:04:28 ts 0
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:04:43 unixtime 1724051085
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:04:43 uptime 19
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:20:58 voltage 0.0
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:04:43 webhook_rev 0
setstate MQTT2_shellyplusplugs_fcb4670c9098 2024-08-19 09:01:04 x_reboot set


Snocksman

Warum frag ich überhaupt... Ich finds doch eh selbst raus...  ;D

Das Devicetopic war nicht richtig gesetzt... Dort stand einfach nur shellyplusplugs. Nachdem ich das angepasst hatte, konnte ich das Device aus FHEM heraus schonmal schalten, aber das Devstateicon wurde mir noch falsch angezeigt. Nachdem ich in den MQTT-Einstellungen des Shelly dann noch Generic Status Update over MQTT aktiviert habe, funktioniert auch das problemlos.  8)

Snocksman

#2
Ich mach das Thema hier doch nochmal auf, da ich bei einer Sache gerade etwas überfragt bin...

Ich habe einen ShellyPlug S, welcher an der Waschmaschine hängt. Dieser hat in der readingsList einen Eintrag loadState, welcher bei über bzw. unterschreiten einer bestimmten Last, zwischen on und off wechselt. Anhand dessen lasse ich beim wechsel auf off, Alexa eine Ansage machen, dass die Waschmaschine fertig ist.

shellies/shellyplug-s-267AC1/relay/0/power:.* { my $compare = $EVTPART0 < 3 ? "off":"on"; ReadingsVal($NAME,"loadState","off") ne $compare ? { 'loadState' => $compare } : return }

Das neue ShellyPlusPlug S Device hat diesen Eintrag in der readingsList nicht und da sich die beiden Devices doch ziemlich unterscheiden, bekomme ich das auch nicht hinzugefügt (zumindest nicht so, dass es funktioniert)... Deswegen hier mal die Frage, ob mir da mal jemand helfen kann, das neue Device um diesen loadState zu erweitern...?

Hier das alte ShellyPlug S Device (mit loadState):
define Waschmaschine MQTT2_DEVICE shellyplug_s_267AC1
attr Waschmaschine IODev MQTT2_FHEM_Server
attr Waschmaschine comment To get appropriate loadState values: Change the default limit "100" in readingList to your needs.
attr Waschmaschine 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";; my $cons = ReadingsVal($name,"relay_0_power","unknown");; my $total = ReadingsVal($name,"relay_0_kWh","unknown");; my $temp = ReadingsVal($name,"temperature","-100");; my $pic = ReadingsVal($name,"loadState","") eq "on"?'scene_laundry_room_fem@green':'scene_laundry_room_fem';; my $text = ReadingsVal($name,"loadState","") eq "on"?"Waschmaschine läuft":'Standby';; "<a href=\"http://".ReadingsVal($name,"ip","none")." \"target=\"_blank\">".FW_makeImage($onl)."</a> <a href=\"/fhem?cmd.dummy=set $name toggle&XHR=1\">".FW_makeImage($pic)."</a><div>Verbrauch: $cons / Total: $total / Temp: $temp °C / $text</div>"}
attr Waschmaschine genericDeviceType switch
attr Waschmaschine model shelly1_w_energy_measuring
attr Waschmaschine readingList shellies/shellyplug-s-267AC1/relay/0:.* state\
  shellies/shellyplug-s-267AC1/relay/0:.* relay0\
  shellies/shellyplug-s-267AC1/input/0:.* input0\
  shellies/shellyplug-s-267AC1/online:.* online\
  shellies/announce:.* { $EVENT =~ m,..id...shellyplug-s-267AC1...mac.*, ? json2nameValue($EVENT) : return }\
  shellies/shellyplug-s-267AC1/announce:.* { json2nameValue($EVENT) }\
  shellies/shellyplug-s-267AC1/relay/0/power:.* relay_0_power\
  shellies/shellyplug-s-267AC1/relay/0/power:.* { my $compare = $EVTPART0 < 3 ? "off":"on";; ReadingsVal($NAME,"loadState","off") ne $compare ? { 'loadState' => $compare } : return }\
  shellies/shellyplug-s-267AC1/temperature:.* temperature\
  shellies/shellyplug-s-267AC1/temperature_f:.* temperature_f\
  shellies/shellyplug-s-267AC1/input_event/0:.* { json2nameValue($EVENT) }\
  shellies/shellyplug-s-267AC1/overtemperature:.* overtemperature\
  shellies/shellyplug-s-267AC1/relay/0/energy:.* relay_0_energy\
  shellies/shellyplug-s-267AC1/relay/0/energy:.* {'relay_0_kWh' => sprintf("%.2f",$EVENT/60/1000)}\
  shellies/shellyplug-s-267AC1/longpush/0:.* longpush_0\
shellyplug_s_267AC1:shellies/shellyplug-s-267AC1/info:.* { json2nameValue($EVENT) }
attr Waschmaschine room Anbau
attr Waschmaschine setList relay0:on,off,toggle shellies/shellyplug-s-267AC1/relay/0/command $EVTPART1\
  toggle:noArg shellies/shellyplug-s-267AC1/relay/0/command toggle\
  off:noArg shellies/shellyplug-s-267AC1/relay/0/command off\
  on:noArg shellies/shellyplug-s-267AC1/relay/0/command on\
  x_update:noArg shellies/shellyplug-s-267AC1/command update_fw\
  x_mqttcom shellies/shellyplug-s-267AC1/command $EVTPART1
attr Waschmaschine setStateList on off toggle
attr Waschmaschine userReadings total_temp:loadState:.on { ReadingsNum("$name","relay_0_kWh",0) },wash:loadState:.off { ReadingsNum("$name","total",0) - ReadingsNum("$name","total_temp",0) },price:loadState:.off {sprintf("%.2f",ReadingsNum("$name","wash",1)*ReadingsNum("kWh_Price","state",0.30))},time:loadState:.off {strftime("%H:%M", localtime(ReadingsAge("$name","total_temp",0)-3600))}, relay_0_energy_total:relay_0_energy:.* monotonic {ReadingsNum("$name","relay_0_energy",0)}
attr Waschmaschine webCmd :
#   CID        shellyplug_s_267AC1
#   DEF        shellyplug_s_267AC1
#   FUUID      602d02ed-f33f-e448-fb45-7dc6d6b96fe47341
#   IODev      MQTT2_FHEM_Server
#   LASTInputDev MQTT2_FHEM_Server
#   MQTT2_FHEM_Server_CONN MQTT2_FHEM_Server_192.168.1.100_11869
#   MQTT2_FHEM_Server_MSGCNT 634
#   MQTT2_FHEM_Server_TIME 2024-08-19 10:19:12
#   MSGCNT     634
#   NAME       Waschmaschine
#   NR         525
#   STATE      on
#   TYPE       MQTT2_DEVICE
#   eventCount 627
#   READINGS:
#     2024-08-19 09:31:22   IODev           MQTT2_FHEM_Server
#     2024-08-19 09:31:39   actions_stats_skipped 0
#     2024-08-19 09:31:39   cfg_changed_cnt 0
#     2024-08-19 09:31:39   cloud_connected false
#     2024-08-19 09:31:39   cloud_enabled   false
#     2024-08-19 09:31:39   fs_free         164907
#     2024-08-19 09:31:39   fs_size         233681
#     2024-08-19 09:31:39   fw_ver          20230913-113421/v1.14.0-gcb84623
#     2024-08-19 09:31:39   has_update      false
#     2024-08-19 09:31:39   id              shellyplug-s-267AC1
#     2024-08-19 09:31:39   ip              192.168.1.100
#     2024-08-16 21:31:11   loadState       off
#     2024-08-19 09:31:39   mac             2CF432267AC1
#     2024-08-19 09:31:39   meters_1_counters_1 0.000
#     2024-08-19 09:31:39   meters_1_counters_2 0.000
#     2024-08-19 09:31:39   meters_1_counters_3 0.000
#     2024-08-19 09:31:39   meters_1_is_valid true
#     2024-08-19 09:31:39   meters_1_overpower 0.00
#     2024-08-19 09:31:39   meters_1_power  0.00
#     2024-08-19 09:31:39   meters_1_timestamp 1724059901
#     2024-08-19 09:31:39   meters_1_total  0
#     2024-08-19 09:31:39   model           SHPLG-S
#     2024-08-19 09:31:39   mqtt_connected  true
#     2024-08-19 09:31:39   new_fw          false
#     2024-08-19 09:31:38   online          true
#     2024-08-19 10:19:09   overtemperature 0
#     2024-08-16 21:31:11   price           -0.22
#     2024-08-19 09:31:39   ram_free        39560
#     2024-08-19 09:31:39   ram_total       52056
#     2024-08-19 10:19:09   relay0          on
#     2024-08-19 10:19:12   relay_0_energy  0
#     2024-08-19 10:19:12   relay_0_energy_total 10605866
#     2024-08-19 10:19:12   relay_0_kWh     0.00
#     2024-08-19 10:19:09   relay_0_power   0.00
#     2024-08-19 09:31:39   relays_1_has_timer false
#     2024-08-19 09:31:39   relays_1_ison   true
#     2024-08-19 09:31:39   relays_1_overpower false
#     2024-08-19 09:31:39   relays_1_source input
#     2024-08-19 09:31:39   relays_1_timer_duration 0
#     2024-08-19 09:31:39   relays_1_timer_remaining 0
#     2024-08-19 09:31:39   relays_1_timer_started 0
#     2024-08-19 09:31:39   serial          1
#     2024-08-19 10:19:09   state           on
#     2024-08-19 10:19:09   temperature     30.71
#     2024-08-19 10:19:09   temperature_f   87.28
#     2024-08-19 09:31:39   time            09:31
#     2024-08-19 09:31:39   tmp_is_valid    true
#     2024-08-19 09:31:39   tmp_tC          30.88
#     2024-08-19 09:31:39   tmp_tF          87.58
#     2024-08-16 15:38:49   total_temp      0.72
#     2024-08-19 09:31:39   unixtime        1724052701
#     2024-08-19 09:31:39   update_beta_version 20231107-164219/v1.14.1-rc1-g0617c15
#     2024-08-19 09:31:39   update_has_update false
#     2024-08-19 09:31:39   update_new_version 20230913-113421/v1.14.0-gcb84623
#     2024-08-19 09:31:39   update_old_version 20230913-113421/v1.14.0-gcb84623
#     2024-08-19 09:31:39   update_status   idle
#     2024-08-19 09:31:39   uptime          4119
#     2024-08-16 21:31:11   wash            -0.72
#     2024-08-19 09:31:39   wifi_sta_connected true
#     2024-08-19 09:31:39   wifi_sta_ip     192.168.1.100
#     2024-08-19 09:31:39   wifi_sta_rssi   -70
#     2024-08-19 09:31:39   wifi_sta_ssid   Snocksland
#
setstate Waschmaschine on
setstate Waschmaschine 2024-08-19 09:31:22 IODev MQTT2_FHEM_Server
setstate Waschmaschine 2024-08-19 09:31:39 actions_stats_skipped 0
setstate Waschmaschine 2024-08-19 09:31:39 cfg_changed_cnt 0
setstate Waschmaschine 2024-08-19 09:31:39 cloud_connected false
setstate Waschmaschine 2024-08-19 09:31:39 cloud_enabled false
setstate Waschmaschine 2024-08-19 09:31:39 fs_free 164907
setstate Waschmaschine 2024-08-19 09:31:39 fs_size 233681
setstate Waschmaschine 2024-08-19 09:31:39 fw_ver 20230913-113421/v1.14.0-gcb84623
setstate Waschmaschine 2024-08-19 09:31:39 has_update false
setstate Waschmaschine 2024-08-19 09:31:39 id shellyplug-s-267AC1
setstate Waschmaschine 2024-08-19 09:31:39 ip 192.168.1.100
setstate Waschmaschine 2024-08-16 21:31:11 loadState off
setstate Waschmaschine 2024-08-19 09:31:39 mac 2CF432267AC1
setstate Waschmaschine 2024-08-19 09:31:39 meters_1_counters_1 0.000
setstate Waschmaschine 2024-08-19 09:31:39 meters_1_counters_2 0.000
setstate Waschmaschine 2024-08-19 09:31:39 meters_1_counters_3 0.000
setstate Waschmaschine 2024-08-19 09:31:39 meters_1_is_valid true
setstate Waschmaschine 2024-08-19 09:31:39 meters_1_overpower 0.00
setstate Waschmaschine 2024-08-19 09:31:39 meters_1_power 0.00
setstate Waschmaschine 2024-08-19 09:31:39 meters_1_timestamp 1724059901
setstate Waschmaschine 2024-08-19 09:31:39 meters_1_total 0
setstate Waschmaschine 2024-08-19 09:31:39 model SHPLG-S
setstate Waschmaschine 2024-08-19 09:31:39 mqtt_connected true
setstate Waschmaschine 2024-08-19 09:31:39 new_fw false
setstate Waschmaschine 2024-08-19 09:31:38 online true
setstate Waschmaschine 2024-08-19 10:19:09 overtemperature 0
setstate Waschmaschine 2024-08-16 21:31:11 price -0.22
setstate Waschmaschine 2024-08-19 09:31:39 ram_free 39560
setstate Waschmaschine 2024-08-19 09:31:39 ram_total 52056
setstate Waschmaschine 2024-08-19 10:19:09 relay0 on
setstate Waschmaschine 2024-08-19 10:19:12 relay_0_energy 0
setstate Waschmaschine 2024-08-19 10:19:12 relay_0_energy_total 10605866
setstate Waschmaschine 2024-08-19 10:19:12 relay_0_kWh 0.00
setstate Waschmaschine 2024-08-19 10:19:09 relay_0_power 0.00
setstate Waschmaschine 2024-08-19 09:31:39 relays_1_has_timer false
setstate Waschmaschine 2024-08-19 09:31:39 relays_1_ison true
setstate Waschmaschine 2024-08-19 09:31:39 relays_1_overpower false
setstate Waschmaschine 2024-08-19 09:31:39 relays_1_source input
setstate Waschmaschine 2024-08-19 09:31:39 relays_1_timer_duration 0
setstate Waschmaschine 2024-08-19 09:31:39 relays_1_timer_remaining 0
setstate Waschmaschine 2024-08-19 09:31:39 relays_1_timer_started 0
setstate Waschmaschine 2024-08-19 09:31:39 serial 1
setstate Waschmaschine 2024-08-19 10:19:09 state on
setstate Waschmaschine 2024-08-19 10:19:09 temperature 30.71
setstate Waschmaschine 2024-08-19 10:19:09 temperature_f 87.28
setstate Waschmaschine 2024-08-19 09:31:39 time 09:31
setstate Waschmaschine 2024-08-19 09:31:39 tmp_is_valid true
setstate Waschmaschine 2024-08-19 09:31:39 tmp_tC 30.88
setstate Waschmaschine 2024-08-19 09:31:39 tmp_tF 87.58
setstate Waschmaschine 2024-08-16 15:38:49 total_temp 0.72
setstate Waschmaschine 2024-08-19 09:31:39 unixtime 1724052701
setstate Waschmaschine 2024-08-19 09:31:39 update_beta_version 20231107-164219/v1.14.1-rc1-g0617c15
setstate Waschmaschine 2024-08-19 09:31:39 update_has_update false
setstate Waschmaschine 2024-08-19 09:31:39 update_new_version 20230913-113421/v1.14.0-gcb84623
setstate Waschmaschine 2024-08-19 09:31:39 update_old_version 20230913-113421/v1.14.0-gcb84623
setstate Waschmaschine 2024-08-19 09:31:39 update_status idle
setstate Waschmaschine 2024-08-19 09:31:39 uptime 4119
setstate Waschmaschine 2024-08-16 21:31:11 wash -0.72
setstate Waschmaschine 2024-08-19 09:31:39 wifi_sta_connected true
setstate Waschmaschine 2024-08-19 09:31:39 wifi_sta_ip 192.168.1.100
setstate Waschmaschine 2024-08-19 09:31:39 wifi_sta_rssi -70
setstate Waschmaschine 2024-08-19 09:31:39 wifi_sta_ssid Snocksland


Und hier das neue ShellyPlusPlug S Device:
define Waschmaschine_2 MQTT2_DEVICE shellyplusplugs_fcb4670c9098
attr Waschmaschine_2 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 Waschmaschine_2 devicetopic shellyplusplugs-fcb4670c9098
attr Waschmaschine_2 genericDeviceType switch
attr Waschmaschine_2 getList in_mode:noArg in_mode $DEVICETOPIC/rpc {"id": 1,"src":"$DEVICETOPIC", "method": "Switch.GetConfig", "params": {"id": 0}}
attr Waschmaschine_2 icon message_socket
attr Waschmaschine_2 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 Waschmaschine_2 model shellyPlus_1pm
attr Waschmaschine_2 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_fcb4670c9098:shellyplusplugs-fcb4670c9098/status/ble:.* ble\
shellyplusplugs_fcb4670c9098:shellyplusplugs-fcb4670c9098/status/ffs:.* { json2nameValue($EVENT) }\
shellyplusplugs_fcb4670c9098:shellyplusplugs-fcb4670c9098/status/plugs_ui:.* plugs_ui\
shellyplusplugs_fcb4670c9098:shellyplusplugs-fcb4670c9098/status/wifi:.* { json2nameValue($EVENT) }\
shellyplusplugs_fcb4670c9098:shellyplusplugs-fcb4670c9098/status/ws:.* { json2nameValue($EVENT) }
attr Waschmaschine_2 room Anbau
attr Waschmaschine_2 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 Waschmaschine_2 setStateList on off toggle on-for-timer off-for-timer
attr Waschmaschine_2 webCmd :
#   CFGFN     
#   CID        shellyplusplugs_fcb4670c9098
#   DEF        shellyplusplugs_fcb4670c9098
#   FUUID      66c2f5a9-f33f-e448-9bfb-c3182aa89f330b54
#   IODev      MQTT2_FHEM_Server
#   LASTInputDev MQTT2_FHEM_Server
#   MQTT2_FHEM_Server_CONN MQTT2_FHEM_Server_192.168.1.109_59334
#   MQTT2_FHEM_Server_MSGCNT 156
#   MQTT2_FHEM_Server_TIME 2024-08-19 10:18:58
#   MSGCNT     156
#   NAME       Waschmaschine_2
#   NR         894
#   STATE      off
#   TYPE       MQTT2_DEVICE
#   eventCount 166
#   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-08-19 09:35:05   IODev           MQTT2_FHEM_Server
#     2024-08-19 10:18:58   aenergy_total   0.009
#     2024-08-19 10:18:58   apower          0.0
#     2024-08-19 09:36:07   attrTemplateVersion 20220303
#     2024-08-19 09:38:08   ble             {}
#     2024-08-19 09:38:08   connected       false
#     2024-08-19 10:18:58   dst             shellyplusplugs-fcb4670c9098/events
#     2024-08-19 09:38:09   ip              192.168.1.109
#     2024-08-19 10:18:58   method          NotifyStatus
#     2024-08-19 09:38:09   mqtt_connected  true
#     2024-08-19 09:38:08   online          true
#     2024-08-19 09:38:09   params_cloud_connected false
#     2024-08-19 09:37:48   params_events_1_cfg_rev 21
#     2024-08-19 09:38:01   params_events_1_component sys
#     2024-08-19 09:38:01   params_events_1_event scheduled_restart
#     2024-08-19 09:37:48   params_events_1_restart_required false
#     2024-08-19 09:38:01   params_events_1_time_ms 996
#     2024-08-19 09:38:01   params_events_1_ts 1724053082.95
#     2024-08-19 09:38:09   params_mqtt_connected true
#     2024-08-19 10:18:58   params_switch_0_aenergy_by_minute_1 0.000
#     2024-08-19 10:18:58   params_switch_0_aenergy_by_minute_2 0.000
#     2024-08-19 10:18:58   params_switch_0_aenergy_by_minute_3 0.000
#     2024-08-19 10:18:58   params_switch_0_aenergy_minute_ts 1724055540
#     2024-08-19 10:18:58   params_switch_0_aenergy_total 0.009
#     2024-08-19 10:00:35   params_switch_0_apower 0
#     2024-08-19 10:00:35   params_switch_0_current 0
#     2024-08-19 10:18:58   params_switch_0_id 0
#     2024-08-19 10:00:35   params_switch_0_output false
#     2024-08-19 10:00:35   params_switch_0_source button
#     2024-08-19 10:00:35   params_switch_0_voltage 0
#     2024-08-19 09:38:18   params_sys_available_updates_beta_version 1.4.2-beta1
#     2024-08-19 09:38:09   params_sys_cfg_rev 21
#     2024-08-19 09:38:09   params_sys_fs_free 106496
#     2024-08-19 09:38:09   params_sys_fs_size 393216
#     2024-08-19 09:38:09   params_sys_kvs_rev 0
#     2024-08-19 09:38:09   params_sys_mac  FCB4670C9098
#     2024-08-19 09:38:09   params_sys_ram_free 144896
#     2024-08-19 09:38:09   params_sys_ram_size 254080
#     2024-08-19 09:38:09   params_sys_reset_reason 3
#     2024-08-19 09:38:09   params_sys_restart_required false
#     2024-08-19 09:38:09   params_sys_schedule_rev 0
#     2024-08-19 09:38:09   params_sys_uptime 4
#     2024-08-19 09:38:09   params_sys_webhook_rev 0
#     2024-08-19 10:18:58   params_ts       1724055540.00
#     2024-08-19 09:38:09   params_wifi_rssi -46
#     2024-08-19 09:38:09   params_wifi_ssid Snocksland
#     2024-08-19 09:38:09   params_wifi_status got ip
#     2024-08-19 09:38:09   params_ws_connected false
#     2024-08-19 09:38:08   plugs_ui        {}
#     2024-08-19 09:38:08   rssi            -46
#     2024-08-19 10:18:58   src             shellyplusplugs-fcb4670c9098
#     2024-08-19 09:38:08   ssid            Snocksland
#     2024-08-19 09:38:08   sta_ip          192.168.1.109
#     2024-08-19 10:18:58   state           off
#     2024-08-19 09:38:08   status          got ip
#     2024-08-19 10:18:58   switch_aenergy_by_minute_1 0.000
#     2024-08-19 10:18:58   switch_aenergy_by_minute_2 0.000
#     2024-08-19 10:18:58   switch_aenergy_by_minute_3 0.000
#     2024-08-19 10:18:58   switch_aenergy_minute_ts 1724055540
#     2024-08-19 10:18:58   switch_current  0.000
#     2024-08-19 10:18:58   switch_id       0
#     2024-08-19 10:18:58   switch_source   button
#     2024-08-19 10:18:58   switch_voltage  0.0
#     2024-08-19 09:38:18   sys_available_updates_beta_version 1.4.2-beta1
#     2024-08-19 09:38:18   sys_cfg_rev     21
#     2024-08-19 09:38:18   sys_fs_free     106496
#     2024-08-19 09:38:18   sys_fs_size     393216
#     2024-08-19 09:38:18   sys_kvs_rev     0
#     2024-08-19 09:38:18   sys_mac         FCB4670C9098
#     2024-08-19 09:38:18   sys_ram_free    143148
#     2024-08-19 09:38:18   sys_ram_size    253964
#     2024-08-19 09:38:18   sys_reset_reason 3
#     2024-08-19 09:38:18   sys_restart_required false
#     2024-08-19 09:38:18   sys_schedule_rev 0
#     2024-08-19 09:38:18   sys_time        09:38
#     2024-08-19 09:38:18   sys_unixtime    1724053099
#     2024-08-19 09:38:18   sys_uptime      15
#     2024-08-19 09:38:18   sys_webhook_rev 0
#     2024-08-19 10:18:58   temperature     37.8
#     2024-08-19 09:38:08   ts              0
#     2024-08-19 09:36:06   x_reboot        set
#
setstate Waschmaschine_2 off
setstate Waschmaschine_2 2024-08-19 09:35:05 IODev MQTT2_FHEM_Server
setstate Waschmaschine_2 2024-08-19 10:18:58 aenergy_total 0.009
setstate Waschmaschine_2 2024-08-19 10:18:58 apower 0.0
setstate Waschmaschine_2 2024-08-19 09:36:07 attrTemplateVersion 20220303
setstate Waschmaschine_2 2024-08-19 09:38:08 ble {}
setstate Waschmaschine_2 2024-08-19 09:38:08 connected false
setstate Waschmaschine_2 2024-08-19 10:18:58 dst shellyplusplugs-fcb4670c9098/events
setstate Waschmaschine_2 2024-08-19 09:38:09 ip 192.168.1.109
setstate Waschmaschine_2 2024-08-19 10:18:58 method NotifyStatus
setstate Waschmaschine_2 2024-08-19 09:38:09 mqtt_connected true
setstate Waschmaschine_2 2024-08-19 09:38:08 online true
setstate Waschmaschine_2 2024-08-19 09:38:09 params_cloud_connected false
setstate Waschmaschine_2 2024-08-19 09:37:48 params_events_1_cfg_rev 21
setstate Waschmaschine_2 2024-08-19 09:38:01 params_events_1_component sys
setstate Waschmaschine_2 2024-08-19 09:38:01 params_events_1_event scheduled_restart
setstate Waschmaschine_2 2024-08-19 09:37:48 params_events_1_restart_required false
setstate Waschmaschine_2 2024-08-19 09:38:01 params_events_1_time_ms 996
setstate Waschmaschine_2 2024-08-19 09:38:01 params_events_1_ts 1724053082.95
setstate Waschmaschine_2 2024-08-19 09:38:09 params_mqtt_connected true
setstate Waschmaschine_2 2024-08-19 10:18:58 params_switch_0_aenergy_by_minute_1 0.000
setstate Waschmaschine_2 2024-08-19 10:18:58 params_switch_0_aenergy_by_minute_2 0.000
setstate Waschmaschine_2 2024-08-19 10:18:58 params_switch_0_aenergy_by_minute_3 0.000
setstate Waschmaschine_2 2024-08-19 10:18:58 params_switch_0_aenergy_minute_ts 1724055540
setstate Waschmaschine_2 2024-08-19 10:18:58 params_switch_0_aenergy_total 0.009
setstate Waschmaschine_2 2024-08-19 10:00:35 params_switch_0_apower 0
setstate Waschmaschine_2 2024-08-19 10:00:35 params_switch_0_current 0
setstate Waschmaschine_2 2024-08-19 10:18:58 params_switch_0_id 0
setstate Waschmaschine_2 2024-08-19 10:00:35 params_switch_0_output false
setstate Waschmaschine_2 2024-08-19 10:00:35 params_switch_0_source button
setstate Waschmaschine_2 2024-08-19 10:00:35 params_switch_0_voltage 0
setstate Waschmaschine_2 2024-08-19 09:38:18 params_sys_available_updates_beta_version 1.4.2-beta1
setstate Waschmaschine_2 2024-08-19 09:38:09 params_sys_cfg_rev 21
setstate Waschmaschine_2 2024-08-19 09:38:09 params_sys_fs_free 106496
setstate Waschmaschine_2 2024-08-19 09:38:09 params_sys_fs_size 393216
setstate Waschmaschine_2 2024-08-19 09:38:09 params_sys_kvs_rev 0
setstate Waschmaschine_2 2024-08-19 09:38:09 params_sys_mac FCB4670C9098
setstate Waschmaschine_2 2024-08-19 09:38:09 params_sys_ram_free 144896
setstate Waschmaschine_2 2024-08-19 09:38:09 params_sys_ram_size 254080
setstate Waschmaschine_2 2024-08-19 09:38:09 params_sys_reset_reason 3
setstate Waschmaschine_2 2024-08-19 09:38:09 params_sys_restart_required false
setstate Waschmaschine_2 2024-08-19 09:38:09 params_sys_schedule_rev 0
setstate Waschmaschine_2 2024-08-19 09:38:09 params_sys_uptime 4
setstate Waschmaschine_2 2024-08-19 09:38:09 params_sys_webhook_rev 0
setstate Waschmaschine_2 2024-08-19 10:18:58 params_ts 1724055540.00
setstate Waschmaschine_2 2024-08-19 09:38:09 params_wifi_rssi -46
setstate Waschmaschine_2 2024-08-19 09:38:09 params_wifi_ssid Snocksland
setstate Waschmaschine_2 2024-08-19 09:38:09 params_wifi_status got ip
setstate Waschmaschine_2 2024-08-19 09:38:09 params_ws_connected false
setstate Waschmaschine_2 2024-08-19 09:38:08 plugs_ui {}
setstate Waschmaschine_2 2024-08-19 09:38:08 rssi -46
setstate Waschmaschine_2 2024-08-19 10:18:58 src shellyplusplugs-fcb4670c9098
setstate Waschmaschine_2 2024-08-19 09:38:08 ssid Snocksland
setstate Waschmaschine_2 2024-08-19 09:38:08 sta_ip 192.168.1.109
setstate Waschmaschine_2 2024-08-19 10:18:58 state off
setstate Waschmaschine_2 2024-08-19 09:38:08 status got ip
setstate Waschmaschine_2 2024-08-19 10:18:58 switch_aenergy_by_minute_1 0.000
setstate Waschmaschine_2 2024-08-19 10:18:58 switch_aenergy_by_minute_2 0.000
setstate Waschmaschine_2 2024-08-19 10:18:58 switch_aenergy_by_minute_3 0.000
setstate Waschmaschine_2 2024-08-19 10:18:58 switch_aenergy_minute_ts 1724055540
setstate Waschmaschine_2 2024-08-19 10:18:58 switch_current 0.000
setstate Waschmaschine_2 2024-08-19 10:18:58 switch_id 0
setstate Waschmaschine_2 2024-08-19 10:18:58 switch_source button
setstate Waschmaschine_2 2024-08-19 10:18:58 switch_voltage 0.0
setstate Waschmaschine_2 2024-08-19 09:38:18 sys_available_updates_beta_version 1.4.2-beta1
setstate Waschmaschine_2 2024-08-19 09:38:18 sys_cfg_rev 21
setstate Waschmaschine_2 2024-08-19 09:38:18 sys_fs_free 106496
setstate Waschmaschine_2 2024-08-19 09:38:18 sys_fs_size 393216
setstate Waschmaschine_2 2024-08-19 09:38:18 sys_kvs_rev 0
setstate Waschmaschine_2 2024-08-19 09:38:18 sys_mac FCB4670C9098
setstate Waschmaschine_2 2024-08-19 09:38:18 sys_ram_free 143148
setstate Waschmaschine_2 2024-08-19 09:38:18 sys_ram_size 253964
setstate Waschmaschine_2 2024-08-19 09:38:18 sys_reset_reason 3
setstate Waschmaschine_2 2024-08-19 09:38:18 sys_restart_required false
setstate Waschmaschine_2 2024-08-19 09:38:18 sys_schedule_rev 0
setstate Waschmaschine_2 2024-08-19 09:38:18 sys_time 09:38
setstate Waschmaschine_2 2024-08-19 09:38:18 sys_unixtime 1724053099
setstate Waschmaschine_2 2024-08-19 09:38:18 sys_uptime 15
setstate Waschmaschine_2 2024-08-19 09:38:18 sys_webhook_rev 0
setstate Waschmaschine_2 2024-08-19 10:18:58 temperature 37.8
setstate Waschmaschine_2 2024-08-19 09:38:08 ts 0
setstate Waschmaschine_2 2024-08-19 09:36:06 x_reboot set


tobi01001

Das liegt wohl daran, dass sich die die Namen geändert haben und jetzt json2nameValue($EVENT,'',$JSONMAP) mittels Attribut jsonMap genutzt wird.

Das gesuchte Reading scheint jetzt apower zu sein. Damit kannst du ein userReading "loadState" ergänzen.

attr Waschmaschine_2 userReadings loadState:apower {ReadingsNum("$name", "apower", 0)<3?"off":"on"}
Vorsicht, wenn du das so eingibst überschreibt es bestehende userReadings. Besser über fhemweb ergänzen. Außerdem hat dein "altes" Plug_s jede Menge Userreadings definiert, die du wahrscheinlich auch irgendwie portieren möchtet?
Im einfachsten Fall brauchst du da nur die Readingnamen zu korrigieren....
FHEM@UbuntuServer on Lenovo ThinkCentre M900 [i5-6500T / 8GB RAM] MySQL-DbLog, Grafana, FTUI3 / HmIP incl. CCU3 / LGESS / Wärempumpe über TA CMI und CANoE / Shellies u.v.m.

Snocksman

Hmmm, ne... Das funktioniert leider nicht. Ich habe das userReading hinzugefügt, bekomme aber trotzdem kein loadState Reading.  ???

tobi01001

Zitat von: Snocksman am 19 August 2024, 13:16:38Hmmm, ne... Das funktioniert leider nicht. Ich habe das userReading hinzugefügt, bekomme aber trotzdem kein loadState Reading.  ???
Gibt es denn ein Reading apower? Und loadState kommt dann wahrscheinlich erst bei Änderung von apower. Also wenn die Waschmaschine grad nicht läuft, wirds wohl dauern...
Was passiert bei einem "setreading Waschmaschine_2 apower 10"
FHEM@UbuntuServer on Lenovo ThinkCentre M900 [i5-6500T / 8GB RAM] MySQL-DbLog, Grafana, FTUI3 / HmIP incl. CCU3 / LGESS / Wärempumpe über TA CMI und CANoE / Shellies u.v.m.

Snocksman

Zitat von: tobi01001 am 19 August 2024, 13:22:59Gibt es denn ein Reading apower?
Ja, gibt es. Liegt aktuell bei 0,0 Watt, da die Waschmaschine aus ist.

Zitat von: tobi01001 am 19 August 2024, 13:22:59Und loadState kommt dann wahrscheinlich erst bei Änderung von apower. Also wenn die Waschmaschine grad nicht läuft, wirds wohl dauern...
Allein, wenn ich die Waschmaschine einschalte, steigt apower auf 2,3 Watt... Das sollte doch reichen, um das ganze zu triggern... Ja, ist unter 3 Watt, deswegen sollte nur ein "off" für loadState dabei raus kommen, aber angelegt werden sollte loadState, oder ?

Zitat von: tobi01001 am 19 August 2024, 13:22:59Was passiert bei einem "setreading Waschmaschine_2 apower 10"
Dann geht apower für kurze Zeit auf den Wert 10, das Reading loadState wird aber trotzdem nicht angelegt.

tobi01001

Sorry, mach mal bitte attr Waschmaschine_2 userReadings loadState:apower:.* {ReadingsNum("$name", "apower", 0)<3?"off":"on"}
FHEM@UbuntuServer on Lenovo ThinkCentre M900 [i5-6500T / 8GB RAM] MySQL-DbLog, Grafana, FTUI3 / HmIP incl. CCU3 / LGESS / Wärempumpe über TA CMI und CANoE / Shellies u.v.m.

Snocksman

Perfekt ! Jetzt funktioniert es ! Danke !  8)

Snocksman

Zu früh gefreut... Ich habe gerade den Rest inkl. Alexa "Alarmierung" eingerichtet und das Ergebnis sieht so aus, dass Alexa in einer Tour sagt, dass die Waschmaschine fertig ist...  :))

Ich vermute, dass das Reading loadState jetzt in einer Tour aktualisiert wird und bei jedem neuen "off" Alexa auf ein neues sprechen lässt.

Kann man in das Userreading noch irgendwas einbauen, dass loadState nur auf off gesetzt wird, wenn es nicht schon auf off ist (das gleiche natürlich für on) ?

Snocksman

Hab jetzt noch ein Dummydevice zwischengehängt und das ganze so quasi "entprellt"...

define act_on_Waschmaschine_2_off notify Waschmaschine_2:loadState:.off { if (Value("Waschload") eq "on") { fhem("set Waschload off") }}

define act_on_Waschmaschine_2_on notify Waschmaschine_2:loadState:.on { if (Value("Waschload") eq "off") { fhem("set Waschload on") }}

Wenn jemand noch eine schönere Lösung einfällt, bitte melden. Funktionieren tut es so jedenfalls.

tobi01001

Guten Morgen,

das userReading erzeugt mit jeder Änderung von apower ein Event weil das Reading aktualisiert wird.

Der Weg über notify funktioniert (ginge eleganter auch mit einem) natürlich. Einfacher wäre in dem Fall allerdings ein
attr Waschmaschine_2 event-on-change-reading loadState.

Damit löst loadState nur dann ein Event aus, wenn sich der Wert auch ändert.


Gruß
FHEM@UbuntuServer on Lenovo ThinkCentre M900 [i5-6500T / 8GB RAM] MySQL-DbLog, Grafana, FTUI3 / HmIP incl. CCU3 / LGESS / Wärempumpe über TA CMI und CANoE / Shellies u.v.m.

Beta-User

Zitat von: Snocksman am 19 August 2024, 17:23:25Kann man in das Userreading noch irgendwas einbauen, dass loadState nur auf off gesetzt wird, wenn es nicht schon auf off ist (das gleiche natürlich für on) ?
Klar. Wenn der Wert sich nicht ändert, gibt man einfach "nichts" zurück. Also ein schlichtes "return;"... Du mußt halt vorher den on/off-Wert in eine Variable schreiben und die dann vergleichen.

Der Weg über das "event-on-.."-Attribut wie vorgeschlagen wird dagegen vermutlich zu viele Events unterdrücken.
Server: HP-elitedesk@Debian 12, aktuelles FHEM@ConfigDB | CUL_HM (VCCU) | MQTT2: ZigBee2mqtt, MiLight@ESP-GW, BT@OpenMQTTGw | ZWave | SIGNALduino | MapleCUN | RHASSPY
svn: u.a Weekday-&RandomTimer, Twilight,  div. attrTemplate-files, MySensors

tobi01001

Zitat von: Beta-User am 20 August 2024, 08:15:35Klar. Wenn der Wert sich nicht ändert, gibt man einfach "nichts" zurück. Also ein schlichtes "return;"... Du mußt halt vorher den on/off-Wert in eine Variable schreiben und die dann vergleichen.
Ahh, ein return; im userReading aktualisiert nichts und löst dann auch kein event aus. Mit dieser Erkenntnis hätte ich mir einige Umwege ersparen können. ;-) Danke. Meine "Versuche" scheiterten meist daran, dass ich anstatt return;, auf ein return verzichtet hatte, was - am Beispiel userReading - das Reading lediglich gelöscht hatte...

@Snocksman: so in etwa: loadState:apower:.* { my $newState = ReadingsNum("$name", "apower", 0)<3?"off":"on"; if($newState ne ReadingsVal("$name", "loadState", "off")) {return $newState}else{return;} }
Zitat von: Beta-User am 20 August 2024, 08:15:35Der Weg über das "event-on-.."-Attribut wie vorgeschlagen wird dagegen vermutlich zu viele Events unterdrücken.
Welche gewollten Events soll das denn unterdrücken? Die Anzahl der Events ist doch mit denen im userReading absolut identisch. Wenn sich der Wert von on zu off oder umgekehrt ändert, wird ein Event ausgelöst - sonst nicht.

Aber die Events am "Ursprung" gar nicht erst zu erzeugen, erscheint mir dennoch eleganter.
FHEM@UbuntuServer on Lenovo ThinkCentre M900 [i5-6500T / 8GB RAM] MySQL-DbLog, Grafana, FTUI3 / HmIP incl. CCU3 / LGESS / Wärempumpe über TA CMI und CANoE / Shellies u.v.m.

Snocksman

Ahhh, sehr schön, danke !  Dann werde ich nachher nochmal ein wenig mit den neuen Infos rumtesten. Das mit dem Dummy-Device funktioniert, aber elegant ist sicherlich anders.