This workspace contains an exploratory Python client for the observed Manima
JSON-RPC-over-UDP protocol. It cycles through one to four configurable channel
groups. Channels not in the active group are sent as 0.
The script uses only the Python standard library, so direnv is optional. If you use direnv, allow it once from this directory:
direnv allowThe .envrc uses direnv's layout python3, which creates and activates an
isolated Python environment under .direnv/.
Running the script without configuration uses these defaults:
channel 1 on, channel 2 off: 60 seconds
channel 1 off, channel 2 on: 60 seconds
To configure the script, copy the supplied example:
cp manima_config.json.example manima_config.jsonThe optional manima_config.json is loaded from the directory containing the
script. It can contain any subset of the following settings; omitted settings
retain their built-in defaults:
{
"controller": "192.168.1.248:6512",
"interval": 60,
"on_value": 255,
"groups": [[1], [2]],
"parameter_name": "Boot Scene",
"scene_name": "Scene 1",
"timeout": 2
}Each inner array is one group of channels that turn on together. Groups may
overlap, so a cycle such as [[1, 2], [2, 3], [3, 1]] is valid. Between one
and eight groups can be configured, using channel numbers 1 through 8.
Supplying any persistent setting on the command line (--controller,
--interval, --on-value, --group, --parameter-name, --scene-name, or
--timeout) skips the config file entirely. Unspecified settings then use
their built-in defaults. The run modes --once and --shutdown do not skip
the config file.
Test the first group with a single request:
python manima_toggle.py --onceThen start the repeating sequence:
python manima_toggle.pyWith no config file or group options, the default values alternate as follows:
group 1: [255, 0, 0, 0, 0, 0, 0, 0]
group 2: [0, 255, 0, 0, 0, 0, 0, 0]
While cycling, the script displays:
Press Ctrl+C to stop and switch all channels off.
Ctrl-C stops the cycle, sends one all-zero request, and confirms the controller response in the terminal. If that request fails, the script warns that channels may still be on and advises running the explicit shutdown command below.
To switch all eight channels off explicitly, run:
python manima_toggle.py --shutdownThis sends one all-zero request, waits for the controller response, and exits. It can be run after the cycling process has been stopped.
Useful overrides:
python manima_toggle.py \
--controller 192.168.1.248:6512 \
--interval 60 \
--on-value 255 \
--group 1,3 \
--group 2,4 \
--parameter-name "Boot Scene" \
--scene-name "Scene 1"Supply --group one to eight times. For example, this cycles through three
groups, changing state every 30 seconds:
python manima_toggle.py \
--group 1,2 \
--group 3,4 \
--group 5,6,7,8 \
--interval 30If only one group is supplied, the script alternates that group between on and off:
python manima_toggle.py --group 1,3,5 --interval 60The state changes immediately on startup and then after every interval. Thus, with three groups and a 60-second interval, each group remains active for one minute and the complete cycle takes three minutes.
The parameter and scene names are defaults inferred from one capture, not yet confirmed protocol constants.