-
Notifications
You must be signed in to change notification settings - Fork 14
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
Examples for how to call aioharmony from within Python #23
Comments
See main.py. It pretty much shows how to use each functionality. |
Sorry, but I can't figure this out. Here is what I am trying to do - just start an activity on a given hub. Here is the code that I have tried, but it says it can't find get_client in module aioharmony. What am I doing wrong?
|
I would also like some examples on using it within python. It isn't as straightforward how to use the library |
First of all, this is using asyncio so you can't just do To start an activity you use: Notice how it needs an activity_id. To get the activity_id (for example for "Watch TV") you retrieve it using:
Thus the program would be:
If you would want to use the methods in
Hope this helps a bit. |
This was perfect! Thank you so much. I got it working! Great work |
One last question, how does the hub.send_command() work. I assume there needs to be a way to send a command to a specific device. |
Look at send_command in send_commands expects an argument of SendCommand or a list of SendCommand (in case multiple commands are to be sent). Overall as arguments it expects a device_id, command, and delay. What you could do is update main.py and do like print statements in there or so (or run it through debug) to see |
I am still having problems getting the package to work from within my Python programs. I tried this but it gives me a self is not defined error.
I have also tried changing the self argument to kitchen_hub but that doesn't work. Anyone have any ideas on how to fix this? |
The documentation shows how to call this from the command line, as in:
python3 aioharmony --harmony_ip 192.168.1.203 show_current_activity
but how would I do this from within Python? Is it possible to get an example working .py file to do stuff like showing activities, starting activities, powering off a hub, etc? What do I import and how do I call the functions, etc
The text was updated successfully, but these errors were encountered: