Digital outputs
Four outputs sit on pins P0…P3 of the PCF8574 (o1 = P0 … o4 = P3), on the same I2C bus as the LCD and SHT41. Pins P4…P7 are used by the touch buttons; both live on one chip.
All outputs are off by default (oN_en = false): a slot that is not enabled is not shown, not reported, and the output command for that slot is rejected. Enable a slot through configuration, then switch it with the output command or rules. All keys take effect without a reboot.
| Key | Default | Function |
|---|---|---|
oN_en |
false |
slot enabled. false = pin forced OFF and commands rejected |
oN_active |
low |
the pin level that means ON. low: ON = pin pulled low (suits LEDs or active-low relay modules, and keeps the output off at power-up). high: ON = pin high |
oN_label |
O1…O4 |
name for the LCD, max. 11 characters |
oN_name |
empty | metric name (e.g. siren); empty = slot ID. Unique across all slots and must not be a reserved name |
Switching an output
Section titled “Switching an output”Over the cmd topic:
{"action":"output","output":"o1","state":true,"seconds":30,"id":"req-7"}| Field | Required | Notes |
|---|---|---|
output |
yes | o1…o4, or the metric name of an enabled slot (oN_name) |
state |
yes | true = ON, false = OFF (boolean) |
seconds |
no | only with state: true: the output turns OFF by itself after 1…86400 seconds (relay pulse). Without seconds, the output stays on until switched off or reboot |
id |
no | returned in cmd/result |
Result in cmd/result: {"ok":true,"msg":"siren HIDUP selama 30 s"}. Rejected (ok:false) if the slot is unknown or oN_en = false, state is not a boolean, seconds exceeds 86400, or the PCF8574 does not answer.
Alternatives: python3 Tools/celestianctl.py cmd <mac> output output=o1 state=true seconds=30, out o1 on 30 in USB serial, or the Control tab of the web interface.
Reporting
Section titled “Reporting”- Telemetry carries a boolean metric
oN_namefor each enabled slot (true= ON, independent ofoN_active). - Every change (from a command, the
secondstimer, a rule, or slot disabling) is sent as an event. A slot disabled while ON automatically turns OFF, and an OFF event is sent once before its metric disappears. - Telemetry carries
expander_ok(boolean).false= the PCF8574 does not answer: buttons are dead, output state cannot be trusted, and theoutputcommand is rejected. - The LCD has an OUTPUT page when any slot is enabled:
HIDUP(ON) /MATI(OFF), orI/O ERRif the PCF8574 does not answer.
What to know about the PCF8574
Section titled “What to know about the PCF8574”The firmware rewrites the output state to the chip every second, so a chip that briefly loses supply returns to the correct state.
Outputs and rules
Section titled “Outputs and rules”On-device rules can take control of outputs with the out action (true, false, or follow). Manual commands keep working and win until that output’s next rule transition. Only one follow rule may control an output.