Package: HTTP Extensions

Author: HCA Central
Version: 1
Added to Library: 11-Nov-23
HCAVersion needed: 17.0.46
Keywords: Utility

Package Description:
Adds extensions to the HTTP Server package

Program: Add to control time list

Program Description:
Builds a sorted list in CSV form that contains the control time for devices and programs.

The list is limited to six items and the head of the list is the most recently controlled device/program

The list is of the form <object name>,<control time>,<object name>,<control time>...

Parameters are the object name and the list

Return value: The list possibly modified with the possible addition of the supplied object

Parameters:

Name Type Description Default
ObjectName Value Name of device or program  
List Value CSV list that contains object name , control time, ...  

Program: Add to sorted name list

Program Description:
Builds a sorted list in CSV form that contains the name of a device and its friendly name

The list is sorted by the object name. This makes it easy to find the friendly name of the object if you forget what it is

The list is of the form <object name>,<friendly name>,<object name>,<friendly name>...

Parameters are the object name and the list

Return value: The list possibly modified with the addition of the supplied object

Parameters:

Name Type Description Default
ObjectName Value Name of device or program  
List Value CSV list that contains object name , friendly name, ...  

Program: Battery Level Table

Program Description:
HTTP Extension for command "battery"

Generates a HTML table showing, for all devices with a "HE_Battery" tag, what percent that tag shows

Example:
localhost/api/v1/battery

Parameters:

Name Type Description Default
op Value Operation extracted from URL  
opWithParameters Value Operation from URL with any parameters attached  

Program: Friendly Names Table

Program Description:
HTTP Extension for command "voiceNames"

Generates a HTML table of devices/programs with friendly names.

Example:
localhost/api/v1/voiceNames

Parameters:

Name Type Description Default
op Value Operation extracted from URL  
opWithParameters Value Operation from URL with any parameters attached  

Program: Recent Control Table

Program Description:
HTTP Extension for command "recentControl"

Generates a HTML table of devices/programs that were recently controlled. The list contains up to six items and is in order with the head of the list the most recently controlled.

The list is limited to devices that follow the same rules as is used in technical note #703 for finding voice controlled names. That is, they have a friendly name (and don't have the "NoHubitat" tag), or have no friendly name but have the "Hubitat" tag.

Example:
localhost/api/v1/recentControl

Parameters:

Name Type Description Default
op Value Operation extracted from URL  
opWithParameters Value Operation from URL with any parameters attached  

Program: Room State Table

Program Description:
HTTP Extension for command "roomState"

Generates a HTML table showing the state of each room in your design

Example:
localhost/api/v1/roomState

Parameters:

Name Type Description Default
op Value Operation extracted from URL  
opWithParameters Value Operation from URL with any parameters attached  

Program: Sensors Table

Program Description:
HTTP Extension for command "sensors"

Generates a HTML table showing, for all devices with a "HE_Temperature", "HE_Humidity", and "HE_Illuminance" tags

Example:
localhost/api/v1/sensors

Parameters:

Name Type Description Default
op Value Operation extracted from URL  
opWithParameters Value Operation from URL with any parameters attached  

Program: Toggle

Program Description:
HTTP Extension for command "Toggle"

Toggles a device state.

Example:
localhost/api/v1/toggle?id=<device-name>

Parameters:

Name Type Description Default
op Value Operation extracted from URL  
opWithParameters Value Operation from URL with any parameters attached  

Program: Whats On Table

Program Description:
HTTP Extension for command "whatsOn"

This is an example. If the URL op is "whatsOn", then this program generates a resultant html file with a table of all devices that are not off.

Optionally you can add to the URL the maxPercent and minPercent parameters like this:

<ipaddress>/api/v1/whatsOn?maxPercent=100&minPercent=50

With those parameters then the table contains only devices that are at between 50 and 100 percent.

Example:
localhost/api/v1/whatsOn

Parameters:

Name Type Description Default
op Value Operation extracted from URL  
opWithParameters Value Operation from URL with any parameters attached