MolSmart API Reference

Dimmer TRIAC — API

TCP string protocol, MQTT topics and HTTP JSON API for the MolSmart 6-Channel TRIAC Dimmer Board — 6 dimming outputs + 6 digital inputs.
MS-D006
ProtocolsTCP · HTTP POST (JSON) · MQTT
Default TCP port502 (changeable)
Firmware familyDimmer-6ch Triac
2.1 / Getting Started

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.

TransportNotes
TCPDefault port 502 (changeable). Protocol MolSmart String(NO) / MolSmart String(NC).
HTTPJSON over HTTP POST for control, plain GET for status.
MQTTPer‑channel state topics plus a single JSON control topic — see §2.4.
2.2 / TCP String Protocol

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

11 → dimmer 1 ON (saved brightness)21 → dimmer 1 OFF16 → dimmer 6 ON (saved brightness)26 → dimmer 6 OFF1X → all dimmers ON (saved brightness)2X → all dimmers OFF
Note

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

11%0 → dimmer 1 OFF (0%)11%100 → dimmer 1 ON at 100%11%20 → dimmer 1 ON at 20%16%40 → dimmer 6 ON at 40%
Note

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)

11:30 → dimmer 1 ON for 30 s, then OFF (saved brightness)16:30 → dimmer 6 ON for 30 s, then OFF (saved brightness)

FBKFeedback string

Example
020000000000000000:111111:6:000000:000000
Field layout — 3 digits per dimmer channel (0-100)
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:

Example — dimmer 1 at 55%, input 1 pressed and held
055000000000000000:H11111:6:000000
2.3 / MQTT

Topics & Payloads

TopicPurpose
/molsmart/dimmer<serial>/in/d1 … /in/d6One state topic per channel
Per-channel topic — accepted values
topic: /molsmart/dimmer1958000/in/d6
values: ON | OFF | %0-%100

A single JSON control topic accepts on/off and delayed commands for any channel:

Control topic
topic: /molsmart/dimmer1958000/in/control
Payload examples — idx selects the channel (1-6)
{"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 fieldValues
typeON/OFF or DELAY
idxchannel number, 1–6
statusON / OFF / %0–%100
timeseconds, used with DELAY; 0 otherwise
passpassword configured on the device, or 0 if disabled
2.4 / HTTP API (JSON)

Set & Read Dimmer

POST/api/v2/dimmer_set.cgi
POST JSON body
{"idx":1,"duty":50,"init":0,"mode":0,"range_min":6,"range_max":70}
JSON fieldMeaning
idxchannel number, 1–6
dutytarget brightness, 0–100
init0 = last status  ·  1 = Turn Off  ·  2 = 25% On  ·  3 = 50% On  ·  4 = 75% On  ·  5 = 100% On
mode0 = range mode  ·  1 = ON/OFF mode
range_min / range_maxthe channel's Smooth Range start/end, as set on the module's Dimmer config page
GET/api/v2/dimmer.cgi
To be confirmed

The 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.

2.5 / Reference

Notes & Open Items

Open itemDetail
GET /api/v2/dimmer.cgi response schemaEndpoint 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 defaults6–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.