### Execute Script and Get Variables
Source: https://github.com/hobbyquaker/homematic-rega/blob/master/readme/README.header.md
Demonstrates how to execute a custom script and retrieve all variables from the Homematic CCU. Ensure the 'homematic-rega' module is installed and the host IP address is correct.
```javascript
const Rega = require('homematic-rega');
const rega = new Rega({host: '192.168.2.105'});
rega.exec('string x = "Hello";
WriteLine(x # " World!");', (err, output, objects) => {
if (err) {
throw err;
}
console.log('Output:', output);
console.log('Objects:', objects);
});
rega.getVariables((err, res) => {
console.log(res);
});
```
--------------------------------
### Get All Variables
Source: https://github.com/hobbyquaker/homematic-rega/blob/master/README.md
Retrieves all variables from the Homematic CCU. Requires the 'homematic-rega' module to be initialized.
```javascript
rega.getVariables((err, res) => {
console.log(res);
});
```
--------------------------------
### rega.startProgram(id, [callback])
Source: https://github.com/hobbyquaker/homematic-rega/blob/master/README.md
Executes a specified program on the Homematic CCU.
```APIDOC
## rega.startProgram(id, [callback])
### Description
Executes a specified program.
### Method
Not applicable (instance method)
### Endpoint
Not applicable (instance method)
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Parameters
- **id** (number) - Required - The ID of the program to start.
- **callback** (function) - Optional - Callback function to handle the result.
```
--------------------------------
### new Rega(options)
Source: https://github.com/hobbyquaker/homematic-rega/blob/master/README.md
Initializes a new Rega instance. It requires connection details for the Homematic CCU and offers options for language, authentication, and TLS.
```APIDOC
## new Rega(options)
### Description
Initializes a new Rega instance with connection options for the Homematic CCU.
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Parameters
- **options** (object) - Required - Configuration options for the Rega instance.
- **options.host** (string) - Required - Hostname or IP address of the Homematic CCU.
- **options.language** (string) - Optional - Language for translations (default: "de").
- **options.disableTranslation** (boolean) - Optional - Disable placeholder translation (default: false).
- **options.tls** (boolean) - Optional - Enable TLS connection (default: false).
- **options.inSecure** (boolean) - Optional - Ignore invalid TLS certificates (default: false).
- **options.auth** (boolean) - Optional - Enable Basic Authentication (default: false).
- **options.user** (string) - Optional - Authentication username.
- **options.pass** (string) - Optional - Authentication password.
- **options.port** (number) - Optional - REGA remote script port (default: 8181, or 48181 if tls is true).
```
--------------------------------
### rega.getPrograms(callback)
Source: https://github.com/hobbyquaker/homematic-rega/blob/master/README.md
Retrieves a list of all available programs on the Homematic CCU.
```APIDOC
## rega.getPrograms(callback)
### Description
Fetches all programs configured on the Homematic CCU.
### Method
Not applicable (instance method)
### Endpoint
Not applicable (instance method)
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Parameters
- **callback** (Rega~programsCallback) - Required - Callback function to process the program data.
```
--------------------------------
### Initialize and Execute Script
Source: https://github.com/hobbyquaker/homematic-rega/blob/master/README.md
Initializes the Rega interface with the CCU host and executes a ReGaHSS script. Handles script output and object data. Requires the 'homematic-rega' module.
```javascript
const Rega = require('homematic-rega');
const rega = new Rega({host: '192.168.2.105'});
rega.exec('string x = "Hello";\nWriteLine(x # " World!");', (err, output, objects) => {
if (err) {
throw err;
}
console.log('Output:', output);
console.log('Objects:', objects);
});
```
--------------------------------
### rega.script(file, [callback])
Source: https://github.com/hobbyquaker/homematic-rega/blob/master/README.md
Executes a Rega script from a specified file. This allows for modular script management.
```APIDOC
## rega.script(file, [callback])
### Description
Executes a Rega script from a specified file path.
### Method
Not applicable (instance method)
### Endpoint
Not applicable (instance method)
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Parameters
- **file** (string) - Required - The path to the Rega script file.
- **callback** (function) - Optional - A callback function to handle the script execution result.
```
--------------------------------
### rega.getFunctions(callback)
Source: https://github.com/hobbyquaker/homematic-rega/blob/master/README.md
Retrieves a list of all functions defined on the Homematic CCU.
```APIDOC
## rega.getFunctions(callback)
### Description
Fetches all functions from the Homematic CCU.
### Method
Not applicable (instance method)
### Endpoint
Not applicable (instance method)
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Parameters
- **callback** (Rega~functionsCallback) - Required - Callback function to process the function data.
```
--------------------------------
### rega.getRooms(callback)
Source: https://github.com/hobbyquaker/homematic-rega/blob/master/README.md
Retrieves a list of all rooms defined on the Homematic CCU.
```APIDOC
## rega.getRooms(callback)
### Description
Fetches all rooms from the Homematic CCU.
### Method
Not applicable (instance method)
### Endpoint
Not applicable (instance method)
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Parameters
- **callback** (Rega~roomsCallback) - Required - Callback function to process the room data.
```
--------------------------------
### rega.getChannels(callback)
Source: https://github.com/hobbyquaker/homematic-rega/blob/master/README.md
Retrieves a list of all devices and channels configured on the Homematic CCU.
```APIDOC
## rega.getChannels(callback)
### Description
Fetches all devices and channels from the Homematic CCU.
### Method
Not applicable (instance method)
### Endpoint
Not applicable (instance method)
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Parameters
- **callback** (Rega~channelCallback) - Required - Callback function to process the channel data.
```
--------------------------------
### rega.getVariables(callback)
Source: https://github.com/hobbyquaker/homematic-rega/blob/master/README.md
Retrieves a list of all variables defined on the Homematic CCU.
```APIDOC
## rega.getVariables(callback)
### Description
Fetches all variables from the Homematic CCU.
### Method
Not applicable (instance method)
### Endpoint
Not applicable (instance method)
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Parameters
- **callback** (Rega~variablesCallback) - Required - Callback function to process the variable data.
```
--------------------------------
### rega.getValues(callback)
Source: https://github.com/hobbyquaker/homematic-rega/blob/master/README.md
Fetches the current values for all devices and channels on the Homematic CCU.
```APIDOC
## rega.getValues(callback)
### Description
Retrieves the current values of all devices and channels.
### Method
Not applicable (instance method)
### Endpoint
Not applicable (instance method)
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Parameters
- **callback** (Rega~valuesCallback) - Required - Callback function to process the values.
```
--------------------------------
### rega.setProgram(id, active, [callback])
Source: https://github.com/hobbyquaker/homematic-rega/blob/master/README.md
Activates or deactivates a specified program on the Homematic CCU.
```APIDOC
## rega.setProgram(id, active, [callback])
### Description
Activates or deactivates a specified program.
### Method
Not applicable (instance method)
### Endpoint
Not applicable (instance method)
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Parameters
- **id** (number) - Required - The ID of the program to set.
- **active** (boolean) - Required - Whether to activate (true) or deactivate (false) the program.
- **callback** (function) - Optional - Callback function to handle the result.
```
--------------------------------
### rega.exec(script, [callback])
Source: https://github.com/hobbyquaker/homematic-rega/blob/master/README.md
Executes a given Rega script directly. This method is useful for running custom scripts on the CCU.
```APIDOC
## rega.exec(script, [callback])
### Description
Executes a Rega script provided as a string.
### Method
Not applicable (instance method)
### Endpoint
Not applicable (instance method)
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Parameters
- **script** (string) - Required - The Rega script to execute.
- **callback** (function) - Optional - A callback function to handle the script execution result.
```
--------------------------------
### rega.setName(id, name, [callback])
Source: https://github.com/hobbyquaker/homematic-rega/blob/master/README.md
Renames an existing object in the Rega system. It takes the object's ID, the new name, and an optional callback function.
```APIDOC
## rega.setName(id, name, [callback])
### Description
Renames an object using its ID and a new name. An optional callback can be provided to handle the result.
### Method
Instance method of [Rega](#Rega)
### Parameters
#### Path Parameters
- **id** (number) - Required - The ID of the object to rename.
- **name** (string) - Required - The new name for the object.
- **[callback]** (function) - Optional - A callback function to be executed after the operation.
### Parameters
#### Path Parameters
- **err** (Error) - Required - An error object if the operation failed.
- **output** (string) - Required - The output from the script execution.
- **variables** (Object.) - Required - An object containing script variables.
```
--------------------------------
### rega.setName(id, name, [callback])
Source: https://github.com/hobbyquaker/homematic-rega/blob/master/README.md
Sets the name of a specified entity (e.g., device, channel, room) on the Homematic CCU.
```APIDOC
## rega.setName(id, name, [callback])
### Description
Sets the name of a specified entity.
### Method
Not applicable (instance method)
### Endpoint
Not applicable (instance method)
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Parameters
- **id** (number) - Required - The ID of the entity to rename.
- **name** (string) - Required - The new name for the entity.
- **callback** (function) - Optional - Callback function to handle the result.
```
--------------------------------
### rega.setVariable(id, val, [callback])
Source: https://github.com/hobbyquaker/homematic-rega/blob/master/README.md
Sets the value of a specific variable on the Homematic CCU.
```APIDOC
## rega.setVariable(id, val, [callback])
### Description
Sets the value of a specified variable.
### Method
Not applicable (instance method)
### Endpoint
Not applicable (instance method)
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Parameters
- **id** (number) - Required - The ID of the variable to set.
- **val** (number | boolean | string) - Required - The new value for the variable.
- **callback** (function) - Optional - Callback function to handle the result.
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.