If you missed part one, I strongly recommend that you check it out. This is part 2 of my tutorial series on controlling your PC from your Android device via Tasker + EventGhost. Part 1 described in detail how to setup the integration between your PC and your Android phone. In this article, I will show you how a volume control method to allow your phone to control your PC's volume level.
Control your PC with Tasker: Part 2 – Volume Control
EventGhost
We are going to start by setting up a new folder for volume controls in EventGhost. These work in a similar way to the power menu we made in Part 1, but will be changing the volume levels on our PC instead of triggering power events. Just as before, an AutoRemote message will be received by EventGhost when we tap on a notification on our phone. A reply message is sent back and the volume is set to the desired value.
Feel free to modify the steps and values. Each message sent to the mobile starts with pc=:= so it could be intercepted by the previously created AutoRemote profile. Values are entered after v, simply because I'm lazy. Feel free to split the variable to get the correct format for the volume (more on that below).
The only unique task in EventGhost (as compared to the previous tutorial) is intercepting the volume change. Use the system volume trigger and this will store the message inside the {eg.eventpayload}. Then send this message to Tasker via AutoRemote with the pc=:=v prefix (p=:=v{eg.event.payload}).
Tasker PC Control Volume Menu
The idea is rather simple. I'm creating a notification that will allow me to set a predefined system volume, or mute the sounds all together. While a slider would be nice to allow for continuous volume levels, due to how EventGhost handles things, it's more trouble than it should be to implement this.
If you followed the previous tutorial, you will see that this step is fairly easy. The good news is other menus will be easy to add as well. This is the main benefit of going through the framework set up in Part 1. Once you know where things should be added, it becomes really fast to keep building on this.
You can still use the same template notification to add new Sub-Menus, but you still have to modify it. The default notification that we always retreat to will be the one from the previous tutorial as well.
Open Sub-Menu Profile/ SubMenu Open
Create a new notification and link it to the IF %ancomm ~ openvolume. If the volume icon from the first row is pressed – this action will be called.
Notification is configured as follows:
- Buttons – as per your liking, make sure the first row is consistent.
- Actions – the first row starts with open (see template) but the volume menu icon should have openclose action assigned instead. The second row has actions ending with ''…pc". I used mutepc,lowvpc,medvpc,highvpc.
- Color – only a second color should be different.
- Prefix for actions – buttontwo
SubMenu Actions/Send AR
Since the framework is already done, we don't need to add anything else. All that hard work from the part one finally paid off.
PC Feedback/Notification
EventGhost will issue a reply when the volume is changed from the PC or through our volume menu. To simplify the process (you can go nuts) the AutoRemote message is sent in this form: pc=:=v(value). This means that we have to intercept all the messages starting with (regex)v.*
In a similar way to the power menu, I'm creating a variable %PcVolume and simply setting the value of it to %arcomm. The value will get assigned to the default notification. At this stage go and update the default notifications (the ones that have only 4 icons) with this variable. Each notification should have %PcPowerontime and%PcVolume in the text field.
Download and Import
As always, I am providing a download link to the Tasker project file you can download and import. Download the below .prj.xml file and save it anywhere on your internal storage. Open Tasker and disable Beginner Mode in Preferences. Then, back at the main screen, long-press on the home icon in the bottom left corner. You should see a pop-up with an "import" option. Select that and look for the project file you just saved and select it to import. If successful, you should now see a new tab/icon at the bottom that contains all of the Profiles and Tasks that we mentioned in this article.
Download the PC Control Tasker Project from AndroidFileHostIn addition, you will need the Material Design Icons that I used in this project. Simply download the below zip file and unzip the folder to the root directory of your internal storage.
Download the Material Icons pack from AndroidFileHostFinally, here is the configuration file for EventGhost that you can import.
Download the EventGhost configuration filePlease note that I've removed my AutoRemote API key from the configuration file. You'll need to enter your own to make this work.
Thanks for being so patient, and I hope you found this tutorial useful. In the next tutorial, we will focus on a bookmark/favorite application menu and in part 4 some screen controls. I will also add a few more case uses for the notification to get you started on your own project.
from xda-developers http://ift.tt/2mJkSvL
via IFTTT
Aucun commentaire:
Enregistrer un commentaire