bitfocus / companion-module-ptzoptics-visca

MIT License
8 stars 11 forks source link

Unable to recall presets #32

Open rfergusonmedia opened 7 months ago

rfergusonmedia commented 7 months ago

I'm running into an issue where I'm unable to recall any camera presets through the companion action. I can control other camera features and can even save presets through the companion action. The only thing that isn't working is the ability to recall a preset that I've saved.

I've confirmed that the presets are stored in the camera through the web interface of the camera and everything works there.

Any ideas?

jswalden commented 7 months ago

What camera model are you running? Do you see the same behavior if you use a totally clean Companion setup, then add a Recall Preset preset button to it and try using that? If you don't, any chance you could generate a slimmed-down companionconfig of your setup, plus a sequence of steps you can take with it to replicate the issue?

Recalling presets is working just fine for me with my cameras, so figuring out precisely what differs between your setup/steps and mine (or that of some hypothetical other person watching here, who might be willing to investigate -- I'm not the module maintainer, but there's nonzero chance that I'm presently the person most interested nonetheless) is going to be essential to figuring out what's up here.

rfergusonmedia commented 7 months ago

I'm using a few generic PTZ cameras that are supposed to be compatible with the PTZ Optics protocol; specifically they are the Tongveo CM-Z323-RT2.

Wiped clean Companion and added just a recall button but get the exact same experience. Camera doesn't respond through Companion but I can open the web interface, see the preset and invoke the preset. Additionally I've tried saving a preset through Companion to which I can see it after its saved but again, recall does nothing.

I've kept the setup extremely simple and have three cameras with 3 presets for each (wide, tight, ultrawide) to pull from.

rfergusonmedia commented 7 months ago

Here's the companionconfig that I'm using PTZ-SETUP_custom-config_20231121-1420.zip

jswalden commented 7 months ago

Hmm. Okay. So...

VISCA (the underlying byte-based protocol that this module uses to communicate with cameras) isn't standardized. There's some cross-vendor common support of some commands. But no guarantees on all of them.

Which makes using non-PTZOptics cameras with this module inherently "your mileage may vary". If your camera doesn't use the same byte sequence to recall camera presets as do PTZ Optics cameras, that would explain the action not working. (Although I'd have naively expected recalling presets to be so basic it would be reasonably consistent...)

I poked very briefly around on the Tongveo site, but I couldn't find documentation for that camera model (or at least it wasn't obvious which line it would be in). http://www.tongveo.net/support/manual/ (And the manuals I took a gander at don't document what VISCA means to them, just says they "support" it.) Developer docs if they have them would be helpful in figuring out if they just support a different Recall Preset command. Maybe you can poke their support to see if they have anything?

Without developer docs, tho, I'm not sure there's much that can be done to figure this out. And with them, if they just encode the command differently...well, at that point the response might be "This module is intended for PTZOptics cameras. If it doesn't work with other cameras in some fashion that isn't a bug."

But I reiterate: I'm not the module maintainer and that's not my call to make, if it turns out your cameras don't use the PTZOptics byte sequence to recall presets.

jswalden commented 7 months ago

One other note, tho -- if Tongveo cameras use a different byte sequence, at least right now you could use the "Custom command" action to invoke them.

rfergusonmedia commented 7 months ago

First...thanks for just responding and even trying to help me out.

I'll see if I can poke their support for the developer docs. I googled VISCA over IP and got the PTZOptics command lines which didn't help either but I'm assuming it could be the same issue. Supported by PTZOptics but perhaps not standardized for all cameras and maybe why the Tongveo can't see it

jswalden commented 7 months ago

The byte sequence PTZOptics cameras use is here, for Preset:Preset:Recall:

81 01 04 3F 02 pp FF

where pp= the number of the preset to recall (as hex, i.e. recalling preset number 17 would be the byte value 11 as hex). Tongveo should be able to compare their byte sequence against that and say if it's the same or different, if it happens that you're unsure if your technical chops are up to the task.

TheGentlemanAtWork commented 4 months ago

@rfergusonmedia I have exactly the same issues. Could you fix the problem or get any response from their support?

rfergusonmedia commented 4 months ago

Unfortunately I never got this fixed or a response that was helpful. So this issue is still unresolved for me and may be an issue with the PTZ instead of the module.

On Wed, Feb 7, 2024 at 6:44 AM TheGentlemanAtWork @.***> wrote:

@rfergusonmedia https://github.com/rfergusonmedia I have exactly the same issues. Could you fix the problem or get any response from their support?

— Reply to this email directly, view it on GitHub https://github.com/bitfocus/companion-module-ptzoptics-visca/issues/32#issuecomment-1932081390, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYRVV4IVMFAYO6SUILR533LYSOALRAVCNFSM6AAAAAA7U5UPM2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZSGA4DCMZZGA . You are receiving this because you were mentioned.Message ID: @.*** com>

JamboMedia commented 3 months ago

2 Camera's: ptz optics 30x sdi gen2

Same problem here. Sometimes it is not posible to recall a preset of a camera. From the webinterface the camera(software of the camera) it is working without a problem.

When we restart companion it sometimes works again, but sometimes the problems stays.

Looks like a bug in companion module, we use our setup for 3 years and in the past no problems.

ploveman commented 2 months ago

2 Camera's: ptz optics 30x sdi gen2

Same problem here. Sometimes it is not posible to recall a preset of a camera. From the webinterface the camera(software of the camera) it is working without a problem.

When we restart companion it sometimes works again, but sometimes the problems stays.

Looks like a bug in companion module, we use our setup for 3 years and in the past no problems.

@JamboMedia that sounds likely a different issue if you're using PTZ optics branded cameras vs a different camera that isn't supported explicitly by this module. What version of companion are you running? Do you see any errors or strange messages on the Log tab (you may need to click info and debug levels on the logs to see)? It's possible that intermittent network issues affecting the socket between companion and the cameras could see issues. That also might explain why sometimes restarting companion might help. @jswalden and I have seen a few issues with the recovery of the socket; he has an issue up on the TCPHelper that sounds like it might help us sort this out for the PTZ Optics module.

JamboMedia commented 2 months ago

We are using the latest version: 3.2.2 I will do some extra testing in the following weeks, and will check the logs.

jswalden commented 1 month ago

The next Companion release will include the 3.0.0 release of this module. (You can also manually install this release in Companion >=3.2 by following the instructions in release notes.) That release adds a config option to turn on extra debug logging, that will go in Companion logs.

If you turn that option on for a connection to your camera and try to recall a preset, you should see something similar to this in your logs:

2024-05-06T23:46:59.487Z info Instance/Wrapper/spkr-ptz SEND: [81 01 04 3F 02 11 FF]... 
2024-05-06T23:47:02.633Z info Instance/Wrapper/spkr-ptz RECV: [90 41 FF] 
2024-05-06T23:47:02.634Z info Instance/Wrapper/spkr-ptz Processing [81 01 04 3F 02 11 FF] ACK in socket 1 
2024-05-06T23:47:02.634Z info Instance/Wrapper/spkr-ptz RECV: [90 51 FF] 
2024-05-06T23:47:02.634Z info Instance/Wrapper/spkr-ptz Completion in socket 1 

(The 11 in the first and third lines corresponds to a "Recall Preset 17" action. You'd see a different value for that byte if you recall a different preset.)

But if instead you see something like this (that third line onward will be the interesting thing -- I'd expect most cameras would respond with a Syntax Error, but in theory they might return an error some other way):

2024-05-06T23:49:27.940Z info Instance/Wrapper/spkr-ptz SEND: [81 01 04 3F 02 11 FF]... 
2024-05-06T23:49:31.914Z info Instance/Wrapper/spkr-ptz RECV: [90 60 02 FF] 
2024-05-06T23:49:31.915Z error Instance/Wrapper/spkr-ptz Error processing command: Camera reported a syntax error in the message [81 01 04 3F 02 11 FF].  This is likely a bug in the ptzoptics-visca Companion module.  Please click the bug icon by any camera instance in the table in Companion's Connections tab to report it. 

Then your camera just doesn't accept the "Recall preset" VISCA command syntax that PTZOptics uses. Your camera must use some other byte sequence to recall presets, and you'll have to contact your camera's manufacturer to learn it (and then use a "Custom command" action to send the command).

I'll leave this open a tad bit longer for people to check what their cameras do. But as this gives every indication to me of being a "you're not using a PTZOptics camera" issue, I'll probably close it after that because it's not really a bug as far as this module's main intended purpose goes.