Skip to main content

Official SinricPro SDK for Python - Control IoT devices with Alexa and Google Home

Project description

SinricPro Python SDK

Official Python SDK for SinricPro - Control your IoT devices with Alexa and Google Home.

Python Version License

Features

  • Easy to Use - Simple, pythonic API with async/await support
  • Type Safe - Full type hints for better IDE support and error detection
  • Voice Control - Works with Alexa and Google Home
  • Real-time - WebSocket-based bidirectional communication
  • Secure - HMAC-SHA256 message signatures
  • Reliable - Auto-reconnection and heartbeat monitoring
  • Flexible - Support for multiple device types and capabilities
  • Cross-Platform - Works on Linux, Windows, macOS, and Raspberry Pi

Supported Devices

Lighting & Switches:

  • Smart Switch - On/Off control
  • Smart Light - RGB color, brightness, color temperature
  • Dimmable Switch - On/Off with brightness control

Sensors:

  • Motion Sensor - Detect movement
  • Contact Sensor - Door/window open/closed detection
  • Temperature Sensor - Temperature and humidity monitoring
  • Air Quality Sensor - PM1.0, PM2.5, PM10 measurements
  • Power Sensor - Voltage, current, power monitoring

Control Devices:

  • Blinds - Position control (0-100%)
  • Garage Door - Open/close control
  • Smart Lock - Lock/unlock control

Climate Control:

  • Thermostat - Temperature control with modes (AUTO, COOL, HEAT, ECO)
  • Window AC - Air conditioning control

Other Devices:

  • Fan - On/Off control
  • Doorbell - Doorbell press events

Installation

pip install sinricpro

Requirements

  • Python 3.10 or higher
  • websockets library (automatically installed)

Platform Support

The SDK works on:

  • Linux (Ubuntu, Debian, Raspberry Pi OS, etc.)
  • Windows 10/11
  • macOS 10.14+
  • Raspberry Pi (All models with Python 3.10+)

Logging

Enable debug logging to see detailed information:

from sinricpro import SinricProLogger, LogLevel

# Set log level
SinricProLogger.set_level(LogLevel.DEBUG)

Available log levels: DEBUG, INFO, WARN, ERROR, NONE

Development

Setup Development Environment

# Clone the repository
git clone https://github.com/sinricpro/python-sdk.git
cd python-sdk

# Install development dependencies
pip install -e ".[dev]"

# Import sinricpro for development.
```python
import sys
from pathlib import Path
from typing import Any

sys.path.insert(0, str(Path(__file__).parent.parent.parent))

from sinricpro import SinricPro, SinricProAirQualitySensor, SinricProConfig

Run tests

pytest

Format code

black .

Type check

mypy sinricpro

Running Examples

# Set environment variables
export SINRICPRO_APP_KEY="your-app-key"
export SINRICPRO_APP_SECRET="your-app-secret"

# Run an example
python examples/switch/switch_example.py

API Reference

Full API documentation is available at Read the Docs (Coming soon!)

Troubleshooting

Connection Issues

  1. Check credentials - Ensure APP_KEY and APP_SECRET are correct
  2. Check device ID - Verify the device ID is exactly 24 hexadecimal characters
  3. Check network - Ensure you have internet connectivity
  4. Enable debug logging - Set debug=True in config to see detailed logs

Common Errors

"Invalid app_key format"

  • App key must be a valid UUID (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)

"Invalid app_secret: must be at least 32 characters"

  • App secret must be at least 32 characters long

"Invalid device_id format"

  • Device ID must be exactly 24 hexadecimal characters

Support

License

Copyright (c) 2019-2025 Sinric. All rights reserved.

This project is licensed under the Creative Commons Attribution-Share Alike 4.0 International License (CC BY-SA 4.0) - see the LICENSE file for details.

You are free to share and adapt this work for any purpose (including commercially), as long as you give appropriate credit and distribute your contributions under the same license.

Acknowledgments

Related Projects


Vibe Coding

If you are to develop agent via vibe coding the llms.txt and the llms-full.txt can be used as context to LLM. While the former one is a summarized one and the later one has the full information in case your LLM has big enough context window.

Made with ❤️ by the SinricPro Team

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sinricpro-5.0.1.tar.gz (42.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sinricpro-5.0.1-py3-none-any.whl (79.2 kB view details)

Uploaded Python 3

File details

Details for the file sinricpro-5.0.1.tar.gz.

File metadata

  • Download URL: sinricpro-5.0.1.tar.gz
  • Upload date:
  • Size: 42.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for sinricpro-5.0.1.tar.gz
Algorithm Hash digest
SHA256 c23a2f240188a1e41f8e4d0a2fa676092a0255f91fb9fe13b030cc445b213977
MD5 766ff460a0e7844920b8d8d7b001c61d
BLAKE2b-256 77bddd1d292f476b553ad03e6d5c025d0ce1f455367cd2e9484b3eadedb68b3f

See more details on using hashes here.

File details

Details for the file sinricpro-5.0.1-py3-none-any.whl.

File metadata

  • Download URL: sinricpro-5.0.1-py3-none-any.whl
  • Upload date:
  • Size: 79.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for sinricpro-5.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 74911745e8162fa5d04c3f2aa46891552a522b4e5802d4268ff3477d8d6f30fb
MD5 0339efadc75c605de6c9e61a324cf3a9
BLAKE2b-256 f56d03e3b46720686d23e7763ccb3f83b76fa2334fa403946171fdeb93dae641

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page