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

[huesync][WIP] Hue Play HDMI Sync Box Binding - Initial contribution #16516

Open
wants to merge 47 commits into
base: main
Choose a base branch
from

Conversation

pgfeller
Copy link
Contributor

@pgfeller pgfeller commented Mar 12, 2024

This binding integrates the Play HDMI Sync Box into openHAB. The integration happens directly through the Hue HDMI Sync Box API.

The beinding is using mDNS to discover HDMI Sync devies in the local network. The LED on the Sync Box must be white or red. This indicates that the device is connected to the Network. If the LED is blinking blue, you need to setup the device using the official Hue Sync App.

Community discussion thread: Philips HDMI Sync API

Closes #10218

Credits

  • Marco Kawon: The code is based on his work - but the binding code was refactored/re-implemented. The refactoring is done to implement functionality step-by-step, so that I understand the code and in the hope to simplify it a bit to improve maintainability (and as a learning exercise for me).
  • Andrew Fiddian-Green: Code review and technical support/advice
  • April_Wexler (Kai): Testing

Tasks

  • ☠️ Binding skeleton created for org.openhab.binding.huesync
  • 🔎 skeleton mDNS discovery implemented
  • communication infrastructure
    • 🔎 mDNS device discovery - use API to get device information
    • 🔐 SSL Handshake & 🔎 Discovery
    • 🤝 Device registration
      image
    • 👋 Device unregistration (remove thing)
    • ⛔ solve timing problems during shutdown
    • 📜 improve handling of configuration update(s)
  • CI/CD & Code maintainability
    • ⛔ Fix CI validation errors
    • ⚠️ Fix PR CI validation warnings
    • 🗨️ check feasibility of re-using resources for log & exception messages ✅
    • 🗨️ check feasibility of using AuthenticationStore
  • 🔧 work in progress: Thing
    • 🔌 device status polling
      • 📦 Create device state DTO
        • 📦 Device status
        • 📦 HDMI input/output status
    • 🔧 work in progress: Channels
      • Create .channel xml declaration/poc for device information
      • Create .channel xml declaration prototype for HDMI input/output status
      • ➕ HDMI input/output channels (read only)
        image
      • 🔧 work in progress
        ➕ Create prototype to switch ambilight on off

ℹ️: The 1st version will not support all possible functions - as the basic setup can be done via the official App ➡️ - I'll focus on status information and commands that are most releveant for auromation in this PR.

@pgfeller pgfeller added new binding If someone has started to work on a binding. For a new binding PR. work in progress A PR that is not yet ready to be merged labels Mar 12, 2024
@pgfeller pgfeller requested a review from andrewfg March 12, 2024 23:12
@pgfeller pgfeller self-assigned this Mar 12, 2024
@pgfeller pgfeller requested a review from a team as a code owner March 12, 2024 23:12
@openhab-bot
Copy link
Collaborator

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/philips-hdmi-sync-api/111679/39

@pgfeller pgfeller force-pushed the 10218-hue-add-hue-sync-box branch 2 times, most recently from edf4eb7 to 565fc72 Compare March 12, 2024 23:41
Signed-off-by: Patrik Gfeller <patrik.gfeller@gmail.com>
Signed-off-by: Patrik Gfeller <patrik.gfeller@gmail.com>
Signed-off-by: Patrik Gfeller <patrik.gfeller@gmail.com>
Signed-off-by: Patrik Gfeller <patrik.gfeller@gmail.com>
Signed-off-by: Patrik Gfeller <patrik.gfeller@gmail.com>
Signed-off-by: Patrik Gfeller <patrik.gfeller@gmail.com>
… device

Signed-off-by: Patrik Gfeller <patrik.gfeller@gmail.com>
Signed-off-by: Patrik Gfeller <patrik.gfeller@gmail.com>
Signed-off-by: Patrik Gfeller <patrik.gfeller@gmail.com>
…formation

Signed-off-by: Patrik Gfeller <patrik.gfeller@gmail.com>
Signed-off-by: Patrik Gfeller <patrik.gfeller@gmail.com>
Signed-off-by: Patrik Gfeller <patrik.gfeller@gmail.com>
Signed-off-by: Patrik Gfeller <patrik.gfeller@gmail.com>
Signed-off-by: Patrik Gfeller <patrik.gfeller@gmail.com>
Signed-off-by: Patrik Gfeller <patrik.gfeller@gmail.com>
Signed-off-by: Patrik Gfeller <patrik.gfeller@gmail.com>
Signed-off-by: Patrik Gfeller <patrik.gfeller@gmail.com>
@andrewfg
Copy link
Contributor

@pgfeller I will start to look at this tomorrow.

@pgfeller pgfeller removed the request for review from maniac103 March 12, 2024 23:58
@pgfeller
Copy link
Contributor Author

@andrewfg Thanks! Take your time - progress will be slow unfortunately; as free time is a rare commodity ...

Signed-off-by: Patrik Gfeller <patrik.gfeller@proton.me>
…tation tasks

Signed-off-by: Patrik Gfeller <patrik.gfeller@proton.me>
Signed-off-by: Patrik Gfeller <patrik.gfeller@proton.me>
Signed-off-by: Patrik Gfeller <patrik.gfeller@proton.me>
Signed-off-by: Patrik Gfeller <patrik.gfeller@proton.me>
Signed-off-by: Patrik Gfeller <patrik.gfeller@proton.me>
Signed-off-by: Patrik Gfeller <patrik.gfeller@proton.me>
Signed-off-by: Patrik Gfeller <patrik.gfeller@proton.me>
…psulation to simplify null handling and annotation

Signed-off-by: Patrik Gfeller <patrik.gfeller@proton.me>
…... 🤔 - wip?

Signed-off-by: Patrik Gfeller <patrik.gfeller@proton.me>
Signed-off-by: Patrik Gfeller <patrik.gfeller@proton.me>
Signed-off-by: Patrik Gfeller <patrik.gfeller@proton.me>
…ration (wip)

- 💣 preparation for connection exceptions
- 📜 preparation for channel .xml's

BREAKING CHANGE:

Signed-off-by: Patrik Gfeller <patrik.gfeller@proton.me>
- current firmware (read only)
- available/latest firmware (read only)

📜 minor improvements and refactoring ... (wip)

Signed-off-by: Patrik Gfeller <patrik.gfeller@proton.me>
@pgfeller pgfeller force-pushed the 10218-hue-add-hue-sync-box branch from 5c6c239 to a4e7e94 Compare May 3, 2024 22:38
- keep firmware property and channel in sync
- README.md updated

Signed-off-by: Patrik Gfeller <patrik.gfeller@proton.me>
@pgfeller pgfeller force-pushed the 10218-hue-add-hue-sync-box branch from 186bd73 to 0549ac6 Compare May 7, 2024 19:55
📜 includes some refactoring (rename of classes and device status callback type)

Signed-off-by: Patrik Gfeller <patrik.gfeller@proton.me>
… 🔧 wip

🧹 Additional code clean up and refactorings to improve maintainability  (⚙️ including refactoring of background job handling)

Signed-off-by: Patrik Gfeller <patrik.gfeller@proton.me>
@pgfeller
Copy link
Contributor Author

@andrewfg Hi Andrew,

I hope you are fine!

I'm not sure if you're following the progress of the implementation from time to time. I've finished most of the infrastructure that I plan to use in the binding. Next I'll will implement the most important channels that are relevant for automation (this PR will not support all the available options the API provides).

I'm a little bit unhappy - as I do not manage to provide/declare all the relevant information in the .xml definitions to automatically create a nice semantic model. Is this a limitation (no problem - but then I can stop to investigate) ... - or do I miss something in the .xml structure?

I've found that there is an advanced configuration option in the UI to add channels from the equipment (very cool). I will use this in the readme to show how to structure things (here comments are also very welcome - as I'm still not familiar enough with the semantic types and properties etc ...

I think the biggest problem of OH is, that most people (including me) are not aware how powerful it is what it is capable of ... e.g. today I learned that it is possible to use f7 and other icons via advanced UI configuration ...

with kind regards,
Patrik

📜 includes also documentation updates in README.md

Signed-off-by: Patrik Gfeller <patrik.gfeller@proton.me>
@andrewfg
Copy link
Contributor

andrewfg commented May 18, 2024

I'm a little bit unhappy - as I do not manage to provide/declare all the relevant information in the .xml definitions to automatically create a nice semantic model. Is this a limitation (no problem - but then I can stop to investigate) ... - or do I miss something in the .xml structure?

I am not sure what you think is missing? Perhaps have a look at the example below..

https://github.com/openhab/openhab-addons/blob/main/bundles/org.openhab.binding.neohub/src/main/resources/OH-INF/thing/thing-types.xml

@pgfeller
Copy link
Contributor Author

Thank you for the example; I've also checked the .xsd definitions - but it seems that I've already added all the info I can. When the equipment/items are automatically created it does not look as nice as I would like to have it ... but that's not a huge problem. With the manual configuration I've added to the readme the representation in the model looks nice.

I'll keep it as is for the moment and continue with channel implementations to get functionality into the thing 🙂. I already use the alpha for some 1st simple automation tasks 👍.

Let me know if you see something I should change from a Java/openHAB framework perspective ... the infra is approaching its final shape; so I do not see any major gaps anymore in that area.

Signed-off-by: Patrik Gfeller <patrik.gfeller@proton.me>
…ure of the class in the name (dto)

Signed-off-by: Patrik Gfeller <patrik.gfeller@proton.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new binding If someone has started to work on a binding. For a new binding PR. work in progress A PR that is not yet ready to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[hue] Add Hue Sync Box
4 participants