Mist, die Knöpfe in der App sind die outputs, so funktioniert es gar nicht. pfffffffff
Also gut, dann werde ich den Zeitplan in der App manuell ändern. Dafür kann ich alle drei separat steuern...
Zeitpläne sollten Namen kriegen!
Mist, die Knöpfe in der App sind die outputs, so funktioniert es gar nicht. pfffffffff
Also gut, dann werde ich den Zeitplan in der App manuell ändern. Dafür kann ich alle drei separat steuern...
Zeitpläne sollten Namen kriegen!
Hi,
ich habe einen Shelly Pro 3 gekauft, um meine zwei Zirkulationspumpen damit anzusteuern. Für die drei Input-Switches habe ich drei Programme erstellt: Normal, Party, Urlaub. Jedes hat einen eigenen Zeitplan, der mit den Detached Inputs ein- oder ausgeschaltet wird.
Was mich interessieren würde: Wie könnte ich in der App in irgendeiner Form darstellen, welches Programm aktuell eingeschaltet ist?
Oder soll ich die digitalen Eingänge einfach immer 'an' lassen, statt sie auszuschalten? Macht das nichts aus?
Setup:
http://192.168.7.43/rpc/Input.SetConfig?id=0&config={"name":"Normal","type":"switch","enable":true,"invert":false}
http://192.168.7.43/rpc/Input.SetConfig?id=1&config={"name":"Party","type":"switch","enable":true,"invert":false}
http://192.168.7.43/rpc/Input.SetConfig?id=2&config={"name":"Urlaub","type":"switch","enable":true,"invert":false}
http://192.168.7.43/rpc/Switch.SetConfig?id=0&config={"name":"Zirko 1","in_mode":"detached","initial_state":"off"}
http://192.168.7.43/rpc/Switch.SetConfig?id=1&config={"name":"Zirko 2","in_mode":"detached","initial_state":"off"}
http://192.168.7.43/rpc/Switch.SetConfig?id=2&config={"name":"Zirko 3","in_mode":"detached","initial_state":"off"}
http://192.168.7.43/rpc/Schedule.DeleteAll
http://192.168.7.43/rpc/Schedule.Create?timespec="0 0,30 6-22 * * *"&calls=[{"method": "switch.set","params": {"on": true,"toggle_after": 300,"id": 0}},{"method": "switch.set","params": {"on": true,"toggle_after": 300,"id": 1}}]
http://192.168.7.43/rpc/Schedule.Create?timespec="0 0,30 * * * *"&calls=[{"method": "switch.set","params": {"on": true,"toggle_after": 300,"id": 0}},{"method": "switch.set","params": {"on": true,"toggle_after": 300,"id": 1}}]
http://192.168.7.43/rpc/Schedule.Create?timespec="0 0 10 * * *"&calls=[{"method": "switch.set","params": {"on": true,"toggle_after": 300,"id": 0}},{"method": "switch.set","params": {"on": true,"toggle_after": 300,"id": 1}}]
http://192.168.7.43/rpc/Schedule.Update?id=0&enable=true
http://192.168.7.43/rpc/Schedule.Update?id=1&enable=false
http://192.168.7.43/rpc/Schedule.Update?id=2&enable=false
Alles anzeigen
script:
var htimer0
var htimer1
var htimer2
Shelly.addEventHandler(function(e) {
if (e.component === "switch:0") {
if ((e.info.event === "toggle") && (e.info.state === true)) {
Timer.clear(htimer0);
htimer0 = Timer.set(100, false, turnOff0);
Shelly.call("Schedule.Update",{"id": 1,"enable": true});
Shelly.call("Schedule.Update",{"id": 2,"enable": false});
Shelly.call("Schedule.Update",{"id": 3,"enable": false});
}
}
else if (e.component === "switch:1") {
if ((e.info.event === "toggle") && (e.info.state === true)) {
Timer.clear(htimer1);
htimer1 = Timer.set(100, false, turnOff1);
Shelly.call("Schedule.Update",{"id": 1,"enable": false});
Shelly.call("Schedule.Update",{"id": 2,"enable": true});
Shelly.call("Schedule.Update",{"id": 3,"enable": false});
}
}
else if (e.component === "switch:2") {
if ((e.info.event === "toggle") && (e.info.state === true)) {
Timer.clear(htimer2);
htimer2 = Timer.set(100, false, turnOff2);
Shelly.call("Schedule.Update",{"id": 1,"enable": false});
Shelly.call("Schedule.Update",{"id": 2,"enable": false});
Shelly.call("Schedule.Update",{"id": 3,"enable": true});
}
}
});
function turnOff0() {
Shelly.call("Switch.set", {'id': 0, 'on': false});
};
function turnOff1() {
Shelly.call("Switch.set", {'id': 1, 'on': false});
};
function turnOff2() {
Shelly.call("Switch.set", {'id': 2, 'on': false});
};
Alles anzeigen
Ich habe ein NAS, das ohnehin immer läuft, daher konnte ich das Problem wie folgt lösen:
Shelly-Script mit Auto-Off: Eine URL zum NAS wird aufgerufen:
(Die NAS-IP muss angepasst werden)
var htimer
function processHttpResponse(result, error_code, error) {
if (error_code != 0) {
// process error
} else {
console.log('', result);
}
}
Shelly.addEventHandler(function(e) {
if (e.component === "switch:0") {
if ((e.info.event === "toggle") && (e.info.state === true)) {
Timer.clear(htimer);
htimer = Timer.set(400, false, turnOff);
Shelly.call("HTTP.GET", {url: "http://192.168.0.12/wol.php"}, processHttpResponse);
}
}
});
function turnOff() {
Shelly.call("Switch.set", {'id': 0, 'on': false});
};
Alles anzeigen
wol.php im NAS /Web Verzeichnis
<?php
ini_set('display_errors', TRUE);
error_reporting(E_ERROR | E_PARSE);
$command = escapeshellcmd('python wol.py');
$output = shell_exec($command);
echo $output;
?>
wol.py im gleichen Verzeichnis:
Die Broadcast-IP anpassen, die MAC-Adressen in 'known_computers' anpassen und ganz unten die Aufrufe von 'wol()' anpassen (Anzahl und Namen aus 'known_computers')
python 2.7
import sys, struct, socket
# Configuration variables
broadcast = ['192.168.0.255']
wol_port = 9
known_computers = {
'pc1' : '23:64:72:24:26:21',
'pc1_lan2' : '23:64:72:24:26:22',
}
def WakeOnLan(ethernet_address):
# Construct 6 byte hardware address
add_oct = ethernet_address.split(':')
if len(add_oct) != 6:
print "\n*** Illegal MAC address\n"
print "MAC should be written as 00:11:22:33:44:55\n"
return
hwa = struct.pack('BBBBBB', int(add_oct[0],16),
int(add_oct[1],16),
int(add_oct[2],16),
int(add_oct[3],16),
int(add_oct[4],16),
int(add_oct[5],16))
# Build magic packet
msg = '\xff' * 6 + hwa * 16
# Send packet to broadcast address using UDP port 9
soc = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
soc.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST,1)
for i in broadcast:
soc.sendto(msg,(i,wol_port))
soc.close()
def wol(*macs):
if len(macs) == 0:
print "\n*** No computer given to power up\n"
print "Use: 'wol computername' or 'wol 00:11:22:33:44:55'"
else:
for i in macs:
if i[0] != '/':
if ":" in i:
# Wake up using MAC address
WakeOnLan(i)
else:
# Wake up known computers
if i in known_computers:
WakeOnLan(known_computers[i])
else:
print "\n*** Unknown computer " + i + "\n"
quit()
if len(macs) == 2:
print "\nDone! The computer should be up and running in a short while."
else:
print "\nDone! The computers should be up and running in a short while."
print
wol('pc1')
wol('pc1_lan2')
Alles anzeigen
Hmm, interesting, thank you!
Hi Michael,
Did you have time to check it? However, I would be surprised if it were different for you. The 'status off' event is triggered by the 'Switch.set,' but it either doesn't leave the device, or it doesn't get delivered to the client. (The same goes for timers) Is there a place to report such things?
the switching status is correctly transferred to the shared account
I see. I'll do some research then.
With the script above, the switch is turned off after 300ms, but the GUI keeps the blue ring over the button in shered mode.
It was the same with a timer, however I entered 0,3s as a timeout, I'll try with timer and 1 second again. (I just don't like the countdown timer in the GUI.)
In shared mode, (shared device), on the client phones, the app does not get any event when the state changes, so the GUI stucks in pushed mode.
Is there a workaround for that?
Thanks, now I can see it!
You only have to setup an auto-off -timer.
Did you mean like I did with a script or is there anything else for that I didn't see?
Heh, how cool is that:
var htimer
Shelly.addEventHandler(function(e) {
if (e.component === "switch:0") {
if ((e.info.event === "toggle") && (e.info.state === true)) {
Timer.clear(htimer);
htimer = Timer.set(400, false, turnOff);
}
}
});
function turnOff() {
Shelly.call("Switch.set", {'id': 0, 'on': false});
};
Alles anzeigen
\o/
Ok, I have to ask again, how can I use the Shelly Pro 1 as a pushbutton on my phone?
It should release the relais automatically.
The Input/Output settings does nothing, it's just a placeholder in the settings.
Also, in the Phone App it has only a caption "Input settings" but in the Shelly web there is a "Set output type" too
but all the items in it are just another indian names for the same function:
Set relay type
- Set Shelly Device to a toggle switch... Act as a flip switch, one state for ON one for OFF
- Momentary switch. Push for ON, push for OFF
- "Edge" switch, changes state on every hit.
This makes no sense for me. All the same.
Is it possible that I have to reflash with some 3rd party firmware to be able to use it as a pushbutton?
Can I write a script to achieve the same?
I'm somewhat disappointed, is the product abandonned?
Ah, I see, thank you. It would be nice to have the same for the GUI, though.
Newbie here, just bought the Pro 1.
There is an Input/Output setting where you can choose between switch or button mode.
If you choose button mode and the available sub-settings, nothing happens; it remains a switch.
It should only trigger as long as my finger is on the display in button mode.
Firmware is the latest.
Am I missing something?
Regards,