Living Technology  

  

 
 
  Control Over Cloud (COC)
 
 

 
           
       Products Student Support Our Mission                  
           
     

 

  COC interface controller software  
     
    -  COC  VB.net  
    -  COC  Python  
     
    - Control Over Cloud  
     
    -  Download COC VB.net Sourcecode  
     

  

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  

 

 

 

 

 

 

 

 

 

 

 

 

 

   
 
    we have developed an open source sample in order to act as a controller application between the iRelay and your hardware so you can embed your code and start using the COC in your projects

** if you have raspberry,you can have access to raspberry GPIO through the internet,

 
  1- sign up new account for COC if you do not have an account yet
  2-  login to the COC control panel  http://hohex.com/ho/index.asp, and click the power button

  3- Then press settings icon to label you iRelay  ,

  4- Run the below python code (may be using Geany)

  5- you will be asked for user name and password ,you have to enter COC username and password you have selected in step 1,

   6- you will be asked to enter the delay in m/sec for successive reads 

   7- now goto http://hohex.com/ho/index.asp , after the successful logging press , and then by switching (switch 1 for example) this will enable GPIO4  High and low
 

 

      #!/usr/bin/python
# -*- coding: utf-8 -*-

import pyodbc
import RPi.GPIO as GPIO
import time
import os
import urllib

## account verification
sock = urllib.urlopen("http://hohex.com/ho/access.asp")
htmlSource = sock.read()
sock.close()
sn=len(htmlSource)

while htmlSource[0:-(sn-6)] != "logged":
un = raw_input("Please Enter you COC username?")
pw = raw_input("Please Enter you COC password? ")


## account verification
sock = urllib.urlopen("http://hohex.com/ho/access.asp?un=" + un + "&pw=" + pw)
htmlSource = sock.read()
sock.close()
sn=len(htmlSource)



if ( htmlSource[0:-(sn-6)] ) == "logged":
print("You have been logged Successfully!")
tset=1
else:
tset=0
print("Wrong account , or connectivity error")




dl = raw_input("enter the samplying interval in seconds? ")
GPIO.setmode(GPIO.BCM)
GPIO.setup(4, GPIO.OUT)

while tset==1:
#try:

st=time.strftime("%Y-%m-%d %H:%M:%S")
print st
sock1 = urllib.urlopen("http://hohex.com/ho/shub.asp?un=" + un + "&pw=" + pw + "&kst=" + st)
print ("--------------------------------------------------------")
htmlSource1 = sock1.read()
sock1.close()




sn=len(htmlSource1)
sw1=htmlSource1[0:-28]
sw2=htmlSource1[2:-26]
sw3=htmlSource1[4:-24]
sw4=htmlSource1[6:-22]
sw5=htmlSource1[8:-20]
sw6=htmlSource1[10:-18]
sw7=htmlSource1[12:-16]
sw8=htmlSource1[14:-14]
sw9=htmlSource1[16:-12]
sw10=htmlSource1[18:-10]
sw11=htmlSource1[20:-8]
sw12=htmlSource1[22:-6]
sw13=htmlSource1[24:-4]
sw14=htmlSource1[26:-2]
sw15=htmlSource1[28:0]

## enable/disable GPIO4 if switch1 is off/on
if "1" in sw1:
GPIO.output(4, True)


if "0" in sw1:
GPIO.output(4, False)
        
 
 
 

 

 

    
    
 

(c) All rights are reserved 2010 - 2012 Cairo ,Egypt.