-
Notifications
You must be signed in to change notification settings - Fork 145
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 OMOTE Hub #100
base: main
Are you sure you want to change the base?
Conversation
…r commands twice.
// Show the message in the UI | ||
showEspNowMessage(jsonStr); | ||
|
||
// TODO: Process the command based on device and command |
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.
This is more of a stub for 2-way communication with the hub
struct CommandExecutionParams { | ||
uint16_t commandId; | ||
CommandExecutionType commandType = CMD_SHORT; | ||
std::string additionalPayload = ""; | ||
}; |
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.
Let me know what you think of CommandExecutionParams
. I've really been enjoying structs in my cpp programming.
This was largely driven by wanted to have the commandType
so the hub can send different commands based on the key press type.
inline void execute_hub_command(uint16_t command, CommandExecutionType type = CMD_SHORT, const std::string& additionalPayload = "") { | ||
CommandExecutionParams params; | ||
params.commandId = command; | ||
params.commandType = type; | ||
params.additionalPayload = additionalPayload; | ||
executeCommand(params); | ||
} |
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.
This will allow us to send hub commands from scenes, like scene_allOff.cpp
. Ex:
#if (ENABLE_HUB_COMMUNICATION == 1)
execute_hub_command(LGTV_POWER_OFF);
execute_hub_command(APPLETV_POWER_OFF);
execute_hub_command(SONYAVR_POWER_OFF);
#else
executeCommand(SAMSUNG_POWER_ON);
delay(500);
...
#endif
Thanks @Stuckya for this PR. Some more thoughts:
|
Yes, I have some rough notes but need to sit down and spend time on documentation. Should I share the markdown over Discord?
I don't have a super strong opinion here and we might want to consult @CoretechR too.
I like the monorepo approach because it is easier for the user. They don't have to worry about cloning multiple repos to get started. That said, I do think multiple repos can work well if there is a Github "Organization". This also helps with managing access for multiple core-contributors. Which would look something more like:
|
What about sharing it here? Everything at one single place.
The only concern I have that you will use completely different technologies for the different directories. For a professional, it is no problem having Java, Angular, docker-compose and whatever all in the same repo. But here, some people already struggle using only PlatformIO for compiling and uploading the firmware to the ESP32. I haven't seen the hub code until now and how it works, maybe we can discuss this later.
That looks interesting. @CoretechR ? |
@KlausMu I have not looked into it in detail, but a GitHub organization seems like a good fit for open source projects like this. We could also split the project into hardware and software repos. But all of that should be thought through well. |
@@ -21,40 +21,55 @@ extern "C" | |||
#define OMOTE_LOG_LEVEL CONFIG_OMOTE_LOG_DEFAULT_LEVEL | |||
#endif | |||
|
|||
// Include the Arduino layer for all platforms |
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.
What is the change in file omote_log.h good for?
First I thought changing from Serial.printf to printf for linux would solve the problem with the delayed log messages when running the application with the upload button. But it didn't solve it.
@@ -21,40 +21,55 @@ extern "C" | |||
#define OMOTE_LOG_LEVEL CONFIG_OMOTE_LOG_DEFAULT_LEVEL | |||
#endif | |||
|
|||
// Include the Arduino layer for all platforms |
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.
How is the change of this file related to the original PR "Support for OMOTE Hub"?
I would like to keep changes separate, to finish each one as soon as possible.
Currently I am afraid that closing the PR "Support for OMOTE Hub" still needs some time, so other changes should be in separate PRs.
Did you see that the PR still does not compile?
|
OMOTE Hub
The goal of this PR is to send commands to a hub instead of sending IR commands directly from the remote.
The hub consumes messages and is responsible for communicating with the devices.
Currently, the OMOTE hub is written in Python and can be run on any linux machine (in my case a Raspberry Pi 4).
Hub transports
Communication between the remote and the hub follows a pub/sub pattern. This allows us to easily swap transports on both the remote and the hub depending on user preference, hardware availability, and use-case.
Contract between hub and remote
The remote emits
RemoteEvent
's, the hub subscribes to these events. The data contract is simple yet expressive (remember we have a 250 byte payload cap if using ESP-NOW).Currently the hub doesn't communicate 2-way, though this is something I'd like to enable soon. For example, I'd love to display the audio level from an AVR or "What's Playing" information on the remote.
The hub will likely emit something like
HubFeedbackEvent
's.The Hub
The hub primarily supports RS-232 and IP Control (HTTP) transports for different devices. I'd like to explore IR emitters and Bluetooth in the near future. I've found controlling IR emitters from Python to be challenging in my tests thus far and might need help.
I'll be opening a separate PR shortly which adds a new directory containing the hub software with more details on functionality.