Dimmer TRIAC — API
Overview
The 6‑Channel TRIAC Dimmer Board (MS-D006) exposes 6 dimming output channels and 6 digital inputs over TCP, MQTT and HTTP (JSON POST) — the same Integrations/Ports configuration page used across the MolSmart line controls the ports, MQTT broker and credentials for this module.
| Transport | Notes |
|---|---|
| TCP | Default port 502 (changeable). Protocol MolSmart String(NO) / MolSmart String(NC). |
| HTTP | JSON over HTTP POST for control, plain GET for status. |
| MQTT | Per‑channel state topics plus a single JSON control topic — see §2.4. |
Control & Feedback
Open a plain TCP connection (default port 502) and send commands as raw text — no line terminator required. Each command targets dimmer channel 1–6.
ONOn / Off with saved brightness
When a channel is turned ON this way it resumes its last saved brightness — because of that, a plain 'Turn Off' command is what actually switches it off (there is no separate 'resume-then-hold' state), exactly as noted in the vendor document.
PCTOn with explicit brightness
An OFF command (2<channel>) also accepts a %level suffix in the vendor examples (e.g. 21%20), but the level is ignored — the channel simply turns off, same as the plain 2<channel> form.
DLYTimed on (delay)
FBKFeedback string
020000000000000000:111111:6:000000:000000
D1 D2 D3 D4 D5 D6 : i1-6 : channel_count : d_mask : i_mask
Each dimmer channel is encoded as 3 digits (000–100 = brightness %); the input block uses one digit per input.
HLDHold event
A long‑press (Hold) on an input is represented with an H in place of the digit for that input:
055000000000000000:H11111:6:000000
Topics & Payloads
| Topic | Purpose |
|---|---|
| /molsmart/dimmer<serial>/in/d1 … /in/d6 | One state topic per channel |
topic: /molsmart/dimmer1958000/in/d6 values: ON | OFF | %0-%100
A single JSON control topic accepts on/off and delayed commands for any channel:
topic: /molsmart/dimmer1958000/in/control
{"type":"ON/OFF","idx":"6","status":"ON","time":"0","pass":"0"}
{"type":"ON/OFF","idx":"6","status":"OFF","time":"0","pass":"0"}
{"type":"ON/OFF","idx":"6","status":"%20","time":"0","pass":"0"}
{"type":"DELAY","idx":"6","status":"ON","time":"5","pass":"0"}| JSON field | Values |
|---|---|
| type | ON/OFF or DELAY |
| idx | channel number, 1–6 |
| status | ON / OFF / %0–%100 |
| time | seconds, used with DELAY; 0 otherwise |
| pass | password configured on the device, or 0 if disabled |
Set & Read Dimmer
/api/v2/dimmer_set.cgi{"idx":1,"duty":50,"init":0,"mode":0,"range_min":6,"range_max":70}| JSON field | Meaning |
|---|---|
| idx | channel number, 1–6 |
| duty | target brightness, 0–100 |
| init | 0 = last status · 1 = Turn Off · 2 = 25% On · 3 = 50% On · 4 = 75% On · 5 = 100% On |
| mode | 0 = range mode · 1 = ON/OFF mode |
| range_min / range_max | the channel's Smooth Range start/end, as set on the module's Dimmer config page |
/api/v2/dimmer.cgiThe vendor document names this endpoint ('Get Status of Dimmer') but does not include a worked response example — the response shape was not independently confirmed for this reference.
Notes & Open Items
| Open item | Detail |
|---|---|
| GET /api/v2/dimmer.cgi response schema | Endpoint name confirmed, response JSON shape not documented in the source reviewed — capture a live response before relying on its exact fields. |
| Authentication on /api/v2/* | No password/session parameter is shown on the JSON endpoints, unlike the Relay Board's pwd CGI parameter — whether HTTP Auth / Session ID (Config page) gates these routes was not confirmed. |
| range_min / range_max defaults | 6–70 in the vendor example matches this board's default Smooth Range (see the product's User Manual, Dimmer page) — treat the example values as illustrative, not fixed. |