Reolink PTZ preset

Hi all,
I would like to us my presets in an automation. I found this site GitHub - fwestenberg/reolink_dev: Home Assistant Reolink addon where it explains you have to use a call service to address the ptz presets. The only thing I am struggling with is that I don’t know exactly that to put in the service data field. Could someone explain it to me with an example?

Thanks!
Aaron
PS I am making the automation visually, not in yaml.

Nobody knows or is my question not formulated in the right manner? :sweat_smile:

This is what it says, but I need an example how to use that in my automation.

Service reolink_dev.ptz_control

Control the PTZ (Pan Tilt Zoom) movement of the camera.

Service data attribute Optional Description
entity_id no The camera to control.
command no The command to execute. Possibe values are: AUTO, DOWN, FOCUSDEC, FOCUSINC, LEFT, LEFTDOWN, LEFTUP, RIGHT, RIGHTDOWN, RIGHTUP, STOP, TOPOS, UP, ZOOMDEC and ZOOMINC.
preset yes In case of the command TOPOS, pass the preset ID here. The possible presets are listed as attribute on the camera.
speed yes The speed at which the camera moves. Not applicable for the commands: STOP and AUTO.

tried this:

service: reolink_dev.ptz_control
target:
  entity_id: camera.reolink_e1_zoom_1
data:
  preset: 1

but that did not work. Tried to change the preset number with the preset name. Still no luck…

When I type this in Developer tools => services:

service: reolink_dev.ptz_control
target:
  entity_id: camera.reolink_e1_zoom_1
data:
  preset: HOME

I get this error:

Failed to call service reolink_dev.ptz_control. expected int for dictionary value @ data[‘preset’]. Got None required key not provided @ data[‘command’]. Got None

What could be wrong?

Hi all,
I have figured it out! :sweat_smile:
In service data I had to put:

command: TOPOS
preset: 1

I hope this helps someone else. I missed the topos part.

4 Likes

Hi. there is the command patrol?

Best Regards

Hi, I´m using this thread, since the topic is similar, yet the challange is a bit different. Still hoping for some help:
I integrated my Reolink Camera with the now available official integration (and not the github version from above). All works fine. When using the YAML code to go for presets though, it says: " … Service not found".
Could it be, that the services are not (yet) realized in the officially supported integration?
Thanks, Peter

entities:
  - entity: switch.kameragartenhaus_auto_focus
  - entity: camera.kameragartenhaus_sub
    icon: mdi:numeric-1-box-outline
    tap_action:
      action: call-service
      service: reolink_dev.ptz_control
      service_data:
        entity_id: camera.kameragartenhaus_sub
        command: TOPOS
        preset: Pos1
title: Video Garten
camera_image: camera.kameragartenhaus_sub
1 Like

@PBloomberg There is no ptz_control service in the official integration, instead there is a select entity for the presets.
Therefore use the select.select_option service to move the camera to any of the configured presets.

If you appreciate the reolink integration and want to support its development, please consider sponsering the upstream library or purchase Reolink products through this affiliate link.

Hi @starkillerOG I’m new to this and trying to work out how to use select in an automation.

I have found the entity I want to use select.my_cam_ptz_preset but I don’t understand how to use that in an automation to make the camera turn to preset 1 for example.
I can’t see any documentation on the official Reolink integration that I understand on this topic.

Thanks

Hi @neast25,
There is no Reolink documentation for this since this is general for all select entities of all integrations, but this is how you set it up:

In HA go to ‘Settings’ → ‘Automations’ → select the automation you want to edit or create a new one → under actions select ‘call service’ → use the ‘select.select_option’ as the service → chose as entity the ‘select.my_cam_ptz_preset’ → as option type the ptz preset that you want the camera to move to.

Under the ‘Developer Tools’ in Homeassistant you can find the list of available ptz presets that you can use, under ‘states’ find the ‘select.my_cam_ptz_preset’ and look at the ‘options’ list.
Note that the option in the automation must match exactly one of these available options.

2 Likes

@starkillerOG
Thanks for this guidance
I have managed to get my cameras to turn to a preset position by following your guidance on the use of select.select_option using a Scripts instead of Automations then by adding a card by entity (name of script) to Lovelace dashboard.
Thanks again for your help :slight_smile:

You could also just add the ‘select.my_cam_ptz_preset’ entity to a type: entities lovelace card. That will give you a dropdown menu, if you select any of the presets from the dropdown, the camera schould move to the position you selected.

But if you prefer buttons, indeed creating a script will work.
However it can be done simpler if you just want to add it to the frontend as a button using the button card:

type: button
show_name: true
show_icon: false
name: PTZ position name
tap_action:
  action: call-service
  service: select.select_option
  target:
    entity_id: select.my_cam_ptz_preset
  data:
    option: preset_name

In that way you do not need to make a script.

1 Like

Yeah, I noticed that option via the default card for a camera, but in my case I want to control multiple cameras (all internal ones when I am in the property) to the wall on one action and stop them recording so the script allows me to do that in one action by clicking run. Well at least the PTZ preset part for now, I will add the record part later.
I am also considering other ways to trigger the action such as presence detection or webhook from another service or a physical button too. But all that is for another day, now I am playing about with layouts to make a nice layout for the sub streams and controls on a single view.

Yes, In that case a script makes perfect sense!
Probably GPS tracking of the phones of all family members using the official HomeAssistant app is the nicest way to automatically “turn off” your cameras.
However if you consider that as too privacy invasive, tracking wifi connections of the same phone to your router using a HomeAssistant integration for your router is a good alternative.