-
Notifications
You must be signed in to change notification settings - Fork 2
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
how can I add custom actions to ambit? #4
Comments
hello @jafny -- this is a completely reasonable question! the callback system is not quite as extensible/modular as i'd like and requires modifying a few different parts of the core ambit code in order to add a new native action. this is suboptimal and will require you to maintain patches against ambit and possibly deal with merge conflicts as the core code evolves. however, for posterity, the places are:
in the meantime, your best bet might actually be to use the executeCommand action is documented at https://github.com/khimaros/ambit/blob/master/docs/CONFIG.md#executecommand and usage would look something like:
with the accompanying external program at https://github.com/khimaros/ambit/blob/master/example/scripts/temperature.sh if you are interested in writing native modules in python or |
i can envision a few ways to support defining custom actions in ambit, i'm interested to hear your thoughts on these. regardless, i'd like the end result to support using custom external actions in the layout like:
option 1: enable plugins in config filethis would allow loading of modules entirely from the config and would not require writing any python code except for the module. it would also make it easier to use community made modules. loading the plugin in the layout config would look like:
and the module itself would look like:
option 2: subclass ambit controllerthis option would require creating a new main entrypoint like
option 3: register callbacks procedurallysame limitations as option 2.
arguably, we could have some combination of these, but curious which you'd prefer. in terms of ease of implementation for me, the order would be: option 3, 2, 1 |
Sorry for the delayed response! If I am picturing the easy option 3 I think it will work well for my use case. At it's most basic, I want to create a method of interfacing with a websocket API where an ambitt powered MonogramCC is my UI. If I can write all my websocket interactions as modules, and then use the proposed "register_external_action" callback to inject that into a button push or knob dial....that feels like it would work great. |
@jafny thank you for the feedback. i just want to confirm: does |
Let me start by saying thanks for this great repo, really excited to play around with it! One question I have is where can I register callbacks to execute when I get an Input? I see that I can use actionmaps for the executeCommand action when I receive input...but I was curious where I can define those callbacks.
Such as the below example:
"rotation_left": { "action": "adjustTemperature", "behavior": "delta", "invert": true }
Where can I define what the adjustTemperature string argument maps to a callback function?
The text was updated successfully, but these errors were encountered: