Skip to content

Commit

Permalink
Rename Item to Object
Browse files Browse the repository at this point in the history
The API all calls these objects so best to go with the flow.

This is a breaking change.
  • Loading branch information
parnic committed Jan 5, 2025
1 parent 21d6254 commit abe9ba7
Show file tree
Hide file tree
Showing 16 changed files with 55 additions and 55 deletions.
4 changes: 2 additions & 2 deletions dist/example.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/example.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions dist/messages/configuration.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import { ICRequest } from "./request.js";
* Requests the configuration of bodies and circuits available to this controller.
*
* The response contains the list of bodies and circuits under the `answer` field.
* Each item has an `objnam` that should be used to reference that item for future requests,
* and `params`.`SNAME` is the user-entered friendly name that can be displayed for the item.
* `params`.`OBJTYP` will be either BODY or CIRCUIT depending on the item it's describing.
* Each object has an `objnam` that should be used to reference that object for future requests,
* and `params`.`SNAME` is the user-entered friendly name that can be displayed for the object.
* `params`.`OBJTYP` will be either BODY or CIRCUIT depending on the object it's describing.
*
* Some items, such as the Pool body, will have the `params`.`OBJLIST` array populated with
* a series of attached items such as a chlorinator device.
* Some objects, such as the Pool body, will have the `params`.`OBJLIST` array populated with
* a series of attached objects such as a chlorinator device.
*
* @returns the object used to issue this request
*/
Expand Down
10 changes: 5 additions & 5 deletions dist/messages/configuration.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/messages/messages.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { GetHeaters } from "./get-heater.js";
import { SubscribeToUpdates } from "./notify.js";
import { GetSchedule } from "./schedule.js";
import { SetHeatMode } from "./set-heater.js";
import { SetItemStatus } from "./set-status.js";
import { SetObjectStatus } from "./set-object-status.js";
import { SetSetpoint } from "./setpoint.js";
import { GetSystemInformation } from "./system-info.js";
export declare const messages: {
Expand All @@ -16,7 +16,7 @@ export declare const messages: {
GetSystemConfiguration: typeof GetSystemConfiguration;
GetSystemInformation: typeof GetSystemInformation;
SetHeatMode: typeof SetHeatMode;
SetItemStatus: typeof SetItemStatus;
SetObjectStatus: typeof SetObjectStatus;
SetSetpoint: typeof SetSetpoint;
SubscribeToUpdates: typeof SubscribeToUpdates;
};
4 changes: 2 additions & 2 deletions dist/messages/messages.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/messages/messages.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions dist/messages/set-object-status.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { ICRequest } from "./request.js";
/**
* Requests to change the status of objects known to this controller.
*
* Turns one or more objects on or off. Use the `objnam` of the circuit to be set.
*
* @returns the object used to issue this request
*/
export declare function SetObjectStatus(object: string | string[], status: boolean): ICRequest;

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/messages/set-object-status.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions dist/messages/set-status.d.ts

This file was deleted.

1 change: 0 additions & 1 deletion dist/messages/set-status.js.map

This file was deleted.

4 changes: 2 additions & 2 deletions example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ console.log("got response:", JSON.stringify(resp, null, 2));
// console.log("got response:", JSON.stringify(resp, null, 2));

// console.log("turning off pool...");
// resp = await unit.send(messages.SetItemStatus("B1101", false));
// resp = await unit.send(messages.SetObjectStatus("B1101", false));
// console.log("got response:", JSON.stringify(resp, null, 2));

// console.log("turning off water feature...");
// resp = await unit.send(messages.SetItemStatus("C0003", false));
// resp = await unit.send(messages.SetObjectStatus("C0003", false));
// console.log("got response:", JSON.stringify(resp, null, 2));

// console.log("sending Set Heatmode request...");
Expand Down
10 changes: 5 additions & 5 deletions messages/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import { GetRequest, ICRequest } from "./request.js";
* Requests the configuration of bodies and circuits available to this controller.
*
* The response contains the list of bodies and circuits under the `answer` field.
* Each item has an `objnam` that should be used to reference that item for future requests,
* and `params`.`SNAME` is the user-entered friendly name that can be displayed for the item.
* `params`.`OBJTYP` will be either BODY or CIRCUIT depending on the item it's describing.
* Each object has an `objnam` that should be used to reference that object for future requests,
* and `params`.`SNAME` is the user-entered friendly name that can be displayed for the object.
* `params`.`OBJTYP` will be either BODY or CIRCUIT depending on the object it's describing.
*
* Some items, such as the Pool body, will have the `params`.`OBJLIST` array populated with
* a series of attached items such as a chlorinator device.
* Some objects, such as the Pool body, will have the `params`.`OBJLIST` array populated with
* a series of attached objects such as a chlorinator device.
*
* @returns the object used to issue this request
*/
Expand Down
4 changes: 2 additions & 2 deletions messages/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { GetHeaters } from "./get-heater.js";
import { SubscribeToUpdates } from "./notify.js";
import { GetSchedule } from "./schedule.js";
import { SetHeatMode } from "./set-heater.js";
import { SetItemStatus } from "./set-status.js";
import { SetObjectStatus } from "./set-object-status.js";
import { SetSetpoint } from "./setpoint.js";
import { GetSystemInformation } from "./system-info.js";

Expand All @@ -17,7 +17,7 @@ export const messages = {
GetSystemConfiguration,
GetSystemInformation,
SetHeatMode,
SetItemStatus,
SetObjectStatus,
SetSetpoint,
SubscribeToUpdates,
};
18 changes: 9 additions & 9 deletions messages/set-status.ts → messages/set-object-status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,28 @@ import { ICParam } from "./param.js";
import { GetRequest, ICRequest, ICRequestObj } from "./request.js";

/**
* Requests to change the status of items known to this controller.
* Requests to change the status of objects known to this controller.
*
* Turns one or more items on or off. Use the `objnam` of the circuit to be set.
* Turns one or more objects on or off. Use the `objnam` of the circuit to be set.
*
* @returns the object used to issue this request
*/
export function SetItemStatus(
item: string | string[],
export function SetObjectStatus(
object: string | string[],
status: boolean,
): ICRequest {
const req = GetRequest();
req.command = "SetParamList";
req.objectList = [];

let items: string[];
if (Array.isArray(item)) {
items = item;
let objects: string[];
if (Array.isArray(object)) {
objects = object;
} else {
items = [item];
objects = [object];
}

for (const i of items) {
for (const i of objects) {
const reqObj = new ICRequestObj();
reqObj.objnam = i;
reqObj.params = new ICParam();
Expand Down

0 comments on commit abe9ba7

Please sign in to comment.