Skip to content

Managing Your Sensor

Once your sensor is deployed, you can manage it remotely via MQTT commands — calibrate sensors, check status, update location, and restart the device without physical access.

Command Topic Structure

Commands are sent to your device's MQTT topic:

{deviceTopicPrefix}/command/{category}/{target}/{action}

For example:

wesense/v2/wifi/nz/wko/device123/command/sensor/scd4x/calibrate

All command responses are published to:

{deviceTopicPrefix}/status/command

Responses include a status (SUCCESS, ERROR, or INFO), a message, and a timestamp.

Sensor Commands

CO2 Sensors

SCD30 / SCD4x (Sensirion)

CommandActionPayload
sensor/scd4x/calibrateCalibrate to known CO2 levelPPM value (e.g. 400 for outdoor air)
sensor/scd4x/asc_enableEnable Automatic Self-Calibration
sensor/scd4x/asc_disableDisable ASC
sensor/scd4x/asc_statusCheck ASC status
sensor/scd4x/resetReset sensor
sensor/scd4x/selftestRun self-test
sensor/scd4x/factory_resetFactory reset (wipes all calibration)
sensor/scd4x/pressure_compensation_statusCheck pressure compensation
sensor/scd4x/pressure_compensation_applyApply pressure compensation

The same commands are available for scd30 (replace scd4x with scd30 in the topic). The SCD30 also supports:

CommandActionPayload
sensor/scd30/set_intervalSet measurement intervalSeconds (2-1800)
sensor/scd30/set_altitudeSet altitude compensationMetres
sensor/scd30/statusGet sensor status

CM1106-C

CommandActionPayload
sensor/cm1106c/calibrateCalibrate to known CO2 levelPPM value (400-1500)
sensor/cm1106c/abc_enableEnable Automatic Baseline Correction
sensor/cm1106c/abc_disableDisable ABC
sensor/cm1106c/statusCheck sensor status
sensor/cm1106c/serial_numberRead serial number
sensor/cm1106c/versionRead firmware version

Air Quality

CommandActionPayload
sensor/sgp41/baseline_statusCheck VOC/NOx baseline learning status
sensor/bme680/gas_heaterEnable/disable gas heaterON or OFF

Pressure

CommandActionPayload
sensor/bmp280/diagnosticRun diagnostic test

Device Commands

LED Control

CommandActionPayload
device/led/setControl status LEDON, OFF, BLINK_FAST, BLINK_SLOW

Location

CommandActionPayload
device/config/locationUpdate sensor locationJSON: {"latitude": -36.8, "longitude": 174.7, "name": "Auckland", "enable": true}
device/config/location_statusCheck current location
device/config/location_resetReset to firmware defaults

This lets you move a sensor to a new location without reflashing the firmware.

System Commands

CommandActionPayload
system/restartRestart the device— (3-second delay for safety)
system/statusGet uptime, memory, connectivity
system/syslog_enableEnable remote syslog
system/syslog_disableDisable remote syslog
system/syslog_statusCheck syslog status

Calibration Management

CommandActionPayload
system/calibration_statusStatus of all sensors' calibration
system/calibration_resetReset calibration stateall or sensor name (e.g. scd4x)
system/calibration_restartReset and restart calibrationall or sensor name
system/calibration_backupBackup calibration data to MQTT
system/calibration_restoreRestore from backupJSON calibration payload
system/testing_enableSuppress ALL data (testing mode)
system/testing_disableResume normal publishing

Sending Commands

You can send commands using any MQTT client. Here's an example using mosquitto_pub:

bash
# Calibrate SCD4x to outdoor air (400 ppm)
mosquitto_pub -h mqtt.wesense.earth -p 8883 \
  --capath /etc/ssl/certs \
  -u "your_user" -P "your_password" \
  -t "wesense/v2/wifi/nz/wko/device123/command/sensor/scd4x/calibrate" \
  -m "400"

# Check system status
mosquitto_pub -h mqtt.wesense.earth -p 8883 \
  --capath /etc/ssl/certs \
  -u "your_user" -P "your_password" \
  -t "wesense/v2/wifi/nz/wko/device123/command/system/status" \
  -m ""

You can also use a GUI like MQTT Explorer, Home Assistant's MQTT integration, or any MQTT dashboard to send commands and view responses.

CO2 Calibration Tips

SCD30 / SCD4x — When to Calibrate

  • Recommended approach: Enable ASC and place the sensor where it gets at least 1 hour of fresh air (~400ppm) daily. ASC takes 7 days to find its initial baseline.
  • Manual calibration: Place the sensor outdoors in fresh air for 2+ minutes, then send the calibrate command with 400 as the payload.
  • Never calibrate indoors — indoor CO2 varies too much for a reliable reference point.

CM1106-C — ABC Considerations

  • ABC is disabled by default — the sensor uses factory calibration on startup.
  • Only enable ABC if the sensor regularly sees outdoor air (~400ppm).
  • ABC uses a 15-day cycle (vs 7 days for SCD4x).
  • Incorrect ABC setup can cause a persistent 50-100ppm offset.

Remote Debug via Telnet

If you enabled Secure Telnet in the firmware configuration, you can connect to your sensor's serial output remotely:

bash
telnet <sensor-ip-address> 23

This shows the same output as the Arduino IDE Serial Monitor — sensor readings, connection status, errors, and calibration state. Useful for diagnosing issues without physical access.

All WeSense data is free and open, forever.