473,406 Members | 2,956 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Switching a Dataprobe iP-415/815 (basic) using TCP

>---<snip>---<snip>---<snip>---<snip>---<snip>---<snip>---<snip>---<
#!/usr/bin/env python

import socket
import sys, time

# ----------------------------------------------------------
# File: dataprobe.py
# Author: Alan Haffner
# Date: 2006-08-10
# Rev. .60
#
# Tested on Linux only
#
# Usage: dataprobe.py <command>
#
# $ dataprobe.py 5P 4
# $ 11110111
# $ 11111111
#
# Note: dataprobe uses about 3 different TCP command protocols
# across their product line, so check /w their tech support
# on your model's specific command set.
# ----------------------------------------------------------

# format the escape hexbyte as a type char
esc = chr(int('1b',16))

# Construct the command which gets the status of the
# dataprobe's (iP-415/815) relay array.
# Uses dataprobe default password
getRelayStateInfo = (("%cPASS" % esc)+'O')

HOST = '192.168.1.254' # Default Dataprobe iP-815 address
PORT = 9100 # The same port as used by the server

# connect to dataport TCP server
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((HOST,
PORT))
time.sleep(3)

# send command to power stript TCP server
# Uses dataprobe default password
header = "%cPASS" % esc
s.send(header + sys.argv[1].strip())

# sleep for one second longer than powercycle set time.
# -- currently the dataprobe is set to a 3sec. pulse delay
sleep_time = float(sys.argv[2].strip())
time.sleep(sleep_time)

# Get Power Strip Bus Status
# -- When using the P command, the first read will always
# show the pulse transition
s.send(getRelayStateInfo)
d = s.recv(16)
print d

time.sleep(2)

s.send(getRelayStateInfo)
d = s.recv(16)
print d

# close TCP connection to dataprobe server
s.close()
>---<snip>---<snip>---<snip>---<snip>---<snip>---<snip>---<snip>---<
Aug 11 '06 #1
0 1038

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Alexander N. Spitzer | last post by:
If I have a machine with 3 virtual IP addresses (192.168.1.), how can I start 3 instances of the same RMI application (each started with different properties/configs), each listening on the port...
1
by: nic | last post by:
Hi, I am building a tcpClient which is supposed to connect to a 3rd party server using a private point-to-point connection. Our internal network is 192.168.16.0 and the private network is on the...
3
by: Dennis Wheeler | last post by:
I'm trying to find a commandline solution for switching projects. Currently I have to modify the IIS virtual directory path to the source files, and then open the solution file in .Net to be...
1
by: Abby | last post by:
I'm writing a code to send/receive udp packet. I'll receive ip address from user (this is the starting ip), then I'll ask user how many ip he wants to connect to. For examples: Please enter 1st...
65
by: kyle.tk | last post by:
I am trying to write a function to convert an ipv4 address that is held in the string char *ip to its long value equivalent. Here is what I have right now, but I can't seem to get it to work. ...
0
by: abdulics | last post by:
Hi, We have immediate openings with one of our Top Notch Telecom clients for their Research and Development Center in Bangalore. Please send me your detailed/brief profile to...
0
by: abdulics | last post by:
Hi, We have immediate openings with one of our Top Notch Telecom clients for their Research and Development Center in Bangalore. Our top notch and reputed client deliver complex IT solutions on...
11
by: brett | last post by:
I use two test servers and one production. I have a Utilities class that holds many of the links used through the site. One of the variables in this class is assigned the domain name. I need to...
2
by: Frank Swarbrick | last post by:
I had asked a question a few weeks ago about having problems at times accessing DB2 Express-C 9.1, and getting "SQL1032N No start database manager command was issued. SQLSTATE=57019" even when the...
4
by: adlloyd | last post by:
Hi all, I've got an application that's written in C++ making use of MFC (VS6). Its purpose is to process SMS messages received from a GSM modem connected via a serial port (USB connection). The...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.