Skip to main content

UnifiedThings Vertex SDK

Project description

vertex

vertex is a framework to build and power your Internet of Things Device. Is is built with a mission to be interoperable with other smart things and devices connected to the internet, and hence is based on open APIs, standards and protocols.

The theme of interoperability is central to the vision of UnifiedThings because we believe

IoT Device < A Smart and Intelligent IoT Device < A Unified, Interoperable and Connected Network of Intelligent and Smart IoT Devices

vertex is a inspired by (read a partial implementation of) the W3C Candidate Recommendation of the WoT Thing Description framework. It is still under active development and might change based on the accepted recommendation of standards as and when they become concrete. Please note that the W3C draft linked here is a Candidate Recommendation and is still awaiting movement to Proposed Recommendation and an actual Recommendation. During these tentative and experimental steps towards achieving open standardization, we aim to strive to achieve implementation feasibility, proof of concepts for value addition of a interoperable and connected IoT network, and contribute to make these set of standards better.

vertex is supposed to work seamlessly with the UnifiedThings cloudlet (an upcoming edge and fog platform) and the UnifiedThings Cloud Platform.

Usage Example

# Let's create a toaster
import random
import threading
import time
import asyncio
from vertex import Vertex, ActionExecutor, PropertyReader

# Create a vertex instance on port 9000
v = Vertex(9000)

# Set the attributes of the thing
v.set_id("123")
v.set_type("toaster")
v.set_title("Toaster in the Kitchen")
v.set_version("1.0")

# Temperature property reader  
class TemperatureReader(PropertyReader):

    def read(self):
        # Implement actual reading from temperature sensor
        return random.random() * 100.0

# Power button action executor
class PowerButtonExecutor(ActionExecutor):

    def execute(self, input_data):
        # Implement actual power button call logic
        return input_data

# Register properties, actions and events
v.register_property("temperature", "number", "celsius", TemperatureReader())
v.register_action("power", "boolean", "boolean", PowerButtonExecutor())
v.register_event("battery", "integer")

# Fake battery percentage events and emit those events
def emit_battery_percentage(loop):
    asyncio.set_event_loop(loop)

    while True:
        # Emit actual battery event from the battery listener
        v.emit_event("battery", random.randint(0, 100))
        time.sleep(1)

battery_event_thread = threading.Thread(target=emit_battery_percentage, args=(asyncio.new_event_loop(),))
battery_event_thread.start()

# Start vertex
v.start()

Project details


Release history Release notifications

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pyvertex, version 0.1
Filename, size File type Python version Upload date Hashes
Filename, size pyvertex-0.1-py3-none-any.whl (12.9 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size pyvertex-0.1.tar.gz (6.2 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page