// Shelly Plus 1PM - Stop the output after consuming
// no power (i.e. below standbyPower) - wait 10 sec after ON
let startMonitor = false;
let standbyPower = 2;
let alertTimer = null;
Shelly.addEventHandler(function (event, user_data) {
if (typeof event.info.state !== "undefined") {
if (event.info.state) {
//startMonitor = true;
delayTimer = Timer.set(10000, true, function () {startMonitor = true; stopTimer();}, null); //delay 10sec
} else {
startMonitor = false;
stopTimer();
}
}
if (typeof event.info.apower !== "undefined") { //delta.apower
if (startMonitor === true) { // && event.id === 0) {
if (event.info.apower < standbyPower) {
//print("Will turn off");
Shelly.call(
"switch.set",
{ id: 0, on: false },
function (result, code, msg, ud) {},
null
);
}
}
}
}, null);
function stopTimer() {
Timer.clear(delayTimer);
} defmod storedCam_notify notify storedCam:lastEventFile.* {\
my $campath = (split /\//,ReadingsVal($NAME,'lastEventFile',''))[3];; \
my $campath0;; \
if ($campath eq "Camera_1") {$campath = "Haustuer";;} \
elsif ($campath eq "Camera_2") {$campath = "Ostseite";;} \
elsif ($campath eq "Camera_3") {$campath = "Westseite";;};; \
$campath0 = $campath." 0";; \
$campath = $campath." 1";; \
fhem "sleep 0.1;; \
setreading storedCam campath_log $campath;; \
setreading storedCam campath_log $campath0"}
attr storedCam_notify comment Da in einem notify setreading zwar ausgeführt wird, aber kein Event erzeugt und demnach auch nicht geloggt wird, \
ist der work-around mit sleep 0.1 notwendig. \
Quellen:\
Forumsbeitrag: https://forum.fhem.de/index.php?topic=118775.0\
sowie: https://fhem.de/commandref_DE.html#setreading
attr storedCam_notify disabledAfterTrigger 15Zitat von: rabehd am 13 Februar 2026, 11:56:40Kannst Du da konkreter werden?
Zitat von: rabehd am 13 Februar 2026, 10:36:12attr Luftdruck valueFormat {ReadingsAge($DEVICE,'pressure',1000)/60 < 60 ? return sprintf("%i hPa", $VALUE) : return undef;;}
attr Luftdruck valueFormat {if($READING eq 'zeitpunkt'){###hier hin was bei Zeitpunkt passieren soll###} elsif($READING eq 'pressure'){ReadingsAge($DEVICE,'pressure',1000)/60 < 60 ? return sprintf("%i hPa", $VALUE) : return undef;;}}