Skip to content

Virtual devices

A virtual device is a device on the HAM platform without hardware. Its readings come from your own system through the API, not from a HAM sensor.

After that, the virtual device works like all other devices: charts, history, rules, reports and sharing.

  • You have a sensor or a system from a different manufacturer and you want its values in the HAM app.
  • You want rules and notifications for values that your own software calculates.
Item Value
Family v (Virtual HAM). The serial number is, for example, v:123.
Readings Up to 6, with the codes u0, u1, u2, u3, u4, u5
Outputs None
Keep-alive None. The device changes only when you send values.

The app has no screen to create a virtual device. For a new virtual device, contact support.

Send a POST to virtual_device_update.php. You need admin permission on the device.

Terminal window
curl -X POST https://api.hamsystems.eu/virtual_device_update.php \
-H "Authorization: Bearer-API YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"serialno": "v:123", "R": {"u0": 2150, "u1": 48}}'
Field Content
serialno The serial number of the virtual device
R The readings, keyed by code (u0 to u5)
untime Optional. The time of the measurement in unix seconds. Without it, the server uses the current time.

The server keeps only the fields serialno, R and untime. It ignores all other fields.

The response is JSON with messages and response.

Error message Cause
Invalid arguments serialno is missing.
Invalid login The key or the token is not correct.
Access denied to device You do not have admin permission on the device.

You read the values in the same ways as for all devices:

Chat with support