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

Q/FR: RESTFul API? #542

Open
shanemcw opened this issue Sep 8, 2024 · 5 comments
Open

Q/FR: RESTFul API? #542

shanemcw opened this issue Sep 8, 2024 · 5 comments

Comments

@shanemcw
Copy link

shanemcw commented Sep 8, 2024

Question:

Is there a current way to also provide control through the central Homebridge web API? I'm experiencing most Homebridge devices can be controlled through a PUT to /characteristics, but WebOS TV plugin accessories are not present in that JSON. Apologies for any ignorance here—I see the documentation of that central API was removed at the Homebridge level.

Feature request:

If not, humbly submitting a feature request for a RESTful API, similar to plugins providing RESTful at the plugin level, e.g. homebridge-xbox-tv.

@merdok
Copy link
Owner

merdok commented Sep 8, 2024

Sorry, i do not quite understand what you mean. If you need direct access to the Tv you can use the cli commands, which allow you to control the tv straight from the terminal.

@shanemcw
Copy link
Author

shanemcw commented Sep 9, 2024

Thanks, merdock, for your quick follow-up and question!

With my thanks again and to answer your question a bit more, the RESTful web API is used by other systems that most likely don't have access to the system terminal shell (e.g. CLI for example) to communicate and control due to security. Homebridge in of itself provides a RESTful web API, allowing a query of (most) accessories exposed by the installed plugins and their characteristics via GET and control of those accessories' characteristics (most) by a PUT.

My use case is central control software (home grown) that integrates home control across various protocols (e.g. X10, Homekit) and data sources (e.g. weather) and other systems—providing a level of conditional automation not supported by HomeKit.

Most plugins' accessories and their characteristics are exposed by Homebridge, e.g. in my setup: switches and state, window blinds and position, fans and speeds, door sensors and state, occupancy sensors and state, lights and light color, thermostats, etc. —I have 42 Homekit accessories in my setup with instances of these for my home at the moment. For most of these, they can be controlled via Homebridge's native out-of-the-box web API. An example that is reported by the API but cannot be controlled by Homebridge's native RESTful web API are buttons (stateless switches)—they can be queried, but they don't expose a "state" that can/will be set to virtually "push" the button. For this, a custom API (via a plugin) needed to be created to allow stateless switches (buttons, e.g. "Amazon Dash Button") to be "pushed" virtually via API.

There are some devices exposed to Homekit by Homebridge plugins of a certain category that are not exposed via Homebridge's native RESTful web API. Looks like "TV" devices are of this category. Examples include yours and homebridge-xbox-tv. The author of homebridge-xbox-tv has added RESTful web API interface functionality to their plugin to compensate (and as was done for the button plugin mentioned above).

This is where my question and feature request is coming from. I hope this makes a bit more sense! Understood if this is functionality not planned for a feature roadmap!

Thanks for your time and thanks again for your quick follow-up!

@merdok
Copy link
Owner

merdok commented Sep 9, 2024

Thanks for the explanation. I have unfortunately no knowledge about the homebridge rest api service so I would first need to read myself into that topic...
I will be quite busy in the next time and I am not sure if I will be able to do it soon, but if someone with that knowledge could create a pull request then it would help here.

@shanemcw
Copy link
Author

Thanks merdok for your reply! When I get a chance, I'll look into the code!

A bit of background follow-up about "CLI":
"CLI" is running homebridge in the terminal instead of as the UI. The functionality in this ticket is inquiring/sending remote commands to/in parallel to the UI-based installation.

Thanks again!

@merdok
Copy link
Owner

merdok commented Sep 11, 2024

The ui should also update and sync when you send a cli command

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