Hello,
e seems not be the problem. In the script i can reach the line 24 but after that status value is always different from 1 or 2.
The variable status not keep the value.
Thanks
Hello,
e seems not be the problem. In the script i can reach the line 24 but after that status value is always different from 1 or 2.
The variable status not keep the value.
Thanks
Hello,
i need to support a particular motor blind (see image attached). I have connect the circuit with myne Shelly PRO 2PM and set it in Cover mode. If i press the Up or Down button it works but the problem is the stop button.
I'm so tring to implement a script for make it working.
In this script what i want to do is:
- store a status of the action that the cover is doing
- based on the status for stop the blind i have to set the shelly in stop mode and then re-set the output in open or close. This stop the blind.
The problem is that seems the status variable not store the value 1 or 2.
let status = 0;
Shelly.addStatusHandler(function(e) {
if (e.component === "cover:0") {
print(e.delta.state);
if (e.delta.state === "opening") {
print("INPUT: Cover is now opening");
status = 1;
}
else if (e.delta.state === "closing") {
print("INPUT: Cover is now closing");
status = 2;
}
else{
print("INPUT: Cover button stop");
status = 0;
}
}
});
Shelly.addStatusHandler(function(e) {
if (e.component === "cover:0") {
if (e.delta.state === "stopped") {
print("STATUS: Cover to stop: ");
print(status);
if(status === 1){
print("Toggle switch closing");
Shelly.call("OUTPUT: Cover.stop", {'id': 0});
Shelly.call("OUTPUT: Cover.close", {'id': 0});
}
else if (status === 2){
print("Toggle switch opening");
Shelly.call("OUTPUT: Cover.stop", {'id': 0});
Shelly.call("OUTPUT: Cover.open", {'id': 0});
}
else{
}
status = 0;
}
}
});
Alles anzeigen
this is the log:
opening
INPUT: Cover is now opening
stopped
INPUT: Cover button stop
STATUS: Cover to stop:
0
undefined
INPUT: Cover button stop
why the status not take the value?
Thanks