roleoroleo / sonoff-hack

Custom firmware for Sonoff GK-200MP2B camera
GNU General Public License v3.0
200 stars 45 forks source link

preset call not working #163

Closed dCypherNx closed 1 week ago

dCypherNx commented 4 months ago

I just updated to 0.1.7, but I can't call presets from either HA or ODM. In HA I can't even call pan tilt commands

roleoroleo commented 4 months ago

It could be a problem with the ptz binary. Open a ssh session and try to move the cam manually: /mnt/mmc/sonoff-hack/bin/ptz -a left -t 500

If it doesn't work, try ptz_h and ptz_p binaries.

dCypherNx commented 4 months ago

the original ptz bin works through ssh but not for presets, I tried resetting them to the default hack and the same behavior persists, ODM is able to pan/tilt but not call or set presets, HA can't control any ptz aspect. When I try to set presets in ODM it returns "Too many presets"

DeadlySin2 commented 4 months ago

Can confirm the issue. On 0.1.6 ptz from HA works well. But on 0.1.7 i get error calling procedure error. From ssh and web interface - works well

roleoroleo commented 4 months ago

In the last release (0.1.7) I completely changed the onvif server.

There is a problem with the configuration file onvif_simple_server.conf Please use the files from this archive: sonoff-hack.tar.gz Let me know if it works.

dCypherNx commented 4 months ago

Seems that nothing changed

roleoroleo commented 4 months ago

Too many preset is a strange message. Please, post your /mnt/mmc/sonoff-hack/etc/ptz_presets.conf

dCypherNx commented 4 months ago

there are few pretest, seems that onvif command is unable to access this file, at ODM the presets aren't lieted either

my ptz_presets.conf ![image](https://github.com/roleoroleo/sonoff-hack/assets/32493242/1407c59f-963f-4f37-88bb-632fd5d3eede) 0=0|969|956 1=1|2362|424 2=2|433|344 3=empty|-1|-1 4=empty|-1|-1 5=empty|-1|-1 6=empty|-1|-1 7=empty|-1|-1 8=empty|-1|-1 9=empty|-1|-1 ~
roleoroleo commented 4 months ago

Could you post the output of the list command? /mnt/mmc/sonoff-hack/bin/ptz -f /mnt/mmc/sonoff-hack/etc/ptz_presets.conf -a get_presets

dCypherNx commented 4 months ago

This command just returned the usage guide, I tried ptz_h and it returned all presets, the ptz_p " can't load library 'libptz.so'" I renamed the ptz_h to ptz, it solved the problem at ODM, BUT at HA the behavior persists. Can I control PTZ through mqtt?

roleoroleo commented 4 months ago

How did you add the cam to ha? Are you using onvif standard or my integration?

dCypherNx commented 4 months ago

Litle update about HA Previously the presets are 0, 1, etc. Now, the presets are PresetToken_0, PresetToken_1, etc. I'm using onvif standard, I didn't know you had your own integration LOL

roleoroleo commented 4 months ago

Are presets working now?

This is my integration: https://github.com/roleoroleo/yi-hack_ha_integration

EDIT

Can I control PTZ through mqtt?

No, at the moment.

dCypherNx commented 4 months ago

Now the presets are working, but the single PTZ is not, just like in the h60ga, maybe the commands are also different, previously I was using UP, DOWN, LEFT, RIGHT of the HA, I will try some variations. In mean time I'll try your integration either

roleoroleo commented 4 months ago

So pan and tilt in ODM work and in ha don't work. Correct? Did you test all available pan and tilt in ODM? I mean continuous, absolute and relative?

But... I'm able to test it. I will let you know.

dCypherNx commented 4 months ago

Presets are fine in both HA and ODM. I'll check variation of relative, absolute and continuous, never had to worry about it before LOL

DeadlySin2 commented 4 months ago

I got ONVIF integration error after the update, so i removed ONVIF integration and tried to install default onvif integration and it can't connect to the camera - ONVIF: All connection attempts failed.

dCypherNx commented 4 months ago

That's it! Previously we didn't need to set move_mode for single moves, now we need to. Presets solved, single moves solved.

roleoroleo commented 4 months ago

Another little fix: onvif_simple_server.gz

But I noticed a problem with ptz service in ha. Ha doesn't ask to the cam the range of the pan and tilt movements. When ha sends the command uses the range 0.0 - 1.0, but the cam works in degrees (0 - 360 and 0 - 180). So the cam doesn't move properly. I think ha is not compliant.

dCypherNx commented 4 months ago

Another little fix: onvif_simple_server.gz

But I noticed a problem with ptz service in ha. Ha doesn't ask to the cam the range of the pan and tilt movements. When ha sends the command uses the range 0.0 - 1.0, but the cam works in degrees (0 - 360 and 0 - 180). So the cam doesn't move properly. I think ha is not compliant.

They probably did it like this cause not all camera can pan 0-360 or tilt 0-180, so they implement as percentage. I don't know how onvif tells to implement

roleoroleo commented 4 months ago

In the onvif ptz specification there are 5 methods:

If you try ODM, you will see this sequence.

DeadlySin2 commented 4 months ago

I can't make ONVIF work on firmware 0.1.7. HA standart integration can't connect after update. YI-hack integration can't connect too. I roled back to 0.1.6 and HA standart integration connected, but YI-hack is not working.

roleoroleo commented 4 months ago

Please, restart from scratch. Clean your sd card and install again the hack.

github-actions[bot] commented 1 month ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.