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.18.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.18.0-py3-none-any.whl (59.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyrademacher-0.18.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.18.0.tar.gz
Algorithm Hash digest
SHA256 401448d20d409ad7d4a7b60d28d80d7f24283e2ea66b8e858f8a7ff141dba3f9
MD5 7c406c2a7ef94a47f4de192bb654f632
BLAKE2b-256 ddf177f2f82b95f8bebd448de46106c71480826a06c951e683087c69078fa9e0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyrademacher-0.18.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.18.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ad89b7e4b9e7c23961ba2919e36bd1e695830a0daaa66f802700d06bc5078358
MD5 9e039b10a8a205085c3116142d374325
BLAKE2b-256 79fff29d83c3e61420c3e4b864a29e1626375d45ae117e20221df23fe0e0abf6

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