Skip to content

API Reference

This section documents the public Python API of the custom_components.sunriser package.

Modules

Module Purpose
coordinator SunRiserCoordinator — polls the device, holds config, exposes helper methods
config_flow UI config flow and options flow
const Domain constants, COLOR_NAMES, MANAGER_OPTIONS, PWM_MAX
light LightEntity per dimmable PWM channel
switch SwitchEntity per on/off PWM channel
sensor Diagnostic sensors, DS1820 temperature, weather state
binary_sensor Device connectivity sensor
button Reboot button
number Fixed-brightness number entity per channel
select Manager-mode select entity per channel
diagnostics async_get_config_entry_diagnostics implementation
init Integration setup, service registration

Protocol overview

POST /          msgpack([key, ...])       → msgpack({key: value, ...})   # read config
PUT  /          msgpack({key: value, ...}) → 204                          # write config
GET  /state     →  msgpack({pwms, sensors, uptime, ...})                  # live state
PUT  /state     msgpack({pwms: {...}})    → 204                          # set PWM values
GET  /weather   →  msgpack stream, first object is list per channel
GET  /reboot    →  reboots device
DELETE /        →  factory reset

All requests use Content-Type: application/x-msgpack and must go over HTTP/1.1 with Connection: close to avoid the WizFi360 keep-alive bug.