roleoroleo / yi-hack-MStar

Custom firmware for Yi 1080p camera based on MStar platform

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[ONVIF] Invalid URL using `onvif-zeep` - http:///onvif/media_service'

ping-localhost opened this issue · comments

I'm trying to add my Yi 1080p Dome BFUS to Frigate, which recently started supporting ONVIF. To check if the camera is supported they provide a simple Python script.


Running the Python script results in the following error for 0.5.4:

Traceback (most recent call last):
  File "/home/mitchell/temp.py", line 24, in <module>
    media_profile = media.GetProfiles()[0]
  File "/home/mitchell/.local/lib/python3.9/site-packages/onvif/client.py", line 26, in wrapped
    raise ONVIFError(err)
onvif.exceptions.ONVIFError: Unknown error: Invalid URL 'http:///onvif/media_service': No host supplied

I also tried 0.5.3 which resulted in a different error:

Traceback (most recent call last):
  File "/home/mitchell/temp.py", line 24, in <module>
    media_profile = media.GetProfiles()[0]
  File "/home/mitchell/.local/lib/python3.9/site-packages/onvif/client.py", line 26, in wrapped
    raise ONVIFError(err)
onvif.exceptions.ONVIFError: Unknown error: Failed to parse: http://H�ɾH�ɾS�ɾ`x��255.255.255.0/onvif/media_service

If there is anything I can do to help/test, let me know!

http:///onvif/media_service

It seems that the script is calling the endpoint without the ip address.

It seems that the script is calling the endpoint without the ip address.

That was my first guess as well, but seeing how "something" was returned in 0.5.3 and it is suddenly empty in 0.5.4 suggest to me that something broke between the two versions.

Line 24 is media_profile = media.GetProfiles()[0], which seems to work for other users of the script.

Please, check your setup, the script works:

root@debian:/home/user/fovtest# python3 ./fovtest.py
Connected to ONVIF camera
Created media service object
Creating PTZ object
Created PTZ service object
PTZ configurations:
{
    'Name': 'PTZCfg',
    'UseCount': 0,
    'NodeToken': 'PTZNodeToken',
    'DefaultAbsolutePantTiltPositionSpace': 'http://www.onvif.org/ver10/tptz/PanTiltSpaces/PositionGenericSpace',
    'DefaultAbsoluteZoomPositionSpace': 'http://www.onvif.org/ver10/tptz/ZoomSpaces/PositionGenericSpace',
    'DefaultRelativePanTiltTranslationSpace': 'http://www.onvif.org/ver10/tptz/PanTiltSpaces/TranslationGenericSpace',
    'DefaultRelativeZoomTranslationSpace': 'http://www.onvif.org/ver10/tptz/ZoomSpaces/TranslationGenericSpace',
    'DefaultContinuousPanTiltVelocitySpace': 'http://www.onvif.org/ver10/tptz/PanTiltSpaces/VelocityGenericSpace',
    'DefaultContinuousZoomVelocitySpace': 'http://www.onvif.org/ver10/tptz/ZoomSpaces/VelocityGenericSpace',
    'DefaultPTZSpeed': {
        'PanTilt': {
            'x': 1.0,
            'y': 1.0,
            'space': 'http://www.onvif.org/ver10/tptz/PanTiltSpaces/GenericSpeedSpace'
        },
        'Zoom': {
            'x': 0.0,
            'space': 'http://www.onvif.org/ver10/tptz/ZoomSpaces/ZoomGenericSpeedSpace'
        }
    },
    'DefaultPTZTimeout': datetime.timedelta(seconds=5),
    'PanTiltLimits': {
        'Range': {
            'URI': 'http://www.onvif.org/ver10/tptz/PanTiltSpaces/PositionGenericSpace',
            'XRange': {
                'Min': 0.0,
                'Max': 360.0
            },
            'YRange': {
                'Min': 0.0,
                'Max': 180.0
            }
        }
    },
    'ZoomLimits': {
        'Range': {
            'URI': 'http://www.onvif.org/ver10/tptz/ZoomSpaces/PositionGenericSpace',
            'XRange': {
                'Min': 1.0,
                'Max': 1.0
            }
        }
    },
    'Extension': {
        '_value_1': [
            <Element {http://www.onvif.org/ver10/schema}PTControlDirection at 0x7f5a3518ea00>
        ],
        'PTControlDirection': None,
        'Extension': None
    },
    'token': 'PTZCfgToken',
    'MoveRamp': 0,
    'PresetRamp': 0,
    'PresetTourRamp': 0,
    '_attr_1': {
}
}

PTZ configuration options:
{
    'Spaces': {
        'AbsolutePanTiltPositionSpace': [
            {
                'URI': 'http://www.onvif.org/ver10/tptz/PanTiltSpaces/PositionGenericSpace',
                'XRange': {
                    'Min': 0.0,
                    'Max': 360.0
                },
                'YRange': {
                    'Min': 0.0,
                    'Max': 180.0
                }
            }
        ],
        'AbsoluteZoomPositionSpace': [
            {
                'URI': 'http://www.onvif.org/ver10/tptz/ZoomSpaces/PositionGenericSpace',
                'XRange': {
                    'Min': 1.0,
                    'Max': 1.0
                }
            }
        ],
        'RelativePanTiltTranslationSpace': [
            {
                'URI': 'http://www.onvif.org/ver10/tptz/PanTiltSpaces/TranslationGenericSpace',
                'XRange': {
                    'Min': -360.0,
                    'Max': 360.0
                },
                'YRange': {
                    'Min': -180.0,
                    'Max': 180.0
                }
            },
            {
                'URI': 'http://www.onvif.org/ver10/tptz/PanTiltSpaces/TranslationSpaceFov',
                'XRange': {
                    'Min': -100.0,
                    'Max': 100.0
                },
                'YRange': {
                    'Min': -100.0,
                    'Max': 100.0
                }
            }
        ],
        'RelativeZoomTranslationSpace': [
            {
                'URI': 'http://www.onvif.org/ver10/tptz/ZoomSpaces/TranslationGenericSpace',
                'XRange': {
                    'Min': 0.0,
                    'Max': 0.0
                }
            }
        ],
        'ContinuousPanTiltVelocitySpace': [
            {
                'URI': 'http://www.onvif.org/ver10/tptz/PanTiltSpaces/VelocityGenericSpace',
                'XRange': {
                    'Min': -1.0,
                    'Max': 1.0
                },
                'YRange': {
                    'Min': -1.0,
                    'Max': 1.0
                }
            }
        ],
        'ContinuousZoomVelocitySpace': [
            {
                'URI': 'http://www.onvif.org/ver10/tptz/ZoomSpaces/VelocityGenericSpace',
                'XRange': {
                    'Min': 0.0,
                    'Max': 0.0
                }
            }
        ],
        'PanTiltSpeedSpace': [
            {
                'URI': 'http://www.onvif.org/ver10/tptz/PanTiltSpaces/GenericSpeedSpace',
                'XRange': {
                    'Min': 1.0,
                    'Max': 1.0
                }
            }
        ],
        'ZoomSpeedSpace': [
            {
                'URI': 'http://www.onvif.org/ver10/tptz/ZoomSpaces/ZoomGenericSpeedSpace',
                'XRange': {
                    'Min': 0.0,
                    'Max': 0.0
                }
            }
        ],
        'Extension': None,
        '_attr_1': None
    },
    'PTZTimeout': {
        'Min': datetime.timedelta(seconds=1),
        'Max': datetime.timedelta(seconds=100)
    },
    '_value_1': [
        <Element {http://www.onvif.org/ver10/schema}PTControlDirection at 0x7f5a352fe840>
    ],
    'PTControlDirection': None,
    'Extension': None,
    'PTZRamps': None,
    '_attr_1': None
}

PTZ service capabilities:
{
    '_value_1': None,
    'EFlip': False,
    'Reverse': False,
    'GetCompatibleConfigurations': False,
    'MoveStatus': True,
    'StatusPosition': True,
    'MoveAndTrack': None,
    '_attr_1': {
}
}

PTZ status:
{
    'Position': {
        'PanTilt': {
            'x': 171.9,
            'y': 63.2,
            'space': 'http://www.onvif.org/ver10/tptz/PanTiltSpaces/PositionGenericSpace'
        },
        'Zoom': {
            'x': 1.0,
            'space': 'http://www.onvif.org/ver10/tptz/ZoomSpaces/PositionGenericSpace'
        }
    },
    'MoveStatus': {
        'PanTilt': 'IDLE',
        'Zoom': 'IDLE'
    },
    'Error': None,
    'UtcTime': datetime.datetime(2024, 2, 14, 8, 9, 14, tzinfo=<isodate.tzinfo.Utc object at 0x7f5a35cb2f70>),
    '_value_1': None,
    '_attr_1': None
}
YES - MoveStatus is reporting IDLE.
YES - RelativeMove Pan/Tilt (FOV) is supported.
YES - RelativeMove Zoom is supported.

Something must be wrong with my device then. Thank you for double checking. I will look into it.

Is there anyway to fully wipe/reset the camera?

If you mean remove the hack, you need a backup of your flash: rootfs and homefs.
If you mean reset the configuration:

  • reset button in maintenance page (webgui) to reset hack configuration
  • back button long pressed to reset yi-hack configuration

Thank you. I'll try and find the original firmware for my Yi 1080p Dome BFUS (as I didn't make a backup 😅).

Will close this issue for now.