/* Demonstrator-Anwendung */ Tür-öffner skript
authorTsuro <Tsuro@stratum0.org/mediawiki/>
Wed, 21 Nov 2012 21:50:44 +0000 (21:50 +0000)
committerTsuro <Tsuro@stratum0.org/mediawiki/>
Wed, 21 Nov 2012 21:50:44 +0000 (21:50 +0000)
Doorbell_Extender.mw

index b6c8411..1a8d534 100644 (file)
@@ -72,3 +72,21 @@ Java-Klasse, mit der UDP-Events gesendet und empfangen werden können.
 * Events: siehe weiter oben
 
 Verfügbar im [http://svn.tinyhost.de/stratum0/doorbell/trunk/UDP_SEND_workspace_%28Java%29/UDP-Send/src/doorbell/ SVN]
+
+=== kleines Python-Skript um die Tür unten zu öffnen ===
+<pre>
+import socket as sock
+import time
+
+stop_command = b"EVENTDISTRv1;DoorUnten=RISING"
+start_command = b"EVENTDISTRv1;DoorUnten=FALLING"
+ip = "192.168.178.255"
+port = 31337
+
+s = sock.socket(sock.AF_INET, sock.SOCK_DGRAM)
+s.setsockopt(sock.SOL_SOCKET,sock.SO_BROADCAST,1)
+s.sendto(start_command,(ip,port))
+time.sleep(3)
+s.sendto(stop_command,(ip,port))
+s.close()
+</pre>
This page took 0.025833 seconds and 4 git commands to generate.