feat: hub-based architecture for automatic shade discovery#29
Conversation
Reuse the home key from already-configured shades so adding subsequent shades skips the key step. Show human-readable shade names from the hub in the device picker. Allow selecting multiple shades at once instead of repeating the flow for each one. Default to hub fetch as the key method.
…ated descriptions
Add ShadeCapability lookup to replace hardcoded model string checks for tilt/tilt-only selection. Add velocity number entity (0–100) and pass velocity through all movement paths including open/close. Remove redundant device_info property overrides and deduplicate hex parsing.
…harging control lock
|
Sorry about the monster PR, but this brings the integration in line with modern HA architecture and should work with most blinds except the ones that have multiple blinds. Thanks for a great integration. My setup is working perfectly. But I don't own all the blinds so I can't test everything. At least it has the necessary information to move to the next step regarding dual and triple blind support, but that requires a bit of a refactor. |
1cd79ef to
548381a
Compare
97b765c to
e7ee2aa
Compare
Resolve power_type from the hub /home/shades response when available, with a one-time BLE 0xFFDE fallback for hub-less setups. Result is cached to the config entry so subsequent restarts skip the query. Sensor and binary_sensor platforms suppress battery_level / battery_charging on known-hardwired shades; unknown power_type stays inclusive so real battery data is never silently hidden.
|
I would if I could, but I don't think I have the skillset for that yet. The little I did took me a long time and involved a lot of trial and error before it worked. And if you asked me to replicate it, I don't think I could. 😂 So if/when I get better at YAML and maybe get the hardware to set up a local LLM, I will try to help out. In the meantime, I am trying to learn by tackling issues here and there on my own setup. I don't think all my trial and error would please the people who use this integration. But would love to buy you a coffee.. |
|
I would really appreciate more testing. I'm running this branch on my HA setup with zero issues. The battery detection is something I can't test as my shades are hard wired. Just note that I'm not in a position to make bug fixes for a couple of months. |
|
Sure. Will let you know but since I only have one set of type 54 its limited what I will find :) Thanks for the hard work. U should set up a way to get u a beer... |
@patman15 I appreciate that. If you would like, just set me up as a collaborator with merge access. If you test my code and it works for you and you merge, them it's actually not that far from complete anyway. |
…i and openhab's database
|
Just gave it a try, but got immediately stuck. You intend that as a breaking change, as you did not implement any migration scenario, right? In principle I'm ok with it as this integration had no release yet. Just checking. |
|
100% a breaking change because it's a different model to suit auto discovery and a single source for the encryption key. I should have made that clearer. But like you say, I figured the integration was very much alpha and I'm helping to get it to beta. Even IF you merge the code, none of us have all the blinds so it will take a community effort to test before a 1st release. |
…e the process more robust
…out of Bluetooth range
|
This branch is ready to merge. Awaiting your approval. |
There was a problem hiding this comment.
Sorry, I'm trying to upgrade my other integration to the newest HA and it causes a lot of headache because of imported issues. 😓
Did a quick test, wow, cool work, thanks a lot. The hub architecture is really cool!
Issues I saw:
- Half of my shades do not show the battery entities
- The
Identifybutton moves the shade instead of beeping, seems to be related to previous one, because some do beep.
I'll play around a bit more but I guess it look pretty ready to be merged.
|
Thanks. The battery detection is hard for me because I don't have any battery blinds. I have tweaked the code to get the battery info from the hub during setup. The "identify" moving the blinds is normal for me. That's how the hub does it. Note that I have not changed that code! |
|
I need to do a review round, the battery detection does not work, although the API seems to deliver the data correctly. |
It might be easier to remove the battery logic and add that as a separate future PR. |
…e to incorrect behaviour
|
Ok. Now I'll add a diagnostics platform so that a user can provide a log of what is actually occuring. From that the correct (hopefully) decisions can be made about how to proceed with battery detection as well as other issues. The addition of the diagnostics.py file is the final piece that makes this integration more manageable and functional - one of the key goals from this PR. |
|
@safepay please keep the PR limited to the original description, i.e. hub based architecture. I'm really struggling to follow your changes and verify them. If you have new additions, please raise another PR to keep individual features separated and the PRs small. Thanks a lot, I'd really like to merge this PR soon. |
|
Ideally, yes. But the PR has been there for 3 months. Without a merge it's hard to iterate and fix residual issues. It's really up to you. |
|
Specifically, simply let me know what the gaps are that are preventing this from being merged. This will help me stop guessing what to do next and modifying the code unnecessarily. Cheers. |
What is this?
This PR introduces a hub-based model for managing PowerView BLE shades. A single config entry represents your PowerView home, and shades are discovered automatically over BLE.
What this PR changes
Architecture — hub-based setup
You set up the integration once — point it at your hub (or enter the key manually) — and shades are picked up automatically as they're discovered over BLE. New shades appear without any additional config. Friendly names come from the hub so they match what you see in the PowerView app.
__init__.py— manages a collection of coordinators (one per shade), registers a BLE callback for new shades, and fetches metadata (names,powerType) from the hub APIconfig_flow.py— a single setup step: choose how to provide the home key (fetch from hub, enter manually, or skip)Shade support
ShadeCapabilityinapi.py) drives which entities get created per shade — top-down, TDBU, duolite, tilt-on-closedaio-powerview-apishade-type tablenumber.pyentity for shades that support velocityquery_power_typeover BLE; battery sensors are hidden on hardwired shades, and the spuriousbattery_chargingcontrol lock has been removedpos2contamination on TDBU shadesReliability & UX
scripts/shade_report.pydiagnostic tool that dumps shade bytes/metadata for debugging unsupported typesCloses #3
Closes #8
Closes #21
Closes #27