Get started

1. Create an account

Sign up for ThePiHub - it's the same login you'll use to view every device you connect.

2. Install the SDK on your Pi (or any Linux machine)

pip install thepihub

Python 3.10 or newer. Two optional extras add the live camera (thepihub[webrtc]) and GPIO pins - buttons, LEDs, sensors (thepihub[gpio]); a 32-bit Pi (an original Pi Zero) installs the camera pieces from apt instead - see the SDK's own README for that step.

3. Copy an example and run it

Every program in Projects marked "example" is meant to be copied, not just read. The widget showcase is the broadest place to start:

python widget_showcase.py

The first time a machine connects, it prints a link and a short code. Open the link while signed in, approve it, and answer y in the terminal. That's it - the device is yours, the platform assigns it an id, and every later run connects straight away with no further setup.

4. Watch it live

Open your dashboard and the device appears, with its widgets already laid out - a gauge for each number, a button for each command, a toggle or a slider for each setting you declared. You never write any web code or say where anything goes.

from pihub import Device, Program

device = Device(register_if_needed=True)

weather = Program(id="weather", name="Weather Station")
temperature = weather.output(id="temperature", type="Gauge")
device.add_program(weather)
device.start()

temperature.set(21.5)     # the gauge on the dashboard now reads 21.5

Running for real

Once a program is worth keeping around, pihub install my_program.py links the machine (if it isn't already) and installs it as a service that starts at boot and restarts if it dies - one command, nothing to configure by hand.

Where to go next

  • Projects - every example and app, with what's actually been proven on real hardware for each one.
  • The SDK's own README (in the source repository) for the full API: outputs, commands, settings, notifications, the Camera, and direct browser-to-device connections.