Skip to content
Image of Reolink Camera API - PTZ - AI - Intercom
Template

Reolink Camera API - PTZ - AI - Intercom

by IlluminateLife - Smarte Haustechnik GmbHNo rating yet52 downloads

Content languageEnglish

Description

Verified on real hardware, not transcribed from the vendor documentation. Every command was executed against an E1 Outdoor Pro and its effect confirmed on the device — with one exception: SET EMAIL V20 was checked for structure and acceptance only, because a write to the e-mail configuration cannot be undone. Where firmware and documentation disagree, these templates follow the firmware, and the comment on the command says why.


What is included

  • reolink.Loxone — project fragment. Everything below, pre-wired, including the Intercom device.
  • VO_Reolink_API-PTZ_AI_Intercom.xml — Virtual Output, 26 commands.
  • VI_Reolink_API-PTZ_AI_Intercom_MdState.xml — Virtual Input HTTP, 1 input for motion detection.
  • VI_Reolink_API-PTZ_AI_Intercom_AiState.xml — Virtual Input HTTP, 4 inputs for AI object detection.

Take the .Loxone file if you want everything at once, or the XML templates if you want to add individual pieces to an existing configuration. The inputs are split across two files because a Virtual Input HTTP template holds exactly one URL and one polling interval.


Outputs


Light and sound

  • WHITE LED ON/OFF — spotlight, manual mode, brightness 100
  • IR AUTO/OFF — infrared illuminator, Auto (camera decides) or Off
  • SIREN ON/OFF — siren, continuous
  • SIREN PULSE 2x — siren, two pulses (pulse output)
  • SIREN ON MOTION ON/OFF — siren triggered by the camera’s own motion detection, 24/7 schedule

Recording and notifications

  • REC ON/OFF — recording to the microSD card
  • PUSH ALL ON/OFF — push notifications, all alarm types
  • PUSH PEOPLE ON/OFF — push notifications, persons only
  • PUSH VEHICLE ON/OFF — push notifications, vehicles only
  • PUSH ANIMALS ON/OFF — push notifications, animals only
  • PUSH MOTION ON/OFF — push notifications, motion detection only
  • SET EMAIL V20 — e-mail notification on/off, including SMTP server, sender and recipient

AI and system

  • AI AUTO TRACKING ON/OFF — master switch for the camera’s AI auto-tracking
  • REBOOT — restart, pulse output. Measured: the camera answers again after about 51 seconds

PTZ — 12 outputs

  • PTZ POS ANALOG — analog output. Move to a preset, the value is the preset number. Details below
  • PTZ PAN LEFT and PTZ PAN RIGHT — pan, jog control: On = move, Off = stop
  • PTZ TILT UP and PTZ TILT DOWN — tilt, jog control
  • PTZ ZOOM IN and PTZ ZOOM OUT — optical zoom, jog control
  • PTZ AUTO PAN ON/OFF — continuous pan, Off stops it
  • PTZ STOP — emergency stop for every axis, zoom and auto pan (pulse output)
  • PTZ GUARD ON/OFF — store the current position as the guard position and enable the automatic return
  • PTZ GUARD GOTO — move to the stored guard position (pulse output)
  • PTZ CALIBRATE — self-calibration of the mechanics (pulse output)


Inputs


From VI_Reolink_API-PTZ_AI_Intercom_MdState.xml:

  • MOTION — 1 while motion is detected


From VI_Reolink_API-PTZ_AI_Intercom_AiState.xml:

  • AI PEOPLE — 1 while a person is detected
  • AI VEHICLE — 1 while a vehicle is detected
  • AI ANIMAL — 1 while an animal is detected
  • AI FACE — 1 while a face is detected. See the note below

Both templates poll every 10 seconds, the shortest interval Loxone allows.

What that means in practice, measured on the device: a detection stays at 1 for as long as the camera sees something, in tests between 6 and 27 seconds. Presence of roughly 10 seconds or more is therefore caught reliably, while a single shorter event is caught with a probability of about its duration divided by ten. If you need every short event, polling is not the right tool — use the Baichuan push channel through the reolink_aio library as middleware, or the webhook function of the RLC models.

MOTION and AI PEOPLE are independent signals, not two views of the same one: in measurements MOTION stayed at 1 while AI PEOPLE had already dropped back to 0. Do not treat one as a substitute for the other.

AI FACE is included for cameras that support face detection. The E1 Outdoor Pro and the RLC-820A both report support 0 for it, so on those models the input stays at 0 permanently.


PTZ in detail


Jog control

PTZ PAN LEFT/RIGHT, PTZ TILT UP/DOWN, PTZ ZOOM IN/OUT and PTZ AUTO PAN send the movement command on the On branch and Stop on the Off branch. Wired to a push button in Loxone Config, the camera moves for exactly as long as the button is held — no timer, no repeat rate needed.

There is no speed parameter. The E1 Outdoor Pro reports supportPtzSpeed as ver 0, so a speed value would be accepted and ignored. It is left out rather than sent uselessly.

PTZ ZOOM IN really is zoom in. Measured on the device: the command ZoomInc raises zoom.pos from 0 to 27. The vendor documentation describes ZoomInc as zoom out and contradicts its own naming.


PTZ POS ANALOG — moving to presets

This is the one output for preset navigation, and it is analog, not digital. The analog value is the preset number.

Loxone substitutes the value inside the POST body as well, as an integer without decimals — verified in Loxone Config. The body that goes out is:

[{"cmd": "PtzCtrl", "action": 0, "param": {"channel": 0, "op": "ToPos", "id": <v>}}]

Send 3 to the output and the camera moves to preset 3. Three ways to wire it:

  1. One button per position. A constant or formula block per preset, triggered by a push button, all feeding the same output. This is the usual case and needs no analog control in the app.
  2. Selection in the app. An analog memory block or a slider, so the user picks the view directly.
  3. Automation. Any analog source: a time switch that sends 1 at sunrise and 2 at dusk, a presence signal that sends 3, an alarm that sends 4.

Where the preset numbers come from: create the presets in the Reolink app, then read their numbers by opening this URL in a browser:

http://<camera>/cgi-bin/api.cgi?cmd=GetPtzPreset&channel=0&user=<user>&password=<password>
Watch out for preset 0. If Loxone treats the analog value 0 as Off it sends the Off branch, which is deliberately empty — preset 0 would then be unreachable through this output. Keep your presets numbered from 1 upwards.


Guard position

PTZ GUARD ON/OFF stores the position the camera is looking at right now as the guard position and enables the automatic return to it. PTZ GUARD GOTO drives there on demand.

One-way door: once a guard position is stored the camera keeps it permanently, across reboots. The API accepts a request to clear it with code 0 and then ignores it. Only the automatic return can be switched off again, not the stored position itself. Aim the camera where you want it before you switch this on the first time.


No position feedback

The firmware has no GetPtzCurPos. There is no way to read back where the camera is pointing, which has one practical consequence: after any manual movement, the only way back to a known view is a preset or the guard position. Build your logic so that every movement ends in a defined position.

PTZ CALIBRATE is worth knowing about for the same reason. It is rarely needed — after a power failure, or when presets are no longer hit accurately — and it drives the mechanics to its end stops without returning. Always send PTZ POS ANALOG afterwards. The camera takes about 15 seconds to answer, which is harmless in Loxone because the template does not wait for the response.


Cameras without pan and tilt

The 12 PTZ outputs and AI AUTO TRACKING need pan/tilt hardware. On a fixed camera such as the RLC-820A they are accepted with rspCode 200 and do nothing — that model reports ptzCtrl and aiTrack as ver 0. Before using them on any other model, query GetAbility for ptzCtrl, ptzPreset and aiTrack.


Setup


1. Prepare the camera

  • Enable HTTP. Camera settings, Network Settings, Advanced Settings, Port Settings. Depending on model and firmware this is off by default; if the camera does not answer, this is the first thing to check.
  • Create a dedicated account for the Miniserver instead of reusing the one from the app. Note that Reolink only knows two levels, guest and admin, and that every Set command fails for a guest — so this account needs admin level. Give it its own password anyway, so it can be revoked on its own.
  • Choose the password carefully. Only A-Z a-z 0-9 - _ and dot, 6 to 31 characters. The password travels in the query string and Loxone does not URL-encode it reliably. A password containing a percent sign fails to authenticate — verified on the device, both encoded and raw.
  • Mind the lockout. Ten failed logins lock the account for 300 seconds. A polling input with a wrong password reaches that in under two minutes.


2. Replace the placeholders before importing

Do this in the file, in a text editor — not afterwards in Loxone Config. The credentials appear 47 times in the Virtual Output alone, and editing 26 commands by hand is where mistakes happen.

  • __RL_HOST__ — camera IP or hostname, without http://. Non-standard port: append it, for example 192.168.1.50:8000. Sits in the address of the Virtual Output and of both Virtual Inputs.
  • __RL_USER__ — camera account. Sits in the query string of every command.
  • __RL_PASS__ — its password. Sits in the query string of every command.
  • __SMTP_HOST__ — SMTP server. Used by SET EMAIL V20 only.
  • __SMTP_USER__ — sender address, max. 127 characters. SET EMAIL V20 only.
  • __SMTP_PASS__ — SMTP password, max. 31 characters. SET EMAIL V20 only.
  • __MAIL_TO__ — recipient address, max. 127 characters. SET EMAIL V20 only.

On Windows, with Notepad++ or any editor that can replace across a whole file: Search, Replace, Replace All, once per placeholder. Keep the file encoding as it is — save as UTF-8 with BOM and do not let the editor convert the line endings to LF. Loxone Config reads the file either way, but an editor that cleans up the encoding can break the template.

On macOS and Linux:

sed -e "s|__RL_HOST__|192.168.1.50|g" \
    -e "s|__RL_USER__|loxone|g" \
    -e "s|__RL_PASS__|YourPassword|g" \
    VO_Reolink_API-PTZ_AI_Intercom.xml > VO_Reolink_local.xml

Delete the local copy once it has been imported. The credentials then live in the Miniserver configuration and nowhere else.

If you do not use SET EMAIL V20, delete that command rather than filling in the SMTP placeholders. Writing an e-mail configuration to the camera is a one-way operation: GetEmailV20 never returns the password, so the previous setting cannot be read out and restored. Write your existing settings down before you send it.


3. Import

The .Loxone file: open it in Loxone Config, select the objects, and copy them into your own project. Everything arrives pre-wired, including the Intercom device.

The XML templates: copy them into the template folders of your Loxone Config installation.

  • The Virtual Output goes into Loxone Config\Templates\VirtualOut\
  • Both Virtual Inputs go into Loxone Config\Templates\VirtualIn\

Restart Loxone Config and insert the template from the list. The list shows the template’s title only, which is why the version number is part of the title.


4. Test one command before wiring the rest

Trigger a single harmless output — IR AUTO/OFF is a good choice — and check that the camera reacts. If it does not, the cause is almost always HTTP still being disabled, a typo in the credentials, or a percent sign in the password. Fix that before the account locks itself.


Intercom: the camera as a door station

The camera’s Snap command returns a single JPEG over plain HTTP, which is exactly what the Loxone Intercom expects. A Reolink camera can therefore serve as the door camera with no additional software. The .Loxone file already contains a fully configured Userdefined Intercom — the placeholders are the only thing left to replace.

The URL pattern:

http://__RL_HOST__/cgi-bin/api.cgi?cmd=Snap&channel=0&user=__RL_USER__&password=__RL_PASS__&width=1280&height=720

Where it goes in the Intercom object:

  • Image when ringing — the internal URL
  • Video stream internal — the internal URL
  • Video stream external — the external URL, see below

The parameters:

  • __RL_HOST__ — camera IP or hostname. Non-standard HTTP port: append it, for example 192.168.1.50:8000
  • cmd=Snap — returns one JPEG
  • channel=0 — channel number, 0 on single-channel cameras
  • user and password — the same camera account as in the templates
  • width and height — output size in pixels. The camera scales the image; 1280x720 is a good compromise between sharpness and load. Leave both parameters out for the camera’s native resolution
  • rs — optional random string. It defeats caching; add it if the image ever appears frozen

Internal, filled in:

http://__RL_HOST__/cgi-bin/api.cgi?cmd=Snap&channel=0&user=__RL_USER__&password=__RL_PASS__&width=1280&height=720

External, two ways — pick one. With Loxone Remote Connect, use the literal host name remoteConnect. The connection then runs through Remote Connect and no port forwarding is needed:

http://remoteConnect/cgi-bin/api.cgi?cmd=Snap&channel=0&user=__RL_USER__&password=__RL_PASS__&width=1280&height=720

With Reolink CloudDNS or your own DDNS, replace the host with the DDNS name and add the forwarded port. This requires a port forwarding rule on the router:

http://yourname.reolink.com:8000/cgi-bin/api.cgi?cmd=Snap&channel=0&user=__RL_USER__&password=__RL_PASS__&width=1280&height=720
One security note, because it is easy to overlook: this URL carries the camera password in clear text. It is stored in the Miniserver configuration, and over HTTP it travels unencrypted on every request. Use a dedicated camera account, keep the cameras in their own VLAN without internet access, and prefer Remote Connect over a port forwarding rule that exposes the camera itself to the internet.


Notes and limitations

Things that cost time to find out, so that they do not have to be found out twice:

  • HTTP only. The cameras ship without a certificate, and the API can read certificate information and clear it but not upload one, so HTTPS is not usable out of the box. Every request carries the password in the clear. The separate VLAN is the actual protection here, not a nice-to-have.
  • Query-string authentication only. Token login exists but is broken on this firmware: Login returns code 0 and a token with a 3600-second lease, and every request made with that token is then rejected with “please login first”.
  • A guest account cannot write. Every Set command fails for a guest, and Reolink has no third permission level between guest and admin.
  • rspCode 200 is not a confirmation. On this firmware it only means the request was syntactically accepted. Verify anything that matters with the matching Get command.
  • AI AUTO TRACKING sends two fields on purpose. aiTrack alone is acknowledged and then discarded while bSmartTrack is still 1; the switch in the Reolink app sets both together too. Object types and track priorities are deliberately not sent, so what you configured in the app stays untouched.
  • The alarm mode “manul” is intentional. The vendor documentation prints “manu”, which the firmware rejects. The typo is the working spelling — do not correct it.
  • PTZ speed and PTZ patrol are deliberately absent. supportPtzSpeed, ptzPatrol and ptzTattern all report ver 0 on the E1 Outdoor Pro, so those parameters would have no effect.


Credits

Built on the vendor’s Camera HTTP API User Guide V8 (April 2023) and on the template “Reolink API + Intercom” by Manuel Campei, which served as the starting point. Rebuilt, corrected and verified command by command against real hardware.


Submitted by illuminateLife – Smarte Haustechnik GmbH.

Inputs and outputs · 2

NameTypeUnit
WHITE LED ON/OFFVirtualOut
SIREN PULSE 2xVirtualOut

FAQ

No questions have been answered yet.

Ratings and comments

No ratings or comments yet.

Questions and answers

No questions have been asked yet.

Report this entry

Report abuse

You have to be logged in to report an entry. Log in