How can we help?
Print

Categories:

OpenAPI

Power Control Module API

PowerSchedule Attributes

UPDATED

The PowerSchedule attributes enable you to add, modify, delete, and retrieve one-time or recurring run-time schedules for Pelican’s Power Control Modules (PM5 Series). This functionality allows for precise control over connected electrical equipment, optimizing energy usage and operational efficiency.

Key Features:

  • Advanced Scheduling: Supports both one-time and recurring schedules to accommodate various operational requirements.

  • Unlimited Schedules: No restriction on the number of schedules that can be added.

  • External Tracking: Schedules added through the API are tracked as “External” schedules.

Predefined system-managed attributes for Thermostat objects, used for essential functions like temperature control, system status, and scheduling. They follow a fixed structure and cannot be renamed or redefined by users.

Reserved Attributes

User Defined Attributes

Custom attributes that users can create, set, and retrieve for Thermostat objects. Any attribute name that is not reserved is treated as user-defined. These attributes are created by assigning a value via a SET request and can be accessed using GET requests. There is no restriction on the number of user-defined attributes, allowing flexibility for custom data storage and retrieval.

User-defined attributes can also be used as selection criteria. For example, if a user wants to manage a specific group of thermostats via the API, they could define an attribute named “managed” and SET its value to “yes” for the thermostats in that group. Then, by including “managed:yes;” in their selection criteria, they can filter and control only those thermostats within the designated group.

Important Considerations:

  • Overlapping Schedules: Any overlapping schedules are automatically merged to prevent conflicts.

  • Day Boundaries: Schedules cannot cross day boundaries. For schedules that need to extend beyond midnight, multiple schedules should be created.

  • Editable Attribute: The editable attribute determines whether a schedule can be modified through the Pelican App:

    • Yes: The schedule can be edited or deleted by users via the Schedule Dashboard.

    • No (default): The schedule is viewable but cannot be modified or deleted through the App.

PowerSchedule - Object Attributes

​Attribute names are not case-sensitive; attribute values are case-sensitive.​

Name Values Settable Description
name String No The configured name of the power module output.
serialNo String No The power control module serial number.
scheduleId String Yes The unique ID of this schedule (See Note 1).
title String Yes descriptive label for the schedule.
startDate String Yes The first date the schedule will run in ISO 8601 format.
endDate String Yes The last date the schedule will run in ISO 8601 format.
startTime String Yes The time of day ISO 8601 extended local time format.
endTime String Yes The time of day ISO 8601 extended local time format.
repeat String Yes The frequency the schedule will run (See Note 2).
editable Yes, No Yes Whether users can edit the schedule through the Schedule Dashboard.
origin Internal, External, All No How the schedule was created (See Note 3)
delete Yes Yes Delete the specified schedule entry.
Note 1: ScheduleID
  • scheduleID is a unique identifier for each schedule.
  • The scheduleID can either be system-generated or user-provided.
  • If not specified when adding a new schedule, the system will automatically generate a unique scheduleID and return it in the response.
  • To modify an existing schedule, include the scheduleID in the request, and the provided attributes will be updated.
  • To delete a schedule, specify its scheduleID in the selection and set delete=Yes.

Note 2: Repeat

The repeat attribute determines how frequently a schedule runs.

Valid values:

  • None (Default) – Runs only once on the specified startDate.
  • Daily – Runs every day from startDate to endDate. If endDate is not specified, it continues indefinitely.
  • Weekly (Mo,Tu,We,Th,Fr,Sa,Su) – Runs on specific days of the week.
    • Days must be comma-separated and enclosed in parentheses.
    • Example: repeat=Weekly(Mo,We,Fr) (schedule runs every Monday, Wednesday, and Friday).
    • At least the first two letters of each day must be included.
  • Monthly – Runs once per month on the same day as startDate.
  • Yearly – Runs once per year on the same day as startDate.

Note 3: Origin

The origin attribute specifies whether a schedule was created through the API (External) or through the Pelican App (Internal).
  • When used in a GET request as a selection attribute, it filters returned schedules.
  • Default value: External (returns only API-created schedules).
  • Retrievable in a value list to determine how a schedule was created.
  • Only “External” schedules can be created via the API. However, both Internal and External schedules can be modified or deleted through the API.

Code Examples

GET

Get the current Temperature, Humidity, and CO2 Level for a thermostat named "Lobby"

				
					curl -Ls "https://demo.officeclimatecontrol.net/api.cgi?username=pelicandemosite@gmail.com&password=pelican&request=get&object=Thermostat&selection=name:Lobby;&value=temperature;humidity;co2Level"
				
			
				
					#!/usr/bin/perl -w

use strict;
use ClimateControl;
# You can request a copy of the ClimateControl Perl
# Module from Pelican Tech Support.
# Send an email to support@pelicanwireless.com

# Create a new ClimateControl object
my $cc = ClimateControl->new(
    'pelicandemosite@gmail.com',      # username
    'pelican',                        # password
    'demo.officeclimatecontrol.net'  # website
);

# Define the selection and attributes to retrieve
my $selection = { 'name' => 'Lobby' };
my $attrlist = ['temperature', 'humidity', 'co2Level'];

# Call getAttributes to retrieve the Thermostat data
my $result = $cc->getAttributes('Thermostat', $selection, $attrlist);

# Check and display the result
if ($result->{'success'}) {
    print "Success: $result->{'message'}\n";
} else {
    print "Error: $result->{'message'}\n";
}
				
			
				
					import requests

url = "https://demo.officeclimatecontrol.net/api.cgi?username=pelicandemosite@gmail.com&password=pelican&request=get&object=Thermostat&selection=name:Lobby;&value=temperature;humidity;co2Level"
response = requests.get(url, verify=False)

if response.status_code == 200:
    print("Success:", response.text)
else:
    print("Error:", response.status_code)
				
			
				
					const https = require('https');

const url = 'https://demo.officeclimatecontrol.net/api.cgi?username=pelicandemosite@gmail.com&password=pelican&request=get&object=Thermostat&selection=name:Lobby;&value=temperature;humidity;co2Level';

https.get(url, { rejectUnauthorized: false }, (resp) => {
  let data = '';

  // Collect data chunks
  resp.on('data', (chunk) => {
    data += chunk;
  });

  // Handle the complete response
  resp.on('end', () => {
    if (resp.statusCode === 200) {
      console.log('Success:', data);
    } else {
      console.log('Error: HTTP', resp.statusCode);
    }
  });
}).on('error', (err) => {
  console.error('Error:', err.message);
});
				
			

Response

				
					<result>
<Thermostat>
<temperature>71.5</temperature>
<humidity>40</humidity>
<co2Level>1049</co2Level>
...
</Thermostat>
<success>1</success>
<message>Retrieved attributes for 1 thermostats.</message>
...
</result>
				
			

SET

Set the Heating and Cooling Ranges for the thermostat named "Lobby"

				
					curl -Ls "https://demo.officeclimatecontrol.net/api.cgi?username=pelicandemosite@gmail.com&password=pelican&request=set&object=Thermostat&selection=name:Lobby;&value=heatMin:50;heatMax:68;coolMin:72;coolMax:85"
				
			
				
					#!/usr/bin/perl -w

use strict;
use ClimateControl;
# You can request a copy of the ClimateControl Perl
# Module from Pelican Tech Support.
# Send an email to support@pelicanwireless.com

# Create a new ClimateControl object
my $cc = ClimateControl->new(
    'pelicandemosite@gmail.com',      # username
    'pelican',                        # password
    'demo.officeclimatecontrol.net'  # website
);

# Define the selection and values as hashes
my $selection = { 'name' => 'Lobby' };
my $values = {
    'heatMin' => '50',
    'heatMax' => '68',
    'coolMin' => '72',
    'coolMax' => '85'
};

# Call setAttributes to update the Thermostat
my $result = $cc->setAttributes('Thermostat', $selection, $values);

# Check and display the result
if ($result->{'success'}) {
    print "Success: $result->{'message'}\n";
} else {
    print "Error: $result->{'message'}\n";
}
				
			
				
					import requests

url = "https://demo.officeclimatecontrol.net/api.cgi?username=pelicandemosite@gmail.com&password=pelican&request=set&object=Thermostat&selection=name:Lobby;&value=heatMin:50;heatMax:68;coolMin:72;coolMax:85"
response = requests.get(url, verify=False)

if response.status_code == 200:
    print("Success:", response.text)
else:
    print("Error:", response.status_code)
				
			
				
					const https = require('https');

const url = 'https://demo.officeclimatecontrol.net/api.cgi?username=pelicandemosite@gmail.com&password=pelican&request=set&object=Thermostat&selection=name:Lobby;&value=heatMin:50;heatMax:68;coolMin:72;coolMax:85';

https.get(url, { rejectUnauthorized: false }, (resp) => {
  let data = '';

  // Collect data chunks
  resp.on('data', (chunk) => {
    data += chunk;
  });

  // Handle the complete response
  resp.on('end', () => {
    if (resp.statusCode === 200) {
      console.log('Success:', data);
    } else {
      console.log('Error: HTTP', resp.statusCode);
    }
  });
}).on('error', (err) => {
  console.error('Error:', err.message);
});
				
			

Response

				
					<result>
<success>1</success>
<message>Updated 1 thermostats.</message>
...
</result>
				
			
Table of Contents