Created
July 14, 2019 22:39
-
-
Save asantaga/308f3a2fc59172e9f272d52a29a25e5b to your computer and use it in GitHub Desktop.
Monitor LightwaveRF Energy Sqwalks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import logging | |
import socket | |
import time | |
data = None | |
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
sock.bind(('0.0.0.0', 9761)) | |
sock.settimeout(30.0) # Wait a Max of 10 seconds | |
while True: | |
try: | |
print("Waiting for data from LWRF Energy Device") | |
data, _ = sock.recvfrom(1024) # buffer size is 1024 bytes | |
print("Data received from LWRF Energy %s " % data) | |
except socket.timeout as ex: | |
print("No data received ") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment