Skip to content

Replace 'wsdiscovery' and 'onvif-zeep' with 'onvif-python' for better ONVIF device discovery and device handling #89

Open
kaburagisec wants to merge 4 commits intogroundlight:mainfrom
kaburagisec:main
Open

Replace 'wsdiscovery' and 'onvif-zeep' with 'onvif-python' for better ONVIF device discovery and device handling #89
kaburagisec wants to merge 4 commits intogroundlight:mainfrom
kaburagisec:main

Conversation

@kaburagisec
Copy link
Copy Markdown

  • Replace wsdiscovery and onvif-zeep dependencies with onvif-python
  • Migrate RTSPDiscovery from WSDiscovery to ONVIFDiscovery API
  • Update ONVIF client usage from ONVIFCamera to ONVIFClient
  • Improve discovery result parsing with fallback for host/port extraction
  • Add additional default credentials for TP-Link and admin123 combinations
  • Expand light discovery mode to try first 4 credentials instead of 2
  • Update unit tests to mock ONVIFDiscovery instead of WSDiscovery
  • Remove wsdiscovery-related logging configuration workarounds

This change improves ONVIF device discovery reliability and reduces dependency conflicts while maintaining backward compatibility.

except Exception as e:
logger.error(f"Error discovering device: {e}", exc_info=True)
#ONVIFDiscovery no need to stop, because it closes sockets automatically
#wsd.stop() # This is supposed to clean up the threads but it doesn't seem to work, sock is still open after running this
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line should be removed

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comments?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking of the the commented out line of code in particular

# will run the following
# I made a PR to fix this aspect of python-ws-discovery: https://github.com/andreikop/python-ws-discovery/pull/89
root_logger = logging.getLogger()
if root_logger.hasHandlers():
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing this part could be removed, since it was only added as a hack to work around an issue with wsdiscovery.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it

@timmarkhuff
Copy link
Copy Markdown
Collaborator

I think this PR seems reasonable. I will need to validate it internally here before we can decide to merge it in.

Out of curiosity, what motivated this change? Did you find something lacking about the wsdiscovery library?

@kaburagisec
Copy link
Copy Markdown
Author

I think this PR seems reasonable. I will need to validate it internally here before we can decide to merge it in.

Out of curiosity, what motivated this change? Did you find something lacking about the wsdiscovery library?

I just want more implementations for the onvif-python library I built. And I can guarantee the quality of the library. You can ask me anything about it. And regarding wsdiscovery, if it's only for ONVIF device discovery, I don't think there's any need for additional libraries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants