[gelöst] Shelly Plus 1 - Anbindung

Begonnen von smoudo, 26 Dezember 2021, 15:58:21

Vorheriges Thema - Nächstes Thema

vic

Danke 87insane für deine Hilfe und Geduld

Ich hatte bereits auf generic gesetzt mit dem Ergebnis dass keine Kommunikation mehr zwischen Shelly und FHEM  erfolgte.

Anbei mein Listing:


   CFGFN      ./FHEM/fhem_020_Erdgeschoss.cfg
   CID        shellyplus1_a8032abcd5e8
   DEF        shellyplus1_a8032abcd5e8
   DEVICETOPIC shellyplus1-a8032abcd5e8
   FUUID      61bf3776-f33f-0f0b-0601-94a5f78e1f0867d0
   IODev      MQTT2
   LASTInputDev MQTT2
   MQTT2_CONN MQTT2_192.168.10.149_59390
   MQTT2_MSGCNT 6
   MQTT2_TIME 2021-12-28 16:33:33
   MSGCNT     6
   NAME       SH_AKT_149_AntiMuecken
   NR         226
   STATE      on
   TYPE       MQTT2_DEVICE
   JSONMAP:
     params_switch_0_aenergy_total aenergy_total
     params_switch_0_apower apower
     params_wifi_sta_ip ip
     temperature_tC temperature
     temperature_tF 0
   READINGS:
     2021-12-28 14:14:15   IODev           MQTT2
     2021-12-24 11:42:44   aenergy_total   0.000
     2021-12-24 11:42:00   apower          0.0
     2021-12-20 07:39:26   attrTemplateVersion 20211128
     2021-12-28 16:33:33   dst             shellyplus1-a8032abcd5e8/events
     2021-12-28 16:06:57   id              0
     2021-12-28 10:59:36   ip              192.168.10.149
     2021-12-28 16:33:33   method          NotifyStatus
     2021-12-28 10:56:52   mqtt_connected  true
     2021-12-28 14:14:48   online          true
     2021-12-28 11:08:49   params_events_1_cfg_rev 10
     2021-12-28 11:08:49   params_events_1_component input:0
     2021-12-28 11:08:49   params_events_1_event config_changed
     2021-12-28 11:08:49   params_events_1_id 0
     2021-12-28 11:08:49   params_events_1_restart_required false
     2021-12-28 11:08:49   params_events_1_ts 1640686130.02
     2021-12-28 14:14:48   params_mqtt_connected false
     2021-12-28 16:33:33   params_switch_0_id 0
     2021-12-28 16:06:57   params_switch_0_output true
     2021-12-28 16:06:57   params_switch_0_source MQTT
     2021-12-28 16:33:33   params_switch_0_temperature_tC 59.06
     2021-12-28 16:33:33   params_switch_0_temperature_tF 138.30
     2021-12-28 10:59:45   params_sys_available_updates_beta_version 0.9.2-beta2
     2021-12-28 10:58:52   params_sys_restart_required true
     2021-12-28 16:33:33   params_ts       1640705613.51
     2021-12-28 10:59:36   params_wifi_rssi -60
     2021-12-28 10:59:36   params_wifi_ssid Lienta_01
     2021-12-28 10:59:36   params_wifi_status got ip
     2021-12-28 16:06:57   result_was_on   false
     2021-12-28 11:00:03   rpc_dst         fhem
     2021-12-28 11:00:03   rpc_id          0
     2021-12-28 11:00:03   rpc_result_was_on true
     2021-12-28 11:00:03   rpc_src         shellyplus1-a8032abcd5e8
     2021-12-28 16:33:33   src             shellyplus1-a8032abcd5e8
     2021-12-28 16:06:55   state           on
     2021-12-28 10:57:29   switch_0_id     0
     2021-12-28 10:57:29   switch_0_output true
     2021-12-28 10:57:29   switch_0_source MQTT
     2021-12-28 10:57:00   sys_available_updates_beta_version 0.9.2-beta2
     2021-12-28 10:57:00   sys_cfg_rev     6
     2021-12-28 10:57:00   sys_fs_free     241664
     2021-12-28 10:57:00   sys_fs_size     458752
     2021-12-28 10:57:00   sys_mac         A8032ABCD5E8
     2021-12-28 10:57:00   sys_ram_free    181236
     2021-12-28 10:57:00   sys_ram_size    249684
     2021-12-28 10:57:00   sys_restart_required false
     2021-12-28 10:57:00   sys_time        10:57
     2021-12-28 10:57:00   sys_unixtime    1640685420
     2021-12-28 10:57:00   sys_uptime      9
     2021-12-28 10:57:29   temperature     53.5
Attributes:
   alias      Anti-Mücken 1
   comment    devStateIcon:

Original:
{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 = ReadingsVal($name,'switch_0_output','false') =~ m{false|off}?'off':'on';; $light = FW_makeImage($light);; my $ip = ReadingsVal($name,'ip','none');; qq(<a href="http://$ip"target="_blank">${onl}</a><a href="/fhem?cmd.dummy=set $name toggle&XHR=1">${light}</a>)}

Vorschlag:
on:rc_GREEN:off off:rc_RED:on absent:rc_BLUE:off Error:rc_YELLOW:off

Aktuell:
{my $onl = ReadingsVal($name,"online","false") eq "false" ? "rot" : ReadingsVal($name,"new_fw","false") eq "true" ? "gelb" : "gruen";; my $light = ReadingsVal($name,"state","off");; 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>" }
   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");; 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>" }
   devicetopic shellyplus1-a8032abcd5e8
   event-on-change-reading .*
   group      Sommer
   icon       message_socket
   jsonMap    params_switch_0_aenergy_total:aenergy_total params_switch_0_apower:apower temperature_tC:temperature temperature_tF:0 params_wifi_sta_ip:ip
   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:.* { json2nameValue($EVENT, 'switch_0_', $JSONMAP) }
shellyplus1_a8032abcd5e8:fhem/rpc:.* { json2nameValue($EVENT) }
   room       MQTT2_DEVICE
   setList    toggle:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"Switch.Toggle","params": {"id":0}}
  off:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"Switch.Set","params": {"id":0,"on":false}}
  on:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"Switch.Set","params": {"id":0,"on":true}}
  on-for-timer $DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"Switch.Set","params": {"id":0,"on":true,"toggle_after":$EVTPART1}}
  x_update:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"Shelly.Update","params": {"stage":"stable"}}
  x_reboot:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"Shelly.Reboot"}
   webCmd     :


Beste Grüsse
Claudio
Raspberry Pi 4
RFXTRX 868MHz und 433MHz
FS20, Intertechno, Homematic, Shelly
MAX!-Cube, Philips HUE-Bridge

87insane

#16
Hey,

ich versuch es nochmal... Leider ist bei deinem ganzen hin und her kopieren einiges krum geraten aber ich meine noch immer du hast eine falsche JSON MAP.
Ich hab dir oben ein RAW gepostet und du muss einfach nur die Dinge übernehmen. Aber das geht mit den devstateicon usw NUR, wenn es auch in der MAP richtig steht.

Meine Zeile:
params_switch_0_aenergy_total:aenergy_total switch_0_apower:apower switch_0_temperature_tC:temperature switch_0_temperature_tF:0 params_wifi_sta_ip:ip

Deine Zeile:
params_switch_0_aenergy_total:aenergy_total params_switch_0_apower:apower temperature_tC:temperature temperature_tF:0 params_wifi_sta_ip:ip

Diese Zeile hier ist ggf nur ein C&P Fehler?
{my $onl = ReadingsVal($name,"online","false") eq "false" ? "rot" : ReadingsVal($name,"new_fw","false") eq "true" ? "gelb" : "gruen";; my $light = ReadingsVal($name,"state","off");; 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>" }
   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");; 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>" }


Bitte geh die Attribute nochmal genau durch und setze sie, wie in meinem RAW.
Ggf einfach löschen und neu anlegen?

EDIT: Anbei mal der Link und was ich hier auch sage... https://forum.fhem.de/index.php/topic,94060.msg1195493.html#msg1195493

Nochmal EDIT: Dein online steht sogar auf true. Aber ich glaube durch das ganze testen macht es Sinn, einmal löschen und neu anlegen. DANACH nochmal ein komplettes RAW.
Wenn du Ihn neu anlegst, dann am besten auch einmal ein RAW posten wie er bei dir aussieht, nach frischem autocreate. Am besten den Shelly einmal neustarten dafür.

Gruß,
87Insane

87insane

#17
Hey und guten Abend....

bei dem ganzen hin und her hat sich keiner mehr getraut?
Was haltet ihr von einem sauberen Status? Ich würde vorschlagen das EVENT ein wenig auseinander zu nehmen und es dann auch in state zu schreiben. Wer auf die Idee kommt das on/off weg zu nehmen.. Naja egal.

Vorschlag für einen weiteren Eintrag in readingList:
  $DEVICETOPIC/events/rpc:.*  { $EVENT =~ s/true/"on"/g; $EVENT =~ s/false/"off"/g; $EVENT =~ m,(on|off),g ? { state => $1 } : undef }
auf rpc oder ggf besser auf switch_0? (einer von beiden reicht. Ich glaube aber das sich RPC als unsinnig erweisen wird)
  $DEVICETOPIC/status/switch_0:.* { $EVENT =~ s/true/"on"/g; $EVENT =~ s/false/"off"/g; $EVENT =~ m,(on|off),g ? { state => $1 } : undef }
schreibt on/off in state. Dann kann man auch einfach das normale devstateicon nehmen....

das könnte so aussehen:
{
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 = ReadingsVal($name,'state','false');
$light = FW_makeImage($light);
my $cons = ReadingsNum($name,'apower',0);
my $total = round(ReadingsNum($name,'aenergy_total',0)/1000,1);
my $temp = ReadingsVal($name,'temperature','-100');
my $ip = ReadingsVal($name,'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>)
}


Sieht dann so aus wie im Bild. Die Werte müsst Ihr Euch vorstellen. Ich habe keinen Verbraucher angeschlossen.


Anbei noch das zu bearbeitende EVENT (JSON), der Vollständigkeit halber:
{
  "src": "shellyplus1pm-7c87ce658380",
  "dst": "shellyplus1pm-7c87ce658380/events",
  "method": "NotifyStatus",
  "params": {
    "ts": 1640880331.21,
    "switch:0": {
      "id": 0,
      "output": true,
      "source": "MQTT"
    }
  }
}

vic

Vielen Dank für deine Hartnäckigkeit 87insane

Wenn du auf das Icon klickst wechselt auch die Darstellung (von Lampe light_light_dim_100 auf light_light)?
Bei mir schaltet der Aktor (licht geht an oder aus) das Icon wechselt jedoch von z.B. FS20.off auf toggle und bleibt dann egal wie ich schalte. Wenn ich jedoch mit dem Befehl set Shelly on (oder off) schalte erscheint das korrekte Icon (FS20.off oder FS20.on).


Internals:
   CFGFN      ./FHEM/fhem_020_Erdgeschoss.cfg
   CID        shellyplus1_a8032abcd5e8
   DEF        shellyplus1_a8032abcd5e8
   DEVICETOPIC shellyplus1-a8032abcd5e8
   FUUID      61bf3776-f33f-0f0b-0601-94a5f78e1f0867d0
   IODev      MQTT2
   LASTInputDev MQTT2
   MQTT2_CONN MQTT2_192.168.10.149_59434
   MQTT2_MSGCNT 32
   MQTT2_TIME 2021-12-31 09:06:37
   MSGCNT     32
   NAME       SH_AKT_149_AntiMuecken
   NR         226
   STATE      off
   TYPE       MQTT2_DEVICE
   JSONMAP:
     params_switch_0_aenergy_total aenergy_total
     params_switch_0_apower apower
     params_wifi_sta_ip ip
     temperature_tC temperature
     temperature_tF 0
   READINGS:
     2021-12-30 14:36:40   IODev           MQTT2
     2021-12-24 11:42:44   aenergy_total   0.000
     2021-12-24 11:42:00   apower          0.0
     2021-12-20 07:39:26   attrTemplateVersion 20211128
     2021-12-31 09:06:37   dst             shellyplus1-a8032abcd5e8/events
     2021-12-31 08:55:54   id              0
     2021-12-28 10:59:36   ip              192.168.10.149
     2021-12-31 09:06:37   method          NotifyStatus
     2021-12-28 10:56:52   mqtt_connected  true
     2021-12-30 14:37:14   online          true
     2021-12-29 12:06:22   params_events_1_cfg_rev 11
     2021-12-29 12:06:22   params_events_1_component input:0
     2021-12-29 12:06:22   params_events_1_event config_changed
     2021-12-29 12:06:22   params_events_1_id 0
     2021-12-29 12:06:22   params_events_1_restart_required false
     2021-12-29 12:06:22   params_events_1_ts 1640775982.68
     2021-12-30 14:37:14   params_mqtt_connected false
     2021-12-31 09:06:37   params_switch_0_id 0
     2021-12-31 09:06:37   params_switch_0_output false
     2021-12-31 09:06:37   params_switch_0_source MQTT
     2021-12-31 02:10:10   params_switch_0_temperature_tC 54.00
     2021-12-31 02:10:10   params_switch_0_temperature_tF 129.20
     2021-12-30 10:59:41   params_sys_available_updates_beta_version 0.9.2-beta2
     2021-12-28 10:58:52   params_sys_restart_required true
     2021-12-31 09:06:37   params_ts       1640937997.76
     2021-12-28 10:59:36   params_wifi_rssi -60
     2021-12-28 10:59:36   params_wifi_ssid Lienta_01
     2021-12-28 10:59:36   params_wifi_status got ip
     2021-12-31 08:55:54   result_was_on   false
     2021-12-29 19:34:22   rpc_dst         fhem
     2021-12-29 19:34:22   rpc_id          0
     2021-12-29 19:34:22   rpc_result_was_on false
     2021-12-29 19:34:22   rpc_src         shellyplus1-a8032abcd5e8
     2021-12-31 09:06:37   src             shellyplus1-a8032abcd5e8
     2021-12-31 09:06:36   state           off
     2021-12-28 10:57:29   switch_0_id     0
     2021-12-28 10:57:29   switch_0_output true
     2021-12-28 10:57:29   switch_0_source MQTT
     2021-12-28 10:57:00   sys_available_updates_beta_version 0.9.2-beta2
     2021-12-28 10:57:00   sys_cfg_rev     6
     2021-12-28 10:57:00   sys_fs_free     241664
     2021-12-28 10:57:00   sys_fs_size     458752
     2021-12-28 10:57:00   sys_mac         A8032ABCD5E8
     2021-12-28 10:57:00   sys_ram_free    181236
     2021-12-28 10:57:00   sys_ram_size    249684
     2021-12-28 10:57:00   sys_restart_required false
     2021-12-28 10:57:00   sys_time        10:57
     2021-12-28 10:57:00   sys_unixtime    1640685420
     2021-12-28 10:57:00   sys_uptime      9
     2021-12-28 10:57:29   temperature     53.5
Attributes:
   alias      Anti-Mücken 1
   comment    devStateIcon:

Original:
{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 = ReadingsVal($name,'switch_0_output','false') =~ m{false|off}?'off':'on';; $light = FW_makeImage($light);; my $ip = ReadingsVal($name,'ip','none');; qq(<a href="http://$ip"target="_blank">${onl}</a><a href="/fhem?cmd.dummy=set $name toggle&XHR=1">${light}</a>)}

Vorschlag:
on:rc_GREEN:off off:rc_RED:on absent:rc_BLUE:off Error:rc_YELLOW:off

Aktuell:
{my $onl = ReadingsVal($name,"online","false") eq "false" ? "rot" : ReadingsVal($name,"new_fw","false") eq "true" ? "gelb" : "gruen";; my $light = ReadingsVal($name,"state","off");; 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>" }
   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 = ReadingsVal($name,'state','false');
$light = FW_makeImage($light);
my $cons = ReadingsNum($name,'apower',0);
my $total = round(ReadingsNum($name,'aenergy_total',0)/1000,1);
my $temp = ReadingsVal($name,'temperature','-100');
my $ip = ReadingsVal($name,'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>)
}
   devicetopic shellyplus1-a8032abcd5e8
   event-on-change-reading .*
   group      Sommer
   icon       message_socket
   jsonMap    params_switch_0_aenergy_total:aenergy_total params_switch_0_apower:apower temperature_tC:temperature temperature_tF:0 params_wifi_sta_ip:ip
   model      shellyPlus_1
   readingList $DEVICETOPIC/online:.* online
$DEVICETOPIC/events/switch_0:.* { json2nameValue($EVENT,'',$JSONMAP) }
  $DEVICETOPIC/status/mqtt:.* { json2nameValue($EVENT, 'mqtt_', $JSONMAP) }
  $DEVICETOPIC/status/sys:.* { json2nameValue($EVENT, 'sys_', $JSONMAP) }
  $DEVICETOPIC/status/switch_0:.* { $EVENT =~ s/true/"on"/g; $EVENT =~ s/false/"off"/g; $EVENT =~ m,(on|off),g ? { state => $1 } : undef }
shellyplus1_a8032abcd5e8:shellyplus1-a8032abcd5e8/events/rpc:.* { json2nameValue($EVENT) }
   room       MQTT2_DEVICE
   setList    toggle:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"Switch.Toggle","params": {"id":0}}
  off:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"Switch.Set","params": {"id":0,"on":false}}
  on:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"Switch.Set","params": {"id":0,"on":true}}
  on-for-timer $DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"Switch.Set","params": {"id":0,"on":true,"toggle_after":$EVTPART1}}
  x_update:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"Shelly.Update","params": {"stage":"stable"}}
  x_reboot:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"Shelly.Reboot"}
   webCmd     :


Wohin darf ich den folgenden Code platzieren?

{
  "src": "shellyplus1pm-7c87ce658380",
  "dst": "shellyplus1pm-7c87ce658380/events",
  "method": "NotifyStatus",
  "params": {
    "ts": 1640880331.21,
    "switch:0": {
      "id": 0,
      "output": true,
      "source": "MQTT"
    }
  }
}


Danke für eure Hilfe
Raspberry Pi 4
RFXTRX 868MHz und 433MHz
FS20, Intertechno, Homematic, Shelly
MAX!-Cube, Philips HUE-Bridge

OdfFhem

@vic

Der Code ist kein Code, sondern stellt das Event-Ergebnis dar, das verarbeitet werden soll ...

87insane

Bitte übernimm die Attribute aus meinem. Raw (entspricht fast dem aktuellen Template). Dann fügst du der readingList eines der "neuen" readings aus meinem Beitrag hinzu.
Und als devstateicon, das aus meinem letzten Post. Ich sehe keinen Grund warum das nicht gehen sollte. Solange du das auch richtig eingefügt hast.

Der readingList Eintrag schreibt einfach sauber on oder off in state. Somit kann devstateicon auch auf diesen zurückgreifen. Aktuell ist in meinen Augen keine setstatelist notwendig. Solltest du dieses Attribut drin haben, bitte löschen.

Es ist auch wichtig das du alles sauber machst...daher - entweder kennst du die Befehle um das Gerät auf zu räumen oder du löscht es und lässt es durch autocreate neu anlegen, und kopierst, wie oben beschrieben, alles rein. Natürlich muss du bei devstatetopic, die ID deines shellys eintragen.

Bin gespannt,
87insane

Und sende - wenn es nicht geht, bitte einfach ein unbearbeites RAW.

vic

Hallo 87insane

Nun habe ich alles mögliche probiert. Bin einfach zu blöde um das zu realisieren.

Anbei ein raw nach dem autocreate:
define MQTT2_shellyplus1_a8032abcd5e8 MQTT2_DEVICE shellyplus1_a8032abcd5e8
setuuid MQTT2_shellyplus1_a8032abcd5e8 61cf1165-f33f-0f0b-eff8-dd8f99d7cd957472
attr MQTT2_shellyplus1_a8032abcd5e8 readingList shellyplus1_a8032abcd5e8:shellyplus1-a8032abcd5e8/online:.* online\
shellyplus1_a8032abcd5e8:shellyplus1-a8032abcd5e8/events/rpc:.* { json2nameValue($EVENT) }
attr MQTT2_shellyplus1_a8032abcd5e8 room MQTT2_DEVICE
define FileLog_MQTT2_shellyplus1_a8032abcd5e8 FileLog ./log/MQTT2_shellyplus1_a8032abcd5e8-%Y.log MQTT2_shellyplus1_a8032abcd5e8
setuuid FileLog_MQTT2_shellyplus1_a8032abcd5e8 61cf1165-f33f-0f0b-066a-53d6290c6ea9473c
attr FileLog_MQTT2_shellyplus1_a8032abcd5e8 logtype text
attr FileLog_MQTT2_shellyplus1_a8032abcd5e8 room MQTT2_DEVICE



Nach dem Anwenden des Template shellyPlus_1:
defmod MQTT2_shellyplus1_a8032abcd5e8 MQTT2_DEVICE shellyplus1_a8032abcd5e8
attr MQTT2_shellyplus1_a8032abcd5e8 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 = ReadingsVal($name,'switch_0_output','false') =~ m{false|off}?'off':'on';;;; $light = FW_makeImage($light);;;; my $ip = ReadingsVal($name,'ip','none');;;; qq(<a href="http://$ip"target="_blank">${onl}</a><a href="/fhem?cmd.dummy=set $name toggle&XHR=1">${light}</a>)}
attr MQTT2_shellyplus1_a8032abcd5e8 devicetopic shellyplus1-a8032abcd5e8
attr MQTT2_shellyplus1_a8032abcd5e8 icon message_socket
attr MQTT2_shellyplus1_a8032abcd5e8 jsonMap params_switch_0_aenergy_total:aenergy_total params_switch_0_apower:apower temperature_tC:temperature temperature_tF:0 params_wifi_sta_ip:ip
attr MQTT2_shellyplus1_a8032abcd5e8 model shellyPlus_1
attr MQTT2_shellyplus1_a8032abcd5e8 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:.* { json2nameValue($EVENT, 'switch_0_', $JSONMAP) }
attr MQTT2_shellyplus1_a8032abcd5e8 room MQTT2_DEVICE
attr MQTT2_shellyplus1_a8032abcd5e8 setList toggle:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"Switch.Toggle","params": {"id":0}}\
  off:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"Switch.Set","params": {"id":0,"on":false}}\
  on:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"Switch.Set","params": {"id":0,"on":true}}\
  on-for-timer $DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"Switch.Set","params": {"id":0,"on":true,"toggle_after":$EVTPART1}}\
  x_update:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"Shelly.Update","params": {"stage":"stable"}}\
  x_reboot:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"Shelly.Reboot"}

setstate MQTT2_shellyplus1_a8032abcd5e8 2021-12-31 15:20:12 IODev MQTT2
setstate MQTT2_shellyplus1_a8032abcd5e8 2021-12-31 15:23:02 attrTemplateVersion 20211128



Das Icon bleibt auf FS20.off (auch wenn ich mit on oder off steuere)
Raspberry Pi 4
RFXTRX 868MHz und 433MHz
FS20, Intertechno, Homematic, Shelly
MAX!-Cube, Philips HUE-Bridge

Helmi55

Hallo 87insane

ich versuche mich gerade am selben Problem

Ich hab deine RAW aus #9 verwendet und an meinen shelly angepasst
Beim RAW Import habe ich die Fehlermeldung "genericDeviceType" nicht vorhanden erhalten.
Wenn ich in den attr nachsehe, ist dieses auch nicht vorhanden? - Hat du deinen in HomeKit eingebunden?

Ich kann den Shelly in FHEM nicht schalten, aber wenn ich den Shelly auf der WebOberfläache schalte - sehe ich das Ergebnis in FHEM

Hier meine RAW
defmod MQTT2_shellyplus1pm_44179394cab4 MQTT2_DEVICE shellyplus1pm_44179394cab4
attr MQTT2_shellyplus1pm_44179394cab4 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 = ReadingsVal($name,'output','false') =~ m{false|off}?'off':'on';; $light = FW_makeImage($light);; my $cons = ReadingsNum($name,'apower',0);; my $total = round(ReadingsNum($name,'aenergy_total',0)/1000,1);; my $temp = ReadingsVal($name,'temperature','-100');; my $ip = ReadingsVal($name,'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_shellyplus1pm_44179394cab4 devicetopic shellyplus1pm-7c87ce657e74
attr MQTT2_shellyplus1pm_44179394cab4 event-on-change-reading .*
attr MQTT2_shellyplus1pm_44179394cab4 jsonMap params_switch_0_aenergy_total:aenergy_total switch_0_apower:apower switch_0_temperature_tC:temperature switch_0_temperature_tF:0 params_wifi_sta_ip:ip
attr MQTT2_shellyplus1pm_44179394cab4 model shellyPlus_1pm
attr MQTT2_shellyplus1pm_44179394cab4 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:.* { json2nameValue($EVENT, 'switch_0_', $JSONMAP) }\
  fhem/rpc:.* { json2nameValue($EVENT,'rpc_',$JSONMAP) }\
shellyplus1pm_44179394cab4:shellyplus1pm-44179394cab4/events/rpc:.* { json2nameValue($EVENT) }\
shellyplus1pm_44179394cab4:shellyplus1pm-44179394cab4/status/switch_0:.* { json2nameValue($EVENT) }\
shellyplus1pm_44179394cab4:shellyplus1pm-44179394cab4/online:.* online\
shellyplus1pm_44179394cab4:shellyplus1pm-44179394cab4/status/mqtt:.* { json2nameValue($EVENT) }\
shellyplus1pm_44179394cab4:shellyplus1pm-44179394cab4/status/sys:.* { json2nameValue($EVENT) }
attr MQTT2_shellyplus1pm_44179394cab4 room MQTT2_DEVICE
attr MQTT2_shellyplus1pm_44179394cab4 setList toggle:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"Switch.Toggle","params": {"id":0}}\
  off:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"Switch.Set","params": {"id":0,"on":false}}\
  on:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"Switch.Set","params": {"id":0,"on":true}}\
  on-for-timer $DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"Switch.Set","params": {"id":0,"on":true,"toggle_after":$EVTPART1}}\
  x_update:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"Shelly.Update","params": {"stage":"stable"}}\
  x_reboot:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"Shelly.Reboot"}

setstate MQTT2_shellyplus1pm_44179394cab4 on
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 15:55:27 IODev myBroker
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 16:13:10 aenergy_by_minute_1 0.000
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 16:13:10 aenergy_by_minute_2 0.000
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 16:13:10 aenergy_by_minute_3 0.000
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 16:13:10 aenergy_minute_ts 1640963589
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 16:13:10 aenergy_total 654.021
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 16:13:10 apower 0.0
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 16:01:51 available_updates_beta_version 0.9.2-beta2
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 16:01:51 cfg_rev 2
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 16:01:40 connected true
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 16:13:10 current 0.0
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 16:13:10 dst shellyplus1pm-44179394cab4/events
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 16:01:51 fs_free 233472
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 16:01:51 fs_size 458752
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 16:13:10 id 0
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 16:01:51 mac 44179394CAB4
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 16:13:10 method NotifyStatus
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 16:01:40 online true
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 16:13:10 output true
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 16:01:36 params_events_1_cfg_rev 2
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 16:01:36 params_events_1_component mqtt
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 16:01:36 params_events_1_event config_changed
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 16:01:36 params_events_1_restart_required true
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 16:01:36 params_events_1_ts 1640962897.35
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 16:01:40 params_mqtt_connected true
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 16:13:00 params_switch_0_aenergy_by_minute_1 0.000
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 16:13:00 params_switch_0_aenergy_by_minute_2 0.000
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 16:13:00 params_switch_0_aenergy_by_minute_3 0.000
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 16:13:00 params_switch_0_aenergy_minute_ts 1640963579
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 16:13:00 params_switch_0_aenergy_total 654.021
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 16:09:27 params_switch_0_apower 0.0
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 16:13:10 params_switch_0_current 0.0
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 16:13:10 params_switch_0_id 0
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 15:59:18 params_switch_0_output true
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 15:59:18 params_switch_0_source WS_in
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 16:01:41 params_switch_0_voltage 218.4
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 16:01:51 params_sys_available_updates_beta_version 0.9.2-beta2
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 16:01:36 params_sys_restart_required true
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 16:13:10 params_ts 1640963591.42
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 16:01:40 params_wifi_rssi -54
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 16:01:40 params_wifi_ssid Dahoam
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 16:01:40 params_wifi_sta_ip 10.0.0.161
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 16:01:40 params_wifi_status got ip
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 16:01:51 ram_free 180508
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 16:01:51 ram_size 249608
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 16:01:51 restart_required false
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 16:13:10 source init
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 16:13:10 src shellyplus1pm-44179394cab4
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 16:02:56 state on
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 16:13:10 temperature_tC 46.2
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 16:13:10 temperature_tF 115.2
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 16:01:51 time 16:01
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 16:01:51 unixtime 1640962911
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 16:01:51 uptime 12
setstate MQTT2_shellyplus1pm_44179394cab4 2021-12-31 16:13:10 voltage 217.7


Gruß
Helmut
System1 fhem 6.1 auf RPi 4B mit 4GB, HMUSBConfig, DS9490R-1Wire, Busware USB 868, Pool-Solarsteuerung mit FHEM. System2 fhem 6.1 auf RPi 4B mit 4GB (Bullseye) mit Busware USB 868 und 433 und HMUARTLGW für Haussteuerung

https://www.flickr.com/photos/canonhelmi/

87insane

#23
Jeder für sich will mich auf den arm nehmen.

Die erste antwort: das tenplate geht so nicht. Du muss es anpassen wie und nun kommen wir zu Antwort 2. Du muss das devicetopic in den Attributen anpassen. Du kannst meinen shelly nicht schalten. Das alles beschrieb ich oben :)

Antwort 2 hat es nach der anpassung geschafft.
Edit: Antwort 2 (Helmut) du muss auch den Eintrag in der readingList anpassen. Kopiere 1 zu 1 meine, nachdem du das topic angepasst hast. Und füge den Eintrag hinzu, aus meinem Post.

So sieht ein laufendes raw aus:
defmod MQTT2_shellyplus1pm_7c87ce658380 MQTT2_DEVICE shellyplus1pm_7c87ce658380
attr MQTT2_shellyplus1pm_7c87ce658380 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 = ReadingsVal($name,'state','false');;\
$light = FW_makeImage($light);; \
my $cons = ReadingsNum($name,'apower',0);; \
my $total = round(ReadingsNum($name,'aenergy_total',0)/1000,1);;\
my $temp = ReadingsVal($name,'temperature','-100');; \
my $ip = ReadingsVal($name,'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_shellyplus1pm_7c87ce658380 devicetopic shellyplus1pm-7c87ce658380
attr MQTT2_shellyplus1pm_7c87ce658380 event-on-change-reading .*
attr MQTT2_shellyplus1pm_7c87ce658380 jsonMap params_switch_0_aenergy_total:aenergy_total switch_0_apower:apower switch_0_temperature_tC:temperature switch_0_temperature_tF:0 params_wifi_sta_ip:ip
attr MQTT2_shellyplus1pm_7c87ce658380 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:.* { json2nameValue($EVENT, 'switch_0_', $JSONMAP) }\
  $DEVICETOPIC/status/switch_0:.* { $EVENT =~ s/true/"on"/g;; $EVENT =~ s/false/"off"/g;; $EVENT =~ m,(on|off),g ? { state => $1 } : undef }\
  fhem/rpc:.* { json2nameValue($EVENT,'rpc_',$JSONMAP) }
attr MQTT2_shellyplus1pm_7c87ce658380 room MQTT2_DEVICE
attr MQTT2_shellyplus1pm_7c87ce658380 setList toggle:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"Switch.Toggle","params": {"id":0}}\
  off:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"Switch.Set","params": {"id":0,"on":false}}\
  on:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"Switch.Set","params": {"id":0,"on":true}}\
  on-for-timer $DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"Switch.Set","params": {"id":0,"on":true,"toggle_after":$EVTPART1}}\
  x_update:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"Shelly.Update","params": {"stage":"stable"}}\
  x_reboot:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"Shelly.Reboot"}
attr MQTT2_shellyplus1pm_7c87ce658380 webCmd :


Gruß,
87insane

Helmi55

Servus
ich will dich sicher nicht auf den Arm nehmen - sorry - du hast mir schon soviel geholfen :) :) :)
Das mit dem Topic war ein Fehler von mir. Der wurde anscheinen bei search and replace nicht mitgenommen  :-\

Es klappt trotzdem noch nicht.
Punkt für heute - nächstes Jahr ist auch noch Zeit und dann werde ich das in Ruhe nochmals angehen

Danke für deinen tollen Support

Alles Gute für 2022 und vor allem gesund bleiben
Gruß
helmut
System1 fhem 6.1 auf RPi 4B mit 4GB, HMUSBConfig, DS9490R-1Wire, Busware USB 868, Pool-Solarsteuerung mit FHEM. System2 fhem 6.1 auf RPi 4B mit 4GB (Bullseye) mit Busware USB 868 und 433 und HMUARTLGW für Haussteuerung

https://www.flickr.com/photos/canonhelmi/

smoudo

Ich werde das auch die Tage nochmal testen. Das es noch nicht 100% funktioniert fuxxt mich!

Vielen Dank für Deine ausdauernde Mühe!

Guten Rutsch in 2022!


Viele Grüße

Matze

87insane

Okay... Sendet dann bitte aber ein RAW. Es ist für mich nicht erkennbar warum etwas nicht gehen soll, ohne zu sehen was eingestellt ist.

Das was ich oben gepostet hab, sollte bis auf die PM eigenschaften (Strom messen) passen. Wenn ihr die Attribute einzeln durch geht und jedes einfach so anpasst. Gibt es nach wie vor keinen Grund warum das nicht gehen soll. In den RAWs bisher, waren leider immer Fehler.... Ich weiß nicht wie ich es quasi noch besser ausdrücken kann.

Warte mal auf Feedback,
87insane

Helmi55

Guten Abend und prosit 2022

ich habe das Device aus FHEM gelöscht. Habe den Shelly rebootet und ihn in FHEM empfangen.
Ich habe KEIN Template ausgewählt, sondern nur wie von dir beschrieben die einzelnen attr in FHEM eingetragen.
Ich konnte kein genericeDevice attr anlegen. Fehlermeldung attr nicht vorhanden???
Ichhabe einen Neustart von FHEM durchführt und danach habe ich bei den readingList diese 5 Zeilen mehr gefunden?
shellyplus1pm_44179394cab4:shellyplus1pm-44179394cab4/events/rpc:.* { json2nameValue($EVENT) }
shellyplus1pm_44179394cab4:shellyplus1pm-44179394cab4/status/switch_0:.* { json2nameValue($EVENT) }
shellyplus1pm_44179394cab4:shellyplus1pm-44179394cab4/online:.* online
shellyplus1pm_44179394cab4:shellyplus1pm-44179394cab4/status/mqtt:.* { json2nameValue($EVENT) }
shellyplus1pm_44179394cab4:shellyplus1pm-44179394cab4/status/sys:.* { json2nameValue($EVENT) }


Hier ein RAW vom Shelly in FHEM

defmod MQTT2_shellyplus1pm_44179394cab4 MQTT2_DEVICE shellyplus1pm_44179394cab4
attr MQTT2_shellyplus1pm_44179394cab4 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 = ReadingsVal($name,'output','false') =~ m{false|off}?'off':'on';;;; $light = FW_makeImage($light);;;; my $cons = ReadingsNum($name,'apower',0);;;; my $total = round(ReadingsNum($name,'aenergy_total',0)/1000,1);;;; my $temp = ReadingsVal($name,'temperature','-100');;;; my $ip = ReadingsVal($name,'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_shellyplus1pm_44179394cab4 devicetopic shellyplus1pm_44179394cab4
attr MQTT2_shellyplus1pm_44179394cab4 event-on-change-reading .*
attr MQTT2_shellyplus1pm_44179394cab4 jsonMap params_switch_0_aenergy_total:aenergy_total switch_0_apower:apower switch_0_temperature_tC:temperature switch_0_temperature_tF:0 params_wifi_sta_ip:ip
attr MQTT2_shellyplus1pm_44179394cab4 model shellyPlus_1pm
attr MQTT2_shellyplus1pm_44179394cab4 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:.* { json2nameValue($EVENT, 'switch_0_', $JSONMAP) }\
  fhem/rpc:.* { json2nameValue($EVENT,'rpc_',$JSONMAP) }\
shellyplus1pm_44179394cab4:shellyplus1pm-44179394cab4/events/rpc:.* { json2nameValue($EVENT) }\
shellyplus1pm_44179394cab4:shellyplus1pm-44179394cab4/status/switch_0:.* { json2nameValue($EVENT) }\
shellyplus1pm_44179394cab4:shellyplus1pm-44179394cab4/online:.* online\
shellyplus1pm_44179394cab4:shellyplus1pm-44179394cab4/status/mqtt:.* { json2nameValue($EVENT) }\
shellyplus1pm_44179394cab4:shellyplus1pm-44179394cab4/status/sys:.* { json2nameValue($EVENT) }
attr MQTT2_shellyplus1pm_44179394cab4 room MQTT2_DEVICE
attr MQTT2_shellyplus1pm_44179394cab4 setList toggle:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"Switch.Toggle","params": {"id":0}}\
  off:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"Switch.Set","params": {"id":0,"on":false}}\
  on:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"Switch.Set","params": {"id":0,"on":true}}\
  on-for-timer $DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"Switch.Set","params": {"id":0,"on":true,"toggle_after":$EVTPART1}}\
  x_update:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"Shelly.Update","params": {"stage":"stable"}}\
  x_reboot:noArg $DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"Shelly.Reboot"}

setstate MQTT2_shellyplus1pm_44179394cab4 off
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-01 17:48:53 IODev myBroker
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-01 17:54:00 aenergy_by_minute_1 0.000
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-01 17:54:00 aenergy_by_minute_2 0.000
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-01 17:54:00 aenergy_by_minute_3 0.000
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-01 17:54:00 aenergy_minute_ts 1641056038
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-01 17:54:00 aenergy_total 0.000
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-01 17:54:00 apower 0.0
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-01 17:47:16 available_updates_beta_version 0.9.2-beta2
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-01 17:47:16 cfg_rev 2
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-01 17:48:58 connected true
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-01 17:54:00 current 0.0
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-01 17:54:00 dst shellyplus1pm-44179394cab4/events
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-01 17:47:16 fs_free 233472
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-01 17:47:16 fs_size 458752
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-01 17:54:00 id 0
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-01 17:47:16 mac 44179394CAB4
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-01 17:54:00 method NotifyStatus
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-01 17:48:58 online true
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-01 17:54:00 output true
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-01 17:48:58 params_mqtt_connected false
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-01 17:54:00 params_switch_0_aenergy_by_minute_1 0.000
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-01 17:54:00 params_switch_0_aenergy_by_minute_2 0.000
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-01 17:54:00 params_switch_0_aenergy_by_minute_3 0.000
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-01 17:54:00 params_switch_0_aenergy_minute_ts 1641056038
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-01 17:54:00 params_switch_0_aenergy_total 0.000
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-01 17:50:26 params_switch_0_apower 0
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-01 17:52:14 params_switch_0_current 0.0
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-01 17:54:00 params_switch_0_id 0
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-01 17:50:30 params_switch_0_output true
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-01 17:50:30 params_switch_0_source WS_in
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-01 17:47:08 params_switch_0_voltage 216.9
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-01 17:47:16 params_sys_available_updates_beta_version 0.9.2-beta2
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-01 17:54:00 params_ts 1641056040.94
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-01 17:47:07 params_wifi_rssi -53
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-01 17:47:07 params_wifi_ssid Dahoam
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-01 17:47:07 params_wifi_sta_ip 10.0.0.161
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-01 17:47:07 params_wifi_status got ip
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-01 17:47:16 ram_free 180504
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-01 17:47:16 ram_size 249600
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-01 17:47:16 restart_required false
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-01 17:54:00 source WS_in
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-01 17:54:00 src shellyplus1pm-44179394cab4
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-01 17:50:33 state off
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-01 17:54:00 temperature_tC 45.0
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-01 17:54:00 temperature_tF 113.0
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-01 17:47:16 time 17:47
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-01 17:47:16 unixtime 1641055637
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-01 17:47:16 uptime 10
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-01 17:54:00 voltage 216.7




wie gesagt ich sehe in FHEM wenn ich den Shelly auf der Weboberfläche schalte, aber ich kann in FHEM nicht schalten?
Ich blicke da nicht durch? Sorry....

Danke für deine Zeit und Hilfe
Gruß
Helmut
System1 fhem 6.1 auf RPi 4B mit 4GB, HMUSBConfig, DS9490R-1Wire, Busware USB 868, Pool-Solarsteuerung mit FHEM. System2 fhem 6.1 auf RPi 4B mit 4GB (Bullseye) mit Busware USB 868 und 433 und HMUARTLGW für Haussteuerung

https://www.flickr.com/photos/canonhelmi/

TomLee

Zitatich habe das Device aus FHEM gelöscht. Habe den Shelly rebootet und ihn in FHEM empfangen.
Ich habe KEIN Template ausgewählt, sondern nur wie von dir beschrieben die einzelnen attr in FHEM eingetragen.
Ich konnte kein genericeDevice attr anlegen. Fehlermeldung attr nicht vorhanden???
Ichhabe einen Neustart von FHEM durchführt und danach habe ich bei den readingList diese 5 Zeilen mehr gefunden?

Hallo Helmut,

wie man an deinem List sieht ging während deinem geschilderten Ablauf irgendwas schief.

Ich bin der Meinung wenn du das hier in einem Raw-Editor (über das + oben links oder unter jedem Device) eingibst und mit Execute bestätigst, das schalten mit dem Icon in der DeviceOverview möglich sein wird, aber erst nachdem der Shelly einmal noch zuvor seinen Status per MQTT übertragen hat:

attr MQTT2_shellyplus1pm_44179394cab4 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 = ReadingsVal($name,'state','false');;\
$light = FW_makeImage($light);; \
my $cons = ReadingsNum($name,'apower',0);; \
my $total = round(ReadingsNum($name,'aenergy_total',0)/1000,1);;\
my $temp = ReadingsVal($name,'temperature','-100');; \
my $ip = ReadingsVal($name,'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_shellyplus1pm_44179394cab4 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:.* { json2nameValue($EVENT, 'switch_0_', $JSONMAP) }\
  $DEVICETOPIC/status/switch_0:.* { $EVENT =~ s/true/"on"/g;; $EVENT =~ s/false/"off"/g;; $EVENT =~ m,(on|off),g ? { state => $1 } : undef }


Gruß

Thomas

Helmi55

Servus Thomas

anscheinend bin ich für die plus Serie zu blöd.....
Habe das Device aus FHEM gelöscht und danach deinen Code im RAW Editor eingegeben und es kam keine Fehlermeldung nach "execute"
Habe den Shelly aus und eingeschaltet und auch einen erbot von FHEM durchgeführt aber anscheinend ohne Erfolg.
Ich habe zwar nun einen grünen Punkt aber daneben steht "false".
Die Readingswerte werden alle aktualisiert.
Die FW vom Shelly ist 0.9.1

Hier nochmals ein RAW
defmod MQTT2_shellyplus1pm_44179394cab4 MQTT2_DEVICE shellyplus1pm_44179394cab4
attr MQTT2_shellyplus1pm_44179394cab4 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 = ReadingsVal($name,'state','false');;\
$light = FW_makeImage($light);; \
my $cons = ReadingsNum($name,'apower',0);; \
my $total = round(ReadingsNum($name,'aenergy_total',0)/1000,1);;\
my $temp = ReadingsVal($name,'temperature','-100');; \
my $ip = ReadingsVal($name,'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_shellyplus1pm_44179394cab4 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:.* { json2nameValue($EVENT, 'switch_0_', $JSONMAP) }\
  $DEVICETOPIC/status/switch_0:.* { $EVENT =~ s/true/"on"/g;; $EVENT =~ s/false/"off"/g;; $EVENT =~ m,(on|off),g ? { state => $1 } : undef }\
shellyplus1pm_44179394cab4:shellyplus1pm-44179394cab4/events/rpc:.* { json2nameValue($EVENT) }\
shellyplus1pm_44179394cab4:shellyplus1pm-44179394cab4/status/switch_0:.* { json2nameValue($EVENT) }\
shellyplus1pm_44179394cab4:shellyplus1pm-44179394cab4/online:.* online\
shellyplus1pm_44179394cab4:shellyplus1pm-44179394cab4/status/mqtt:.* { json2nameValue($EVENT) }
attr MQTT2_shellyplus1pm_44179394cab4 room MQTT2_DEVICE

setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 09:56:42 IODev myBroker
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 10:01:01 aenergy_by_minute_1 1850.434
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 10:01:01 aenergy_by_minute_2 1933.446
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 10:01:01 aenergy_by_minute_3 1924.849
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 10:01:01 aenergy_minute_ts 1641114059
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 10:01:01 aenergy_total 106.367
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 10:01:01 apower 108.6
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 09:56:48 connected true
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 10:01:01 current 0.5
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 10:01:11 dst shellyplus1pm-44179394cab4/events
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 10:01:01 id 0
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 10:01:11 method NotifyStatus
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 09:56:48 online true
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 10:01:01 output true
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 09:56:48 params_mqtt_connected false
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 10:01:11 params_switch_0_aenergy_by_minute_1 1850.434
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 10:01:11 params_switch_0_aenergy_by_minute_2 1933.446
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 10:01:11 params_switch_0_aenergy_by_minute_3 1924.849
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 10:01:11 params_switch_0_aenergy_minute_ts 1641114059
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 10:01:11 params_switch_0_aenergy_total 106.367
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 10:00:56 params_switch_0_apower 108.6
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 09:58:37 params_switch_0_current 0.5
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 10:01:11 params_switch_0_id 0
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 10:01:11 params_ts 1641114061.78
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 10:01:01 source WS_in
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 10:01:11 src shellyplus1pm-44179394cab4
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 10:01:01 temperature_tC 39.1
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 10:01:01 temperature_tF 102.4
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 10:01:01 voltage 223.6



Was ich mir nicht erklären kann, woher kommen plötzlich wieder diese 4 Zeilen?
shellyplus1pm_44179394cab4:shellyplus1pm-44179394cab4/events/rpc:.* { json2nameValue($EVENT) }\
shellyplus1pm_44179394cab4:shellyplus1pm-44179394cab4/status/switch_0:.* { json2nameValue($EVENT) }\
shellyplus1pm_44179394cab4:shellyplus1pm-44179394cab4/online:.* online\
shellyplus1pm_44179394cab4:shellyplus1pm-44179394cab4/status/mqtt:.* { json2nameValue($EVENT) }


Danke für deine Zeit
Gruß
Helmut
System1 fhem 6.1 auf RPi 4B mit 4GB, HMUSBConfig, DS9490R-1Wire, Busware USB 868, Pool-Solarsteuerung mit FHEM. System2 fhem 6.1 auf RPi 4B mit 4GB (Bullseye) mit Busware USB 868 und 433 und HMUARTLGW für Haussteuerung

https://www.flickr.com/photos/canonhelmi/