Welcome to Phason API Official Documentation API Reference
Access the Phason APIs to retrieve Autoflex Connect data.
Contact for support: APISupport@phason.ca
API Endpoint Response Examples
https://api.phason.ca
Schemes: https
Version: 1.0.2
Authentication
OAuth2 protocol is used for Authentication..
phason_OAuth2
To obtain the information needed to obtain access tokens so that you can utilize our API, please email us at APISupport@phason.ca
Phason login implemented in your website in order to connect the user to their phason user. This is done using the Authorization code flow. This proccess will return an access token that is needed to obtain data of that user. A refresh token will also be returned , which is used to obtain a new access token once the old access token expires. Read more here.
Client_secret_post is currently used to send client secret to the /token endpoint. The client_secret is placed in POST rather than basic authorization.
Once an access token is recieved, it can be used to access Phason API endpoints relating to the user
account that logged in.
Access tokens are placed in an authorization header like this:
Bearer <access_token>
There are OAuth2 Client libraries that handle making requests to /auth and /token already written in various languages.
Steps to get a new Access Token for the first time (or if the Refresh Token has expired):
-
One can invoke the callback URL which would take you to the Phason users' login page. One needs to
login with their Phason Webservices Account credentials (The same account which was added while
configuring AutoFlex).
As an example, the callback URL should look like the following URL :
https://api.phason.ca/client/example_callback.php
Note: Please contact us for having their account setup (includes account specific callback URL, client ID and secret) for the authentication and access to Phason APIs.
- After successful login, one needs accept the consent. Following acceptance of the consent, the authentication servcie would provide you with the set of access and refresh tokens.
- Here is the link to checkout the responses from the POST request of the /refresh API:
https://api.phason.ca/#tag-Refresh
Some important points on the lifespan of OAuth2.0 Access and Refresh tokens:
- The Access Token has a lifespan of 24 hours and you can refresh it for the next 168 hours or roughly 7 days to retreive a new set of Access and Refresh tokens.
- When refresh token expires, one has to login again into the callback API URL using phason accounts to generate a new set of tokens.
- If one phason account added to multiple devices, single set of tokens is adequate to access all devices for same phason account.
Grants read access
Response Example for Refresh endpoint (200 OK)
{
"message": "New key issued",
"code": "0",
"expiry": "1647032643",
"access_key": "acccess_key",
"refresh_token": "refresh_token"
}
Response Example for Refresh endpoint (200 OK)
{
"message": "Key Still Valid",
"code": "0",
"expiry": "1647032643",
"access_key": "acccess_key",
"refresh_token": "refresh_token"
}
Device
User Autoflex devices.
GET /devices
Returns all user devices for the user for whom the token was created.
successful operation
Response Example (200 OK)
{
"device_id": "5555",
"device_name": "My AFX 2",
"host_name": "AutoFlex-3AA2AA",
"device_type": "AutoFlex Connect"
"version": "3.08.01"
"last_reported_on": "2024-07-23 05:55:55"
}
Room
Rooms are a respresentation of a physical area.
GET /devices/{deviceId}/rooms
Returns all rooms for one device.
successful operation
No rooms found
Response Example (200 OK)
{
"room_id": "1217",
"room_name": "First Room"
}
Equipment Group
AutoFlex Equipment Groups
Group Types
Group Type | Description | Unit |
---|---|---|
1 | Temperature | °C |
5 | Static pressure | Inches water column |
9 | Data only | No valid readings |
15 | Windchill | °C |
16 | Temperature humidity index | THI |
101 | Ventilation grid | °C |
GET /devices/{deviceId}/equipment_groups
Returns all equipment groups in one device.
successful operation
No equipment groups found
Response Example (200 OK)
{
"group_id": "12402",
"room_id": "1217",
"group_type": "1",
"group_type_description": "temperature",
"group_name": "Group 1",
"current_reading": "21.4",
"alarm_code": "0",
"alarm_time": "0",
"target_value": "0",
"target_lower_limit": "0",
"target_upper_limit": "5",
"reading_time": "2022-05-04 09:50:12"
}
GET /devices/{deviceId}/equipment_groups?start=yyyy-mm-dd&end=yyyy-mm-dd
Returns all equipment groups in one device between a start end and end date.
The start date for the device you want to get the settings for.
The end date for the device you want to get the settings for.
successful operation
No equipment groups found
Response Example (200 OK)
{
"group_id": "12402",
"room_id": "1217",
"group_type": "1",
"group_type_description": "temperature",
"group_name": "Group 1",
"current_reading": "21.4",
"alarm_code": "0",
"alarm_time": "0",
"target_value": "0",
"target_lower_limit": "0",
"target_upper_limit": "5",
"reading_time": "2022-05-04 09:50:12"
}
GET /devices/{deviceId}/equipment_groups/settings
Returns equipment group settings for specific group.
The id for the group you want to get the settings for.
successful operation
No equipment groups found
Response Example (200 OK)
{
"message": "Success",
"settings": [
{
"setting_num": 1,
"settings_name": "Room settings mode 1",
"master_setpoint": 23.4
}
]
}
POST /devices/{deviceId}/equipment_groups/settings
Set equipment group settings for specific group.
The id of the group you want to get the settings for.
New master setpoint in Celsius.
successful operation
No equipment groups found
Missing post data
Response Example (200 OK)
{
"message": "Success",
"settings": [
{
"setting_num": 1,
"settings_name": "Room settings mode 1",
"master_setpoint": 23.4
}
]
}
Misting Group
Active start time / end time calculation
Examples
Active start time | Calculations |
---|
GET /devices/{deviceId}/misting_groups
Returns all misting groups in one device.
successful operation
No misting groups found
Response Example (200 OK)
{
"group_id": "12402",
"room_id": "1217",
"function_mode": "1",
"active": "1",
"active_start_time": "0",
"active_end_time": "82800",
"cycle_duration": "1980",
"min_misting_duration": "60",
"max_misting_duration": "120",
"soak_duration": "180",
"min_cycle_duration": "2940",
"max_cycle_duration": "3900",
"low_temp": "20",
"high_temp": "26.7",
"max_temp": "32.2",
"pump_delay": "10",
"humidity_bypass_active": "0",
"humidity_setpt": "80",
"humidity_module_num": "10",
"humidity_io_num": "1",
"low_thi": "68"
"high_thi": "72"
"max_thi": "78"
"entered_by": "Jon Doe"
}
GET /devices/{deviceId}/misting_groups/settings
Returns misting group settings for specific group.
The id for the group you want to get the settings for.
successful operation
No misting groups found
Response Example (200 OK)
{
"message": "Success",
"settings": {
"settings_num": 0,
"function_mode": 0,
"active": 0,
"active_start_time": 0,
"active_end_time": 0,
"cycle_duration": 0,
"min_mist_duration": 0,
"max_mist_duration": 0,
"soak_duration": 0,
"min_cycle_duration": 0,
"max_cycle_duration": 0,
"low_temp": 0,
"high_temp": 0,
"max_temp": 0,
"pump_delay": 0,
"humidity_bypass_active": 0,
"humidity_setpt": 0
"low_thi": "0"
"high_thi": "0"
"max_thi": "0"
}
}
POST /devices/{deviceId}/misting_groups/settings
Set misting group settings for specific group.
The id of the group you want to get the settings for.
The sprinkler modes: Soaking, Misting/Fogging, Smart Mode.
Switched on or not.
The start time of the function (0 - 86340 seconds).
The end time of the function (0 - 86340 seconds).
Duration of the function in a cycle (60 - 86340 seconds).
Minimum duration when Misting was enabled (60 - 86340 seconds).
Maximum duration when Misting was enabled (60 - 86340 seconds).
Soaking Duration for each sprinkler (60 - 86340 seconds).
Minimum cycle duration (60 - 86340 seconds).
Maximum cycle duration (60 - 86340 seconds).
Low set point temperature value (-10 to 51.7 Celsius).
High set point temperature value (-10 to 51.7 Celsius).
Maximum set point temperature value (-10 to 51.7 Celsius).
Beginning of the active time of day. Sprinklers do not operate before this time (1-59 seconds).
successful operation
No equipment groups found
Missing post data
Response Example (200 OK)
{
"message": "misting setting change success.",
"settings": {
"settings_num": 0,
"function_mode": 0,
"active": 0,
"active_start_time": 0,
"active_end_time": 0,
"cycle_duration": 0,
"min_mist_duration": 0,
"max_mist_duration": 0,
"soak_duration": 0,
"min_cycle_duration": 0,
"max_cycle_duration": 0,
"low_temp": 0,
"high_temp": 0,
"max_temp": 0,
"pump_delay": 0,
"humidity_bypass_active": 0,
"humidity_setpt": 0
"low_thi": 0
"high_thi": 0
"max_thi": 0
}
}
Time
The time endpoint is used to get the current time and timezone request from a device. All readings are in the device's local time, as such conversions to other timezones required to know the unit's original time.
GET /devices/{deviceId}/time
Returns timezone and current time for a device.
successful operation
Response Example (200 OK)
{
"datetime": "2022-05-23 09:54:23",
"timezone": "America/Chicago"
}
Lighting Timed Events
The time event endpoint is used to get, set, update, delete schedule related parameters on AutoFlex.
GET /devices/{deviceId}/timed_statistic
Returns all the timed event related ids on a AutoFlex.
The id of the device the timed events are in
successful operation
Response Example (200 OK)
{
"device_id": 8446,
"schedule_ids": [
{
"schedule_id": 1,
"segment_ids": [
{
"segment_id": 1,
"event_ids": [
23,
24,
93,
94,
95,
97
]
},
{
"segment_id": 2,
"event_ids": [
73,
74,
75,
76
]
},
{
"segment_id": 3,
"event_ids": [
27,
28,
29,
30
]
}
]
},
{
"schedule_id": 2,
"segment_ids": [
{
"segment_id": 2,
"event_ids": [
73,
74,
75,
76
]
},
{
"segment_id": 3,
"event_ids": [
27,
28,
29,
30
]
},
{
"segment_id": 4,
"event_ids": [
31,
32,
33,
34,
35,
36
]
}
]
},
{
"schedule_id": 3,
"segment_ids": [
{
"segment_id": 5,
"event_ids": [
77,
78,
79,
80,
81,
82,
83
]
},
{
"segment_id": 6,
"event_ids": [
27,
28,
29,
30
]
},
{
"segment_id": 4,
"event_ids": [
31,
32,
33,
34,
35,
36
]
}
]
},
{
"schedule_id": 4,
"segment_ids": [
{
"segment_id": 6,
"event_ids": [
60,
61,
62,
63,
64
]
}
]
},
{
"schedule_id": 5,
"segment_ids": [
{
"segment_id": 7,
"event_ids": [
49,
50,
51,
52,
53
]
},
{
"segment_id": 8,
"event_ids": [
57,
58,
59,
128,
131,
138,
140,
142,
145,
147,
161
]
}
]
}
]
}
GET /devices/{deviceId}/event_single
Returns a single AutoFlex event.
The id of the device the timed events are in
The segment id of the event in
The id of the event
successful operation
Response Example (200 OK)
{
"device_id": 8446,
"segment_id": 1,
"event_id": 23,
"event_value": 0,
"event_time": "2019-09-19 03:55:08"
}
GET /devices/{deviceId}/events_segment
Returns AutoFlex events of one segment.
The id of the device the timed events are in
The segment id of the event in
successful operation
Response Example (200 OK)
{
"device_id": 8446,
"segment_id": 3,
"events": [
{
"event_id": 27,
"event_value": 0,
"event_time": "2016-08-08 09:56:00"
},
{
"event_id": 28,
"event_value": 1,
"event_time": "2016-08-08 12:00:00"
},
{
"event_id": 29,
"event_value": 1,
"event_time": "2016-08-08 10:58:00"
},
{
"event_id": 30,
"event_value": 0,
"event_time": "2016-08-08 11:00:00"
}
]
}
GET /devices/{deviceId}/events_device
Returns all the events, segments and schedules belongs to the device.
The id of the device the timed events are in
successful operation
Response Example (200 OK)
{
"device_id": 8446,
"schedule_ids": [
{
"schedule_name": "TE-SCH1",
"schedule_repeat": 8,
"schedule_id": 1,
"segment_ids": [
{
"segment_name": "TE-SCH1-SEG1",
"segment_start": 3,
"segment_id": 1,
"event_ids": [
{
"event_id": 23,
"event_value": 0,
"event_time": "2019-09-19 03:55:08"
},
{
"event_id": 24,
"event_value": 0,
"event_time": "2019-09-19 03:55:09"
},
{
"event_id": 93,
"event_value": 1,
"event_time": "2023-09-29 15:57:06"
}
]
},
{
"segment_name": "TE-SCH1-SEGX",
"segment_start": 5,
"segment_id": 2,
"event_ids": [
{
"event_id": 23,
"event_value": 0,
"event_time": "2019-09-19 03:55:08"
},
{
"event_id": 24,
"event_value": 0,
"event_time": "2019-09-19 03:55:09"
},
{
"event_id": 93,
"event_value": 1,
"event_time": "2023-09-29 15:57:06"
}
]
},
{
"segment_name": "TE-SCH2-SEG1",
"segment_start": 6,
"segment_id": 3,
"event_ids": [
{
"event_id": 23,
"event_value": 0,
"event_time": "2019-09-19 03:55:08"
},
{
"event_id": 24,
"event_value": 0,
"event_time": "2019-09-19 03:55:09"
},
{
"event_id": 93,
"event_value": 1,
"event_time": "2023-09-29 15:57:06"
}
]
}
]
},
{
"schedule_name": "TE-SCH2",
"schedule_repeat": 8,
"schedule_id": 2,
"segment_ids": [
{
"segment_name": "TE-SCH1-SEGX",
"segment_start": 1,
"segment_id": 2,
"event_ids": [
{
"event_id": 23,
"event_value": 0,
"event_time": "2019-09-19 03:55:08"
},
{
"event_id": 24,
"event_value": 0,
"event_time": "2019-09-19 03:55:09"
},
{
"event_id": 93,
"event_value": 1,
"event_time": "2023-09-29 15:57:06"
}
]
},
{
"segment_name": "TE-SCH2-SEG1",
"segment_start": 3,
"segment_id": 3,
"event_ids": [
{
"event_id": 23,
"event_value": 0,
"event_time": "2019-09-19 03:55:08"
},
{
"event_id": 24,
"event_value": 0,
"event_time": "2019-09-19 03:55:09"
},
{
"event_id": 93,
"event_value": 1,
"event_time": "2023-09-29 15:57:06"
}
]
},
{
"segment_name": "TE-SCH2-SEG2",
"segment_start": 5,
"segment_id": 4,
"event_ids": [
{
"event_id": 23,
"event_value": 0,
"event_time": "2019-09-19 03:55:08"
},
{
"event_id": 24,
"event_value": 0,
"event_time": "2019-09-19 03:55:09"
},
{
"event_id": 93,
"event_value": 1,
"event_time": "2023-09-29 15:57:06"
}
]
}
]
}
]
}
PUT /devices/{deviceId}/event_single
Update a single AutoFlex event.
The id of the device the timed events are in
The segment id of the event belongs to
The event id
The event value(0/1)
The event time, format is hh:mm:ss.
successful operation
Response Example (200 OK)
{
"Message": "Event Updated.",
"Update": {
"segment_id": 1,
"event_id": 23,
"event_value": 0,
"event_time": "2019-09-19 03:55:08"
}
}
POST /devices/{deviceId}/event_single
Create a single AutoFlex event.
The id of the device the timed events are in
The segment id of the event belongs to
The event value(0/1)
The event time, format is hh:mm:ss.
successful operation
Response Example (200 OK)
{
"Message": "Event Created.",
"Create": {
"segment_id": 8,
"event_id": 163,
"event_value": 0,
"event_time": "2019-09-19 03:55:08"
}
}
DELETE /devices/{deviceId}/event_single
Delete a single AutoFlex event.
The id of the device the timed event is in
The segment id of the event belongs to
The event id to be deleted.
successful operation
Response Example (200 OK)
{
"Message": "Event Deleted.",
"Delete": {
"segment_id": 1,
"event_id": 23,
"event_value": 1,
"event_time": "2023-12-19 03:55:30"
}
}
GET /devices/{deviceId}/segment_single
Get a single AutoFlex timed event segment which is added to a schedule.
The id of the device the timed event segment is in
The schedule id of the schedule which contains this segment
The segment id of a single segment
successful operation
Response Example (200 OK)
{
"message": "Segment Details fetched successfully.",
"settings": {
"device_id": 8751,
"schedule_id": 5,
"segment_id": 3,
"segment_name": Seg test 1,
"segment_start": 1
}
}
GET /devices/{deviceId}/segments_all
Get all AutoFlex timed event segments. Note that all the segments are retreived in this endpoint which may or maynot be added to the schedules.
The id of the device the timed event segment is in
successful operation
Response Example (200 OK)
[
{
"segment_id": 2,
"segment_name": Seg relay 1,
"seg_module_type": 2
},
{
"segment_id": 7,
"segment_name": Seg variable 1,
"seg_module_type": 3
},
{
"segment_id": 2,
"segment_name": Seg Follow Lux 1,
"seg_module_type": 13
},
{
"segment_id": 10,
"segment_name": Seg 2,
"seg_module_type": 2
}
]
PUT /devices/{deviceId}/segment_single
Update one AutoFlex timed event segment name.
The id of the device the timed event segment is in
The segment id of the segment.
The name of the segment.
successful operation
Response Example (200 OK)
{
"message": "Segment Name Updated successfully",
"settings": {
"segment_id": 5,
"segment_name": Seg variable 1
}
}
PUT /devices/{deviceId}/tie_schedule_segment
Update one AutoFlex timed event segment which is added to a schedule. You can update the starting day of every segment which is configured in a schedule. Also, note that same segment can be re-used with a different start day.
The id of the device the timed event segment is in
The segment id of the segment.
The schedule id of the schedule in which the segment is added.
The new start day of the segment.
The old/existing start day of the segment.
successful operation
Response Example (200 OK)
{
"message": "Segment Start Day Updated successfully",
"settings": {
"schedule_id": 3,
"segment_id": 5,
"segment_start": 11
}
}
POST /devices/{deviceId}/segment_single
Create a new AutoFlex timed event segment. Note that all new segments are independent from the schedules. Which means one has to add the segments separately using other endpoints.
Note: The segment id will auto-increment.
The name of the segment
Select the following Module type for the segment:
Relay: 2
Variable: 3
Follow Lux (Light DOL-16 (0-1000lx)): 13
successful operation
Response Example (200 OK)
{
"message": "New Segment Inserted Successfully",
"settings": {
"segment_id": 5,
"segment_name": "Seg relay 1",
"segment_module_type": 2
}
}
POST /devices/{deviceId}/tie_schedule_segment
Add an AutoFlex timed event segment to an existing schedule. One can specify the segment start days as per the requirement.
Note that the module type of the segment should be same as that of the schedule.
Schedule id of the schedule
Segment id of the segment to be added
Start Day for the segment
successful operation
Response Example (200 OK)
{
"message": "Schedule and Segment Tied Successfully",
"settings": {
"schedule_id": 3,
"segment_id": 5,
"segment_start": 15,
"schedule_module_type": 2
}
}
DELETE /devices/{deviceId}/segment_single
Delete single segment.
Note that the segment should be independent of any schedule before deletion.
Segment id of the segment to be deleted
successful operation
Response Example (200 OK)
{
"message": "Segment Details Deleted Successfully",
}
DELETE /devices/{deviceId}/tie_schedule_segment
Delete segment from schedule.
Schedule id of the schedule from where the segment would be deleted
Segment id of the segment to be deleted from schedule
Segment start day of the particular segment which is to be deleted from the schedule
successful operation
Response Example (200 OK)
{
"message": "Segment with this Start day is Successfully Deleted from Schedule Successfully!",
}
GET /devices/{deviceId}/light_all_schedules
Get all the Schedules data, including segments and events, from a device
The id of the device that has Schedules data
Successful operation
Response Example (200 OK)
[
[
{
"schedule_id": 1,
"schedule_name": "timed_events_schedule",
"schedule_type": 1,
"sched_repeat_day": 31,
"output_module": 6,
"output_port": 1,
"output_module_desc": "M6O1-timed",
"input_module": 0,
"input_port": 0,
"input_module_type": 0
"input_module_desc": ""
"schedule_current_day": 10
"segments": [
{
"segment_id": "1",
"segment_name": "segment 1",
"segment_start": "1",
"events": [
{
"event_id": 12,
"event_value": 1,
"event_time": "2016-08-08 12:00:00"
},
{
"event_id": 13,
"event_value": 0,
"event_time": "2016-08-08 14:00:00"
}
]
},
{
"segment_id": "2",
"segment_name": "segment 20",
"segment_start": "20",
"events": [
{
"event_id": 15,
"event_value": 1,
"event_time": "2016-08-08 06:00:00"
},
{
"event_id": 16,
"event_value": 0,
"event_time": "2016-08-08 17:00:00"
}
]
}
]
},
{
"schedule_id": 1,
"schedule_name": "timed_events_schedule",
"schedule_type": 1,
"sched_repeat_day": 31,
"output_module": 5,
"output_port": 2,
"output_module_desc": "M5O2-timed",
"input_module": 0,
"input_port": 0,
"input_module_type": 0
"input_module_desc": ""
"schedule_current_day": 21
"segments": [
{
"segment_id": "1",
"segment_name": "segment 1",
"segment_start": "1",
"events": [
{
"event_id": 12,
"event_value": 1,
"event_time": "2016-08-08 12:00:00"
},
{
"event_id": 13,
"event_value": 0,
"event_time": "2016-08-08 14:00:00"
}
]
},
{
"segment_id": "2",
"segment_name": "segment 20",
"segment_start": "20",
"events": [
{
"event_id": 15,
"event_value": 1,
"event_time": "2016-08-08 06:00:00"
},
{
"event_id": 16,
"event_value": 0,
"event_time": "2016-08-08 17:00:00"
}
]
}
]
}
],
[
{
"schedule_id": 15,
"schedule_name": "variable schedule",
"schedule_type": 100,
"sched_repeat_day": 31,
"output_module": 1,
"output_port": 1,
"output_module_desc": "M1O1-follow-lux-schedule",
"input_module": 2,
"input_port": 1,
"input_module_type": 21
"input_module_desc": "M2O1-timev-100"
"schedule_current_day": 8
"segments": []
}
]
]
GET /devices/{deviceId}/single_schedule
Get a Schedule by its id
The id of the device where the Schedule is located
The id of the Schedule
Successful operation
Response Example (200 OK)
{
"schedule_id": 1,
"schedule_name": "timed_events_schedule",
"schedule_type": 1,
"sched_repeat_day": 31,
"segments": [
{
"segment_id": "1",
"segment_name": "segment 1",
"segment_start": "1",
"events": [
{
"event_id": 12,
"event_value": 1,
"event_time": "2016-08-08 12:00:00"
},
{
"event_id": 13,
"event_value": 0,
"event_time": "2016-08-08 14:00:00"
}
]
},
{
"segment_id": "2",
"segment_name": "segment 20",
"segment_start": "20",
"events": [
{
"event_id": 15,
"event_value": 1,
"event_time": "2016-08-08 06:00:00"
},
{
"event_id": 16,
"event_value": 0,
"event_time": "2016-08-08 17:00:00"
}
]
}
]
}
POST /devices/{deviceId}/create_schedule
Create a new Schedule
The id of the device
The name of a new Schedule
The repeating day of a new Schedule. The Schedule will start over this day
The type of the Schedule must be one of the following numbers:
1 - "Relay Schedule"
100 - "Variable Schedule"
1000 - "0-1000 Schedule"
Successful operation
Response Example (200 OK)
{
"Message": "The Schedule is created successfully",
"schedule_id": "13"
}
POST /devices/{deviceId}/single_schedule
Update a Schedule name and/or repeating day
The id of the device
The id of the Schedule
The name of the Schedule
The repeating day of the Schedule. The Schedule will start over this day
Successful operation
Response Example (200 OK)
{
"Message": "The Schedule is updated successfully"
}
POST /devices/{deviceId}/single_schedule_set_module
Set a Schedule module and port, and current day
The id of the device
The id of the Schedule
The id of the module the Schedule will be tied to
The id of the port the Schedule will be tied to. The new port must have a function that is compatible with a Schedule type:
Schedule Type Id | Schedule Type | Module Type | Port Function |
---|---|---|---|
1 | Relay | 2, 8 | "Timed Events" |
100 | Variable | 3, 4 | "Follow Lux" (with "Light DOL-16 (0-100 lx)" input) or "Timed Events" |
1000 | 0-1000 | 3, 4 | "Follow Lux" (with "Light DOL-16 (0-1000 lx)" input) |
The Schedule current day. It has to be less than the Repeat Day
Successful operation
Response Example (200 OK)
{
"Message": "The Schedule is updated successfully"
}
POST /devices/{deviceId}/single_schedule_module
Update a Schedule module and/or port, and/or current day
The id of the device
The id of the Schedule
The id of the old module the Schedule is tied to
The id of the old port the Schedule is tied to
The id of the module the Schedule will be tied to
The id of the port the Schedule will be tied to. The new port must have a function that is compatible with a Schedule type:
Schedule Type Id | Schedule Type | Module Type | Port Function |
---|---|---|---|
1 | Relay | 2, 8 | "Timed Events" |
100 | Variable | 3, 4 | "Follow Lux" (with "Light DOL-16 (0-100 lx)" input) or "Timed Events" |
1000 | 0-1000 | 3, 4 | "Follow Lux" (with "Light DOL-16 (0-1000 lx)" input) |
A new Schedule current day. It has to be less than the Repeat Day
Successful operation
Response Example (200 OK)
{
"Message": "The Schedule is updated successfully"
}
DELETE /devices/{deviceId}/single_schedule
Delete the Schedule
The id of the device
The id of the Schedule
Successful operation
Response Example (200 OK)
{
"Message": "The Schedule is deleted successfully"
}
POST /devices/{deviceId}/ramp_test
Test Ramp for Variable Follow Lux
The id of the device
The ramp test mode,
1: ramp down to 0 lux;
2: ramp up to 100 or 1000 lux which depends on
hardware.
The target module.
The target port.
Successful operation
Response Example (200 OK)
{
"Message": "Ramp test command issued successfully."
}
POST /devices/{deviceId}/auto_cali
Automatic Calibration for Follow Lux Variables
The id of the device
The target module.
The target port.
Successful operation
Response Example (200 OK)
{
"Message": "Automatic calibration command issued successfully."
}
POST /devices/{deviceId}/man_cali
Manual Calibration for Follow Lux VAC/VDC and Timed VAC
The id of the device
The target module.
The target port.
Successful operation
Response Example (200 OK)
{
"Message": "Manual calibration command issued successfully."
}
Configuration
Configuration is a quick overview of the hardware available inside of one device.
AutoFlex Modules
module_type | Description |
---|---|
1 | IN4 - Input module |
2 | RM4 - Relay output module |
3 | VDC4 - Variable DC output module |
4 | VAC1 - Variable AC output module |
5 | ACT1 - Actuator output module |
8 | RM2 - Relay with current output module |
9 | VCMDC1 - Variable chimney fan output module |
10 | LD2 - Loop drive output module |
11 | LS4 - Loop sense input module for chaindisk |
12 | ACT1T - Time Feedback Actuator Module |
GET /devices/{deviceId}/configuration
Returns all smart modules' configured inputs and outputs.
successful operation
No configuration found
Response Example (200 OK)
{
"device_id": "645",
"module_num": "2",
"io_num": "1",
"group_id": "17042",
"name": "Module 2 Output 1",
"module_type": "2",
"io_type": "temperature",
"current_reading": "20.1",
"alarm_code": "1",
"alarm_time": "2022-02-22 22:22:22",
"version_number": "1.02",
"reading_time": "2022-02-22 22:22:22"
}
Output
AutoFlex Outputs
Output Types
Module type 2, 3, 4 and 8
io_type | Description |
---|---|
1 | Cooling |
2 | Heating |
3 | Cooling duty cycle |
4 | Heating duty cycle |
5 | Timed events |
6 | Trigger relay |
7 | Follow variable |
8 | Follow relay |
9 | Heat mat 1k temperature probe |
10 | Heat mat 3k temperature probe |
11 | Heat mat 5k temperature probe |
12 | Misting and fogging |
13 | Follow lux sensor |
14 | Air curtain blower |
io_type | Description |
---|---|
1 | Potentiometer feedback |
2 | No feedback - time |
5 | Chaindisk |
6 | Timed feedback |
io_type | Description |
---|---|
1 | Feedback |
2 | No feedback |
Output Types
Module type 2
IO Number | Reading |
---|---|
All IOs | 0=open
1=closed |
IO number | Reading |
---|---|
All IOs | 0-100% |
IO number | Reading |
---|---|
1 | 0-100% |
2 | °C - If output type 9-11 |
3 | Amps |
IO number | Output type | Reading |
---|---|---|
1 | 1,6 | 0-100% |
1 | 2,5 | 0=Idle
1=Opening 2=Closing |
IO Number | Reading |
---|---|
1,2 | 0=open
1=closed |
3,4 | Amperage |
GET /devices/{deviceId}/outputs
Returns all outputs for one device.
The id of the device the outputs are in
Start date-time of the input history
End date-time of the input history
successful operation
No outputs found
Response Example (200 OK)
{
"device_id": "645",
"module_num": "2",
"io_num": "1",
"group_id": "17042",
"name": "Module 2 Output 1",
"module_type": "2",
"io_type": "1",
"current_reading": "20.1",
"alarm_code": "1",
"alarm_time": "2022-02-22 22:22:22",
"version_number": "1.02",
"reading_time": "2022-02-22 22:22:22",
"values": [
{
"reading": "23",
"time": "2019-11-25 20:20:00"
}
]
}
GET /devices/{deviceId}/outputs/settings
Returns output settings for one output.
The id of the device the outputs are in
The module number of the output you want to retrieve
The io number of the output you want to retrieve
successful operation
No outputs found
Response Example (200 OK)
{
"message": "Success",
"fixed stage settings": [
{
"setpoint": "23"
}
],
"variable output settings": [
{
"setpoint": "21",
"idle_setpoint": "23",
"idle_speed": "50",
"differential_setpoint": "26"
}
],
"Inlet no feedback settings": [
{
"setpoint": "20",
"idle_band": "3",
"open_runtime": "180",
"open_idle_time": "240",
"close_runtime": "120",
"close_idle_time": "300"
}
],
"Inlet With Feedback Settings": [
{
"minimum": {
"setpoint": "20",
"position": "5"
},
"stage1": {
"setpoint": "20",
"position": "10",
"differential_setpoint": "21"
},
"stage2": {
"setpoint": "22",
"position": "20",
"differential_setpoint": "23"
},
"stage3": {
"setpoint": "23",
"position": "30",
"differential_setpoint": "24"
},
"stage4": {
"setpoint": "24",
"position": "40",
"differential_setpoint": "25"
},
"stage5": {
"setpoint": "25",
"position": "50",
"differential_setpoint": "26"
}
}
]
"Misting Order output settings": [
{
"misting_function": "1",
"misting_order": "3",
}
]
"Timed Event/Follow Lux output settings": [
{
"schedule_id": "8",
"schedule_current_day": "3",
}
]
}
POST /devices/{deviceId}/outputs/settings
Sets output settings for one output.
The module number of the output you want to retrieve
The io number of the output you want to retrieve
Please see Output Settings Schema for appropriate settings to send
Only used for setting following misting/soaking functions:-
Disabled Relay = 0 (misting_order = 0)
Misters = 1 (misting_order = 2 to 15)
Pumps = 2 (misting_order = 16)
Fans = 3 (misting_order = 16)
The order of the various functions set according to the misting_function
successful operation
No outputs found
Missing post data
Response Example (200 OK)
{
"message": "Success",
"fixed stage settings": [
{
"setpoint": "23"
}
],
"variable output settings": [
{
"setpoint": "21",
"idle_setpoint": "23",
"idle_speed": "50",
"differential_setpoint": "26"
}
],
"Inlet no feedback settings": [
{
"setpoint": "20",
"idle_band": "3",
"open_runtime": "180",
"open_idle_time": "240",
"close_runtime": "120",
"close_idle_time": "300"
}
],
"Inlet With Feedback Settings": [
{
"minimum": {
"setpoint": "20",
"position": "5"
},
"stage1": {
"setpoint": "20",
"position": "10",
"differential_setpoint": "21"
},
"stage2": {
"setpoint": "22",
"position": "20",
"differential_setpoint": "23"
},
"stage3": {
"setpoint": "23",
"position": "30",
"differential_setpoint": "24"
},
"stage4": {
"setpoint": "24",
"position": "40",
"differential_setpoint": "25"
},
"stage5": {
"setpoint": "25",
"position": "50",
"differential_setpoint": "26"
}
}
]
"Misting Order output settings": [
{
"misting_function": "1",
"misting_order": "3",
}
]
}
POST /devices/{deviceId}/outputs/manual_override
Returns output settings for one output.
The module number of the output you want to retrieve
The io number of the output you want to retrieve
Either 1 or 0. 1 enables override, 0 disables override.
The value that will be used when overriding. Only used if enabled is 1.
The length of the override in seconds. 0 duration means it will not leave override. Default: 0
successful operation
No outputs found
Missing post data
Input
AutoFlex Inputs
io_type | unit |
---|---|
temperature | °C |
humidity | % |
co2 | PPM |
static_pressure | wc |
nh3 | PPM |
wind_speed | km/h |
wind_direction | azimuth degrees |
digital_input | boolean(on/off) |
rain_sensor | boolean(rain/no rain) |
pulse_counter | pulse/min |
light | lux |
barometric_pressure | hPa |
GET /devices/{deviceId}/inputs
Returns all Inputs of a device and their recording history.
The id of the device the inputs are in
Start date-time of the input history
End date-time of the input history
successful operation
Response Example (200 OK)
{
"name": "Temp input",
"io_num": "1",
"module_number": "3",
"io_type": "temperature",
"values": [
{
"reading": "23",
"time": "2019-11-25 20:20:00"
}
]
}
Refresh
Used to refresh expired Access Keys.
Code | Description |
---|---|
0 | New key issued |
1 | Key still valid |
2 | Missing post data |
3 | Access token recieved instead of refresh token |
POST /refresh
Steps to get a new access token using the active Refresh Token:
To refresh the token once the access token has expired, one can send the POST request at URL:
https://api.phason.ca/refresh in a client such as POSTMAN or Thunder
Client CLI to create a new set of tokens.
The following parameters would be necessary for the request to work:
- The expired Access Token is required in Bearer Token column.
-
The client_id, secret and the current Refresh
Token is required in the body column of the request.
Client ID access key is attached to
Associated client secret
Refresh token associated with access key used to authenticate
successful operation
Missing post data
Response Example (200 OK)
{
"message": "New key issued",
"code": "0",
"expiry": "1647032643",
"access_key": "acccess_key",
"refresh_token": "refresh_token"
}
Response Example (200 OK)
{
"message": "Key Still Valid",
"code": "0",
"expiry": "1647032643",
"access_key": "acccess_key",
"refresh_token": "refresh_token"
}
Schema Definitions
Device: object
- device_id: integer
- device_name: string
- host_name: string
- device_type: string
- version: string
- last_reported_on: timestamp
Example
{
"device_id": "5555",
"device_name": "My AFX 2",
"host_name": "AutoFlex-3AA2AA",
"device_type": "AutoFlex Connect"
"version": "3.08.01"
"last_reported_on": "2024-07-23 05:55:55"
}
Room: object
- room_id: integer
- room_name: string
Example
{
"room_id": "1217",
"room_name": "First Room"
}
Equipment Group: object
- group_id: integer
- room_id: integer
- group_type: integer
- group_type_description: string
- group_name: string
- current_reading: double
- alarm_code: integer
- alarm_time: integer
- target_value: integer
- target_lower_limit: object
- target_upper_limit: double
- reading_time: string
Example
{
"group_id": "12402",
"room_id": "1217",
"group_type": "1",
"group_type_description": "temperature",
"group_name": "Group 1",
"current_reading": "21.4",
"alarm_code": "0",
"alarm_time": "0",
"target_value": "0",
"target_lower_limit": "0",
"target_upper_limit": "5",
"reading_time": "2022-05-04 09:50:12"
}
Equipment Group Settings: object
- message: string
- settings: object[]
-
object - setting_num: number
- settings_name: number
- master_setpoint: number
Example
{
"message": "Success",
"settings": [
{
"setting_num": 1,
"settings_name": "Room settings mode 1",
"master_setpoint": 23.4
}
]
}
Misting Group: object
- group_id: integer
- room_id: integer
- function_mode: integer
- active: integer
- active_start_time: integer
- active_end_time: integer
- cycle_duration: integer
- min_misting_duration: integer
- max_misting_duration: integer
- soak_duration: integer
- min_cycle_duration: integer
- max_cycle_duration: integer
- low_temp: integer
- high_temp: integer
- max_temp: integer
- pump_delay: integer
- humidity_bypass_active: integer
- humidity_setpt: integer
- humidity_module_num: integer
- humidity_io_num: integer
- low_thi: integer
- high_thi: integer
- max_thi: integer
- entered_by: string
Example
{
"group_id": "12402",
"room_id": "1217",
"function_mode": "0",
"active": "0",
"active_start_time": "0",
"active_end_time": "82800",
"cycle_duration": "1980",
"min_misting_duration": "60",
"max_misting_duration": "120",
"soak_duration": "180",
"min_cycle_duration": "2940",
"max_cycle_duration": "3900",
"low_temp": "20",
"high_temp": "26.7",
"max_temp": "32.2",
"pump_delay": "10",
"humidity_bypass_active": "0",
"humidity_setpt": "80",
"humidity_module_num": "10",
"humidity_io_num": "1",
"low_thi": "68",
"high_thi": "72",
"max_thi": "78",
"entered_by": "Jon Doe"
}
Misting Group Settings: object
- message: string
- settings: object[]
-
object - settings_num: integer
- function_mode: integer
- active: integer
- active_start_time: integer
- active_end_time: integer
- cycle_duration: integer
- min_misting_duration: integer
- max_misting_duration: integer
- soak_duration: integer
- min_cycle_duration: integer
- max_cycle_duration: integer
- low_temp: integer
- high_temp: integer
- max_temp: integer
- pump_delay: integer
- humidity_bypass_active: integer
- humidity_setpt: integer
- low_thi: integer
- high_thi: integer
- max_thi: integer
Example
{
"message": "Success",
"settings": [
{
"settings_num": 0,
"function_mode": 0,
"active": 0,
"active_start_time": 0,
"active_end_time": 0,
"cycle_duration": 0,
"min_mist_duration": 0,
"max_mist_duration": 0,
"soak_duration": 0,
"min_cycle_duration": 0,
"max_cycle_duration": 0,
"low_temp": 0,
"high_temp": 0,
"max_temp": 0,
"pump_delay": 0,
"humidity_bypass_active": 0,
"humidity_setpt": 0
"low_thi": 0
"high_thi": 0
"max_thi": 0
}
]
}
Time: object
- datetime: datetime
- timezone: string
Example
{
"datetime": "2022-05-23 09:54:23",
"timezone": "America/Chicago"
}
Segment: object
- segment_id: integer
- segment_name: string
- segment_start: integer
- segment_module_type: integer
- events: array
Example
{
"segment_id": "1",
"segment_name": "segment 1",
"segment_start": "1",
"segment_module_type": "2",
"events": [
{
"event_id": 12,
"event_value": 1,
"event_time": "2016-08-08 12:00:00"
},
{
"event_id": 13,
"event_value": 0,
"event_time": "2016-08-08 14:00:00"
}
]
},
{
"segment_id": "2",
"segment_name": "segment 5",
"segment_start": "20",
"segment_module_type": "3",
"events": [
{
"event_id": 15,
"event_value": 1,
"event_time": "2016-08-08 06:00:00"
},
{
"event_id": 16,
"event_value": 0,
"event_time": "2016-08-08 17:00:00"
}
]
}
Schedule: object
- schedule_id: integer
- schedule_name: string
- schedule_type: integer
- sched_repeat_day: integer
- segments: array
Example
{
"schedule_id": 1,
"schedule_name": "timed_events_schedule",
"schedule_type": 1,
"sched_repeat_day": 31,
"segments": [
{
"segment_id": "1",
"segment_name": "segment 1",
"segment_start": "1",
"events": [
{
"event_id": 12,
"event_value": 1,
"event_time": "2016-08-08 12:00:00"
},
{
"event_id": 13,
"event_value": 0,
"event_time": "2016-08-08 14:00:00"
}
]
},
{
"segment_id": "2",
"segment_name": "segment 20",
"segment_start": "20",
"events": [
{
"event_id": 15,
"event_value": 1,
"event_time": "2016-08-08 06:00:00"
},
{
"event_id": 16,
"event_value": 0,
"event_time": "2016-08-08 17:00:00"
}
]
}
]
}
Configuration: object
- device_id: integer
- module_num: integer
- io_num: integer
- group_id: integer
- name: string
- module_type: integer
- io_type: integer
- current_reading: double
- alarm_code: integer
- alarm_time: timestamp
- version_number: string
- reading_time: timestamp
Example
{
"device_id": "645",
"module_num": "2",
"io_num": "1",
"group_id": "17042",
"name": "Module 2 Output 1",
"module_type": "2",
"io_type": "1",
"current_reading": "20.1",
"alarm_code": "1",
"alarm_time": "2022-02-22 22:22:22",
"version_number": "1.02",
"reading_time": "2022-02-22 22:22:22"
}
Output: object
- device_id: integer
- module_num: integer
- io_num: integer
- group_id: integer
- name: string
- module_type: integer
- io_type: integer
- current_reading: double
- alarm_code: integer
- alarm_time: timestamp
- version_number: string
- reading_time: timestamp
- values: object[]
-
object - reading: number
- time: string
Example
{
"device_id": "645",
"module_num": "2",
"io_num": "1",
"group_id": "17042",
"name": "Module 2 Output 1",
"module_type": "2",
"io_type": "1",
"current_reading": "20.1",
"alarm_code": "1",
"alarm_time": "2022-02-22 22:22:22",
"version_number": "1.02",
"reading_time": "2022-02-22 22:22:22",
"values": [
{
"reading": "23",
"time": "2019-11-25 20:20:00"
}
]
}
Output Settings: object
- message: string
- fixed stage settings: object[]
-
object - setpoint: number
- variable output settings: object[]
-
object - setpoint: number
- idle_setpoint: number
- idle_speed: number
- differential_setpoint: number
- Inlet no feedback settings: object[]
-
object - setpoint: number
- idle_band: number
- open_runtime: number
- open_idle_time: number
- close_runtime: number
- close_idle_time: number
- Inlet With Feedback Settings: object[]
-
object - minimum: object
-
- setpoint: number
- position: number
- stage1: object
-
- setpoint: number
- position: number
- differential_setpoint: number
- stage2: object
-
- setpoint: number
- position: number
- differential_setpoint: number
- stage3: object
-
- setpoint: number
- position: number
- differential_setpoint: number
- stage4: object
-
- setpoint: number
- position: number
- differential_setpoint: number
- stage5: object
-
- setpoint: number
- position: number
- differential_setpoint: number
- Misting Order output settings: object[]
-
object - misting_function: number
- misting_order: number
Example
{
"message": "Success",
"fixed stage settings": [
{
"setpoint": "23"
}
],
"variable output settings": [
{
"setpoint": "21",
"idle_setpoint": "23",
"idle_speed": "50",
"differential_setpoint": "26"
}
],
"Inlet no feedback settings": [
{
"setpoint": "20",
"idle_band": "3",
"open_runtime": "180",
"open_idle_time": "240",
"close_runtime": "120",
"close_idle_time": "300"
}
],
"Inlet With Feedback Settings": [
{
"minimum": {
"setpoint": "20",
"position": "5"
},
"stage1": {
"setpoint": "20",
"position": "10",
"differential_setpoint": "21"
},
"stage2": {
"setpoint": "22",
"position": "20",
"differential_setpoint": "23"
},
"stage3": {
"setpoint": "23",
"position": "30",
"differential_setpoint": "24"
},
"stage4": {
"setpoint": "24",
"position": "40",
"differential_setpoint": "25"
},
"stage5": {
"setpoint": "25",
"position": "50",
"differential_setpoint": "26"
}
}
]
"Misting Order output settings": [
{
"misting_function": "1",
"misting_order": "3",
}
]
}
Input: object
- name: string
- io_num: integer (int64)
- module_number: integer (int64)
- io_type: string
- values: object[]
-
object - reading: number
- time: string
Example
{
"name": "Temp input",
"io_num": "1",
"module_number": "3",
"io_type": "temperature",
"values": [
{
"reading": "23",
"time": "2019-11-25 20:20:00"
}
]
}