Skip to main content

Control devices connected to your Rademacher Homepilot (or Start2Smart) hub

Project description

pyrademacher

Python Library to read/control devices connected to your Rademacher HomePilot (or Start2Smart) hub.

This library uses the latest REST API, so you must update your hub to the latest firmware if you want to use this library.

Installation

Use pip to install pyrademacher lib:

pip install pyrademacher

Usage

API Class

With the HomePilotApi class you can acess the REST API directly:

from homepilot.api import HomePilotApi

api = HomePilotApi("hostname", "password") # password can be empty if not defined ("")

print(asyncio.run(asyncio.run(api.get_devices()))) # get all devices

asyncio.run(api.async_open_cover(did="1")) # open cover for device id "1" (assuming it's a cover device)

Manager Class

You can use the HomePilotManager helper class to more easily manage the devices:

import asyncio
from homepilot.manager import HomePilotManager
from homepilot.api import HomePilotApi

api = HomePilotApi("hostname", "password") # password can be empty if not defined ("")

manager = asyncio.run(HomePilotManager.async_build_manager(api))
asyncio.run(manager.update_states())

print(manager.devices["1"].is_closed)
print(manager.devices["1"].cover_position)

print(manager.devices["-1"].fw_version) # ID -1 is reserved for the hub itself

Each device in manager.devices is an instance of the specific device class.

Auto Config Devices: Commands

Every device that inherits from HomePilotAutoConfigDevice (covers, switches/actuators, thermostats, lights) exposes the weather and contact commands that the hub advertises for that device. Each command has a capability flag (has_*_cmd) and an awaitable method that is a no-op when the capability is missing:

Command Capability flag Method
Sun start / stop has_sun_start_cmd / has_sun_stop_cmd async_sun_start_cmd() / async_sun_stop_cmd()
Wind start / stop has_wind_start_cmd / has_wind_stop_cmd async_wind_start_cmd() / async_wind_stop_cmd()
Rain start / stop has_rain_start_cmd / has_rain_stop_cmd async_rain_start_cmd() / async_rain_stop_cmd()
Go to dawn / dusk position has_goto_dawn_pos_cmd / has_goto_dusk_pos_cmd async_goto_dawn_pos_cmd() / async_goto_dusk_pos_cmd()
Contact open / close has_contact_open_cmd / has_contact_close_cmd async_contact_open_cmd() / async_contact_close_cmd()
device = manager.devices["1"]

if device.has_sun_start_cmd:
    await device.async_sun_start_cmd()   # trigger the sun command

if device.has_contact_open_cmd:
    await device.async_contact_open_cmd()

These devices also support the auto modes (has_*_auto_mode / *_auto_mode_value / async_set_*_auto_mode(...)) for auto, time, contact, wind, dawn, dusk, rain and sun.

They additionally expose the read-only weather program "active" states for devices that advertise the corresponding event — has_sun_prog_active / sun_prog_active_value, has_wind_prog_active / wind_prog_active_value and has_rain_prog_active / rain_prog_active_value — updated on every state refresh.

Scene Management

The library supports managing HomePilot scenes with comprehensive functionality:

import asyncio
from homepilot.manager import HomePilotManager
from homepilot.api import HomePilotApi
from homepilot.scenes import SceneNotAvailableError, SceneNotManuallyExecutableError

api = HomePilotApi("hostname", "password")

# Build manager with scenes (manual executable scenes only by default)
manager = asyncio.run(HomePilotManager.async_build_manager(api))

# Include all scenes (including non-manual executable)
manager = asyncio.run(HomePilotManager.async_build_manager(api, include_non_manual_executable=True))

# Access scene properties
scene = manager.scenes["1"]  # Scene with ID "1"
print(f"Scene: {scene.name}")
print(f"Description: {scene.description}")
print(f"Enabled: {scene.is_enabled}")
print(f"Manual Executable: {scene.is_manual_executable}")
print(f"Available: {scene.available}")

# Execute scene operations with automatic validation
try:
    await scene.async_execute_scene()    # Only works if scene is available and manually executable
    await scene.async_activate_scene()   # Only works if scene is available
    await scene.async_deactivate_scene() # Only works if scene is available
except SceneNotAvailableError as e:
    print(f"Scene operation failed: {e}")
except SceneNotManuallyExecutableError as e:
    print(f"Cannot manually execute scene: {e}")

# Update scenes from API
await manager.async_update_scenes()

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

pyrademacher-0.17.0.tar.gz (50.3 kB view details)

Uploaded Source

Built Distribution

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

pyrademacher-0.17.0-py3-none-any.whl (59.1 kB view details)

Uploaded Python 3

File details

Details for the file pyrademacher-0.17.0.tar.gz.

File metadata

  • Download URL: pyrademacher-0.17.0.tar.gz
  • Upload date:
  • Size: 50.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for pyrademacher-0.17.0.tar.gz
Algorithm Hash digest
SHA256 0054959649e437ce25584a8e9fab8cbb8d0962303dba5d3ac5d1bedc2a299e49
MD5 34609db0335a4af8881da42c0f7a279d
BLAKE2b-256 525143027ff81d8c0c09e07f8555b884739c6b8dd4527ed32cbb755b348119ec

See more details on using hashes here.

File details

Details for the file pyrademacher-0.17.0-py3-none-any.whl.

File metadata

  • Download URL: pyrademacher-0.17.0-py3-none-any.whl
  • Upload date:
  • Size: 59.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for pyrademacher-0.17.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c0cad8cbb0583f4b47276029fedc24178970abb280a27153a5940e42b7d8e2b8
MD5 8a73cbd6bd44c31514b7466775fb2314
BLAKE2b-256 aeada2a676e7e3d01fc71ed0a5845b74c276465094fb6420769e9fe7ab8bec20

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