[gelöst] Shelly Plus 1 - Anbindung

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

Vorheriges Thema - Nächstes Thema

pflock_y

Guten morgen zusammen,
ich bin durch Zufall auf diesen Beitrag gestoßen, hab daraufhin viel probiert.
Bei mir gehen meine Plus1PM´er nun auch.
Aufgefallen ist mir das man beim
attr devicetopic das gleiche reinschreiben muss wie in den MQTT Einstellungen des Shellys.
Danach hat alles funktioniert.

vg
pflock_y

TomLee

#31
Du hättest nix löschen müssen, der Vorschlag hätte die Attribute des bestehenden Devices angepasst/überschrieben.

Das + gibts nur im f18-Style.

In jedem anderen Style gibts aber auch den "Raw-Editor", ganz unten in der Detailansicht eines Devices.

Gehe in die Detailansicht des MQTT2_shellyplus1pm_44179394cab4-Device, scrolle ganz nach unten, entferne bzw. ersetze alles in dem Fenster durch diese Definition und tippe Execute command:

defmod MQTT2_shellyplus1pm_44179394cab4 MQTT2_DEVICE shellyplus1pm_7c87ce658380
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 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 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_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"}
attr MQTT2_shellyplus1pm_44179394cab4 webCmd :


Nix löschen, nicht restarten nur einmal bspw. ein set MQTT2_shellyplus1pm_44179394cab4 on ausführen.

Helmi55

Hallo Zusammen
habe da anscheinend von Thomas falsch verstanden
SO funktioniert es jetzt

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 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) }\
  $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) }\
shellyplus1pm_44179394cab4:shellyplus1pm-44179394cab4/status/cloud:.* { json2nameValue($EVENT) }\
shellyplus1pm_44179394cab4:shellyplus1pm-44179394cab4/status/sys:.* { json2nameValue($EVENT) }\
shellyplus1pm_44179394cab4:fhem/rpc:.* { 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 2022-01-02 09:56:42 IODev myBroker
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 11:26:23 aenergy_by_minute_1 0.000
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 11:26:23 aenergy_by_minute_2 2037.045
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 11:26:23 aenergy_by_minute_3 2384.606
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 11:26:23 aenergy_minute_ts 1641119181
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 11:26:23 aenergy_total 275.891
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 11:26:23 apower 0.0
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 10:34:33 available_updates_beta_version 0.9.2-beta2
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 10:34:33 cfg_rev 9
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 10:33:20 connected true
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 11:26:23 current 0.0
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 11:26:23 dst shellyplus1pm-44179394cab4/events
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 10:34:33 fs_free 233472
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 10:34:33 fs_size 458752
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 11:26:23 id 0
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 10:34:33 mac 44179394CAB4
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 11:26:23 method NotifyStatus
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 10:28:49 online true
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 11:26:23 output true
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 10:33:20 params_cloud_connected true
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 10:33:19 params_events_1_cfg_rev 9
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 10:33:19 params_events_1_component cloud
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 10:33:19 params_events_1_event config_changed
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 10:33:19 params_events_1_restart_required false
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 10:33:19 params_events_1_ts 1641115999.31
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 10:28:49 params_mqtt_connected true
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 11:26:01 params_switch_0_aenergy_by_minute_1 2037.045
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 11:26:01 params_switch_0_aenergy_by_minute_2 2384.606
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 11:26:01 params_switch_0_aenergy_by_minute_3 2110.045
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 11:26:01 params_switch_0_aenergy_minute_ts 1641119159
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 11:26:01 params_switch_0_aenergy_total 275.891
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 11:26:16 params_switch_0_apower 0
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 11:26:23 params_switch_0_current 0.0
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 11:26:23 params_switch_0_id 0
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 11:26:20 params_switch_0_output true
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 11:26:20 params_switch_0_source MQTT
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 10:28:49 params_switch_0_voltage 224.5
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 10:34:33 params_sys_available_updates_beta_version 0.9.2-beta2
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 11:26:23 params_ts 1641119183.89
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 10:28:49 params_wifi_rssi -53
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 10:28:49 params_wifi_ssid Dahoam
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 10:28:49 params_wifi_sta_ip 10.0.0.161
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 10:28:49 params_wifi_status got ip
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 10:34:33 ram_free 170500
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 10:34:33 ram_size 249228
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 10:34:33 restart_required false
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 11:26:20 result_was_on false
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 11:26:23 source MQTT
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 11:26:23 src shellyplus1pm-44179394cab4
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 11:26:23 state on
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 11:26:23 switch_0_aenergy_by_minute_1 0.000
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 11:26:23 switch_0_aenergy_by_minute_2 2037.045
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 11:26:23 switch_0_aenergy_by_minute_3 2384.606
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 11:26:23 switch_0_aenergy_minute_ts 1641119181
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 11:26:23 switch_0_aenergy_total 275.891
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 11:24:03 switch_0_apower 142.2
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 11:26:23 switch_0_current 0.0
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 11:26:23 switch_0_id 0
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 11:26:23 switch_0_output true
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 11:26:23 switch_0_source MQTT
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 11:24:03 switch_0_temperature_tC 39.5
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 11:24:03 switch_0_temperature_tF 103.1
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 11:26:23 switch_0_voltage 221.3
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 11:26:23 temperature 39.4
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 11:26:23 temperature_tC 39.4
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 11:26:23 temperature_tF 103.0
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 10:34:33 time 10:34
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 10:34:33 unixtime 1641116073
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 10:34:33 uptime 345
setstate MQTT2_shellyplus1pm_44179394cab4 2022-01-02 11:26:23 voltage 221.3



Schönen Tag noch

PS: die Angaben sind jetzt in der neuen Generation in Watt Stunden und nicht mehr Minuten - sehe ich das richtig?

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/

Helmi55

Servus haben uns soeben überschnitten
Hatte schon an mir selbst gezweifelt........
Habe jetzt noch das WebCmd auf ":" ergänzt.
Jetzt klappt alles.

Einzig das von 87insane angeführte genericDeviceType gibts nicht (hast du ja auch nicht drinnen!)
Scheint eine Verknüpfung mit HomeKit zu sein?

Schönen Sonntag 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/

vic

@Helmi55

Bitte stelle mir dein RAW rein. Bei mir klappt es ganz und gar nicht. Das Symbol wechselt beim Anklicken auf toggle und ändert sich nicht mehr. Der Aktor Schaltet jedoch.

Ich habe versucht alle eure Vorschläge umzusetzen. Leider ohne Erfolg.

Anbei mein RAW:
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,'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_shellyplus1_a8032abcd5e8 devicetopic shellyplus1-a8032abcd5e8
attr MQTT2_shellyplus1_a8032abcd5e8 event-on-change-reading .*
attr MQTT2_shellyplus1_a8032abcd5e8 group Sommer
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/rpt:.* { 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 }\
shellyplus1_a8032abcd5e8:shellyplus1-a8032abcd5e8/events/rpc:.* { json2nameValue($EVENT) }
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 off
setstate MQTT2_shellyplus1_a8032abcd5e8 2022-01-02 16:17:23 IODev MQTT2
setstate MQTT2_shellyplus1_a8032abcd5e8 2021-12-31 15:23:02 attrTemplateVersion 20211128
setstate MQTT2_shellyplus1_a8032abcd5e8 2022-01-02 16:23:09 dst shellyplus1-a8032abcd5e8/events
setstate MQTT2_shellyplus1_a8032abcd5e8 2022-01-02 10:43:19 ip 192.168.10.149
setstate MQTT2_shellyplus1_a8032abcd5e8 2022-01-02 16:23:09 method NotifyStatus
setstate MQTT2_shellyplus1_a8032abcd5e8 2022-01-02 16:18:05 online true
setstate MQTT2_shellyplus1_a8032abcd5e8 2022-01-02 10:41:10 params_events_1_cfg_rev 12
setstate MQTT2_shellyplus1_a8032abcd5e8 2022-01-02 10:43:13 params_events_1_component sys
setstate MQTT2_shellyplus1_a8032abcd5e8 2022-01-02 10:43:13 params_events_1_event ota_success
setstate MQTT2_shellyplus1_a8032abcd5e8 2022-01-02 10:43:13 params_events_1_msg Update applied, rebooting
setstate MQTT2_shellyplus1_a8032abcd5e8 2022-01-02 10:43:11 params_events_1_progress_percent 98
setstate MQTT2_shellyplus1_a8032abcd5e8 2022-01-02 10:41:10 params_events_1_restart_required false
setstate MQTT2_shellyplus1_a8032abcd5e8 2022-01-02 10:43:13 params_events_1_ts 1641116592.89
setstate MQTT2_shellyplus1_a8032abcd5e8 2022-01-02 16:18:05 params_mqtt_connected false
setstate MQTT2_shellyplus1_a8032abcd5e8 2022-01-02 16:23:09 params_switch_0_id 0
setstate MQTT2_shellyplus1_a8032abcd5e8 2022-01-02 16:20:12 params_switch_0_output false
setstate MQTT2_shellyplus1_a8032abcd5e8 2022-01-02 16:20:12 params_switch_0_source MQTT
setstate MQTT2_shellyplus1_a8032abcd5e8 2022-01-02 16:23:09 params_switch_0_temperature_tC 47.69
setstate MQTT2_shellyplus1_a8032abcd5e8 2022-01-02 16:23:09 params_switch_0_temperature_tF 117.84
setstate MQTT2_shellyplus1_a8032abcd5e8 2022-01-02 10:42:20 params_sys_available_updates_beta_version 0.9.2-beta2
setstate MQTT2_shellyplus1_a8032abcd5e8 2022-01-02 16:09:29 params_sys_available_updates_stable_version 0.9.1
setstate MQTT2_shellyplus1_a8032abcd5e8 2022-01-02 16:23:09 params_ts 1641136989.69
setstate MQTT2_shellyplus1_a8032abcd5e8 2022-01-02 16:09:18 params_wifi_rssi -62
setstate MQTT2_shellyplus1_a8032abcd5e8 2022-01-02 16:09:18 params_wifi_ssid Lienta_01
setstate MQTT2_shellyplus1_a8032abcd5e8 2022-01-02 16:09:18 params_wifi_sta_ip 192.168.10.149
setstate MQTT2_shellyplus1_a8032abcd5e8 2022-01-02 16:09:18 params_wifi_status got ip
setstate MQTT2_shellyplus1_a8032abcd5e8 2022-01-02 16:23:09 src shellyplus1-a8032abcd5e8
setstate MQTT2_shellyplus1_a8032abcd5e8 2022-01-02 16:20:12 state off



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

87insane

Puh hier geräd ja alles außer Rand und Band....


Also wie ich schon 3, 4 mal schrieb: aber urgendwie liest das keiner... Ihr müsst auch device topic richtig setzen. Ich hab am ende doch sogar ein kompettes RAW gepostet.

Alles was shelly- und shelly_ ist muss eben durch euren shelly ersetzt werden. Dann geht alles. Die Umrechnung des Verbrauchs hab ich nicht gegengeprüft. Vermutlich im shelly style, sollte die bereits aus den alten templates bekannte angewandt werden.

Ich würde von einem von euch aber gern mal erklärt bekommen, wo das Problem ist, das 1zu1 zu übernehmen. Denn, immer war in den RAWs irgendwas nicht mit übernommen usw. Also mein ich nicht böse aber copy&search+replace&paste, sollte doch laufen. Ansonsten gäbe es gewaltige Unterschiede bei allen von uns. Da das aber alles generisch gehalten wird, glaube ich das nicht.

genericDeviceType ist für Sprach Assistenten zb. Genaueres im Wiki.

Wenn hier wirklich einer die RAW Datei von mir übernimmt, angepasst auf sich, bitte RAW zurück und zeigen was nicht geht.

Gruß,
sorry wegen der "Energie" - 87insane

Helmi55

Hallo vic
gerne hier das aktuelle letzte RAW (Werte im Moment nicht aktuell da PVBalkonAnlage und finster
Hat aber den ganzen Nachmittag funktioniert

defmod PVAnlage MQTT2_DEVICE shellyplus1pm_44179394cab4
attr PVAnlage 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 PVAnlage devicetopic shellyplus1pm-44179394cab4
attr PVAnlage event-on-change-reading .*
attr PVAnlage 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 PVAnlage model shellyPlus_1pm
attr PVAnlage 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) }\
shellyplus1pm_44179394cab4:shellyplus1pm-44179394cab4/status/cloud:.* { json2nameValue($EVENT) }\
shellyplus1pm_44179394cab4:shellyplus1pm-44179394cab4/status/sys:.* { json2nameValue($EVENT) }\
shellyplus1pm_44179394cab4:fhem/rpc:.* { json2nameValue($EVENT) }
attr PVAnlage room PV Anlage,MQTT2_DEVICE
attr PVAnlage 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 PVAnlage userReadings relay_0_energy_kWh:params_switch_0_aenergy_total.* monotonic {ReadingsVal($NAME,"params_switch_0_aenergy_total",0)/1000.0}, Ertrag:relay_0_energy_kWh.* { sprintf("%.2f",(ReadingsVal($NAME,"relay_0_energy_kWh",0) - 0.01)*.2);;;;}
attr PVAnlage webCmd :

setstate PVAnlage on
setstate PVAnlage 2022-01-02 16:04:00 Ertrag 0.12
setstate PVAnlage 2022-01-02 13:27:31 IODev myBroker
setstate PVAnlage 2022-01-02 17:27:59 aenergy_by_minute_1 0.000
setstate PVAnlage 2022-01-02 17:27:59 aenergy_by_minute_2 0.000
setstate PVAnlage 2022-01-02 17:27:59 aenergy_by_minute_3 0.000
setstate PVAnlage 2022-01-02 17:27:59 aenergy_minute_ts 1641140878
setstate PVAnlage 2022-01-02 17:28:17 aenergy_total 0.000
setstate PVAnlage 2022-01-02 17:27:59 apower 0.0
setstate PVAnlage 2022-01-02 16:50:39 available_updates_beta_version 0.9.2-beta2
setstate PVAnlage 2022-01-02 16:50:39 cfg_rev 10
setstate PVAnlage 2022-01-02 16:50:28 connected true
setstate PVAnlage 2022-01-02 17:27:59 current 0.0
setstate PVAnlage 2022-01-02 17:28:17 dst shellyplus1pm-44179394cab4/events
setstate PVAnlage 2022-01-02 16:50:39 fs_free 233472
setstate PVAnlage 2022-01-02 16:50:39 fs_size 458752
setstate PVAnlage 2022-01-02 17:27:59 id 0
setstate PVAnlage 2022-01-02 16:50:28 ip 10.0.0.161
setstate PVAnlage 2022-01-02 16:50:39 mac 44179394CAB4
setstate PVAnlage 2022-01-02 17:28:17 method NotifyStatus
setstate PVAnlage 2022-01-02 16:50:28 mqtt_connected true
setstate PVAnlage 2022-01-02 16:50:28 online true
setstate PVAnlage 2022-01-02 17:27:59 output true
setstate PVAnlage 2022-01-02 12:46:30 params_cloud_connected false
setstate PVAnlage 2022-01-02 17:01:37 params_events_1_cfg_rev 11
setstate PVAnlage 2022-01-02 17:01:37 params_events_1_component switch:0
setstate PVAnlage 2022-01-02 17:01:37 params_events_1_event config_changed
setstate PVAnlage 2022-01-02 17:01:37 params_events_1_id 0
setstate PVAnlage 2022-01-02 17:01:37 params_events_1_restart_required false
setstate PVAnlage 2022-01-02 17:01:37 params_events_1_ts 1641139298.02
setstate PVAnlage 2022-01-02 16:50:28 params_mqtt_connected true
setstate PVAnlage 2022-01-02 17:28:17 params_switch_0_aenergy_by_minute_1 0.000
setstate PVAnlage 2022-01-02 17:28:17 params_switch_0_aenergy_by_minute_2 0.000
setstate PVAnlage 2022-01-02 17:28:17 params_switch_0_aenergy_by_minute_3 0.000
setstate PVAnlage 2022-01-02 17:28:17 params_switch_0_aenergy_minute_ts 1641140878
setstate PVAnlage 2022-01-02 17:28:17 params_switch_0_aenergy_total 0.000
setstate PVAnlage 2022-01-02 17:01:51 params_switch_0_apower 0
setstate PVAnlage 2022-01-02 17:27:08 params_switch_0_current 0.0
setstate PVAnlage 2022-01-02 17:28:17 params_switch_0_id 0
setstate PVAnlage 2022-01-02 17:02:21 params_switch_0_output true
setstate PVAnlage 2022-01-02 17:02:21 params_switch_0_source timer
setstate PVAnlage 2022-01-02 17:01:51 params_switch_0_timer_duration 30.00
setstate PVAnlage 2022-01-02 17:01:51 params_switch_0_timer_started_at 1641139311.56
setstate PVAnlage 2022-01-02 16:50:30 params_switch_0_voltage 217.6
setstate PVAnlage 2022-01-02 16:50:39 params_sys_available_updates_beta_version 0.9.2-beta2
setstate PVAnlage 2022-01-02 17:28:17 params_ts 1641140880.20
setstate PVAnlage 2022-01-02 16:50:28 params_wifi_rssi -54
setstate PVAnlage 2022-01-02 16:50:28 params_wifi_ssid Dahoam
setstate PVAnlage 2022-01-02 16:50:28 params_wifi_sta_ip 10.0.0.161
setstate PVAnlage 2022-01-02 16:50:28 params_wifi_status got ip
setstate PVAnlage 2022-01-02 16:50:39 ram_free 176824
setstate PVAnlage 2022-01-02 16:50:39 ram_size 249588
setstate PVAnlage 2022-01-02 16:50:59 relay_0_energy_kWh 0.631858
setstate PVAnlage 2022-01-02 16:50:39 restart_required false
setstate PVAnlage 2022-01-02 17:01:51 result_was_on true
setstate PVAnlage 2022-01-02 17:27:59 source timer
setstate PVAnlage 2022-01-02 17:28:17 src shellyplus1pm-44179394cab4
setstate PVAnlage 2022-01-02 17:27:59 state on
setstate PVAnlage 2022-01-02 17:27:59 switch_0_aenergy_by_minute_1 0.000
setstate PVAnlage 2022-01-02 17:27:59 switch_0_aenergy_by_minute_2 0.000
setstate PVAnlage 2022-01-02 17:27:59 switch_0_aenergy_by_minute_3 0.000
setstate PVAnlage 2022-01-02 17:27:59 switch_0_aenergy_minute_ts 1641140878
setstate PVAnlage 2022-01-02 17:27:59 switch_0_aenergy_total 0.000
setstate PVAnlage 2022-01-02 11:24:03 switch_0_apower 142.2
setstate PVAnlage 2022-01-02 17:27:59 switch_0_current 0.0
setstate PVAnlage 2022-01-02 17:27:59 switch_0_id 0
setstate PVAnlage 2022-01-02 17:27:59 switch_0_output true
setstate PVAnlage 2022-01-02 17:27:59 switch_0_source timer
setstate PVAnlage 2022-01-02 11:24:03 switch_0_temperature_tC 39.5
setstate PVAnlage 2022-01-02 11:24:03 switch_0_temperature_tF 103.1
setstate PVAnlage 2022-01-02 17:01:59 switch_0_timer_duration 30.00
setstate PVAnlage 2022-01-02 17:01:59 switch_0_timer_started_at 1641139311.56
setstate PVAnlage 2022-01-02 17:27:59 switch_0_voltage 216.1
setstate PVAnlage 2022-01-02 16:50:39 sys_available_updates_beta_version 0.9.2-beta2
setstate PVAnlage 2022-01-02 16:50:39 sys_cfg_rev 10
setstate PVAnlage 2022-01-02 16:50:39 sys_fs_free 233472
setstate PVAnlage 2022-01-02 16:50:39 sys_fs_size 458752
setstate PVAnlage 2022-01-02 16:50:39 sys_mac 44179394CAB4
setstate PVAnlage 2022-01-02 16:50:39 sys_ram_free 176824
setstate PVAnlage 2022-01-02 16:50:39 sys_ram_size 249588
setstate PVAnlage 2022-01-02 16:50:39 sys_restart_required false
setstate PVAnlage 2022-01-02 16:50:39 sys_time 16:50
setstate PVAnlage 2022-01-02 16:50:39 sys_unixtime 1641138639
setstate PVAnlage 2022-01-02 16:50:39 sys_uptime 11
setstate PVAnlage 2022-01-02 17:27:59 temperature 40.7
setstate PVAnlage 2022-01-02 17:27:59 temperature_tC 40.7
setstate PVAnlage 2022-01-02 17:27:59 temperature_tF 105.3
setstate PVAnlage 2022-01-02 16:50:39 time 16:50
setstate PVAnlage 2022-01-02 17:01:59 timer_duration 30.00
setstate PVAnlage 2022-01-02 17:01:59 timer_started_at 1641139311.56
setstate PVAnlage 2022-01-02 16:50:39 unixtime 1641138639
setstate PVAnlage 2022-01-02 16:50:39 uptime 11
setstate PVAnlage 2022-01-02 17:27:59 voltage 216.1




@87insane
Danke keine Ahnung was da beim c&p passiert ist
Aber es funkt jetzt wie es soll und ich hab auch die Kosten/Ertragsrechnung angepasst da ja jetzt schon WattStunden und nicht mehr Minuten angegeben werden
Danke für deine Arbeit mit und meine "patschertkeit = österr. Ausdruck für ungeschickt
Nice Eve
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

Hey das ist gut.

Also seid ihr vermutlich auch für diese Lösung oder hat jemand einwände?

Grundsätzlich muss halt jemand bestätigen das es so auch geht. Sonst wird das Template von FHEM nicht angepasst.

Ich weiß das meine devstateicon variante "übertrieben" ist aber ich mag sie. Anders geht natürlich immer.

Gruß,
87insane

vic

Danke für eure Antworten und vor allem die RAWs.

Bei mir klappt es immer noch nicht.
Als Letztes hatte ich Helmi55s RAW 1:1 übernommen und nur die folgenden Parameter angepasst:
shellyplus1pm_44179394cab4  ->  shellyplus1_a8032abcd5e8
shellyplus1pm-44179394cab4  ->  shellyplus1-a8032abcd5e8

Der Aktor reagiert genau wie immer. Auch ein weiteres Shelly lieferte das gleiche Ergebnis.

Ich blicke da nicht mehr durch.
Es kann doch nicht daran liegen dass ich einen shellyplus1 anstatt ein shellyplus1pm einsetze oder?

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

Helmi55

Hallo Vic
Zeig uns mal dein RAW. Ich bin kein Spezialist aber vielleicht sehe ich auch was
Ich hab leider mein umbenanntes RAW gepostet aber du musst ja nur PVAnlage mit deinen Shelly Daten austauschen

@87insane mMn ist das Template perfekt

Grüße
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

#40
So ich kam jetzt auch zum testen. Bei mir ist es das gleiche.
Ich habe jetzt im Webcmd noch ein on:off zusätzlich mit eingebaut. Damit wird der state auf on oder off gesetzt. Sobald ich das Icon betätige wird im state toggle gesetzt und das icon springt auch auf toggle.
Anbei mein RAW. Testweise als shellyPlus_1pm und mit dem zusätzlichen webcmd eintrag. ergebnis bei beiden settings das gleiche.
Wo könnte man denn das icon generell ändern? habe überall die rc_RED oder rc_Green bei den Steckdosen.
Die setstate Einträge habe ich nicht abgeändert. Ich gehe davon aus diese werden vom device gesetzt. Falls das relevant sein sollte bitte um kurzen Fingerzeig :)


defmod Strom_Strasse MQTT2_DEVICE shellyplus1_a8032abcdffc
attr Strom_Strasse 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 Strom_Strasse devicetopic shellyplus1-a8032abcdffc
attr Strom_Strasse event-on-change-reading .*
attr Strom_Strasse group Aussensteckdosen
attr Strom_Strasse icon message_socket
attr Strom_Strasse 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 Strom_Strasse model shellyPlus_1pm
attr Strom_Strasse 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 }\
shellyplus1_a8032abcdffc:shellyplus1_a8032abcdffc/events/rpc:.* { json2nameValue($EVENT) }\
shellyplus1_a8032abcdffc:shellyplus1_a8032abcdffc/status/switch_0:.* { json2nameValue($EVENT) }\
shellyplus1_a8032abcdffc:shellyplus1_a8032abcdffc/online:.* online\
shellyplus1_a8032abcdffc:shellyplus1_a8032abcdffc/status/mqtt:.* { json2nameValue($EVENT) }\
shellyplus1_a8032abcdffc:shellyplus1_a8032abcdffc/status/cloud:.* { json2nameValue($EVENT) }\
shellyplus1_a8032abcdffc:shellyplus1_a8032abcdffc/status/sys:.* { json2nameValue($EVENT) }\
shellyplus1_a8032abcdffc:fhem/rpc:.* { json2nameValue($EVENT) }
attr Strom_Strasse room Outdoor
attr Strom_Strasse 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 Strom_Strasse userReadings relay_0_energy_kWh:params_switch_0_aenergy_total.* monotonic {ReadingsVal($NAME,"params_switch_0_aenergy_total",0)/1000.0}, Ertrag:relay_0_energy_kWh.* { sprintf("%.2f",(ReadingsVal($NAME,"relay_0_energy_kWh",0) - 0.01)*.2);;;;}
attr Strom_Strasse webCmd : on:off

setstate Strom_Strasse off
setstate Strom_Strasse 2022-01-03 23:52:55 IODev MQTT2_FHEM_Server
setstate Strom_Strasse 2021-12-27 11:58:43 attrTemplateVersion 20211224
setstate Strom_Strasse 2022-01-03 23:55:24 dst fhem
setstate Strom_Strasse 2022-01-03 23:55:24 id 0
setstate Strom_Strasse 2022-01-01 10:22:20 ip 192.168.1.50
setstate Strom_Strasse 2022-01-03 23:55:21 method NotifyStatus
setstate Strom_Strasse 2022-01-03 16:48:45 online true
setstate Strom_Strasse 2021-12-27 12:11:28 params_events_1_cfg_rev 36
setstate Strom_Strasse 2021-12-27 12:11:28 params_events_1_component sys
setstate Strom_Strasse 2021-12-27 12:11:28 params_events_1_event config_changed
setstate Strom_Strasse 2021-12-27 12:11:28 params_events_1_restart_required false
setstate Strom_Strasse 2021-12-27 12:11:28 params_events_1_ts 1640603488.46
setstate Strom_Strasse 2022-01-03 16:48:45 params_mqtt_connected true
setstate Strom_Strasse 2022-01-03 23:55:21 params_switch_0_id 0
setstate Strom_Strasse 2022-01-03 23:55:21 params_switch_0_output false
setstate Strom_Strasse 2022-01-03 23:55:21 params_switch_0_source MQTT
setstate Strom_Strasse 2021-12-31 21:28:32 params_switch_0_temperature_tC 48.48
setstate Strom_Strasse 2021-12-31 21:28:32 params_switch_0_temperature_tF 119.26
setstate Strom_Strasse 2022-01-03 00:51:58 params_sys_available_updates_beta_version 0.9.2-beta2
setstate Strom_Strasse 2022-01-03 23:55:21 params_ts 1641250521.69
setstate Strom_Strasse 2022-01-01 10:22:20 params_wifi_rssi -56
setstate Strom_Strasse 2022-01-01 10:22:20 params_wifi_ssid homenet 24
setstate Strom_Strasse 2022-01-01 10:22:20 params_wifi_status got ip
setstate Strom_Strasse 2022-01-03 23:55:24 result_was_on false
setstate Strom_Strasse 2022-01-03 23:55:24 src shellyplus1-a8032abcdffc
setstate Strom_Strasse 2022-01-03 23:55:24 state off


Plus zum besseren Verständnis ein Bild von dem ganzen.

Viele Grüße und vielen Dank für Eure Mühen!!

Matze

OdfFhem

@smoudo

***

Das Attribut icon legt das Icon vor dem Namen in der Übersichtszeile fest.

Das Attribut devStateIcon legt das "Icon" hinter dem Namen in der Übersichtszeile fest.
Für dieses "Icon" gibt es zwei Möglichkeiten; in Deinem Fall wird die freie Gestaltung mit Perl unterstützt. Die Variable "$onl" legt das erste Icon fest (basiert auf dem Reading "online" und dem noch fehlenden Reading "new_fw"), die Variable "$light" legt das zweite Icon fest (basiert auf dem Reading "state"; besser wäre hier vermutlich das output-Reading, da ansonsten zu viele Zustände entstehen).

***

Dein Attribut readingList ist unnötig groß. Da Du das Attribut "devicetopic" definiert hast, sollten hier nur Einträge mit $DEVICETOPIC hinterlegt werden; alle anderen sollten gelöscht werden. Taucht "irgendwann" ein Eintrag ohne $DEVICETOPIC auf, dann ist ein bislang noch nicht unterstützer Eintrag dazugekommen (momentan wäre ein möglicher Verursacher der fehlende Eintrag für $DEVICETOPIC/rpc ... quasi identisch zu $DEVICETOPIC/events/rpc).

Frage ist noch, welches topic bei Deinem Shelly in der MQTT-Konfiguration hinterlegt ist (mit - oder mit _). Dieser Wert sollte im devicetopic-Attribut hinterlegt werden.

***

Beim Attribut setList "stören" die doppelten Backslash am Ende jeder Zeile.

***

Zeilen mit setstate sollten auf jeden Fall ignoriert und nicht übernommen werden.

vic

@Helmi55: Anbei sende ich dir mein RAW

defmod PVAnlage MQTT2_DEVICE shellyplus1_a8032abcd5e8
attr PVAnlage 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 PVAnlage devicetopic shellyplus1-a8032abcd5e8
attr PVAnlage event-on-change-reading .*
attr PVAnlage 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 PVAnlage model shellyPlus_1pm
attr PVAnlage 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 }\
shellyplus1_a8032abcd5e8:shellyplus1-a8032abcd5e8/events/rpc:.* { json2nameValue($EVENT) }\
shellyplus1_a8032abcd5e8:shellyplus1-a8032abcd5e8/status/switch_0:.* { json2nameValue($EVENT) }\
shellyplus1_a8032abcd5e8:shellyplus1-a8032abcd5e8/online:.* online\
shellyplus1_a8032abcd5e8:shellyplus1-a8032abcd5e8/status/mqtt:.* { json2nameValue($EVENT) }\
shellyplus1_a8032abcd5e8:shellyplus1-a8032abcd5e8/status/cloud:.* { json2nameValue($EVENT) }\
shellyplus1_a8032abcd5e8:shellyplus1-a8032abcd5e8/status/sys:.* { json2nameValue($EVENT) }\
shellyplus1_a8032abcd5e8:fhem/rpc:.* { json2nameValue($EVENT) }
attr PVAnlage room PV Anlage,MQTT2_DEVICE
attr PVAnlage 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 PVAnlage userReadings relay_0_energy_kWh:params_switch_0_aenergy_total.* monotonic {ReadingsVal($NAME,"params_switch_0_aenergy_total",0)/1000.0}, Ertrag:relay_0_energy_kWh.* { sprintf("%.2f",(ReadingsVal($NAME,"relay_0_energy_kWh",0) - 0.01)*.2);;;;}
attr PVAnlage webCmd :

setstate PVAnlage toggle
setstate PVAnlage 2022-01-04 08:25:02 IODev MQTT2
setstate PVAnlage 2022-01-04 08:26:35 dst shellyplus1-a8032abcd5e8/events
setstate PVAnlage 2022-01-04 08:26:35 id 0
setstate PVAnlage 2022-01-04 08:26:35 method NotifyStatus
setstate PVAnlage 2022-01-04 08:25:31 online true
setstate PVAnlage 2022-01-04 08:25:31 params_mqtt_connected false
setstate PVAnlage 2022-01-04 08:26:35 params_switch_0_id 0
setstate PVAnlage 2022-01-04 08:26:35 params_switch_0_output true
setstate PVAnlage 2022-01-04 08:26:35 params_switch_0_source MQTT
setstate PVAnlage 2022-01-04 08:26:35 params_ts 1641281195.62
setstate PVAnlage 2022-01-04 08:26:35 result_was_on false
setstate PVAnlage 2022-01-04 08:26:35 src shellyplus1-a8032abcd5e8
setstate PVAnlage 2022-01-04 08:26:34 state toggle


Was mir aufgefallen ist.. wenn ich nicht on oder off schalte sondern zu beginn direkt auf dem Icon so bleibt der STATE-parameter auf ???. Wenn ich z.B. auf on schalte so ist dann STATE auf on. Mit Klick auf Icon bleibt er auf on. Der state-Parameter auf Readings hingegen wechselt auf toggle.

Vielleich hilft das was.
Raspberry Pi 4
RFXTRX 868MHz und 433MHz
FS20, Intertechno, Homematic, Shelly
MAX!-Cube, Philips HUE-Bridge

Helmi55

Servus vic

Ich habe meine pluspm mit obiger RAW zum Laufen bekommen.
ich kann leider nicht sagen wie sich ein shelly plus ohne pm verhält? Ich habe keinen und weiß leider auch nicht ob es da unterschiede (außer pm) gibt.

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/

vic

Guten Tag Helmut

Du kannst somit den Shelly mittels Klicken auf dem Icon schalten (das funktioniert bei mir ebenfalls) .und. das Icon wechselt die Darstellung (das funktioniert bei mir nicht  >:( :().

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