Milesight WS558: LoRaWAN Smart Light Controller
Milesight WS558 LoRaWAN smart light controller: own ChirpStack/ThingsBoard decoder, decoded example, 8-channel switching, power metering and downlink control.
- LoRaWAN
- Class C, OTAA
- Band / port
- EU868 / port 85
- Switching channels
- 8 (LN type or switch type)
- Metering
- Voltage, current, active power, energy
- Local control
- Physical buttons + works without network
- Configuration
- NFC (Milesight ToolBox)
- D2D
- Gateway-free device-to-device control
What the WS558 measures
8 switch channels
Independent ON/OFF state for each of the eight lighting circuits, packed into a bit field.
Voltage
Mains voltage in volts, reported as UINT16 with a /10 scale.
Active power
Total active power draw in watts (UINT32).
Power consumption
Cumulative energy in watt-hours for billing and savings tracking.
Total current & power factor
Total current in mA and power factor in percent for load diagnostics.
Integration
Sensor / controller
Measures or controls in the field and sends LoRaWAN uplinks.
LoRaWAN gateway
Receives the radio packets and forwards them to the server.
ChirpStack
Network server: manages sessions and decodes the payload.
ThingsBoard / Grafana
Dashboards, alarms, rules and reports.
function decodeUplink(input) {
var bytes = input.bytes;
var data = {};
for (var i = 0; i < bytes.length; ) {
var channel = bytes[i++];
var type = bytes[i++];
if (channel === 0x03 && type === 0x74) { // voltage (V)
data.voltage = readUInt16LE(bytes, i) / 10; i += 2;
} else if (channel === 0x04 && type === 0x80) { // active power (W)
data.active_power = readUInt32LE(bytes, i); i += 4;
} else if (channel === 0x05 && type === 0x81) { // power factor (%)
data.power_factor = bytes[i]; i += 1;
} else if (channel === 0x06 && type === 0x83) { // power consumption (Wh)
data.power_consumption = readUInt32LE(bytes, i); i += 4;
} else if (channel === 0x07 && type === 0xc9) { // total current (mA)
data.total_current = readUInt16LE(bytes, i); i += 2;
} else if (channel === 0x08 && type === 0x31) { // 8 switch states (bit flags)
var flags = bytes[i + 1];
for (var s = 0; s < 8; s++) {
data["switch_" + (s + 1)] = ((flags >> s) & 1) ? "on" : "off";
}
i += 2;
} else {
break;
}
}
return { data: data };
}
function readUInt16LE(b, i) {
return (b[i + 1] << 8) | b[i];
}
function readUInt32LE(b, i) {
return ((b[i + 3] << 24) | (b[i + 2] << 16) | (b[i + 1] << 8) | b[i]) >>> 0;
}
Implemented from the published Milesight byte specification (Communication Protocol / User Guide).
Channel format: 03 74 voltage (UINT16 little-endian, /10), 04 80 active power (UINT32, W), 05 81 power factor (%), 06 83 power consumption (UINT32, Wh), 07 c9 total current (mA), 08 31 switch status where the second byte is a bit field for switches 1 to 8 (bit 0 = switch_1). Device-info segments on channel 0xff (version, serial, class) and downlink acknowledgements appear separately; this codec reads the periodic measurement uplink. Implemented from the published Milesight byte specification. For ThingsBoard the same channel logic goes into an uplink converter.
Uplink (hex)
0374FC080480960000000581620683A911000007C98C0208310003Decoded JSON
{ "voltage": 230, "active_power": 150, "power_factor": 98, "power_consumption": 4521, "total_current": 652, "switch_1": "on", "switch_2": "on", "switch_3": "off", "switch_4": "off", "switch_5": "off", "switch_6": "off", "switch_7": "off", "switch_8": "off" }Use cases
Configuration & pitfalls
Class C power
The WS558 keeps its receive window open for fast downlink switching, so it is mains powered. Plan a stable supply, not battery operation.
LN type vs switch type
Order the variant that matches your wiring: LN type drives the load directly, switch type is a dry-contact relay output. Mixing them up will not control the lights.
Downlink switching
Relays are flipped by downlink on the same port. Build and verify the ON/OFF and delay-task commands in your dashboard before rollout.
Energy counter resets
power_consumption is a cumulative counter. Compute deltas in the dashboard and store the clear-counter events so reports stay traceable.
How merkaio supports your WS558
From sourcing to day-to-day operation, all from one partner on our own European infrastructure.
Pre-staging & provisioning
We configure the WS558, set keys, intervals and alarms, and ship it ready to deploy.
Own decoder
Payload codec for ChirpStack v4 and ThingsBoard, implemented from the Milesight specification.
Dashboard integration
Data lands in your ThingsBoard or Grafana, with alarms and reports.
Operations & monitoring
We run the LoRaWAN stack and dashboards on European infrastructure, you just use the data.
Frequently asked questions
Let's discuss your infrastructure. Digital and on-site.
Whether it's IoT platform development, hardware selection, managed hosting for ChirpStack, ThingsBoard, Grafana or NetBird VPN, or migration from a self-hosted setup - we'll find the right solution for your use case. Book a free 30-minute consultation, no commitment required.
Your contact
Timo Wevelsiep
Founder, merkaio
15 minutes, no commitment, directly with Timo.
Decoder for ChirpStack v4. merkaio is an independent integrator and is not affiliated with Milesight.