good job @user2684
I have an imou cruiser 4MP, after recovering the keys by registering the app, I did the setup without any problems and it recognized 23 entities.
I’m also very interested in having the presets or have the PTZ comand, because being able to move the cam from Home Assistant is something I really miss.
Can’t you do this by adding it via onvif ?
Ptz is working via onvif. If I will be at home I Will share the code
As far as I know PTZ in onvif works by calling a service but I do not have a camera supporting it to confirm
Back to PTZ/Preset discussion. After some research (and also because I do not have a camera supporting it for running some tests), apparently (ONVIF - Home Assistant) both PTZ and presets are available through the onvif integration (and I assume all of you have onvif configured to watch live videos). Can anybody confirm? The principle here has always been to avoid replicating functionalities already available in other integrations but want to be sure I’m not missing something. Thanks
Yes presets and ptz can work via onvif, but imou cameras not work with onvif presets. I guess onvif camera need absolutemove to call presets but imou only works with continousmove
Thanks. Looking at the API I see the capability to move to an absolute position (controlLocationPTZ:PTZ positioning interface · Development documentation) or to control tilt/pan/etc (controlMovePTZ:PTZ mobile control interface · Development documentation) but I see nothing about presets. I wonder if this is more kind of a local setting to the Imou Life App which based on the preset saved locally, calls the APIs.
For me the loveance card looks like:
type: picture-glance
entities:
- entity: camera.fynncam_profile000
tap_action:
action: call-service
service: onvif.ptz
service_data:
pan: LEFT
speed: 1
distance: 0.5
move_mode: ContinuousMove
target:
entity_id: camera.fynncam_profile000
name: Pan Left
show_state: false
icon: mdi:arrow-left
show_icon: true
- entity: camera.fynncam_profile000
tap_action:
action: call-service
service: onvif.ptz
service_data:
tilt: UP
speed: 1
distance: 0.3
move_mode: ContinuousMove
target:
entity_id: camera.fynncam_profile000
name: Pan Up
show_state: false
icon: mdi:arrow-up
show_icon: true
- entity: camera.fynncam_profile000
tap_action:
action: call-service
service: onvif.ptz
service_data:
pan: RIGHT
speed: 1
distance: 0.5
move_mode: ContinuousMove
target:
entity_id: camera.fynncam_profile000
name: Pan right
show_state: false
icon: mdi:arrow-right
show_icon: true
- entity: camera.fynncam_profile000
tap_action:
action: call-service
service: onvif.ptz
service_data:
tilt: DOWN
speed: 1
distance: 0.3
move_mode: ContinuousMove
target:
entity_id: camera.fynncam_profile000
name: Pan down
show_state: false
icon: mdi:arrow-down
show_icon: true
camera_image: camera.camfynn
camera_view: live
I had already tried these instructions, but evidently they are not supported by my ipcam.
The cruiser supports moving via app, but if I try to use the code you posted, nothing happens and I have this content in the logs.
Logger: homeassistant.components.onvif
Source: components/onvif/device.py:401
Integration: ONVIF (documentation, issues)
First occurred: 14:37:42 (12 occurrences)
Last logged: 14:38:17
ContinuousMove not supported on device ‘cruiser’
And you are sure you are using the correct camera entity? I mean; it is not supported on the cruiser but you must use the profile000 entity.
Version 1.0.9 just released should make everybody’s happy with PTZ support directly in the integration In more details:
- Added PTZ support, exposed as
imou_life.ptz_location
andimou_life.ptz_move
services - Added Camera entity, used for invoking the PTZ services
Please note the camera entity is neither showing an image preview nor has ability to stream the video. It is just there for facilitating interacting with the PTZ services.
More details on how it works, expected parameters and troubleshooting and how to use this functionality to emulate presets, have a look here: GitHub - user2684/imou_life: Home Assistant custom component for controlling Imou devices
I guess you are in luck, 1.0.9 just got released with PTZ options.
thanks @user2684 and @mhoogenbosch ,
i tried the two options in the services, but i could only get imou_life.ptz_move to work.
This is the code I put in a card and it works correctly (cruiser is camera from onvif and portone is camera from imou_life integration)
type: picture-glance
entities:
- entity: camera.cruiser_profile000
tap_action:
action: call-service
service: imou_life.ptz_move
data:
operation: LEFT
duration: 200
target:
entity_id: camera.portone_camera
name: Pan Left
show_state: false
icon: mdi:arrow-left
show_icon: true
I couldn’t find the correct parameters to make imou_life.ptz_location work.
What options do you recommend to try?
ptz_location requires 3 parameters:
- horizontal which is a float between -1 and 1 (I assume 0 is the center, -1 all left, 1 all right or something like that)
- vertical, always a float -1 to 1, similar to the above
- zoom still float, between 0 (no zoom), 1 max zoom
Unfortunately I could not test any of those so would be great if you can confirm they work and if not if you can share any error from the logs
Thanks
Work in service, not in lovelace. Show an error
Wait for an upgrade.
OK, it’s work
service: imou_life.ptz_location
data:
horizontal: 0.25
vertical: 0.45
zoom: 0
target:
entity_id: camera.portone_camera
I can use these instructions to create presets at will.
The zoom doesn’t work, I tried to put 0 and 1 but nothing happens.
EDIT: @user2684 the IMOU Cruiser 4MP, not have a optical zoom, but only digital zoom.
In the app i pinch the screen to zoom in on the image. I believe there is no zoom option.
Thank you for your great work, I have had this cam for more than a year and when I bought it I looked for the possibility of moving it with HA.
The new camera entity is ‘inactive’ any guidance on getting it active? When I open the info tab it stays empty. Is there an action required to get this to active?
@byxil Thanks for confirming both the services are working! Regarding the zoom, yes not all the devices support the zoom even if is a mandatory parameter to send the API. Generally speaking, as for now, we are making this PTZ service available for all the devices, even those not supporting PTZ (the API throws an error in this case)
@Tarusky80 Which error are you getting? Share it via PM if you can so I can have a look at it
@mhoogenbosch the camera entity is empty, this is an expected behavior for now (I will document it better). It is not intended to work, just to be used for PTZ commands