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.

AutoRemote EventGhost plugin:EG->Android and Android->EG

Questions and comments specific to a particular plugin should go here.
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: AutoRemote EventGhost plugin:EG->Android and Android->EG

Post by Pako »

Sorry, I incorrectly tried.
I still have to continue.

Pako
joaomgcd
Posts: 17
Joined: Tue Oct 02, 2012 9:42 pm

Re: AutoRemote EventGhost plugin:EG->Android and Android->EG

Post by joaomgcd »

Thank you very much.

I appreciate it.
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: AutoRemote EventGhost plugin:EG->Android and Android->EG

Post by Pako »

I finally found out, where the next (and main) problem.
The module "pickle" can not handle the class "AutoRemoteDevice" (which is stored in the argument "devices").
It can be solved in different ways.
The easiest way is to use an ordinary class tuple or dictionary.

Pako
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: AutoRemote EventGhost plugin:EG->Android and Android->EG

Post by Pako »

Here is one possible way that required minimum modifications.

Pako
Attachments
__init__.py
(28.16 KiB) Downloaded 313 times
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: AutoRemote EventGhost plugin:EG->Android and Android->EG

Post by Pako »

Sorry, now I fixed a small bug. :oops:

Pako
Attachments
__init__.py
(28.16 KiB) Downloaded 375 times
joaomgcd
Posts: 17
Joined: Tue Oct 02, 2012 9:42 pm

Re: AutoRemote EventGhost plugin:EG->Android and Android->EG

Post by joaomgcd »

Pako, I have to say, AWESOME!! :mrgreen:
Your latest version works as expected, thanks so much.

Any idea why pickler doesn't correctly support the AutoRemoteDevice class?

Anyway, now I want to keep backwards compatibility with the previous version so I changed

Code: Select all

self.devices = [AutoRemoteDevice(*i) for i in devices]
to

Code: Select all

if len(devices) > 0:
            if(isinstance(devices[0], AutoRemoteDevice)):            
                self.devices = devices
            else:
                self.devices = [AutoRemoteDevice(*i) for i in devices]
But there's just one problem: if a user doesn't open and save the AutoRemote plugin configuration at least once after using this version, they will still get the error because EventGhost still wouldn't use the tuple instead of the AutoRemoteDevice object.

Any way to force EventGhost to save the plugin's configuration without the user manually going into the plugin settings dialog and clicking "Ok"?

Again, thank you very much for your support. :D
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: AutoRemote EventGhost plugin:EG->Android and Android->EG

Post by Pako »

joaomgcd wrote:Any idea why pickler doesn't correctly support the AutoRemoteDevice class?
I do not know.
You've read the documentation?
joaomgcd wrote: But there's just one problem: if a user doesn't open and save the AutoRemote plugin configuration at least once after using this version, they will still get the error because EventGhost still wouldn't use the tuple instead of the AutoRemoteDevice object.

Any way to force EventGhost to save the plugin's configuration without the user manually going into the plugin settings dialog and clicking "Ok"?
You can do it (simply) like this:

Code: Select all

        if len(devices) > 0:
            if(isinstance(devices[0], AutoRemoteDevice)):           
                self.devices = devices
                trItem = self.info.treeItem
                args = list(trItem.GetArguments())
                args[3] = [AutoRemoteDevice(*i) for i in devices]
                eg.actionThread.Func(trItem.SetArguments)(args)        
                eg.document.SetIsDirty()
                eg.document.Save()
            else:
                self.devices = [AutoRemoteDevice(*i) for i in devices]
        self.port = port
        self.publicIp = publicIp
        self.dname = dname
        self.server = MyServer(RequestHandler, port)
        self.server.Start()

    def __stop__(self):
        self.server.Stop()
Or a little more complicated as follows:

Code: Select all

        if len(devices) > 0:
            if(isinstance(devices[0], AutoRemoteDevice)):           
                self.devices = devices
                trItem = self.info.treeItem
                args = list(trItem.GetArguments())
                args[3] = [AutoRemoteDevice(*i) for i in devices]
                eg.actionThread.Func(trItem.SetArguments)(args)        
                eg.document.SetIsDirty()
                wx.CallAfter(self.SaveConfig)
            else:
                self.devices = [AutoRemoteDevice(*i) for i in devices]
        self.port = port
        self.publicIp = publicIp
        self.dname = dname
        self.server = MyServer(RequestHandler, port)
        self.server.Start()


    def SaveConfig(self):
        from eg.Classes.Document import SaveChangesDialog
        dialog = SaveChangesDialog(eg.document.frame)
        result = dialog.ShowModal()
        dialog.Destroy()
        if result == wx.ID_YES:
            eg.document.Save()


    def __stop__(self):
        self.server.Stop()
Note: untested

Pako
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: AutoRemote EventGhost plugin:EG->Android and Android->EG

Post by krambriw »

Dear Pako,
This is absolutely a wonderful solution and information, very useful generally indeed. I will remember this for future.
Once again, thank you

Very best regards, Walter
joaomgcd
Posts: 17
Joined: Tue Oct 02, 2012 9:42 pm

Re: AutoRemote EventGhost plugin:EG->Android and Android->EG

Post by joaomgcd »

Thanks again Pako.

Unfortunately EventGhost hangs at

Code: Select all

eg.actionThread.Func(trItem.SetArguments)(args)  
and eventually times out with this error:

Code: Select all

      Traceback (most recent call last) (1582):
        File "C:\Program Files\EventGhost\eg\Classes\ThreadWorker.py", line 326, in __DoOneEvent
          self.HandleAction(action)
        File "C:\Program Files\EventGhost\eg\Classes\ThreadWorker.py", line 289, in HandleAction
          action()
        File "C:\Program Files\EventGhost\eg\Classes\ThreadWorker.py", line 62, in __call__
          self.returnValue = self.func(*self.args, **self.kwargs)
        File "C:\Program Files\EventGhost\eg\Classes\EventThread.py", line 142, in StartSession
          actionThread.Func(actionThread.StartSession, 120)(filename)
        File "C:\Program Files\EventGhost\eg\Classes\ThreadWorker.py", line 214, in Wrapper
          raise Exception("Timeout while calling %s" % func.__name__)
      Exception: Timeout while calling StartSession
Any ideas?
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: AutoRemote EventGhost plugin:EG->Android and Android->EG

Post by Pako »

Ah, so we have to do it a little differently.
And anyway there was another bug ...

Automatic method:

Code: Select all

        if len(devices) > 0:
            if(isinstance(devices[0], AutoRemoteDevice)):           
                self.devices = devices
                wx.CallAfter(self.SaveConfig, devices)
            else:
                self.devices = [AutoRemoteDevice(*i) for i in devices]
        self.port = port
        self.publicIp = publicIp
        self.dname = dname
        self.server = MyServer(RequestHandler, port)
        self.server.Start()


    def SaveConfig(self, devices):
        trItem = self.info.treeItem
        args = list(trItem.GetArguments())
        args[3] = [(i.name, i.url, i.key) for i in self.devices]
        eg.actionThread.Func(trItem.SetArguments)(args)       
        eg.document.SetIsDirty()
        eg.document.Save()


    def __stop__(self):
        self.server.Stop()
Interactive method:

Code: Select all

        if len(devices) > 0:
            if(isinstance(devices[0], AutoRemoteDevice)):           
                self.devices = devices
                wx.CallAfter(self.SaveConfig, devices)
            else:
                self.devices = [AutoRemoteDevice(*i) for i in devices]
        self.port = port
        self.publicIp = publicIp
        self.dname = dname
        self.server = MyServer(RequestHandler, port)
        self.server.Start()


    def SaveConfig(self, devices):
        trItem = self.info.treeItem
        args = list(trItem.GetArguments())
        args[3] = [(i.name, i.url, i.key) for i in self.devices]
        eg.actionThread.Func(trItem.SetArguments)(args)       
        eg.document.SetIsDirty()
        dialog = eg.Classes.Document.SaveChangesDialog(eg.document.frame)
        result = dialog.ShowModal()
        dialog.Destroy()
        if result == wx.ID_YES:
            eg.document.Save()

    def __stop__(self):
        self.server.Stop()
Pako
joaomgcd
Posts: 17
Joined: Tue Oct 02, 2012 9:42 pm

Re: AutoRemote EventGhost plugin:EG->Android and Android->EG

Post by joaomgcd »

Awesome, that did it!! :mrgreen:

Brilliant! thank you you very much.

The other bug you mentioned I was able to figure out myself as well but thanks for fixing it nonetheless. :)

Awesome, awesome support, thanks!

By the way, how do I apply to be part of the "official" EventGhost plugins? Or is that not open right now?

Thanks again!
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: AutoRemote EventGhost plugin:EG->Android and Android->EG

Post by Pako »

joaomgcd wrote:By the way, how do I apply to be part of the "official" EventGhost plugins? Or is that not open right now?
B is correct.
Author program (Bitmonster) just before he left the project, worked on major change.
You can read about it here.
I think there is no doubt that it is not appropriate to continually add new plugins to the program.
So we are looking for a person (or team) who could implement this idea. New plugins will not be added.

BTW: If I do (in the future) Android phone I buy, I'll try AutoRemote. I get a discount? :wink:

Pako
joaomgcd
Posts: 17
Joined: Tue Oct 02, 2012 9:42 pm

Re: AutoRemote EventGhost plugin:EG->Android and Android->EG

Post by joaomgcd »

Better than that, you'll get all my apps for free. :)
Nelsun
Posts: 1
Joined: Wed Jan 09, 2013 12:32 pm

Re: AutoRemote EventGhost plugin:EG->Android and Android->EG

Post by Nelsun »

Thanks for help getting this sorted Pako :D I'd say it's worth getting yourself an Android phone (a Nexus 4 if you can) just because of what it + AutoRemote + EventGhost can all achieve together. I cannot imagine not using any of them on a regular basis every single day 8)
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: AutoRemote EventGhost plugin:EG->Android and Android->EG

Post by Pako »

joaomgcd wrote:Better than that, you'll get all my apps for free. :)
This is amazing!
And how do I do it, when it will current? (You can use PM ...)

Pako
Post Reply