This tutorial explains how to set up simple Car Counter project from scratch and get occupancy data via REST API.
For example and simplicity let’s assume our Car Counter project has only one parking lot with one entrance and one exit. We will need to create the following object “tree” (hierarchy):
Project: Example Project
Zone: Example Zone
Group: Example Group
Position 1: Entrance
Position 2: Exit
Parking Hierarchy registration
Project registration
Open Main Menu
Go to Settings → Projects page
Press button
Enter new Project Name, Timezone and press ADD
Zone registration
Open Main Menu
Go to Device Management → Zones page
Press button
Enter Zone name, select Project and press SAVE
Group registration
After zone registration you can see Zone page. Go to GROUPS tab
Press button
Enter Group Name, select Group Type → Standalone Car Counters, optionally enter Custom ID and press SAVE
You registered parking project structure. The next step is device positioning.
Optional: Virtual sensors creating
For API testing purposes it always easier to start with virtual sensors.
Open Main Menu
Go to Device Management → Virtual Devices page
Press button
Enter Firmware → CC basic UK B1/1.11.5, Number of devices → 2, turn on Active switcher and press ADD.
Device positioning
Sign it https://splace.nwave.io with login and possword for https://d.nwave.io.
You can use mobile application Splace instead of https://splace.nwave.io
Press Action button and click on the top button in the dropped out list
On the tab GROUP OF DEVICES select Project, Zone, Group and enter number of positioning devices, then press button SET POSITIONS
Locate central marker on your parking position, then press OK
Now you can see green text START POINT in the bottom left. You can just press on OK in second time to proceed
Now you can see that text FINISH POINT hase became green too. Press OK button to proceed
If you see an error and FINISH POINT still has red color, try to go to the application settings page and disable option “Interval placing”.
Enter positioning devices IDs and press button CREATE AND BIND. If you followed instructions in the previous chapter, you should insert IDs of created virtual devices. If you are positioning real devices, enter their IDs.
If you see an error about incompatibbility of device firmware type and group type, check if group has type Standalone Car Counter and device firmware has prefix “CC”
You has finished Car Counter hierarhy registration if you see the following message
Car Counter area configuration
Parking equipped by Car Counter require some specific operations:
configuration of entraces, exits, transitions
configuration of groups capacity
setting up current group occupancy
Temporary all operations described above can be done only by Nwave Team. Please, contact us if you need to complete car counter parking project registration.
Configuration of entraces, exists, transitions and group capacity is one-off operation in most cases. You should provide us information in fomat presented below:
Project: “Example Project”
Zone: “Example Zone”
Group “Example Group” capacity: 300
Sensor 1FD02, Group “Example Group”, Direction: IN
Sensor 1FDCA, Group “Example Group”, Direction: OUT
After receiving this data, we will make nedded configuration in next 24h.
Also, we can correct current group occupancy operatively if you notify us about you need in this action at least 24h before.
Capacity Configuration
Capacity can be configured only for groups. You should go to page of group which you created earlier and find group ID
Now you are able to get and set the group capacity. The following examples gets capacity of group with ID 1234
and sets capacity to 99 spaces:
curl --location --request GET 'https://api.nwave.io/car_counters/v1/group/1234/capacity' --header 'X-Auth-Token: XXXXXXXXXXX'
curl --location --request PUT 'https://api.nwave.io/car_counters/v1/group/1234/capacity' --header 'X-Auth-Token: XXXXXXXXXXX' --header 'Content-Type: application/json' --data-raw '{"capacity":99}'
Occupancy Correction
Occupancy correction is needed preiodically or after technical maintenance. The Nwave cloud calculates occupancy for all levels of hierarchy basing on group occupancy, so all occupancy correction opperations are possible only with groups.
You can find how to get group ID in the previous chapter.
The following examples shows how to get current occupancy for group 1234 and hot to set it:
curl --location --request GET 'https://api.nwave.io/car_counters/v1/group/1234/occupancy' --header 'X-Auth-Token: XXXXXXXXXXX'
curl --location --request PUT 'https://api.nwave.io/car_counters/v1/group/2923/occupancy' --header 'X-Auth-Token: XXXXXXXXXXX' --header 'Content-Type: application/json' --data-raw '{"occupied":3}'
Manual Testing
Virtual Car Counters
Virtual Car Counters allows you to set counter value that you want and when you whant.
For doung this, got to Device Management → Virtual Devices page, find virtual device in the list and press button SEND MESSAGE
Enter a new counter value and press SEND
Message has been send, you can check this by pressing on button VIEW MESSAGES
Requesting occupancy data
First of all, you have to create Authorization Token for getting access to Nwave API.
This document completely describes process of Authorization Tokens creation: Generating Authorization Tokens
Now, you should get know ID of created zone. For this you have to go to Device Management → Zones, find your zone in the list and press ont the zone name.
Zone ID is demonstrated on the top of Zone page
The next step is getting data. You can read about API here: https://nwaveio.atlassian.net/wiki/spaces/ND/pages/3018096657/Car+Counters#Analytics-API
In this tutorial we show only how to get zone current occupancy. Use the following snippet. You should replace zone_id and X-Auth-Token values before running.
curl --request GET 'https://api.nwave.io/analytics/v1/car_counters/realtime/occupancy_summary?group_by=zone&zone_id=111' --header 'x-Auth-Token: XXXXXXXXXXXX'
🎆 Done! You have just created Car Counters Parking Project and got data about it’s occupancy.