How can we help?
Print

Categories:

OpenAPI

Attributes

DemandResponseHistory Attributes

UPDATED

The DemandResponseHistory object attributes allow you to retrieve historical information about past Demand Response (DR) events, including their occurrence and duration. A DemandResponseHistory request must include at least the required selection attributes, specifying a starting (startDateTime) and ending (endDateTime) date/time. If no specific DemandResponseHistory object attributes are provided in the request, all attributes within the specified date range will be returned.

Predefined system-managed attributes for DemandResponseHistory 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 DemandResponseHistory 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.

DemandResponseHistory - Selection Attributes

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

Name Value Required Description
startDateTime Date/Time Yes ISO 8601 formatted date and time indicating the start of the history retrieval range.
endDateTime Date/Time Yes ISO 8601 formatted date and time indicating the end of the history retrieval range.

DemandResponseHistory - Selection Attributes

​Attribute names are not case-sensitive; attribute values are case-sensitive. As this pertains to historical information, all requests are GET only.​

Name Value Description
eventID String The unique identifier of the event.
startDateTime Date/Time ISO 8601 formatted date and time when the event started.
endDateTime Date/Time ISO 8601 formatted date and time when the event ended.
duration Integer The duration of the event in minutes.

Thermostat Demand Response Participation Information

The DemandResponseHistory object provides information about DR events at the site level but does not detail individual thermostat participation. For thermostat-specific DR information: ​
  • Active Event Status: To determine if a DR event is currently active for one or multiple thermostats, use the Thermostat object with the setback attribute.​
 
  • Historical Participation: To retrieve historical data on how long one or multiple thermostats participated in DR events, use the ThermostatHistory object with the appropriate date/time range and the setback attribute.​
 
  • Additional Historical Data: For more detailed information about the state of a thermostat before, during, and after a DR event, utilize the relevant ThermostatHistory object attributes to GET the desired historical data.​

By leveraging these attributes, you can effectively monitor and analyze Demand Response events within your Pelican system, ensuring optimal energy management and system performance.

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