Seitenhierarchie

  Wiki Navigation

    Loading...


 Recently Updated


 Latest Releases

 MediaPortal 1.32
            Releasenews | Download
 MediaPortal 2.5
            Releasenews | Download


Table of Contents

Overview

Controlling your lights and electronics when you receive a phone call.

Introduction

It’s not in the spirit of this guide to require the user to manually pause the movie and turn on the lights when receiving a phone call. The software needed to automate this is called EventGhost for Android. It can also be a remote control for the HTPC, loading different layouts depending on the software currently running but for now we will use it as an event trigger on incoming phone calls.

Installation and Configuration

  1. In EventGhost on the HTPC, add plugin Network Event Receiver to Autostart and set a password (already done if you followed Step 4 - Add MediaPortal to the equation).
  2. Install EventGhost for Android on the Android device. Tap Menu / Options / Add New in the EventGhost Server section. Enter the HTPC host and remember to create an exception in the firewall if needed.
    The Android device can connect to your HTPC over 3G or Wi-Fi. You might not want the phone to send events to the HTPC when you’re not home but also rather not have the Wi-Fi powered on all day. Perhaps install an app like Tasker which will automatically turn on Wi-Fi and connect to your network when the phone is near home.
  3. In the Basic Settings section tap Manage Plugins, long tap Android Events and tap Configure. Select the events to pass on to EventGhost on the HTPC: Incoming and outgoing phone calls, incoming SMS and battery status.
     
    Now there will be an event triggered (TCP.PhoneState.RINGING ['<ip address>', u'<phone number>']) at EventGhost on the HTPC when receiving a call. This event should trigger the Tellstick “Lights on” macro and send a pause to MediaPortal.
  4. To pause MediaPortal from EventGhost we’ll simply send a Space character to MediaPortal.exe. Add Macro > Window > Find a Window, be sure to have MediaPortal running and select MediaPortal.exe.
     
    The Find a Window action will make the next action be sent to MediaPortal.
  5. Next select Add action > Window > Emulate Keystrokes and insert Space as a special key ({Space}).
     
    There is a flaw to just sending a space character to MediaPortal on incoming call and that is if you already paused a video and receive a call. It will then start playing the video and pause again when hung up. There’s a couple of ways around this, for example you could let eventTrigger disable the incoming call trigger when pausing a video. See the sample configuration below.
  6. This macro should be triggered by an incoming phone call. Make sure Log only assigned and activated events is unchecked, call your Android phone and hang up. Drag and drop the ring event (TCP.PhoneState.RINGING) to the pause macro created in the previous step.
  7. In addition to sending pause to MediaPortal, we also like to turn the lights on but only if the sun is down. Select Add Action > SunTracker > Sunstate with weather compensation. Select a value for weather compensation, for example 60 min. This action will return True if the sun is up and False if it's down. We can use this value in a Jump action. Select Add Action > EventGhost > Jump. If: last action was unsuccessful Jump to: choose the TellStick: Turn on Lamp 1 that you created in Step 3 - Replace TelldusCenter.
  8. Repeat step 4 - 6 for a macro that will unpause MediaPortal and turn the lights off again. Instead of TCP.PhoneState.RINGING event you need to add TCP.PhoneState.IDLE and the Jump action should instead jump to TellStick: Turn off Lamp 1.
  9. As a bonus we could show the calling phone number on-screen. The number is stored in a variable called eg.event.payload[1]. Select Add Macro > EventGhost > Python Command and copy+paste the following code:
    eg.plugins.EventGhost.ShowOSD("Incoming call: " + eg.event.payload[1], u'0;-24;0;0;0;700;0;0;0;1;0;0;2;32;Tahoma', (255, 255, 255), (0, 0, 0), 4, (0, 0), 1, 7.0, True)
    Add the event TCP.PhoneState.RINGING to make this macro be triggered by the incoming phone call.
     
    The eg.plugins.EventGhost.ShowOSD function takes the following arguments: osdText, fontInfo, textColour, outlineColour, alignment, offset, displayNumber, timeout, skin.

    Check out EventGhost plugin Growl for other styles of OSD.

 

Sample Configuration

Here’s what the complete EventGhost configuration looks like:

  1. All plugins in the Autostart section will run in the background when EventGhost launches. The SunTracker plugin will generate on and off events at sunset and sunrise. The SunTracker action contains the settings and should also be Autostarted. The TellStick plugin enables control of remote sockets and the Network Event Receiver will listen for communication from an Android device.
  2. This macro will be triggered by four different events: Main.Electronics ON (generated by SunTracker) and Video.Pause/Stop/End (generated by eventTrigger). The TellStick: Turn on Lamp 1 action will turn the lights on by using a TellStick USB device.
  3. This macro will be triggered by an incoming phone call on the Android device (generated by EventGhost for Android). The Find Window action will make sure that the Emulate Keystrokes action is sent to MediaPortal, even if it's not in focus. Sunstate with weather compensation will check if the sun is up (successful) or down (unsuccessful) and jump to Turn on Lamp 1 only if the sun is down.
  4. Shows the calling number on screen.

 

Attached is the EventGhost xml configuration listed above. Don't forget to set a password in the Network Event Receiver plugin if you download this file.

MediaPortalSunTracker.xml

Troubleshooting

  • There might be a situation where the Wi-Fi connection is put to sleep as the phone is locked. When it rings the Wi-Fi is not turned on quickly enough and the message is not received by the HTPC. The solution is to disable the Wi-Fi sleep policy by opening Settings -> Wireless & networks -> Wi-Fi settings -> Advanced -> Wi-Fi sleep policy -> Never.
  • EventGhost's On Screen Display seems to have trouble displaying over videos in MediaPortal if VMR9 Exclusive Mode is selected as Video Renderer. It may be visible for a split second and then disappear. Try disabling Exclusive Mode but be aware that it may lead to tearing.

   

 

This page has no comments.