Vielen Dank für die Antworten Bernd und 87insane
Ist es zwingend notwendig den MQTT2-Server einzurichten?
Ich verwende einen externen MQTT-Server (mosquitto) und binde die Shellies mit MQTT2_DEVICE ein.
Code
define AKT_031_Waschmaschine MQTT2_DEVICE
attr AKT_031_Waschmaschine IODev mosquitto
attr AKT_031_Waschmaschine alias Waschmaschine
attr AKT_031_Waschmaschine comment To get appropriate loadState values: Change the default limit "100" in readingList to your needs.
attr AKT_031_Waschmaschine devStateIcon {my $onl = ReadingsVal($name,"online","false") eq "false"?"10px-kreis-rot" : ReadingsVal($name,"new_fw","false") eq "true" ? "10px-kreis-gelb" : "10px-kreis-gruen";;;; my $light = ReadingsVal($name,"state","off");;;; my $cons = ReadingsVal($name,"relay_0_power","unknown");;;; my $total = ReadingsVal($name,"relay_0_kWh","unknown");;;; my $temp = ReadingsVal($name,"temperature","-100");;;;"<a href=\"http://".ReadingsVal($name,"ip","none")." \"target=\"_blank\">".FW_makeImage($onl)."</a> <a href=\"/fhem?cmd.dummy=set $name toggle&XHR=1\">".FW_makeImage($light)."</a><div>Verbrauch: $cons / Total: $total/ Temp: $temp °C</div>"}
attr AKT_031_Waschmaschine event-on-change-reading .*
attr AKT_031_Waschmaschine group Keller
attr AKT_031_Waschmaschine icon scene_washing_machine
attr AKT_031_Waschmaschine model shelly1_w_energy_meassuring
attr AKT_031_Waschmaschine readingList shellies/shelly1pm-123456057890/relay/0:.* state\
shellies/shelly1pm-123456057890/relay/0:.* relay0\
shellies/shelly1pm-123456057890/input/0:.* input0\
shellies/shelly1pm-123456057890/online:.* online\
shellies/announce:.* { $EVENT =~ m,..id...shelly1pm-123456057890...mac.*, ? json2nameValue($EVENT) : return }\
shellies/shelly1pm-123456057890/announce:.* { json2nameValue($EVENT) }\
shellies/shelly1pm-123456057890/relay/0/power:.* relay_0_power\
shellies/shelly1pm-123456057890/relay/0/power:.* { my $compare = $EVTPART0 < 100 ? "off":"on";; ReadingsVal($NAME,"loadState","off") ne $compare ? { 'loadState' => $compare } : return }\
shellies/shelly1pm-123456057890/temperature:.* temperature\
shellies/shelly1pm-123456057890/overtemperature:.* overtemperature\
shellies/shelly1pm-123456057890/relay/0/energy:.* relay_0_energy\
shellies/shelly1pm-123456057890/relay/0/energy:.* {'relay_0_kWh' => sprintf("%.2f",$EVENT/60/1000)}\
shellies/shelly1pm-123456057890/longpush/0:.* longpush_0
attr AKT_031_Waschmaschine room MQTT
attr AKT_031_Waschmaschine setList relay0:on,off,toggle shellies/shelly1pm-123456057890/relay/0/command $EVTPART1\
off:noArg shellies/shelly1pm-123456057890/relay/0/command off\
on:noArg shellies/shelly1pm-123456057890/relay/0/command on\
x_update:noArg shellies/shelly1pm-123456057890/command update_fw\
x_mqttcom shellies/shelly1pm-123456057890/command $EVTPART1
attr AKT_031_Waschmaschine userReadings total_temp:loadState:.on { ReadingsNum("$name","relay_0_kWh",0) },wash:loadState:.off { ReadingsNum("$name","total",0) - ReadingsNum("$name","total_temp",0) },price:loadState:.off {sprintf("%.2f",ReadingsNum("$name","wash",1)*ReadingsNum("kWh_Price","state",0.30))},time:loadState:.off {strftime("%H:%M", localtime(ReadingsAge("$name","total_temp",0)-3600))}
attr AKT_031_Waschmaschine webCmd :
Alles anzeigen
Den notify versuche ich auf diese Weise.
Code
define var_AKT_031_Waschmaschine notify AKT_031_Waschmaschine { my $AKT_031_Waschmaschine_power=ReadingsVal("AKT_031_Waschmaschine","relay_0_power",0) ;; fhem("set var_AKT_031_Waschmaschine $AKT_031_Waschmaschine_power") ;; if (Value("var_AKT_031_Waschmaschine") < 20 ) { (DebianMail_gmx('mail.mail@hostname.com', '***** FHEM ***** Waschmaschine unter 20 Watt *****', 'Waschmaschine unter 20 Watt') ) } }
Irgendwo mache ich einen Gedankenfehler...
Soll ich meinen Post in die FHEM-FAQ eintragen? Ich denke dies ist zu banal....
Danke für eure Hilfe
Claudio