Giter Site home page Giter Site logo

zspri / wemo-server Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 7 KB

Flask server to find and manage Belkin WeMo smart switches

License: BSD 3-Clause "New" or "Revised" License

Python 100.00%
flask python wemo belkin belkin-wemo upnp wemo-switch rest-api

wemo-server's Introduction

wemo-server

A Flask server to find manage Belkin WeMo smart switches

Requirements

  • Python 3.8
  • All requirements in requirements.txt
  • Valid environment variables
  • DEFAULT_AUTH_KEY
  • NET_SPACE

The server periodically scans the addresses in NET_SPACE to find any devices that respond to port 49153. Worker code is modified from iancmcc/ouimeaux.

Endpoints

By default, the server runs on port 80 and binds to any address.

Note: an Authorization header must be provided, with the content matching DEFAULT_AUTH_KEY.

GET /devices

Get details on all discovered devices.

Example response:

{
    "_last_update": 1585269342.533981,
    "devices": [
        {
            "device": "192.168.0.12:49153",
            "hash": "431e98acb8e7e5e8",
            "name": "Desk Lamp",
            "state": 1
        },
        {
            "device": "192.168.0.19:49153",
            "hash": "5e09949a6ee030e3",
            "name": "Bedroom Lamp",
            "state": 1
        }
    ]
}

GET /devices/:hash

Get details on a specific WeMo device.

Example response: /devices/431e98acb8e7e5e8

{
    "device": "192.168.0.12:49153",
    "hash": "431e98acb8e7e5e8",
    "name": "Desk Lamp",
    "state": 1
}

PATCH /devices/:hash

Turn a WeMo device on or off. Requires a "state" parameter that must be either 0 or 1, representing the state that the switch should be changed to.

Example response: /devices/431e98acb8e7e5e8?state=0

{
  "state": 0
}

wemo-server's People

Contributors

zspri avatar

Stargazers

 avatar

Watchers

 avatar

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.