Skip to main content

Item comparison with Nexmosphere's BLE pickup sensors

In this tutorial we will use Nexmosphere's XM-350 modular controller with EM-f8 expansion module and 4 pieces of XF-P3N pick-up sensors.

Setup sensor

  • Connect the controller to the device you wish to use.
  • Go to Home page right-click on the LG screen then navigate yourself to Manage screen >> Device Properties >> Set sensor configuration
  • In the Sensor config field insert the following configuration

Sensor configuration

{
"services":[
{
"uid":"asd",
"type":"GENERIC",
"settings":{
"rules":[
{
"pattern":"(\\w\\d{3}\\w)\\[(\\d*)]\r\n",
"idGroupIndex":1,
"valueGroupIndex":2
},
{
"pattern":"(\\w\\d{3}\\w)\\[(TR|TD)=UID:([A-Za-z0-9]*)]\r\n",
"idGroupIndex":1,
"eventGroupIndex":2,
"valueGroupIndex":3
},
{
"pattern":"(\\w\\d{3}\\w)\\[(\\w*)=([A-Za-z0-9]*)]\r\n",
"idGroupIndex":1,
"eventGroupIndex":2,
"valueGroupIndex":3
}
]
},
"connection":{
"port":"3",
"parity":0,
"baudrate":115200,
"dataBits":8,
"stopBits":1,
"flowControl":0
}
}
]
}
SHOW CONSOLE WINDOW

After you sat the configuration, enable the Show console window on your device, when you interact with the board it will show the actual sensor's ID, Event and Value, which will be needed in content creation.

Content

In this content you will need a main page and 15 different pages.

Check the events and values you can receive from the pickup sensors.
In this content the events and values are the following.

ble-event-map.png

Mock datasource

  • In the editor create a mock datasource in base data path modal of the properties >> content tab.
  • This will track the actual state of the sensor.
{"sensor":"","sensor2":"","sensor3":"","sensor4":""}
img.png

After you created a Mock datasource, save it then navigate yourself to properties >> content >> edit sensor events

  • Switch on the Allow specifying sensor values and Allow specifying sensor ids options on the bottom of the modal.
img.png
  • Create an action batch then in the sent fields, select the Received value then as a name, enter value (because we want to overwrite one of the value of the mock datasource).
  • As a sensor event, define one of the pickup sensor's event.
  • Leave the other fields empty.
img.png
  • After it is done click on the Actions button, as an action type select Change datasource then select the previously made mock datasource.
  • Select the overwrite property and as a property name, enter one of the row name from the mock. Here we used the first one ("sensor":"")
  • Under the field name on the left set the evaluation type to is anything,because we want to capture everything from the indexed sensor.
img.png

Repeat it until every value of the mock datasource has been used, but make sure you use different property names, otherwise every single event will overwrite the same indexed value in the datasource.

expand mock datasource with new events

If you have more than 4 events incoming (more than 4 sensors), you have to add a new row to the mock datasource (like "sensor5":""), and a new action batch with the defined sensor event in the edit sensor events modal.

  • After you finished the settings in Edit sensor events modal, then navigate yourself to edit datasource events modal.

    • Here you can create action batches to separate the actions by the incoming event numbers.
  • Create the first action batch.

  • As a bound value select the mock datasource

img.png
  • then as evaluation type select has changed anything.
img.png
  • In sent fields select the property of received value for 4 times then fill it with the values from the datasource, because they will define which action will be executed.
  • If you finished, click on the Actions button then add a new action.
ble-event-map.png
  • value 3 will come if you pick up the sensor, and when you put it down then it will be 0.
  • this is the evaluation we will use to define which page must be shown.

- Create an action for each option when only 1 event received

BLUE EVENT RECEIVED
img.png
GREEN EVENT RECEIVED
img.png
RED EVENT RECEIVED
img_1.png
YELLOW EVENT RECEIVED
img_2.png

- Create an action when no event received (it will jump back to the main page.)

NO EVENT RECEIVED
img_3.png

- Create an action batch with the same method then create actions for each option when 2 events received at the same time

BLUE + GREEN EVENTS RECEIVED
img.png
RED + GREEN EVENTS RECEIVED
img_1.png
YELLOW + RED EVENTS RECEIVED
img_2.png
BLUE + YELLOW EVENTS RECEIVED
img_3.png
BLUE + RED EVENTS RECEIVED
img_4.png
YELLOW + GREEN EVENTS RECEIVED
img_5.png

- Create an action batch with the same method then create actions for each option when 3 events received at the same time

YELLOW + RED + GREEN EVENTS RECEIVED
img_6.png
BLUE + RED + GREEN EVENTS RECEIVED
img_7.png
YELLOW + RED + BLUE EVENTS RECEIVED
img_8.png
YELLOW + GREEN + BLUE EVENTS RECEIVED
img_9.png

- Create an action batch with the same method then create actions for each option when all events received at the same time

YELLOW + RED + BLUE + GREEN EVENTS RECEIVED
img.png

After you created all the actions, save it, save the content, then try it out

Downloadable content