Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for J and H models #67

Closed
epenet opened this issue Mar 6, 2022 · 14 comments
Closed

Support for J and H models #67

epenet opened this issue Mar 6, 2022 · 14 comments

Comments

@epenet
Copy link
Collaborator

epenet commented Mar 6, 2022

Hi @xchwarze

I could not find a library for communicating with the J and H models on pypi.

How would you feel about adding support for these inside this package, using as a base the work from https://github.com/eclair4151/SmartCrypto and https://github.com/kdschlosser/samsungctl?

@xchwarze
Copy link
Owner

xchwarze commented Mar 6, 2022

The intention of this wrapper is to support what is standardized in the Tizen ecosystem (like samsung.remote.control or com.samsung.art-app)
I think it would make more sense to add support for DLNA/UPnP. Although the original idea I had was to make a second library for that...

When they implemented this library in HA I mentioned that the most logical thing was to make two components (SamsungTizen and SamsungLegacy) because all the things that can be done under Tizen cannot be done under legacy and that gave a confusing user experience

@epenet
Copy link
Collaborator Author

epenet commented Mar 6, 2022

In between SamsungTizen (using this library) and SamsungLegacy (using the old samsungctl library) we need to have a way to communicate with the SamsungEncrypted models.
If you really don't want to implement it in this library, then I will create a separate library :( I won't force you into anything...

@xchwarze
Copy link
Owner

xchwarze commented Mar 6, 2022

And if make a second dependency? Something like samsung-tv-legacy-api for put the pre-tizen tvs

@epenet
Copy link
Collaborator Author

epenet commented Mar 7, 2022

Would you make samsung-tv-encrypted-api and samsung-tv-legacy-api?
For me the priority would be samsung-tv-encrypted-api for J and H

@xchwarze
Copy link
Owner

xchwarze commented Mar 7, 2022

Ok!
I'm still traveling for a few more days so I'll probably do this when I'm in town

@epenet
Copy link
Collaborator Author

epenet commented Mar 9, 2022

This is a potential starting point for the encrypted library:
https://github.com/epenet/home-assistant-core/tree/samsungtv-encrypted/homeassistant/components/samsungtv/encrypted

  • encrypted/__init__.py (root)
  • encrypted/authenticator.py (a class to follow the authentication steps - display PIN, input PIN, get token, get session - needed for config flow)
  • encrypted/command.py (similar to ws API)
  • encrypted/remote.py (similar to ws API)
  • encrypted/session.py (used by remote to encrypt commands - could be moved inside remote)
  • test_authenticator.py (a manual script to test the authentication steps - could be just in documentation)

@xchwarze
Copy link
Owner

I'll try to start it this weekend!

@epenet
Copy link
Collaborator Author

epenet commented Mar 11, 2022

FYI: users are starting to test it in epenet/home-assistant-core#71

@epenet
Copy link
Collaborator Author

epenet commented Mar 11, 2022

I won't be able to work on it this week-end, but it looks like my code is working correctly.
See epenet/home-assistant-core#71 (comment)

These are the files required:

  • authenticator.py
  • command.py
  • exceptions.py
  • remote.py
  • session.py

Dependencies:

  • aiohttp>=3.8.1
  • py3rijndael>=0.3.3 no longer needed
  • pycryptodome>=3.12.0 replaced by cryptography>=35.0.0
  • websockets>=10.2

@epenet
Copy link
Collaborator Author

epenet commented Mar 14, 2022

I have adjusted the latest code to use cryptography instead of pycryptodome

These are the updated dependencies:

  • aiohttp>=3.8.1
  • py3rijndael>=0.3.3
  • cryptography>=35.0.0
  • websockets>=10.2

@epenet
Copy link
Collaborator Author

epenet commented Mar 14, 2022

I have also managed to drop the py3rijndael dependency

These are the updated dependencies:

  • aiohttp>=3.8.1
  • cryptography>=35.0.0
  • websockets>=10.2

@epenet
Copy link
Collaborator Author

epenet commented Mar 15, 2022

I have created three more PRs to finalise the support: #79 / #80 / #81
It would be great if you could publish a release once they are merged.

@xchwarze
Copy link
Owner

done!

@epenet
Copy link
Collaborator Author

epenet commented Mar 16, 2022

Thanks: corresponding PR home-assistant/core#68225

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

No branches or pull requests

2 participants