Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

terRemote - Android remote app for EventGhost

Questions and comments specific to a particular plugin should go here.
mpg732
Experienced User
Posts: 92
Joined: Mon Aug 05, 2013 6:59 pm

Re: terRemote - Android remote app for EventGhost

Post by mpg732 »

[quote="terRemote"]@Mike:
Can you send me a screenshot via mail? I'm not sure if I understand the problem correctly.

I have no idea on how to take a screen shoot of my android.

Let me see if I can clarify, If I add my own custom icons and set the boarder to 0 it will not show the out lined boarder. If I create a button with nothing more then text showing "no icon" or if I create a button and use one of the supplied icons and set those to the same "design setting" used on the imported icons, the boarders will show. This is some thing that changed 2 updates ago.
r0lZ
Posts: 36
Joined: Thu Aug 08, 2013 7:00 am

Re: terRemote - Android remote app for EventGhost

Post by r0lZ »

OK, I've managed to have my web view Refresh button to work. I have had to modify the HTMP and the URL fields, and call the Reload method, in that precise order. It's not simple, but it works.

Now, I have another problem. I would like to enable/disable some widgets according to the current wifi state. So, I have created 2 macros. One that is called when the wifi is connected, and one when it is disconnected. Currently, they display simply a toast message. The problem is that I can't get them to work. Regardless of what I set in the SSID field, it seems that the macro is never called when I connect or disconnect the wifi. (I have tried * and .* without success.)

How is the wifi state event supposed to work? Is it triggered immediately when the defined wifi state becomes active? Should I use the "connected" and "disconnected" states? What should I type in the SSID field to match all wifi connections?
User avatar
terRemote
Experienced User
Posts: 183
Joined: Tue May 22, 2012 8:13 pm

Re: terRemote - Android remote app for EventGhost

Post by terRemote »

@Mike:
I can't reproduce the problem but I'll write you a mail when I get home. We should be able to fix it easily once we are on the same page ;)

@r0lZ:
Do the events "WiFi state - connected["some_ssid"]" and "WiFi state - disconnected" appear in the log? If not, you probably did not select the feature in the options.
Leaving the ssid field blank (without choosing the regex-option) makes the event be triggered by all ssids. You get the same effect if you enter ".*" WITH the regex option selected. I noticed that, if you want the event to be triggered by a certain ssid, you have to put the name in quotes, actually writing "some_ssid", not just some_ssid. I think this is a bug (maybe this makes sense but I don't remember why I should have put it this way on purpose...). However, when I just click on the "from log" button and select the connected-event (if it appeared there), everything is entered correctly and my macro is triggered.
Let me know how it goes.

Chris
r0lZ
Posts: 36
Joined: Thu Aug 08, 2013 7:00 am

Re: terRemote - Android remote app for EventGhost

Post by r0lZ »

Oh, sorry. The wifi feature was not ticked in the options. :oops:
Maybe I have been confused because it is necessary to restart terRemote when that option is changed. Anyway, everything is working fine now.

Note that I have restricted the detection of the wifi enabled to my home connection. It works with the SSID without quotes for me, and doesn't work in I add the quotes. IMO, it's perfect as it is here. Not sure why you have to put the quotes.


Now, I'm trying to use the ClipboardChanged event to capture the clipboard and send it to the PC, to sync the clipboard in the Android -> PC direction. (It works already fine in the other direction.) Currently, when the clipboard changes, the event triggers a macro that echoes the content of the clipboard to the log. It will be easy to encode it in base64 and send it to EventGhost, but I guess I will have an infinite loop. EventGhost will place it in the PC clipboard, and therefore trigger the ClipboardChanged message, and send it back to terRemote, that will place it in the Android clipboard, and be notified again. Of course, I need to break that infinite loop as soon as possible. In your opinion, what is the best method? Is it possible to compare the string with the current clipboard, and if it is equal, not place it in the clipboard? (I suppose it's possible in EventGhost, but I don't think it's possible in terRemote, as it cannot retrieve the clipboard content without being triggered by the network event. Right?) Another possibility would be to add a short pause after having send the message to EG. But I'm not sure the pause will be sufficient to forbid to process the message from EG.
Any pointer?
mpg732
Experienced User
Posts: 92
Joined: Mon Aug 05, 2013 6:59 pm

Re: terRemote - Android remote app for EventGhost

Post by mpg732 »

terRemote wrote:@Mike:
I can't reproduce the problem but I'll write you a mail when I get home. We should be able to fix it easily once we are on the same page ;)
Chris
I just uploaded my lay outs to the on line library. I labeled them as "home""apple tv"and "plastaion 3" If you take a look at the home layout you will see a few buttons with text "Lights" "AC" "fan Speed" before the update I did not see boarders around those buttons and now I do. You should also see a few added icons like the alarm clock, once I edited the design to boarder of zero, the boarders around that icon went away. Hope they show up for you.

Thanks
Mike
User avatar
terRemote
Experienced User
Posts: 183
Joined: Tue May 22, 2012 8:13 pm

Re: terRemote - Android remote app for EventGhost

Post by terRemote »

Perfect, Mike. I'll check. Mind if I publish the layouts? They look quite great.

r0lZ, I stumpled upon the same problem. Here's what I did:

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1610">
    <Folder Name="Clipboard sync" Expanded="True">
        <Macro Name="Send Clipboard On Change" id="331" Expanded="True">
            <Event Name="System.ClipboardChanged" />
            <Action>
                EventGhost.PythonScript(u'import base64\ntext = eg.WinApi.Clipboard.GetClipboardText();\ntext = base64.b64encode(text);\neg.plugins.NetworkSender.plugin.Send("clipboardchange", [text]);')
            </Action>
        </Macro>
        <Macro Name="Receive Clipboard Change From Android" Expanded="True">
            <Event Name="TCP.clipboardchange" />
            <Action>
                EventGhost.DisableItem(XmlIdLink(331))
            </Action>
            <Action>
                EventGhost.PythonScript(u'eg.WinApi.Clipboard.SetClipboardText(eg.event.payload[1])')
            </Action>
        </Macro>
        <Macro Name="Activate Clipboard sending" Expanded="True">
            <Event Name="System.ClipboardChanged" />
            <Action>
                EventGhost.EnableItem(XmlIdLink(331))
            </Action>
        </Macro>
    </Folder>
</EventGhost>
Just copy the code and paste into any folder in the EG tree.
There are three macros, one receives the clipboard change in Windows and forwards it to terRemote. Pretty basic.
The second one receives the event from terRemote and changes the clipboard but BEFORE it does this, it disables the previous macro. The clipboard change fires an event (as you noticed) but since the first macro is disabled, it is not triggered. Instead, the third macro is triggered which just enables the first one.

Honestly, I am quite proud of that solution :)
It does not use base64 in this version so you have to make some changes.

Best,
Chris
r0lZ
Posts: 36
Joined: Thu Aug 08, 2013 7:00 am

Re: terRemote - Android remote app for EventGhost

Post by r0lZ »

I see. Good idea, and thanks for sharing it. :-)

But currently, I'm stuck on another basic problem.
I have written my terRemote macro that gets triggered when the android clipboard changes. Here is its content:

Events:
Network event - ClipboardChanged

Actions:
Network event:
Type: EventGhost
Server: PC
Event: Clipboard.Set
Payload: Sbase64enc{${payload.0}}
Durable: off

The macro is correctly triggered when the clipboard content changes and the event is sent to EventGhost, but the problem occurs at the PC side. I guess EG should receive ONE Clipboard.Set event with the IP and the base64 encoded clipboard as arguments, but instead, it receives this:

Code: Select all

TCP. ['192.168.0.2', u'CiAgICAgICAgICDCsGdnZw==']
TCP.Clipboard.Set ['192.168.0.2']
It seems that it receives an unnamed event with the base64 clip, and a second event with the correct name but without the parameter.
I don't understand why there are 2 events. Can you explain what you did on the terRemote side to sent the clipboard to EG?


[EDIT]
I have modified the label of the event sent to EG to adopt your terminology and see if that changes something, but without luck. Your script is now called instead of mine, but I get an error. Here is the EG log:

Code: Select all

TCP. ['192.168.0.2', u'Z2dnZ2dnaA==']
TCP.clipboardchange ['192.168.0.2']
   Receive Clipboard Change From Android
      Disable: Send Clipboard On Change
      Python Script
         Traceback (most recent call last):
           Python script "5", line 1, in <module>
             eg.WinApi.Clipboard.SetClipboardText(eg.event.payload[1])
         IndexError: list index out of range
Obviously, the "double event" is the problem.
User avatar
terRemote
Experienced User
Posts: 183
Joined: Tue May 22, 2012 8:13 pm

Re: terRemote - Android remote app for EventGhost

Post by terRemote »

I totally forgot about that error. I fixed it but it will only be in the next version. The problem is that the Java function by default terminates the base64 with a new line and this is interpreted by EG in the way you experienced...

There is a workaround that works for short texts. Put "$base64enc{${payload.0}}clipboardchange" in the payload of the action and rename the event to something else. The last part of the string will be interpreted as the event name by EG. You will still get two events but the right one is one of them, the other can be ignored.

As I said, you will still have problems for longer strings. Are you a beta tester, yet? I'll put the fix in the new beta version which hopefully comes Friday.
r0lZ
Posts: 36
Joined: Thu Aug 08, 2013 7:00 am

Re: terRemote - Android remote app for EventGhost

Post by r0lZ »

Thanks. I'll wait for the fix. In the meantime, I'll try your workaround...

Yes, I'm a beta tester. But I haven't verified if I receive the betas from the Play Store. I suppose so, as I have installed a lot of updates recently.
mpg732
Experienced User
Posts: 92
Joined: Mon Aug 05, 2013 6:59 pm

Re: terRemote - Android remote app for EventGhost

Post by mpg732 »

Go ahead and publish those layouts, when I finish with the layouts I will repost them for you.
mpg732
Experienced User
Posts: 92
Joined: Mon Aug 05, 2013 6:59 pm

Re: terRemote - Android remote app for EventGhost

Post by mpg732 »

I do have a question, can we do a repeat on button press/hold?
r0lZ
Posts: 36
Joined: Thu Aug 08, 2013 7:00 am

Re: terRemote - Android remote app for EventGhost

Post by r0lZ »

mpg732 wrote:I do have a question, can we do a repeat on button press/hold?
Use a timer in the Action on press, and cancel the timer with the Action on release. Define what the button should do and the time interval (between shoots) in the timer itself. (The first Time value is the total duration of the timer, but if you cancel it with the action on release, it should be infinite, or at least very long. I use 1000000 ms.)
mpg732
Experienced User
Posts: 92
Joined: Mon Aug 05, 2013 6:59 pm

Re: terRemote - Android remote app for EventGhost

Post by mpg732 »

r0lZ wrote:
mpg732 wrote:I do have a question, can we do a repeat on button press/hold?
Use a timer in the Action on press, and cancel the timer with the Action on release. Define what the button should do and the time interval (between shoots) in the timer itself. (The first Time value is the total duration of the timer, but if you cancel it with the action on release, it should be infinite, or at least very long. I use 1000000 ms.)
Not home right now, but are you talking on terRemote side or Eventghost side? Who does a timer cause a repeat. To me a timer would just set a time to execute a command? LOL

Thanks
Mike
User avatar
terRemote
Experienced User
Posts: 183
Joined: Tue May 22, 2012 8:13 pm

Re: terRemote - Android remote app for EventGhost

Post by terRemote »

The timer has two kinds of actions, one that is executed when the timer runs out and one that is executed regularly every certain interval.
e.g, you can put the interval to 1000, then the interval action is executed every second until the button is relased. The answer by r0lZ is absolutely correct. Don't forget to give a unique id to your timer so that you can cancel it programmatically.
mpg732
Experienced User
Posts: 92
Joined: Mon Aug 05, 2013 6:59 pm

Re: terRemote - Android remote app for EventGhost

Post by mpg732 »

Thanks, so then it is on the remote end. LOL
Post Reply