Show Menu

IoT Cheat Sheet (DRAFT) by [deleted]


This is a draft cheat sheet. It is a work in progress and is not finished yet. - Install and Configure IoT Devices

Part 1. Setting up the Home Network

Step 1: Set up the wired network

Connect FastEt­hernet on Home Switch to Home Gateway using a coper straig­ht-­through cable.
Connect FastEt­hernet0 on PC -> FastEt­hernet on HomeSwitch
Set IPConfig of PC to DHCP

Step 2: Set up the wireless network

Home Gateway -> Config -> Internet -> select DHCP
Home Gateway -> Wireless -> change SSID to MyHome Gateway, auth to WPA2-PSK, use CiscoIoT as passphrase
Laptop -> Desktop -> PC Wireless -> Connect -> select MyHome­Gateway -> connect

Step 3: Connect the IoT devices to the network

Connect Coffee Pot to FastEt­hernet using copper straig­ht-­through cable
Coffee Pot -> Config -> FastEt­hernet0 -> select DHCP
Lamp/C­eiling Fan -> Config -> Wireless0 -> connect to MyHome­Gateway

Part 2. Intera­cting with IoT devices

Step 1: Acces the IoT devices locally

Click Alt + Lamp a few times, how many settings does the lamp have: 3
Alt + Lamp Switch: 2
Alt + Ceiling Fan: 3, Switch: 2
Alt + Coffee Pot: 2, Swtich: 2

Step 2: Configure the IoT devices for remote access

Lamp/C­eiling Fan/Coffee Pot -> Config -> IoE Server heading -> Remote server:
Server address:­gis­ter.pka
Username: admin
Password: admin

-> connect

Step 3: Access the IoT devices remotely

Laptop­/Sm­art­phone -> Desktop -> Webbrowser ->­gis­ter.pka -> login with admin:­admin
Devices can be controlle

Coffee Pot ins Internet hängen

Netcat starten: nc -l 1234

Javascript Code beim Coffee Pot unter Advanced -> Progra­mming einfügen:
var state = 0;
var client = new RealTC­PCl­ient();
var coffee­status = ["Of­f","O­n"];

function setup() {
// 17 Zeilen ...
setSta­te(­state);­nne­ct(­"­ip", 1234);

// 10 Zeilen ...

function setSta­te(­new­State) {
// 10 Zeilen; client.send als letzte Zeile einfügen:­nd(­get­Nam­e()­+": "­+co­ffe­est­atu­s[s­tat­e]+­"­\n");

Netcat bekommt nun (nach Neustart und Cofee Pot Stop/S­tar­t/A­ltc­lick) Nachri­chten

Mozilla Webthings Gateway

Lubuntu in VM Winsta­lli­eren, Firefox in der VM starten, Mozilla Webgateway instal­lieren und starten, im Browser auf Config­seite gehen.


Dependency installieren: pip install webthing

from __future__ import division
from webthing import (Action, Event, Property, SingleThing, Thing, Value,
import logging
import time
import uuid

# Ein Event dass Überhitzung indiziert
class OverheatedEvent(Event):

    def __init__(self, thing, data):
        Event.__init__(self, thing, 'overheated', data=data)

# eine Action, welche die Lampe "faden" lässt
class FadeAction(Action):

    def __init__(self, thing, input_):
        Action.__init__(self, uuid.uuid4().hex, thing, 'fade', input_=input_)

    def perform_action(self):
        time.sleep(self.input['duration'] / 1000)
        self.thing.set_property('brightness', self.input['brightness'])
        self.thing.add_event(OverheatedEvent(self.thing, 102))

def make_thing():
    # lamp thing erstellen, kann ein/aus geschalten werden, hat verschiedene properties
    thing = Thing(
        'My Lamp',
        ['OnOffSwitch', 'Light'],
        'A web connected lamp'

                     '@type': 'OnOffProperty',
                     'title': 'On/Off',
                     'type': 'boolean',
                     'description': 'Whether the lamp is turned on',
                     '@type': 'BrightnessProperty',
                     'title': 'Brightness',
                     'type': 'integer',
                     'description': 'The level of light from 0-100',
                     'minimum': 0,
                     'maximum': 100,
                     'unit': 'percent',

            'title': 'Fade',
            'description': 'Fade the lamp to a given level',
            'input': {
                'type': 'object',
                'required': [
                'properties': {
                    'brightness': {
                        'type': 'integer',
                        'minimum': 0,
                        'maximum': 100,
                        'unit': 'percent',
                    'duration': {
                        'type': 'integer',
                        'minimum': 1,
                        'unit': 'milliseconds',

            'The lamp has exceeded its safe operating temperature',
            'type': 'number',
            'unit': 'degree celsius',

    return thing

def run_server():
    # thing erstellen
    thing = make_thing()

    # webserver starten
    # If adding more than one thing, use MultipleThings() with a name.
    # In the single thing case, the thing's name will be broadcast.
    server = WebThingServer(SingleThing(thing), port=8888)
    try:'starting the server')
    except KeyboardInterrupt:'stopping the server')

if __name__ == '__main__':
        format="%(asctime)s %(filename)s:%(lineno)s %(levelname)s %(message)s"
    # server starten