Skip to content

Latest commit

 

History

History
40 lines (24 loc) · 782 Bytes

README.md

File metadata and controls

40 lines (24 loc) · 782 Bytes

IoT Python Client

Prerequisites

First you need to install socket.io python client

pip install socketio-client

Usage

Now download the client.py file from biot and include that in your python file/project

from biot.client import BIoTClient

DEVICE_ID = 1 		# Your Device ID
DEVICE_TOKEN = "" 	# Your Access Token

client = BIoTClient("<Server IP Address>", <port>, params={'token': DEVICE_TOKEN})

client.wait(2) # Give some time to connect to Server

def lightUpdate(status):
    print("Light update received" ,status);
    if status == 'true':
        # Turn your Device ON
        pass
    else:
        # Turn your Device ON
        pass
	

client.on_update(1, 'status', lightUpdate)

client.wait()

Run the program using python -u sample.py