Pipe Clip

Developers Manual SKU: CLPWIE01
Version: 1.1

1. Pipe-Clip

The Smart-Pipe-Clip is a compact, clip-like clamp that can be easily attached to any water pipe with a diameter between 15 and 32 mm. The device offers three functions:

The device is powered by two AAA batteries and transmits the collected data and any alarms via Wi-Fi to the preferred app or smart home platform. Alternatively, it can be operated with an external 3V power supply.

In addition to Wi-Fi, the claw can also communicate via LoRa or LoRaWAN. Normally, communication with the user takes place via Wi-Fi. In case of an alarm, a previously paired Aqua-Scope shut-off motor (for ball valves or angle seat valves) can be directly controlled by the device via LoRa. This allows a response to water leaks even if the communication network is unavailable. Since the monitoring of the water pipe, as well as the pairing and control of the motor, occurs without the need for a wireless connection, such a system can also function completely offline without an internet connection.

With a special button sequence, the sensor can be switched to LoRaWAN mode, allowing it to transmit data over the standardized LoRaWAN wide-area network as a Class A device. This mode requires LoRaWAN network coverage at the installation site.


2. JSON Cloud Interface

By default, the devices communicate directly with the Aqua-Scope Cloud via an IP connection. The data is encoded as a JSON object and then encrypted using the XXTEA encryption algorithm with a private key stored in the device. The encrypted data is transmitted as ASCII hexadecimal values in the POST field of an HTTP request. In the data field of the HTTP request, the downlink data is also sent as a JSON object and encrypted using XXTEA.

The very same JSON encoding is used for the MQTT and the JSON Webservice interface. The following downlink commands are understood by the devices as JSON objects:

Downlink Command: 'conf': {a:b,c:d}

Changing configuration parameter 'a' resp. 'c' to the value of 'b' resp 'd'. A maximum of 32 parameters can be changed simultaneously. The parameters are modified in the order they are specified. For the explanation of the parameters and its values please refer to the section 'Configuration parameters' in this manual.


3. Local Web Server

HTTPD Dienst

The local web server of Aqua-Scope WLAN devices is active by default on Port 80 (HTTP service) and can be used for the initial configuration of WLAN, among other functions. Once the WLAN interface is successfully configured, the web server is deactivated. However, it can be reactivated from any communication channel. The web server allows for enabling and disabling, as well as configuring other communication channels like MQTT or JSON web service. It also provides easy access to the current sensor values of the device. Accessing the web server when the device is in sleep mode is challenging as there is a very limited time available for querying or setting values.

The web server interface is self-explanatory.


4. JSON-Web-Service

To use this communication channel, you need an HTTP server with a communication endpoint to which the device can send its data in JSON format via the POST field. The communication options are defined in the Aqua-Scope Cloud Interface description.

If encryption via XXTEA (https://en.wikipedia.org/wiki/XXTEA) is chosen, you must have a device-specific 128-bit encryption key. This key is securely embedded in the device and cannot be extracted or read. You can obtain this key directly from Aqua-Scope upon request, providing the 8-byte ID. The 8 bytes of the ID follow the format specified by Aqua-Scope.

AA BB BB BB CC CC CC CC

When no encryption is selected, data transmission occurs as an HTML POST with a content type of 'application/json.' With encryption, 'application/raw' is used, and the JSON object is encrypted with XXTEA and then encoded as HEX ASCII.

The transmitted JSON object corresponds to the Aqua-Scope Cloud Interface description. As a response or command to the device, a downlink object can be sent in the HTTP text, the format of which also complies with the Aqua-Scope Cloud Interface.

The transmission of sensor raw data (using the 'arr' object) must be explicitly enabled, for example, in the app. This data is generally not encrypted.

The following small example demonstrates the reception of a JSON object from the Aqua-Scope device, exemplified as PHP code.

If you have any further questions or need assistance with anything specific, feel free to ask.

require_once __DIR__ . 'xxtea-php.php'; 
// from https://github.com/xxtea/xxtea-php

#define EID 060000001
#define KEY 06000000123456780600000012345678


error_reporting(0);
$json  = json_decode(file_get_contents('php://input'), true);
if(!$json) {
	$key = hex2bin(KEY);	
	$jd = xxtea_decrypt(base64_decode(file_get_contents('php://input')),$key);
	$json  = json_decode(jd, true);
	if(!$json) die(”wrong key or wrong id”);
}
var_dump($json); 

5. MQTT Service

All data (except for the raw data from the main sensor) can be sent in parallel to both the JSON web service and the Aqua-Scope Cloud to an MQTT broker. During initial setup or later in the Aqua-Scope App (Menu 'Info' -> Scroll Down to End -> Button 'Debug') the MQTT service can be activated and MQTT server name, Server Port and optionally username and password must be provided. The following topics apply ('12345678' stands for your 8 digit device ID):

The MQTT services uses JSON notation. The values for uplink commands and downlink sensor values are identical to the JSON service(Example turn the vale on {'valve': '100'}).


6. Bluetooth Low Energy

The Bluetooth interface of Aqua-Scope WLAN devices is active by default and is used for the initial configuration of WLAN through the Aqua-Scope app. Once the WLAN interface is successfully configured, the Bluetooth interface is deactivated. However, it can be reactivated from any communication channel. Please note that reactivating the Bluetooth interface on battery-operated devices will block their sleep mode and quickly deplete the battery.

The Bluetooth interface implements the UART profile in BLE 5. It can be used with all serial Bluetooth applications. It's even more convenient when using a PC or an Android mobile phone with Bluetooth capabilities. You can open the Chrome browser, navigate to the website 'https://ble.aqua-scope.com,' and connect to the Bluetooth device 'AQS-XXXXXX' (where XX is the device's ID).

Once the Bluetooth connection is established, you have direct access to the internal serial console of the device. You can view all debug messages and execute commands, seeing their results on the console. The following commands are supported:


7. Alarms

Alarm messages send wirelessly consist of three values:

Alarm 2 (0x02): Temperature is lower then allowed

Description: The alarm is triggered if the water temperature drops below a allowable threshold specified in configuration parameter 9. The factory setting is 5 degrees Celsius.

Optional Alarm Value: Current Temperature in 1/10 degree celsius

Alarm 3 (0x03): Prolonged water usage

Description: The water flows for a very long time. The threshold is set at 15 minutes from the factory and can be adjusted in the app under 'Configuration'. The alarm is automatically cleared when the water usage stops.

Optional Alarm Value: Seconds of Water Flow

Alarm 5 (0x05): Stuck toilet

Description: A stuck toilet will not cause damage but will unnecessarily consume water. A stuck toilet creates a very characteristic usage pattern and is therefore easily recognized. The problem is usually resolved by pressing the toilet flush button. The alarm is also cleared when no sticking is detected anymore.

Optional Alarm Value: Time in Seconds between 8 events

Alarm 6 (0x06): Temperature is higher then allowed

Description: The alarm is triggered if the water temperature raises above a allowable threshold specified in configuration parameter 8. The factory setting is 5 degrees Celsius.

Optional Alarm Value: Current Temperature in 1/10 degree celsius

Alarm 7 (0x07): Dripping faucet or Leakage

Description: Any water usage above the measurement inaccuracy and below normal water usage is recognized as a dripping faucet. If the water flows minimally over a period of at least one hour, an alarm is triggered. The cause of such an alarm can also be a small leak in a water pipe (micro-leakage). Therefore, the matter should be investigated and the cause rectified.

Optional Alarm Value: debug value provided

Alarm 8 (0x08): Dripping faucet or Leakage V2

Description: Any water usage above the measurement inaccuracy and below normal water usage is recognized as a dripping faucet. If the water flows minimally over a period of at least one hour, an alarm is triggered. The cause of such an alarm can also be a small leak in a water pipe (micro-leakage). Therefore, the matter should be investigated and the cause rectified.

Optional Alarm Value: debug value provided

Alarm 12 (0x0c): Low Battery

Description: The battery is running low and needs to be replaced.

Optional Alarm Value: Battery voltage in mV


8. Configuration Parameters

This list of configuration parameters is supported by this device. All configuration parameters are 32 bit values but - with the exception of Parameter 3 only the lower 16 bits are used

Parameter 1 (0x01): System Register (Default: 0x141d = dec 5149)

The bitmap defines the general behavior of the device. Dont change the setting unless you know what you do.

Parameter 2 (0x02): Status Reporting Interval (Default: 0x00b4 = dec 180)

This parameter defines after how manyintervals (defined in parameter 4) a complete status report is sent out

Parameter 3 (0x03): Serial Number (Default: 0x0000 = dec 0)

This parameter contains a copy of the serial number as assigned in production.

Parameter 4 (0x04): Metering Interval (Default: 0x003c = dec 60)

This interval defines the seconds between measurement sequences. Lowering the value will make the measurements more accurate but increases the power consumption.

Parameter 5 (0x05): Temperature Calibration (Default: 0x03e8 = dec 1000)

This parameter enables the fine calibration of the temperature sensor. The default value is an arbitrary 1000. Lowering the value will increase the shown temperature value, Rising the temperature value will decrease the shown value.

Parameter 7 (0x07): Long Flow Detection Threshold Estimate (Default: 0x0384 = dec 900)

This threshold defines the maximum time of water flow before a 'Long water flow alarm' is issued. The default value is 900 seconds. Please be aware, that the threshold only gives an estimate of the time only.

Parameter 8 (0x08): High Temperature Threshold (Default: 0x0190 = dec 400)

In case the temperature rises above this value a "High Temperature Alarm" is issued. The alarm value is defined as 1/10 degree Celsius (150 equals 15.0 degrees Celsius). The default value is 400 = 40 degree Celsius.

Parameter 9 (0x09): Low Temperature Threshold (Default: 0x000a = dec 10)

In case the temperature drops below this value a "Low Temperature Alarm" is issued. The alarm value is defined as 1/10 degree Celsius (150 equals 15.0 degrees Celsius). The default value is 10 = 1 degree Celsius.