-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add new features #5
base: main
Are you sure you want to change the base?
Conversation
I will add the new handshake procedure for new models tomorrow as well |
Added the new auth protocol and a new way to send commands. It uses a send_command function that can send CMD consts. This will allow home assistant to send commands like set the laser_power to high (added a test for that). I would appreciate if someone could review this so I can get started on the home assistant part. I want to extend sending commands, add sensors, add binary sensors, etc I updated the formatters to use consts so the keys can be referenced in commands |
Heres some output examples
I added a functional test so you can check it out as well |
Any chance this could get reviewed? |
@SteveEasley Would it be possible to get this reviewed and merged? This add-on is broken for all of the new JVC models due to a password format change. @iloveicedgreentea has that fixed above so it would be great to implement. |
It’s been a while so I might just have to fork this and make a PR to home assistant to use the fork |
Hey sorry, just noticed this request after ironically just pushing up some changes to fix the auth issue. Not sure why I didn't get a git notification of the PR until I pushed up my change. @iloveicedgreentea I notice our auth code is a little different. I think your implementation might be including the The const changes look like a good thing. But I do want to take a day or so to test the other new commands on my own projector. I have some concerns about the fast refreshes and bogging down the projector with the new traffic. But might be ok. How about we split this up into two HA PRs? I will get my auth changes pushed through, and lets work on the new commands as a separate (but concurrent) change. Feel free to give feedback on my changes though (05d8e86) |
Sure sounds good I copied the implementation from my library which worked for users but could have added an extra underscore there. I don’t think the underscore is supposed to be included. I can rebase without the auth changes when it’s merged |
The auth change is already merge to main here (will be good to have eyes for PRs in the future though!). So feel free to rebase when you are ready. I am starting to dig into your changes now, with my projector. |
@jmery You should actually be able work around the issue until we get this into HA by doing the password encode yourself. In fact this might be a good test of our future encoding logic, since you would be manually doing exactly what's being done in the library.
Thanks! |
requirements_test.txt
Outdated
@@ -1,6 +1,6 @@ | |||
aioconsole==0.5.1 | |||
black==22.12.0 | |||
flake8=6.0.0 | |||
flake8==6.0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Today in main I replaced these lint/format tools with ruff (same as HA uses), and added a pre-commit hook for it.
Thanks I will take a look at these this week |
This doesn't appear to work. I reset the PJ's network password. Adding the integration via the HA UI constantly returns "Invalid Authentication". |
Hmm that’s concerning since that’s the same process we would use in the code. Would you mind trying with a test password and share it and the sha256 value you put into the HA integration with me? And/or try it the exact values I gave above. 1234567890 for the projector password and cc3054cf7c701a32a883bf45a7b19cbf7f62db778208b3c058e0c6dde886996f for the HA integration password. |
I reset it to your exact example from the original password. I don't see any instructions from JVC requiring any kind of reboot or anything for the password to be effective. |
Ok figured this out. This was actually an unrelated bug thats always been there. Passwords over 10 characters were getting truncated to 10 characters, so it wont except the long SHA :( I submitted a fix for this here home-assistant/core#126581. But by the time thats fixed, the SHA256 PR (home-assistant/core#126453) should be live at the same time, so should be able to use your regular password. Thanks for taking the time to try it, squashed a bug at least! |
2024.9.3 shipped overnight. I just installed and can confirm the issue is fixed. Thanks so much for the quick fix and happy to have helped a little :-) |
3f7e655
to
882bde4
Compare
882bde4
to
f879209
Compare
I rebased to main, used your connect code, and fixed the rest of the comments. Please let me know what you think |
Cool will look at this over the next couple of days. |
pushed a fix to improve sending info commands and fix version processing for unknown string |
fyi looking good. I am assuming we will leave this open until you are done on the HA side and ready for a PR on that side. |
Yeah I started working on that in core. I will try to get it plugged in soonish |
@SteveEasley I made a draft PR for HA core here https://github.com/home-assistant/core/pull/131320/files I added sending commands and the new sensors. I need to do more testing but at first glance it all works. I am installing the lib from git (pulling changes into my core devcontainer) with
Makes it easy to iterate LMK what you think. I will probably disable some sensors by default because the core people will complain about it. I also want to make it easier to see what commands can be sent like "laser_power, high". I also updated the tests. |
I pushed changes to automate generating commands and for HA I added more selects and improved sensors and all that. Will do more testing tomorrow. 99% code coverage too
|
Okay I think im done for now. I added mypy and enabled pre-commit and fixed all the errors. I uploaded a test package to pyjvcprojector_test so if anyone wants to test you can add this branch as a custom component and set the manifest to pyjvcprojector_test==1.1.2. You will need to add a version field set to anything too |
@SteveEasley ive been running this in my HA instance and its been good the only issues I see are occasional timeouts (just while sending commands not reading state) I suspect its an issue of trying to read an empty buffer which suggests a syncing issue but not sure. Not sure if this ever happened before my changes. In my custom component I implemented a PriorityQueue which allowed user commands to have immediate access while refresh commands took a back seat. This gave you strict command ordering, priority, and a queue system. let me know if you are interested in that I can implement it also to be clear the timeout only happens when sending commands so I think its related to synchronizing writing and reading |
Hey, sorry for the delay. Should be diving into this by the end of the week. |
Cool no worries. So far I haven’t run into any issues besides occasional warning for timeouts. I don’t send a lot of commands though. I suspect we may need a command queue regardless |
Any update? I'm waiting for this to merge before switching to the official JVC integration, since I use installation mode in my automations. Was hoping to make the update over the holidays. Thanks! |
Yep I provided some feedback on the HA side in home-assistant/core#131320 last weekend. It was working for me for the most part. |
Hey, I am the maintainer for another JVC integration
https://github.com/iloveicedgreentea/jvc_projector_python
https://github.com/iloveicedgreentea/jvc_homeassistant
I have archived it since yours is in core already. I plan on extending the core version to support new sensors and other entities that my custom component had. As a precursor, I wanted to add some features to the library
Summary of changes
I updated some tests and made sure all of these worked with my NZ7. I like how you set up the formatter with regex for parsing commands, that is very slick.
Please let me know what you think