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.

Milesight WS558
WS558Sensor
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
Measurements

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.

Data into your dashboard

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.

ChirpStack v4 · decodeUplink
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)

0374FC080480960000000581620683A911000007C98C0208310003

Decoded 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" }
From the field

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.

Your partner

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

Yes. It is a standard LoRaWAN Class C device, no Milesight gateway or cloud required. You add the codec to the device profile and provision it via OTAA.
Yes, for both ChirpStack and ThingsBoard, implemented from the published Milesight byte specification. The same channel logic goes into a ThingsBoard uplink converter.
Eight independent channels. Their ON/OFF states arrive as a bit field on channel 0x08, and each relay can be flipped individually by downlink.
Yes. It supports the Milesight D2D protocol for ultra-low-latency device-to-device control, and it has physical buttons plus a power-on self test so you can switch and verify circuits even without the network.
Yes. It reports voltage, total current, power factor, active power and cumulative power consumption, so you can track per-installation energy use and savings.
It is a Class C device on LoRaWAN port 85. Class C keeps the receive window open continuously so downlink switching commands reach the relays in near real time.
From the same series

Related devices

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.

Timo Wevelsiep

Your contact

Timo Wevelsiep

Founder, merkaio

15 minutes, no commitment, directly with Timo.

By submitting, you agree to our Privacy Policy.

Decoder for ChirpStack v4. merkaio is an independent integrator and is not affiliated with Milesight.