Skip to content
mattzzw edited this page Jan 20, 2019 · 63 revisions

Welcome to the obi_socket Wiki

Intro

There are several cheap "smart" wifi sockets around and most of them are already supported by excellent projects like Tasmota or ESPurna - including this socket.

However, the objective of this project is about creating a Python based software that provides a REST-like api to control the socket via http calls.

The project started out with a 9€ wifi enabled power socket from OBI - hence the name.

Supported Hardware

OBI socket 2nd gen BlitzWolf BW SHP2

And probably a lot more esp8266-based smart sockets...

Warning

‼️ ⚠️ ‼️

Working on electricity is dangerous. Working on power sockets can kill you!

If your socket's case is open and is connected to mains you can easily blow up your scope, your notebook or yourself by touching the wrong bits. Be careful. Be super extra careful! Even little things like connecting a serial port or a scope can have serious consequences (GND != GND!). Use an isolating transformer.

The much safer way: Power your socket with 5V or 3v3. Check the hardware pages for more information.

Web API

GET methods

URI Description
/switch?pwr=<on/off> switch power on/off
/toggle?duration=<seconds> toggle power for x seconds, use duration=0 to toggle only once
/status returns port status as JSON

POST methods

URI Description
/restart restart socket
/reset reset socket to default cfg

MQTT

MQTT settings can be changed in the /SETUP menu. The initial default settings for MQTT are

                'mqtt_enable':      True,
                'mqtt_keepalive':   0,
                'mqtt_cid':         unique_machine_id,
                'mqtt_server':      'iot.eclipse.org',
                'mqtt_user':        '',
                'mqtt_pw':          '',
                'mqtt_subt':        initial_hostname + '/' + 'switch/action',
                'mqtt_pubt':        initial_hostname + '/' + 'switch/status'

Implemented actions are on/off/toggle.