---
title: "HPD2 IP"
canonical: "https://docs.cuesystem.com/space/CVCDD/1814593539/HPD2%20IP"
format: markdown
---
> Macro (toc)

---

# Description

The Steinel HPD2 IP is a high-precision sensor that detects the presence and number of people in indoor spaces using optical technology. The sensor allows you to set up to 10 separate zones and count people in each zone. The sensor also measures temperature, illumination, and humidity. It is used for smart building applications such as lighting control, energy management, and room or desk reservation systems.

The HPD2IP driver (version 3) is designed to read data from the Steinel HPD2 IP sensor via an HTTP client channel on CUE units. It integrates presence, people count information, temperature, and humidity into the CUE control system. Communication is via HTTPS on standard port 443.

Function and value names are derived from the original names used in the sensor's JSON and API.

![image-20250618-090122.png](media://47087bf8-8e48-42ca-b6ac-7476b35b82b2)


# Resources

[https://www.steinel.de/en/group/sensors/smart-space-sensors/hpd-2-3/](https://www.steinel.de/en/group/sensors/smart-space-sensors/hpd-2-3/) 

Driver is available on CUE cloud: *Steinel_Sensor_HPD2IP_Http_Client_3.xx.cvcd*

![image-20250619-120250.png](media://cd38db49-214f-4cb3-9962-92af835ae843)


# Properties

|  |  |  |  |
| --- | --- | --- | --- |
| Property name | Data type | Default value | Description |
| IpAddress | Text | "10.0.0.1" | Sensor IP address (IPv4) |
| Password | Text | ““ | User (recommended) or admin password to access the sensor admin web |
| AnswerTimeOut | Time | :10.0 | Timeout for communication with the sensor |
| PoolingEnabled | Boolean | True | Enables or disables periodic reading of data from the sensor. When set to True, the system regularly polls the sensor for updated values. After successfully reading sensor data via polling, the OnUpdate event is raised. |
| PoolingTimeout | Time | :30.0 | Pooling period, also used as cache timeout. Sensor data is cached to reduce unnecessary communication. If the cached data is newer than the pooling period, it is used instead of reading from the sensor. Otherwise, fresh data is retrieved and the cache is updated. |


# Functions

## GetDetectedPersons

This function returns the total number of detected persons. 

#### Syntax

```
GetDetectedPersons() As Long
```

#### Return value

<u>[Long](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long)</u> total number of detected persons

#### Example

```
Var Persons As Long
Persons := SensorHPD2Alpha.GetDetectedPersons() //number of persons is written to variable Persons
```


## GetDetectedPersonsZone

This function returns the number of detected persons in the zone. 

#### Syntax

```
GetDetectedPersonsZone(zone As Long) As Long
```

#### Parameters

zone

<u>[Long](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long)</u> number of zone, 1 - 10

#### Return value

<u>[Long](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long)</u> number of detected persons in the selected zone

#### Example

```
Var Persons As Long
Persons := SensorHPD2Alpha.GetDetectedPersonsZone(3) //number of persons in zone 3 is written to variable Persons
```


## GetGlobalIlluminanceLux

This function returns luxes measured from whole picture or from zones union if there are any zone defined.

#### Syntax

```
GetGlobalIlluminanceLux() As Long
```

#### Return value

<u>[Long](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long)</u> luxes measured from whole picture or from zones union if there are any zone defined

#### Example

```
Var L As Long
L := SensorHPD2Alpha.GetGlobalIlluminanceLux() //global illuminance in lux is written to variable L
```


## GetGlobalLightValue

This function returns average brightness in frame.

#### Syntax

```
GetGlobalLightValue() As Long
```

#### Return value

<u>[Long](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long)</u> average brightness in frame in range 0 - 255

#### Example

```
Var B As Long
B := SensorHPD2Alpha.GetGlobalLightValue() //average brightness in frame is written to variable B
```


## GetHumidity

This function returns the measured humidity in percent.

#### Syntax

```none
GetHumidity() As Double
```

#### Return value

<u>[Double](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/495058958/Data+types#Double)</u> measured humidity in percent

#### Example

```none
Var H As Double
H := SensorHPD2Alpha.GetHumidity() //humidity is written to variable H
```


## GetLastUpdateOK

Returns True if the last data read from the sensor was successful and the “final” element in the received JSON from the sensor had the value “OK”.

#### Syntax

```
GetLastUpdateOK() As Boolean
```

#### Return value

<u>[Boolean](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> True, if the last reading of data from the sensor was OK or False if an error occurs.

#### Example

```none
Var Persons As Long
Persons := SensorHPD2Alpha.GetDetectedPersons()
If SensorHPD2Alpha.GetLastUpdateOK() Then 
  //the data from the sensor is fine, here actions can be performed based on this data
End If
```


## GetLuxZone

This function returns the illuminance level measured in the selected zone.

#### Syntax

```
GetLuxZone(zone As Long) As Long
```

#### Parameters

zone

<u>[Long](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long)</u> number of zone, 1 - 10

#### Return value

<u>[Long](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long)</u> illuminance level in selected zone

#### Example

```
Var L As Long
L := SensorHPD2Alpha.GetLuxZone(5) //illuminance in zone 5 is written to variable L
```


## GetPersonPresence

The function returns whether the sensor detects any persons. 

#### Syntax

```
GetPersonPresence() As Boolean
```

#### Return value

<u>[Boolean](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> True if any persons are detected, False if no persons are detected

#### Example

```
Var RoomOccupied As Boolean
RoomOccupied := SensorHPD2Alpha.GetPersonPresence() //person presence is written to variable RoomOccupied
```


## GetPersonPresenceZone

The function returns whether the sensor detects any persons in selected zone

#### Syntax

```
GetPersonPresenceZone(zone As Long) As Boolean
```

#### Parameters

zone

<u>[Long](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long)</u> number of zone, 1 - 10

#### Return value

<u>[Boolean](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> True if any persons are detected in selected zone, False if no persons are detected

#### Example

```
Var Zone2Occupied As Boolean
Zone2Occupied := SensorHPD2Alpha.GetPersonPresenceZone(2) //person presence in zone 2 is written to variable Zone2Occupied
```


## GetTemperature

This function returns the measured temperature. The temperature unit (Celsius/Fahrenheit) can be configured in the sensor admin web.

#### Syntax

```none
GetTemperature() As Double
```

#### Return value

<u>[Double](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/495058958/Data+types#Double)</u> measured temperature

#### Example

```none
Var T As Double
T := SensorHPD2Alpha.GetTemperature() //temperature is written to variable T
```


## SetCommunication

This function sets the IP communication parameters if you don't want to use the parameters set in the Properties, or you need to change them.

#### Syntax

```
SetCommunication(newipaddress As Text, newpassword As Text, newanswertimeout As Time := :10.0) As Boolean
```

#### Parameters

newipaddress

<u>[Text](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u> IP address (IPv4) of the sensor

newpassword

<u>[Text](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/495058958/Data+types#Text)</u> user (recommended) or admin password to access the sensor admin web

newanswertimeout

<u>[Time](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/495058958/Data+types#Time)</u> Optional, defaults to :10.0. Timeout for communication with sensor.

#### Return value

<u>[Boolean](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> True on success or False if an error occurs.

#### Example

```
SensorHPD2Alpha.SetCommunication("192.168.1.42", "superstr0ngp4ssw0rd")
```

 

## SetPooling

This function enables or disables periodic sensor data reading (pooling). After successfully reading sensor data via polling, the OnUpdate event is raised.

#### Syntax

```
SetPooling(newpoolingenabled As Boolean, newpoolingtimeout As Time) As Boolean
```

#### Parameters

newpoolingenabled

<u>[Boolean](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> True to enable pooling, or False to disable it 

newpoolingtimeout

<u>[Time](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/495058958/Data+types#Time)</u>  pooling period, also used as cache timeout. See description of [property ](/wiki/spaces/CVCDD/pages/1814593539/HPD2+IP#Properties)PoolingTimeout. If the entered value is shorter than 1 second, it is set to 1 second.

#### Return value

<u>[Boolean](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> True on success or False if an error occurs.

#### Example

```
SensorHPD2Alpha.SetPooling(True, 0:20.0)
//enables pooling in sensor SensorHPD2Alpha with period 20 seconds, cache timeout will also be 20 seconds

SensorHPD2Beta.SetPooling(False, 0:5.0)
//disables pooling in sensor SensorHPD2Beta and sets cache timeout to 5 seconds
```

 

## GetPooling

The function allows you to retrieve the current polling settings.

#### Syntax

```
GetPooling(ByRef isenabled As Boolean, ByRef timeout As Time)
```

#### Parameters

newpoolingenabled

<u>[Boolean](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> <u><span style="color: #0747a6">ByRef</span></u> True if pooling enabled, or False if disabled 

timeout

<u>[Time](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/495058958/Data+types#Time)</u>  <u><span style="color: #0747a6">ByRef</span></u> current pooling period /cache timeout. See description of [property ](/wiki/spaces/CVCDD/pages/1814593539/HPD2+IP#Properties)PoolingTimeout. 

#### Example

```
PoolingEnabled As Boolean
PoolingPeriod As Time
SensorHPD2Alpha.GetPooling(PoolingEnabled, PoolingPeriod)
//in variable PoolingEnabled is stored whether pooling is enabled
//current pooling period/cache timeout is written to variable PoolingPeriod
```


## GetSensorState

This function reads the state of the whole sensor data and stores it in a variable **state **of the **SensorStateStructure **type.

#### Syntax

```
GetSensorState(ByRef state As Namespace "CUE.Device.Steinel_Sensor_HPD2IP_Http_Client.3".SensorStateStructure) As Boolean
```

#### Parameters

state

<span style="color: #4c9aff">SensorStateStructure</span>: this structure describes the state of the whole STEINEL HPD2IP sensor and is described below.

#### Return value

<u>[Boolean](https://cue.atlassian.net/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> True on success or False if an error occurs.

#### Example

```
Var S As Namespace "CUE.Device.Steinel_Sensor_HPD2IP_Http_Client.3".SensorStateStructure
Var PeopleTotal As Long
Var PeopleZone1 As Long
Var PeopleZone2 As Long
Var Temperature As Double
SensorHPD2Alpha.GetSensorState(S)
PeopleTotal := S.DetectedPersons        //total number of persons is written to variable PeopleTotal
PeopleZone1 := S.DetectedPersonsZone[1] //number of persons in zone 1 is written to variable PeopleZone1
PeopleZone2 := S.DetectedPersonsZone[2] //number of persons in zone 2 is written to variable PeopleZone2
Temperature := S.Temperature            //temperature is written to variable Temperature
```

 

# Events

## OnUpdate

This event is invoked when pooling is enabled and valid data is read from the sensor.

#### Syntax

```visualbasic
Process OnUpdate(sensorstate As Namespace "CUE.Device.Steinel_Sensor_HPD2IP_Http_Client.3".SensorStateStructure)
```

#### Parameters

sensorstate

<span style="color: #4c9aff">SensorStateStructure</span>: this structure describes the state of the whole STEINEL HPD2IP sensor and is described below.

#### Example

```none
Var PeopleTotal As Long
Var PeopleZone1 As Long
Var PeopleZone2 As Long
Var Temperature As Double

Private Process SensorHPD2Alpha_OnUpdate(sensorstate As Namespace "CUE.Device.Steinel_Sensor_HPD2IP_Http_Client.3".SensorStateStructure) Link SensorHPD2Alpha.OnUpdate
    PeopleTotal := sensorstate.DetectedPersons         //total number of persons is written to variable PeopleTotal
	PeopleZone1 := sensorstate.DetectedPersonsZone[1]  //number of persons in zone 1 is written to variable PeopleZone1
	PeopleZone2 := sensorstate.DetectedPersonsZone[2]  //number of persons in zone 2 is written to variable PeopleZone2
	Temperature := sensorstate.Temperature             //temperature is written to variable Temperature
End Process
```


# Structures

The GetSensorState function and OnUpdate event returns the **SensorStateStructure **data structure that describes the entire status of the sensor. Here is a description of this data structure. See the original STEINEL manuals for details of each item.

![image-20250619-102533.png](media://a7dd8827-1957-4d1d-9cd1-9361d6454064)

#### Declaration

```
Global Structure SensorStateStructure
	Var SensorType						As Text [32]
	Var MessageType						As Text [32]
	Var AppVersion						As Text [32]
	Var ModelName						As Text [32]
	Var IrLedOn							As Boolean
	Var DetectedPersons					As Long
	Var PersonPresence					As Boolean
	Var DetectedPersonsZone [MAX_ZONES]	As Long //MAX_ZONES := 10
	Var PersonPresenceZone [MAX_ZONES]	As Boolean
	Var DetectionZonesPresent			As Long
	Var GlobalIlluminanceLux			As Long
	Var LuxZone [MAX_ZONES]				As Long
	Var GlobalLightValue				As Long
	Var Temperature						As Double
	Var Humidity						As Double
	Var LastUpdateOK					As Boolean //*
	Var LastUpdateUTCTime				As Time
End Structure
```

`* `If the sensor returned the value "OK" in the JSON element "final"  during data reading, LastUpdateOK is set to True; otherwise, it is set to False. The available documentation does not specify what other values the "final" element might contain; it is likely used to indicate internal errors or sensor fault states.

#### Example

Note: The declaration of a data variable with this structure must be referenced by the **Namespace "CUE.Device.Steinel_Sensor_HPD2IP_Http_Client.3".SensorStateStructure** in the main program and modules.

```
Var S As Namespace "CUE.Device.Steinel_Sensor_HPD2IP_Http_Client.3".SensorStateStructure
Var PeopleTotal As Long
Var PeopleZone1 As Long
Var PeopleZone2 As Long
Var Temperature As Double
SensorHPD2Alpha.GetSensorState(S)
PeopleTotal := S.DetectedPersons        //total number of persons is written to variable PeopleTotal
PeopleZone1 := S.DetectedPersonsZone[1] //number of persons in zone 1 is written to variable PeopleZone1
PeopleZone2 := S.DetectedPersonsZone[2] //number of persons in zone 2 is written to variable PeopleZone2
Temperature := S.Temperature            //temperature is written to variable Temperature
```