Example: Getting Volume Information

We will now learn how to retrieve and display information from the computer. In particular, we want the seekbar of the previous tutorial to always show the correct volume, also when we change it by hand. For this we assume that you have created the seekbar from the previous Tutorial (or a similar one).

Preparations

In terRemote, the option "Receive Network Events" must be activated.
Also, you have to configure the incoming server and set the port (default is 1024) and a password.
If you haven't done so, go to EventGhost and add the Plugin "network sender".
Enter the IP of your phone and the password that have given in the previous step.
You are now able to send data from EventGhost to your device.

The EventGhost Part

When you change the volume on your computer, EventGhost receives an Event "System.Volume" with the new volume level as payload.
We will use this event to send its data to your device. Create a macro with action "Python script" and add the following line: 'eg.plugins.NetworkSender.plugin.Send("System.Volume", [str(eg.event.payload)])'
Add the event to the macro via drag and drop. It should now look as in the picture.
Having this, you should see an event in the terRemote log every time you change the volume on the computer.

The terRemote part

Create a Macro and add the Network Event "System.Volume". You can also easily add it from the event log. Add an action "Change Widget", enter the name of the internal identifyer of your seekbar (here: "System.Volume") and enter the value "${payload.0}".
The result should look like this:
Voila! Every time you change the volume at the computer, the seekbar changes its value to the correct one. Note: The official System layout uses some other tricks to ensure that the seekbar is also reset whenever the layout is started. It also controls the look of the mute button. Have a look at this to get into these more elaborate techniques.