Skip to content

Milesight UG56 and UG65 LoRaWAN gateways ​

This page takes a Milesight UG56 (industrial, outdoor) or UG65 (semi-industrial, indoor) from the box to sensor readings in Omaya: power it, get it online, turn on the network server built into it, point that network server at Omaya, and add your sensors on both sides.

How the pieces fit ​

A LoRaWAN sensor's radio frames are encrypted, and something has to hold the keys, accept the sensor's join and decrypt what it sends. That job is the network server, and it is not Omaya's — Omaya reads what a network server has already decoded. (Why the line sits there is explained under adding an unknown sensor.)

The UG56 and UG65 carry a network server of their own, so for a single-gateway site nothing else is needed:

StepWhereWhat happens
1SensorSends an uplink over LoRa radio
2Gateway radioHears it, passes it to the gateway's own network server
3Gateway network serverDecrypts it, runs the payload codec that turns bytes into readings
4Gateway applicationPublishes the result over MQTT to Omaya's connector topic
5OmayaMatches the gateway and the sensor to what you registered, and records the readings

More than one gateway on the site?

You do not need a separate network server. The rule is only that the sensors must be known to one network server, not one per gateway — two UGs each running their own would each know half the sensors, and a sensor heard by the wrong one is lost.

  • All Milesight gateways: keep one UG as the network server (the one you connect to Omaya in step 5) and point the others' packet forwarders at it instead of at their own — Milesight calls this a Gateway Fleet. Add the sensors on that one gateway only, and register every gateway's EUI in Omaya, since each uplink names the gateway that heard it.
  • Mixed brands or a large estate: run one ChirpStack network server, point every gateway's packet forwarder at it, and connect ChirpStack to Omaya instead. The gateway set-up below still applies up to the end of step 3.

For a single gateway, neither is needed: the steps below are the whole job.

What you do in Omaya

  1. Create the connector and copy its host and topic — step 4
  2. Register the gateway by its EUI and place it on the floor plan — step 4
  3. Register each sensor by its DevEUI, in the zone it measures — step 7
  4. Check the gateway, the sensor's own page and the reports — step 8

Before you start ​

  • The right frequency variant. Both models come as an 868 MHz variant (EU868, IN865, RU864) and a 915 MHz variant (US915, AU915, KR920, AS923). The gateway and every sensor must be on the same plan — in Malaysia that is AS923-1, on the 915 MHz hardware. A sensor on a different plan is simply never heard.
  • Firmware new enough for payload codecs: UG65 60.0.0.41 or later, UG56 56.0.0.3 or later. Update to the latest Milesight publishes in any case (step 2).
  • An internet connection for the gateway: Ethernet is the simplest; Wi-Fi client and cellular (on models with a SIM slot) also work.
  • Each sensor's DevEUI and AppKey, from its label, its box, or Milesight's ToolBox app. Milesight sensors ship with a default AppKey; if you have changed it, use yours.
  • In Omaya, an administrator login and the venue and floor plan the gateway serves, already set up.

Step 1 — Power it up ​

  1. Screw on the LoRa antenna first — and the Wi-Fi and cellular antennas if your model has them. Transmitting without an antenna can damage the radio.
  2. Power it from the supplied DC adapter or from a PoE injector or switch port.
  3. Give it a couple of minutes to boot before connecting to it.

Mount it high and in the open when you know the final position: LoRa carries a long way, but a gateway in a cabinet or a basement plant room hears a fraction of what it would on a wall or a ceiling.

Step 2 — First login ​

Connect a laptop to the gateway, either way:

Wi-FiEthernet
Connect tothe access point Gateway_xxxxxx (the last six characters of its Wi-Fi MAC); on recent firmware the Wi-Fi password is iotpasswordthe gateway's Ethernet port, with the laptop set to a fixed address in 192.168.23.x
Browse tohttp://192.168.1.1http://192.168.23.150

Sign in as admin / password, then:

  1. Change the password when asked, and keep it somewhere the site team can find it. (Five wrong attempts lock the login page for ten minutes.)
  2. Update the firmware under Maintenance → Upgrade, using the file from Milesight's download page for your exact model, and let it reboot.

Step 3 — Get it online and set the radio ​

  1. Internet. Under Network → Interface, set the WAN port to DHCP (or the static address your network team gave you), or join a Wi-Fi network, or set up the cellular APN. Status → Overview confirms it is online.
  2. Clock. Under System → General Settings → System Time, choose Sync with NTP server and your time zone. The time on every reading Omaya records comes from the gateway: a clock that is wrong puts readings in the wrong hour.
  3. Radio plan. Under Packet Forwarder → Radios, choose the channel plan for your country (AS923-1 in Malaysia) and keep the default channels unless your sensors were set to others.
  4. Forward to the built-in network server. Under Packet Forwarder → General, the forwarder should be enabled with the embedded network server (localhost) as its destination — the factory setting.
  5. Note the Gateway EUI shown on that page: sixteen hexadecimal characters such as 24E124FFFEF54092. It is the gateway's identity in Omaya.

Step 4 — Prepare Omaya ​

Create the connector. In Omaya, open Connectors → IoT Gateway (MQTT) and add one:

FieldChoose
Connector Nameanything recognisable, e.g. Milesight UG65 — Level 3
VendorChirpStack (LoRa) — Milesight's network server speaks the same format
ProtocolLoRa / LoRaWAN
Activeon

Save, then copy the host, port and topic it shows. The topic looks like omaya/<organisation>/<16-character token>/chirpstack/lora; the token in it is the gateway's credential, so treat it like a password. One connector can serve every Milesight gateway you own.

Register the gateway. Under Device → Gateway, add it:

FieldEnter
Namewhere it hangs, e.g. LoRa GW — L3 east corridor
MAC addressthe Gateway EUI from step 3, sixteen characters, no colons or dashes
Device ModelMilesight
Location, venue, zonewhere it is

Then place it on the floor plan. A message from a gateway Omaya does not know is dropped, so do this before step 5.

Step 5 — Turn on the network server and connect it to Omaya ​

Back on the gateway:

  1. Network Server → General: enable it. Leave NetID, join delay and the other timings at their defaults.
  2. Network Server → Profiles: add a device profile — a name such as Class A OTAA, join type OTAA, class A. Most Milesight sensors are Class A; use the class the sensor's manual states if it differs.
  3. Network Server → Applications: add an application called Omaya, then add a data transmission of type MQTT to it:
FieldEnter
Broker addressthe host from the connector, e.g. omaya4.synchroweb.com
Broker port8883 with TLS on, or 1883 with TLS off
TLS / security modeCA signed server certificate (Omaya's certificate is a public one)
Client IDanything unique to this gateway, e.g. its EUI
User credentialsoff
Uplink data topicthe connector topic, exactly
Uplink data QoS0
Downlink data topicomaya-downlink/{token}/$deveui — {token} is the connector's token, the part of the connector topic after your organisation. Lets Omaya change the sensors' report interval (Configuring devices); leave empty if you do not want that
Join, ACK, error and other topicsleave empty

Save. The application's status should turn Connected within a few seconds. If it does not, check the host and port first; TLS on port 1883, or off on port 8883, is the usual cause.

Step 6 — The payload codec ​

Out of the box, the gateway publishes each uplink as encrypted-then-decrypted bytes (data, base64) with the radio details beside it. Omaya needs the readings — temperature, battery, CO₂ — which come from running the sensor model's decoder. The gateway can run it, with one catch:

A plain codec sends nothing Omaya can use

With a codec attached, Milesight sends only the decoder's output — no gateway EUI, no signal strength, no time. Omaya cannot tell which gateway heard it and drops the message. Use the wrapped decoder below, which puts the readings under object and keeps the radio details, the same shape a ChirpStack server sends.

  1. Open Milesight's decoder library on GitHub, github.com/Milesight-IoT/SensorDecoders, and find your sensor model's folder (for example em-series/em300-th). Open the file ending -decoder.js and copy all of it.

  2. In the gateway, go to Network Server → Payload Codec → Custom Payload Codec and add one named after the model with (Omaya) on the end, e.g. EM300-TH (Omaya). Paste the decoder into the decoder script.

  3. In what you pasted, find the function marked // Chirpstack v3:

    js
    function Decode(fPort, bytes) {
        return milesightDeviceDecode(bytes);
    }

    and replace it with:

    js
    function Decode(fPort, bytes) {
        return {
            devEUI:     LoRaObject.devEUI,
            deviceName: LoRaObject.deviceName,
            time:       LoRaObject.time,
            fCnt:       LoRaObject.fCnt,
            fPort:      fPort,
            data:       LoRaObject.data,
            rxInfo:     LoRaObject.rxInfo,
            txInfo:     LoRaObject.txInfo,
            object:     milesightDeviceDecode(bytes)
        };
    }

    Leave the rest of the file as it is.

  4. Save. If the editor's test reports that LoRaObject is not defined, the firmware is too old for it — update it (step 2).

You need one wrapped codec per sensor model, not per sensor.

Step 7 — Add the sensors ​

On the gateway, under Network Server → Device, add each sensor:

FieldEnter
Device namewhere it is, e.g. EM300-TH meeting room 3A
Device EUIthe sensor's DevEUI
Device-Profilethe profile from step 5
ApplicationOmaya
Payload Codecthe wrapped codec for its model, from step 6
fPort85 for Milesight sensors
Application Keythe sensor's AppKey

Power the sensor on (or wake it with its button or with ToolBox). Within a minute or two, Network Server → Packets shows a join and then its first uplink; opening the uplink shows the decoded readings.

In Omaya, under Device → Sensor, register it:

FieldEnter
MAC addressthe DevEUI, sixteen characters, no separators
Device Modelthe Milesight model if it is listed; otherwise Other / Generic — LoRaWAN readings come from the codec, not the model
Location, venue, zonethe room it measures

Step 8 — Check it end to end ​

  • Device → Gateway: the gateway turns online with the first uplink that reaches Omaya, and stays online for 30 minutes after each one — a LoRaWAN gateway is only heard when a sensor sends.
  • The sensor's own page: last seen, signal strength, and its readings.
  • Reports → Environment (for temperature, humidity, air quality and light) fills from the next hour onward.

If nothing arrives, work back along the chain: the application says Connected; the topic matches the connector's character for character (a wrong token is dropped silently, by design); the gateway EUI and DevEUI are registered in Omaya exactly as the gateway shows them; the device uses the wrapped codec.

What arrives ​

Omaya recognises Milesight's decoder output by name:

Milesight sendsOmaya records
temperatureTemperature (°C)
humidityHumidity (%)
co2, tvoc, pm2_5, pm10Air quality
pressureAir pressure (hPa)
illumination (EM500-LGT and other lux sensors)Light (lux)
pir — trigger / idlePresence: the sensor's zone occupied or empty, also when it arrives beside the readings above
batteryBattery (%)
active_power / electric_power, power_consumption, voltage, current, power_factor (WS5xx sockets)Power (W), energy (kWh), supply voltage, current and power factor in the Energy app
current, current_chn1 … current_chn3, ch1_sumkwh … (CT clamps)Current (A) and, from a -V2 clamp, energy (kWh) in the Energy app
line_1_period_in … line_4_period_in / _out (VS133, VS135)Enter / Exit — people across the lines since the last report, all lines added together
region_1_count … region_4_count (VS133, VS135)People count — people in the regions now, all regions added together
signal strength and SNR from the gatewaythe sensor's signal, per gateway that heard it

Everything else the decoder produces is kept with the reading but not placed in a report. Two to know about:

  • light_level on AM-series sensors is a brightness level from 0 to 5, not lux, so it is deliberately not shown as Light.
  • A VS133 or VS135 counts one doorway or room per device. Its lines are added into one in and one out, and its regions into one head count; the running totals (line_N_total_in) and the separate child counts are kept but not added, because they would count the same people twice. Draw the lines and regions for one doorway or room, and register the counter in the zone it counts. Register it with model VS133 Counter.

Without a codec ​

A sensor added with no codec still works as far as the radio goes: Omaya sees it, records when it was last heard and at what signal, and keeps the raw bytes of each uplink. Its readings stay empty until either you attach the wrapped codec, or you teach Omaya the payload with New sensor types — the route for a sensor Milesight publishes no decoder for.

When it disappoints ​

The gateway shows stale, or goes offline overnight. Milesight's built-in network server sends no heartbeat of its own; Omaya knows the gateway is alive from the uplinks it forwards. A LoRaWAN gateway — one registered by its EUI — is therefore given longer than a Bluetooth one: it stays online for 30 minutes after the last uplink, reads stale after that, and is offline, with an alert, only after 60 minutes of silence. Most Milesight sensors report every ten minutes, which keeps it comfortably online; if every sensor behind a gateway reports less often than every half hour, it will sit at stale between uplinks and, past an hour, raise offline alerts. Shorten one sensor's report interval, or ask for the organisation's LoRaWAN windows to be lengthened.

The application never says Connected. Host, port and TLS disagree — see step 5. A corporate firewall blocking outbound 8883 or 1883 is the next suspect.

Connected, joins show on the gateway, nothing in Omaya. In order: the uplink topic, the gateway EUI registered in Omaya, the DevEUI registered in Omaya, the wrapped codec.

The sensor never joins. Frequency plan (step 3) against the sensor's variant, then the AppKey, then distance — try it next to the gateway first.

Readings arrive at the wrong hour. The gateway clock — step 3, NTP.

Last updated:

Omaya platform documentation