iTranslated by AI
Building a Patlite Alert System Triggered by SoraCam Motion Detection
What I want to achieve
I will set up a Patlite to light up when someone moves within the Soracam's field of view.
This configuration was created for use in a demo at a SORACOM exhibition booth.
In this project, the Patlite will light up orange when a person is detected. Furthermore, if a person wearing a blue T-shirt (commonly known as a "Cele-T") appears in the footage, the Patlite will light up red.
Since it would be problematic if it stayed lit throughout the exhibition, I will make it so that the Patlite turns off when a button device is pressed.

Please check out these articles as well.
What you need
-
SORACOM account
-
Soracam
-
SORACOM Air (SIM card)
-
LTE router
-
Patlite (HTTP compatible)
The one used this time is the LR5-LAN
-
Switching hub
-
LAN cable
-
PC for configuration
Steps
Wiring Connections
Connect as follows.

LTE Router Configuration
Configure the LTE router (UD-LT2) following the steps here.
Change the LAN side IP address.
From the network settings, select LAN, enter 192.168.10.100/24 into IP1, and click Update (this sets the IP address of the UD-LT2's LAN port to 192.168.10.100).

Since the IP address has changed, access http://192.168.10.100/ and log back into the UD-LT2 configuration screen.
Set up port forwarding (DNAT setting) to transfer commands sent to the UD-LT2 to the Patlite.
-
On the UD-LT2 configuration screen, click [Transfer Settings] -> [NAT] -> [Add].

-
Configure as follows and save.
| Item | Value |
|---|---|
| NAT Setting | DNAT |
| Protocol | TCP |
| Initial Address Type | interface |
| Interface | 4G |
| Initial Port | 50080 |
| Mapping Address | 192.168.10.1 |
| Mapping Port | 80 |

Patlite Configuration
-
Access the Patlite configuration screen: http://192.168.10.1/

-
Change the language.

-
Set a password.

-
Configuration complete.

-
Log in using the password you just set.

-
Set to DHCP.
Under Network Settings -> IP Address Setting Method, select "Obtain automatically" and click Set.

-
In Command Reception Settings, confirm that HTTP Command Reception is set to "Enabled" and make a note of the MAC address in the top right.

-
Return once more to the UD-LT2 configuration screen (
http://192.168.10.100).Configure a DHCP reservation so that
192.168.10.1is always assigned to the Patlite via DHCP.Ir-5lan

Enter the following settings in the "Fixed IP" entry under "DHCP Settings".Item Value IP Address 192.168.10.1 MAC Address MAC address of the Patlite 
Soracam Configuration
Click here if you're new to Soracam (from purchase to setup)!
SORACOM Account Creation, etc.
Set the coverage type to JP.
From Soracam Purchase to Setup
In fact, recently you don't necessarily have to use the app for Soracam setup.
Installing Soracam
There is a lot of expertise regarding installation accumulated here.
First and foremost, let's verify that the camera is working correctly.
-
"SORACOM Cloud Camera Service" -> "Device Management"

-
In the device list, confirm that the camera you just registered is online.

-
Furthermore, clicking on the camera name will display the camera's feed.

SORACOM Flux Configuration
Configuration Overview

We will create a flow like this. I will explain the detailed configuration settings below.
1. Motion Detection Webhook
Event Source: API/Manual Execution
Output Channel: API Channel
Set the Webhook URL to be called as an action when the Soracam detects motion.
(The configuration for Soracam's motion detection will be described later.)
Input JSON
{
"eventType": "event_detected",
"deviceId": "Camera Device ID",
"deviceName": "Camera Name",
"alarmType": "motion_detected"
}
2. Create Patlite lighting command
Input Channel: API Channel
Detailed settings for the republish action
| Category | Item | Setting Value | Remarks |
|---|---|---|---|
| CONDITION | Execution condition | payload.deviceId=="Camera Device ID" | Process only notifications from a specific camera |
| CONFIG | Transform data | ✅️ | |
| CONFIG | Content Type | application/json | Output in JSON format |
| CONFIG | Content | { "command":"011990" } |
Patlite control command (lights up yellow and green) |
| OUTPUT | Send output to another channel | Enabled | Output destination channel |
| OUTPUT | Destination channel | Output Channel | Output destination channel |
Configuration screen (example)

Output Channel: Output Channel
3. Issue Downlink API command
Input Channel: Output Channel
Detailed settings for the SORACOM API action
| Category | Item | Setting Value | Remarks |
|---|---|---|---|
| CONDITION | Execution condition | None | Process all events |
| CONFIG | URL:path | /v1/sims/SIM ID/downlink/http |
SIM HTTP DownlinkSIM ID is the SIM ID of the SIM inserted into the router connected to the PatlitesendDownlinkHttp |
| CONFIG | URL:method | POST | HTTP Method |
| CONFIG | body | { "method": "GET", "path": "/api/control?alert=${payload.command}", "port": 50080, |
|
| "skipVerify": true, | |||
| "ssl": false } |
Patlite control API call | ||
| OUTPUT | Destination channel | Output | Output destination channel |
Configuration screen (example)

Output Channel: Output
4. Image extraction (Save to Harvest Files)
Input Channel: Output
Detailed settings for the action
| Category | Item | Setting Value | Remarks |
|---|---|---|---|
| CONDITION | Execution condition | event.payload.deviceId != null | Process only when device ID exists |
| CONFIG | URL:path | /v1/sora_cam/devices/${event.payload.deviceId}/images/exports | Soracam image export API exportSoraCamDeviceRecordedImage |
| CONFIG | URL:method | POST | HTTP Method |
| CONFIG | body | {"time": ${now()}, "imageFilters": [], "harvestFiles": {"pathPrefix": "Directory name for image export (saving)"}} | Image export settings |
| OUTPUT | Destination channel | None | No output |
Configuration screen (example)

5. Data from button device (unified endpoint)
Perform the initial setup of the button by following Register SORACOM LTE-M Button for Enterprise in the User Console.
Event Source: IoT Device
Enable it and select the group to which the button device belongs.

Output Channel: IoT Device Channel
6. Create Patlite off command
Input Channel: IoT Device Channel
Detailed settings for the republish action
| Category | Item | Setting Value | Remarks |
|---|---|---|---|
| CONDITION | Execution condition | payload.deviceId=="Camera ID" | Process only notifications from a specific camera |
| CONFIG | Transform data | ✅️ | |
| CONFIG | Content Type | application/json | Output in JSON format |
| CONFIG | Content | { "command":"000990" } |
Patlite control command (lights up yellow and green) |
| OUTPUT | Send output to another channel | Enabled | Output destination channel |
| OUTPUT | Destination channel | Output Channel | Output destination channel |
Configuration screen (example)

Output Channel: Output Channel
(Merged with the output of action 2.)
7. Image extraction complete
Select "SORACOM Harvest Files" as the event source.
Enable it and specify the directory name where the exported images are saved.

Output Channel: Harvest Files Event Channel
8. Image analysis using Generative AI (Multimodal foundation model)
Input Channel: Harvest Files Event Channel
Detailed settings for the action
| Category | Item | Setting Value | Remarks |
|---|---|---|---|
| CONDITION | Execution condition | None | Process all events |
| CONFIG | AI Model | azure-openai (gpt-4o) | AI service (AI model) to be used |
| CONFIG | Prompt | Analyze the image and check if there is a person wearing an emerald green T-shirt in the image. The output should be in JSON. If there is a person wearing an emerald green T-shirt, return {"result":true} If there is no person wearing an emerald green T-shirt, return {"result":false}. |
|
| Instructions for the AI | |||
| CONFIG | Format AI response as JSON | ✅️ | |
| CONFIG | Provide image to AI | ${payload.presignedUrls.get} | URL of the image to analyze |
| OUTPUT | Destination channel | Output AI | Output destination channel |
Configuration screen (example)

Output Channel: Output AI
9. Create Patlite lighting command
Input Channel: Output AI
Detailed settings for the republish action
| Category | Item | Setting Value | Remarks |
|---|---|---|---|
| CONDITION | Execution condition | payload.output.result == true | If the AI judgment result is true
|
| CONFIG | Transform data | ✅️ | |
| CONFIG | Content Type | application/json | Output in JSON format |
| CONFIG | Content | { "command":"011990" } |
Patlite control command (lights up yellow and green) |
| OUTPUT | Send output to another channel | Enabled | Output destination channel |
| OUTPUT | Destination channel | Output Channel 2 | Output destination channel |
Configuration screen (example)

Output Channel: Output Channel 2
10. Create Patlite lighting command
Input Channel: Output AI
Detailed settings for the republish action
| Category | Item | Setting Value | Remarks |
|---|---|---|---|
| CONDITION | Execution condition | payload.output.result == false | If the AI judgment result is false
|
| CONFIG | Transform data | ✅️ | |
| CONFIG | Content Type | application/json | Output in JSON format |
| CONFIG | Content | { "command":"000000" } |
Patlite control command (all lights off) |
| OUTPUT | Send output to another channel | Enabled | Output destination channel |
| OUTPUT | Destination channel | Output Channel 2 | Output destination channel |
Configuration screen (example)

Output Channel: Output Channel 2
11. Issue Patlite lighting/off command
Input Channel: Output Channel 2
Detailed settings for the SORACOM API action
| Category | Item | Setting Value | Remarks |
|---|---|---|---|
| CONDITION | Execution condition | None | Process all events |
| CONFIG | path | /v1/sims/SIM ID/downlink/http |
SIM HTTP DownlinkSIM ID is the SIM ID of the SIM inserted into the router connected to the PatlitesendDownlinkHttp |
| CONFIG | method | POST | HTTP Method |
| CONFIG | body | { "method": "GET", "path": "/api/control?alert=${payload.command}", "port": 50080, "skipVerify": true, "ssl": false } |
Patlite control API call |
| OUTPUT | Destination channel | Output | Output destination channel |
Configuration screen (example)

Setting up Soracam Notifications
Configure Soracam to send a payload to the SORACOM Flux Webhook endpoint when motion is detected.
1. Obtain the SORACOM Flux Webhook URL
First, obtain the Webhook URL from the "1. Motion Detection Webhook" action created in Flux.
- In the SORACOM Flux management screen, select the relevant action.
- Copy the Webhook URL displayed on the detail screen for "API Channel".
2. Configure Soracam Notifications
Next, in the SORACOM User Console, set the Webhook URL obtained above as the notification destination for motion detection.
- Log in to the SORACOM User Console and go to [Menu] > [SORACOM Cloud Camera Service] > [Notification Settings].
- If the "Regarding the use of Soracam Notification Option" screen appears, review the content and click [Understand and use].
- Click [Set up notifications] in the [Device Motion Detection/Sound Detection Notifications] section.
3. Motion Detection Notification Settings
-
Add a notification destination.
- Select the [Webhook] tab and click [+Add Webhook notification destination].
- Configure as follows and click [Save].
- Webhook URL: Paste the URL copied in step 1.
-
HTTP method:
POST -
HTTP header: Leave as default.
- Select the [Webhook] tab and click [+Add Webhook notification destination].
-
Select the target cameras for notification.
- Return to the notification settings screen and click [Set target devices for notification].
- Select the camera to perform motion detection from the list and turn on the toggle for notification.
-
Customize the payload to be sent.
- Enable the toggle in [Notification Message Settings] > [Motion Detection/Sound Detection Settings] on the notification settings screen.
- Click [Set message content] and select the [Webhook] tab.
- Select the notification destination added earlier and click [Edit Webhook message].
- Set the following content in the request body.
{
"eventType":"{{ event_type }}",
"deviceId":"{{ device_id }}",
"deviceName":"{{ device_name }}",
"alarmType":"{{ alarm_type }}"
}
Configuration screen (example)

When motion detection occurs, a JSON payload like the following will be sent to SORACOM Flux:
{
"eventType": "event_detected",
"deviceId": "Camera Device ID",
"deviceName": "Camera Name",
"alarmType": "motion_detected"
}
This payload received by SORACOM Flux will trigger the Patlite control process.
Appendix
About Patlite Control
The Patlite (LR5-LAN) can be controlled using HTTP commands. The main commands are explained below.
Basic format of HTTP commands
GET /api/control?alert=XXXXXX
Command structure
Commands consist of a 6-digit number, where each digit has the following meaning:
| Digit Position | Meaning | Value |
|---|---|---|
| 1st digit | Red LED | 0: Off, 1: On, 2: Flashing (Slow), 3: Flashing (Medium), 4: Flashing (Fast), 5: Single flash, 6: Double flash, 7: Triple flash, 9: No change |
| 2nd digit | Yellow LED | 0: Off, 1: On, 2: Flashing (Slow), 3: Flashing (Medium), 4: Flashing (Fast), 5: Single flash, 6: Double flash, 7: Triple flash, 9: No change |
| 3rd digit | Green LED | 0: Off, 1: On, 2: Flashing (Slow), 3: Flashing (Medium), 4: Flashing (Fast), 5: Single flash, 6: Double flash, 7: Triple flash, 9: No change |
| 4th digit | Blue LED | 0: Off, 1: On, 2: Flashing (Slow), 3: Flashing (Medium), 4: Flashing (Fast), 5: Single flash, 6: Double flash, 7: Triple flash, 9: No change |
| 5th digit | White LED | 0: Off, 1: On, 2: Flashing (Slow), 3: Flashing (Medium), 4: Flashing (Fast), 5: Single flash, 6: Double flash, 7: Triple flash, 9: No change |
| 6th digit | Buzzer | 0: Stop, 1–9: Patterns 1–9 |
Signal light pattern details
The flashing patterns for each LED operate as follows:
| Pattern | Operation | Timing |
|---|---|---|
| 0 | Off | Always OFF |
| 1 | On | Always ON |
| 2 | Flashing (Slow) | Repeats ON 500ms → OFF 500ms |
| 3 | Flashing (Medium) | Repeats ON 250ms → OFF 250ms |
| 4 | Flashing (Fast) | Repeats ON 125ms → OFF 125ms |
| 5 | Single flash | Repeats ON 50ms → OFF 450ms |
| 6 | Double flash | Repeats ON 50ms → OFF 50ms → ON 50ms → OFF 350ms |
| 7 | Triple flash | Repeats ON 50ms → OFF 50ms → ON 50ms → OFF 50ms → ON 50ms → OFF 250ms |
Examples of use
Examples of commands used in this article:
-
011990: Lights up yellow and green (when a person is detected) -
100990: Lights up red (when a blue T-shirt is detected) -
000000: All lights off
Other control command examples
# Basic lighting and turning off
GET /api/control?alert=100000 # Red on
GET /api/control?alert=010000 # Yellow on
GET /api/control?alert=001000 # Green on
# Flashing patterns (Slow)
GET /api/control?alert=200000 # Red flashing (Slow)
GET /api/control?alert=020000 # Yellow flashing (Slow)
GET /api/control?alert=002000 # Green flashing (Slow)
# Flashing patterns (Medium/Fast)
GET /api/control?alert=300000 # Red flashing (Medium)
GET /api/control?alert=400000 # Red flashing (Fast)
# Flash patterns
GET /api/control?alert=500000 # Red single flash
GET /api/control?alert=600000 # Red double flash
GET /api/control?alert=700000 # Red triple flash
# Combinations of multiple colors
GET /api/control?alert=120000 # Red on + Yellow flashing (Slow)
GET /api/control?alert=234000 # Red flashing (Slow) + Yellow flashing (Medium) + Green flashing (Fast)
GET /api/control?alert=567000 # Red single flash + Yellow double flash + Green triple flash
# Patterns with buzzer
GET /api/control?alert=001001 # Green on + Buzzer pattern 1
GET /api/control?alert=222225 # All colors flashing (Slow) + Buzzer pattern 5
GET /api/control?alert=567009 # Multiple flash patterns + Buzzer pattern 9
# All colors simultaneously
GET /api/control?alert=111110 # All colors on
GET /api/control?alert=222220 # All colors flashing (Slow)
GET /api/control?alert=444440 # All colors flashing (Fast)
GET /api/control?alert=777770 # All colors triple flash
About buzzer patterns
Specific patterns cannot be specified via parameters; the pattern configured by the DIP switches on the unit will be used.
| Pattern | Description |
|---|---|
| 0 | Stop (Silent) |
| 1 | Sounding |
| 9 | No change |
Notes
- The command must always be specified with 6 digits.
For detailed specifications, please refer to the official Patlite catalog.
Discussion