Giter VIP home page Giter VIP logo

stupimo's Introduction

StuPiMo

Stu's Multiple Wemo Emulator for RPi

There are a few Wemo Emulators out there - FAUXMO etc. but i couldn't be bothered to learn python and so needed one written in C.

This code allows a set of relays attached to the Raspberry Pi's GPIO ports to be controlled from a 'Smarthome' controller like Alexa or Google Home.

It does this by emulating a Wemo device on the network and responding to UPNP requests from the controller.

Stuart's Alexa to Raspberry Pi interface

Starts multiple device handler processes monitoring separate TCP Ports

  • Responds to device calls:
    • GetBinaryState
    • SetBinaryState

Starts an SSDP discovery packet handler on the local thread

  • Responds to XML discovery packets

Starts a Web Server to offer button control of interface pins

Function:

Opens multiple device handlers on local sockets counting up from PORTBASE (43540)

Watches for discovery packets on UDP SSDP 239.255.255.250 port 1900
responds with discovery pointer to http://<ip>:43540+n/setup.xml for each device

Alexa then polls each logical device
Devices then respond with configuration xml
Alexa registers devices based on XML config

Alexa then Calls devices with GET and SET state requests
Device handlers then toggle the associated GPIO pins.

Uses WiringPi to operate the GPIO pins so use the -lwiringPi compiler option

gcc -o StuPiMo StuPiMo.c -l wiringPi

To start normally:

./StuPiMo

Or in verbose mode (Dumps all packets to console)

./StuPiMo -v

UDP requires the interfaces to be running in promiscous mode check with ifconfig

ifconfig

and change if needed:

sudo ifconfig eth0 promisc
sudo ifconfig wlan0 promisc

I had to make this permanent in local.rc

Update Added extra debug feature -w0 and -w1

./StuPiMo -w0

This puts just the first client into verbose mode to cut down on the noise to the console to let you debug more easily.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.