Repository navigation
feat: add Set Host action and host variable - #123
Conversation
Allows the Ember+ provider the module connects to be changed at runtime from a button, rather than only through the config UI, so a single Companion instance can be retargeted between providers. The new host is persisted with saveConfig so it survives a restart, and any Bonjour selected device is cleared as it would otherwise take precedence. The connection host is exposed as the 'host' variable. Co-authored-by: Cursor <cursoragent@cursor.com>
|
LGTM, @phillipivan do you have any feedback? |
|
Sorry I missed this, busy week. Since this is an unusual feature for a companion module - what is the use case where this a preferable option to adding additional ember plus connections? However, assuming there is a good case for this feature - I think it must also include the ability to set the port, since not all ember providers use port 9000 (including Companion!), and for some devices it is configurable, so even moving from like to like connection might not be on the same port. |
| subscribe: subscribeParameterAction(self), | ||
| }, | ||
| [ActionId.SetHost]: { | ||
| name: 'Set Host', |
There was a problem hiding this comment.
Suggest drop down to set hostname, port or both. with host and port options exposed via isVisibleExpression
There was a problem hiding this comment.
I don't think it makes sense to have this as a dropdown since the point of the feature is to set it programatically
There was a problem hiding this comment.
What I mean is a drop down to chose between setting host only, port only or host and port.
|
The core goal is to standardize dynamic control surface assignment across all our modules. In a multi-gallery broadcast environment (say, 5 or 6 control rooms), each physical position usually stays fixed with its own hardware and Buttons setup. However, the actual show or resources that position needs to control changes depending on the production. Instead of remapping layout or changing positions inside Buttons, we handle this at the module level. We have buttons that set these connection strings to the correct address and or port. This makes the setup very flexible and professional. I am actually hoping to get something like this into the Companion and Buttons software to be able to do this directly on the connections instead of building it into each module. But I guess that is further out. |
|
Thanks for explaining. Can I ask why not just change pages on the surface? I can imagine the companion project as a whole would have some reticence to implement a feature like this as for some modules it's not likely to work very well - but is a whole other discussion. Even with this module, changing connection to a dissimilar device is likely to leave all actions, feedbacks, and variables broken; or at least behaving in an unexpected manner - depending on the structure of the ember tree. |
|
The goal is to build the shell of the pages once and reuse them for all galleries. We have 7 or more galleries that all need these buttons. And the pages would add up fast and be a nightmare to maintain. Not sure how much you have worked with Buttons but they have a concept of Shared sections and Positions that have Position variables for doing these things. They will implement some solution for this in Buttons going forward but it will take some time. Changing the connection string is fine as long as we run the destroy and reconnect correctly. We have done this in production with the Mosart module I made for a long time. |
The Set Host action now allows changing the connection port independently or together with the host. Either field can be left empty to preserve the current value. Added validation for hostnames/IPs and port numbers, a Learn button to reset to current config, and exposed the configured port as the `port` variable.
Disable emberplus-connection's internal 5s auto-reconnect and handle retries in the module with exponential backoff (5s → 60s, reset on connect). Stop discarded clients from retrying forever, and treat a connect() timeout (resolved Error) as a failure.
|
Hi! While working on this module I found a reconnect problem when the Ember+ device is unreachable: Already on master: emberplus-connection retries every 5s forever. connect() resolves with an Error on timeout instead of rejecting, so the module never sees the failure. Also, discard() doesn't stop the library's retry timer if the socket never connected, so every host or port change leaves a client behind that keeps retrying. I have a fix on feature/set-host-action: the library's own retries are turned off and the module reconnects with backoff (5s → 60s, back to 5s once connected). |
…action # Conflicts: # package.json
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. Thanks for integrating Codecov - We've got you covered ☂️ |
|
Please split the reconnect fix into a seperate PR. There have been some changes to the base ember+ library connection handling, plus I am working through some bug fixes on that library, and I'd like to see where this fix sits after all that is complete; but there is no reason for the feature to wait in that. |
Allows the Ember+ provider the module connects to be changed at runtime from a button, rather than only through the config UI, so a single Companion instance can be retargeted between providers.
The new host is persisted with saveConfig so it survives a restart, and any Bonjour selected device is cleared as it would otherwise take precedence. The connection host is exposed as the 'host' variable.