VPN/Proxy erkannt
Es scheint, dass Sie einen VPN- oder Proxy-Dienst verwenden. Bitte beachten Sie, dass die Nutzung eines solchen Dienstes die Funktionalität dieser Webseite einschränken kann.
-
"Sorry for not responding for so long - I was sick...
The script works great! Thank you so much!!!"

-
Hello De kat.
Zitat
Ok, you just want a script thats turns the Relay off when its reached 1kwh power, and a new input (button? or switch?) turns the relay back on?
Yes exactly.
Zitat
So you already have some kind of Script for this.
I tried to write it myself, but then I found a script for my device in the library.
Here is it:
// This script listens for the event when the output is turned on, and starts
// counting the power reported in NotifyStatus every minute It is accumulated in
// a counter and if the combined consumption is over a threshold the output is
// turned off
let startMonitor = false;
let eAccumulator = 0;
let maxEnergy = 100; //threshold, in milliwatthours
Shelly.addEventHandler(function (event, user_data) {
if (typeof event.info.output !== "undefined") {
if (event.info.output) {
startMonitor = true;
eAccumulator = 0;
} else {
startMonitor = false;
}
}
}, null);
Shelly.addStatusHandler(function (event, user_data) {
print(JSON.stringify(event));
if (typeof event.delta.aenergy !== "undefined") {
if (startMonitor) {
eAccumulator = eAccumulator + event.delta.aenergy.by_minute[0];
if (eAccumulator > maxEnergy) {
print("Will turn off because of power consumed");
Shelly.call(
"switch.set",
{ id: 0, on: false },
function (result, code, msg, ud) {},
null
);
}
}
}
}, null);
Alles anzeigen
-
Hello everyone.
I'm seeking help with configuring my Shelly Pro 1PM.
I need it to count 1 kWh upon activation and then have the device turn off until the next activation.
The problem is that the device doesn't respond to scripts at all. The script runs, the logs indicate that everything is working, but nothing happens.
How can I make the switch follow the programmed sequence?
Thanks for the responses!