Setting up a new factory
How to set up a new factory
Create the company, the people, the gateway, the sensor, and the MQTT connector.
Introduction
Who this is for. A platform owner who creates the factory, then a plant admin who finishes the site.
Follow these steps in order for a new factory. Do the work as a platform owner, then as a plant admin. Keep passwords, AppKeys, and gateway tokens in the password store. The engineering background is in Technology and architecture.
Architecture
A factory is one company in Factora, one tenant in the network server, and one broker user.
- Ops consoleCreates the factory and the first plant passwords.
- PlantAreas and lines, Device registry, Industrial connectivity, Settings, and Alerts.
- Network serverTenant, application, gateway, device keys, and codec.
- WorkerHolds the MQTT connection and writes readings.
Step 0. Create the company in the ops console
- Open the ops console and sign in as a platform owner. MFA is required there.
- Choose + Add factory. The screen is Create a factory.
- Pick an industry template. Optional areas can be skipped. Required areas stay.
- Enter the company name and the plant or site name. Leave the plant name blank and the site name becomes the company name plus plant.
- Under Advanced · ERP connection, choose Not now unless you already have the codes.
- Review and choose Create factory. The factory starts in Onboarding with the time zone and currency you chose, and telemetry starts as demo.
- Copy the one-time passwords. The starter usernames are admin, maintenance, and operator.

Step 1. Turn on MFA and add people
- On the fleet page, open the new factory and open security. Turn on Require MFA for all team members.
- Enter the factory as a platform owner. Open Settings, then Team. You can turn on Require MFA here as well.
- Add each extra person with a display name and a role: admin, maintenance, or operator. The new password is shown once.
- Each person installs an authenticator, scans the enrolment code at sign-in, and stores the recovery codes.

Step 2. Add areas and lines
- Enter the factory as admin.
- Open Areas and lines.
- Add an area by name and kind, then add a line under that area.

Step 3. Create the network server tenant
Do this in the network server admin, not in Factora.
- Create a tenant named factory-<factory slug>.
- Create one application in that tenant for the site's sensors.
- Create or reuse a device profile: region EU868, LoRaWAN 1.0.x, OTAA, and a codec named for the measurement.
- Note the application id. The MQTT topic uses that id, not the factory slug.
ScreenshotComing soon
Step 4. Register the gateway
- In the network server, under the factory tenant, add the gateway by its id.
- Choose a per-gateway token, or a client certificate when you are ready for mutual TLS.
- On the gateway, set the server to wss://lns.factoraiot.com:3001.
- Confirm the gateway is online, then in the plant choose Register gateway on Industrial connectivity.

Step 5. Register devices
- In the network server, add DevEUI and JoinEUI, set the AppKey, and attach the EU868 device profile.
- Power the sensor and wait for a join, then an uplink whose object contains the measurement.
- In Device registry, choose Create device if the template does not already have the row you need: code, name, parameter, unit, and area.
- Store the ingest token if it is shown. A LoRaWAN sensor does not use it.

Step 6. Add the broker user
This is a change on the LoRaWAN broker, then a reload. Factora cannot do it.
- Add a user named factora-<factory slug> with a new password in the broker password file.
- Allow that user to read only application/<application id>/#. Do not allow that user to publish, and do not allow another factory's application.
- Reload the broker. Leave the gateway-bridge user and the network server user as they are.
ScreenshotComing soon
Step 7. Create the MQTT connector
- Enter the factory as admin and open Industrial connectivity.
- Set Type to MQTT and name the connector for the site.
- Set Broker / endpoint to mqtt://mosquitto:1883.
- Set Topic / node / register pattern to application/<application id>/device/+/event/up.
- Enter Password / secret and choose Save connector. Status should become connected.

Step 8. Map devices to sensors
- On the same page, under Map external source → FactoraERP device, choose the connector.
- Set External id to the uplink topic. For one sensor use application/<application id>/device/<DevEUI>/event/up. Match the DevEUI spelling, including letter case.
- Choose the FactoraERP device and choose Activate mapping.
- When an uplink arrives with no mapping, it is listed under Discovered. You can choose Map to selected device.

Step 9. Set alert rules
- The industry template already creates an offline rule and the limits that came with the template.
- On Register sensor, Min threshold and Max threshold add a minimum rule and a maximum rule for that new device.
- On Alerts, use Alert rules to write a sentence for a sensor that already exists: when it is above, below, or outside a value for a number of minutes, notify admin, maintenance, or operator.
- Operators acknowledge on Alerts. Maintenance can resolve.

Step 10. Verify the first readings
- The network server shows an uplink for the DevEUI, with a decoded object.
- The Factora connector stays connected, accepted messages increase, and the last error is empty.
- The device last value and last seen time move. Open the device and Plant dashboards and confirm the same number.
- Trigger one alert only if the plant agrees. Confirm it appears, acknowledge it, and resolve it.

Step 11. Go live
- Gateway online on Basics Station, EU868, and the sensor has joined.
- Broker user can read only this factory's application topic.
- Factora connector is connected to mqtt://mosquitto:1883. Remember the username gap before you call this done.
- Mapping external id matches the uplink topic, and the value path points at the codec field.
- Settings, Plant: Telemetry is Live mode (gateway ingest), and status is Active when staff should use it every day. Paused blocks plant login. Onboarding does not.
- Require MFA is on, and every person has enrolled. One-time passwords and the AppKey are only in the password store.
- The platform owner has left the factory so day-to-day work is done by plant users.

