Author Topic: Belkin WeMo plugin  (Read 85039 times)

Offline LH

  • Sr. Newbie
  • *
  • Posts: 39
  • Karma: +0/-1
Re: Belkin WeMo plugin
« Reply #30 on: April 28, 2013, 09:10:49 pm »

At this point, I'll wait for v4 to be released since clearly it's an issue with my procedure.


Offline AJ

  • Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
Re: Belkin WeMo plugin
« Reply #31 on: April 29, 2013, 03:47:27 am »
Great work futzle! I've been waiting for a wemo app to show up here before purchasing a unit, as soon as yours did I purchased a motion and power switch.  I'm pretty happy with the Wemo setup.  One question, I've been able to access my demo devices using Mios, and they reflect the state when used from the iPhone app, however I'm unable to turn the power switch on/off using Mios.  Am I missing something?

Offline futzle

  • Beta Testers
  • Master Member
  • *****
  • Posts: 3255
  • Karma: +191/-9
Re: Belkin WeMo plugin
« Reply #32 on: April 29, 2013, 04:47:49 am »
AJ, you might have discovered a bug. The buttons are (obviously) supposed to work. Can you please catch a Luup log that encompasses the few seconds during which you try to set the state? I bet there's an error message. First set Debug to 2 in the Advanced tab, and then Save.

Any reflections on the discovery process? It's obviously a bit flaky, so I'd like to know how well it did or didn't work.

Offline LH

  • Sr. Newbie
  • *
  • Posts: 39
  • Karma: +0/-1
Re: Belkin WeMo plugin
« Reply #33 on: April 29, 2013, 10:52:56 pm »
futzle,

Wanted to let you know that v4 installed just fine and I was able to manually add the IP for my Belkin switch and I can now control the switch.

Soo..in summary, I messed something up during our back and forth over the weekend. Total user error.

LH
« Last Edit: April 29, 2013, 10:56:25 pm by LH »

Offline futzle

  • Beta Testers
  • Master Member
  • *****
  • Posts: 3255
  • Karma: +191/-9
Re: Belkin WeMo plugin
« Reply #34 on: April 29, 2013, 11:00:41 pm »
Thanks for providing closure, LH. Now, on to the testing. Let me know how often you have to restart the Luup engine to keep connectivity. For me, it's once every couple of days. Extending that will be the focus of the next few versions.

Offline AJ

  • Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
Re: Belkin WeMo plugin
« Reply #35 on: April 30, 2013, 06:15:44 am »
Hi futzle, thanks for the feedback.  I followed LH's lead and installed V4 and now everything seems to be working fine now.  If you need anything tested let me know.  I'm really happy being able to have a Wemo on my Z-wave so thanks again for writing this plugin.

Offline LH

  • Sr. Newbie
  • *
  • Posts: 39
  • Karma: +0/-1
Re: Belkin WeMo plugin
« Reply #36 on: May 06, 2013, 09:17:01 pm »
Sooooo.


All was working great w/ the WeMo plugin, but tonight I got a "Startup Lua Failed" error again. I added a couple of IP cameras, but that was the only change I made to the system.

I will uninstall and re-install. Not sure what happened :(

Offline futzle

  • Beta Testers
  • Master Member
  • *****
  • Posts: 3255
  • Karma: +191/-9
Re: Belkin WeMo plugin
« Reply #37 on: May 06, 2013, 10:29:17 pm »
LH, no, don't uninstall. It probably won't make any difference anyway. If you can catch the error message from the Luup log then I can prevent the error from happening.

IP cameras tend to have UPnP servers inside them. If one of them is producing a discovery response I'm not expecting, that could explain the coincidence.

Offline LH

  • Sr. Newbie
  • *
  • Posts: 39
  • Karma: +0/-1
Re: Belkin WeMo plugin
« Reply #38 on: May 06, 2013, 10:32:03 pm »
Ahh...ok.

I tried to uncheck the "Enable scan for WeMo devices on LAN" option, and it's checked and greyed out...meaning I can't uncheck it.

I'll try to capture the error message....how do I do that again? :)

Offline futzle

  • Beta Testers
  • Master Member
  • *****
  • Posts: 3255
  • Karma: +191/-9
Re: Belkin WeMo plugin
« Reply #39 on: May 07, 2013, 12:32:42 am »
LH, that option is greyed out because you have added a WeMo device as "Dynamic". You've effectively locked in UPnP discovery to get your WeMo devices so you can't turn it off of you'd lose them.

As for getting the Luup log, you can do it the traditional way and SSH to your Vera and catch the /var/log/cmh/LuaUPnP.log file, or you can use the newfangled Log Viewer plugin. This question gets asked A Lot so you'll have to forgive my impulse to tell you to search the forum.

Offline LH

  • Sr. Newbie
  • *
  • Posts: 39
  • Karma: +0/-1
Re: Belkin WeMo plugin
« Reply #40 on: May 07, 2013, 09:33:22 am »
Loaded up the Log Viewer. I think this is the section that may interest you:


50   05/07/13 6:24:08.587   luup_log:14: Init script unchanged. __LEAK__ this:393216 start:421888 to 0x9e9000 <0x2c0f3680>
50   05/07/13 6:24:08.659   luup_log:16: WUIWeather: #16 starting up with id  <0x2c0f3680>
02   05/07/13 6:24:08.693   ctrl_chr[33;1mJobHandler_LuaUPnP::REQ_Handler no handler for lr_al_logctrl_chr[0m __LEAK__ this:221184 start:643072 to 0xa1f000 <0x2ed20680>
02   05/07/13 6:24:08.725   ctrl_chr[33;1mJobHandler_LuaUPnP::REQ_Handler no handler for lr_al_logctrl_chr[0m <0x2ed20680>
50   05/07/13 6:24:08.789   luup_log:24: Starting WeMo plugin (device 24) <0x2c0f3680>
06   05/07/13 6:24:09.026   Device_Variable::m_szValue_set device: 14 service: urn:futzle-com:serviceId:UPnPProxy1 variable: ctrl_chr[35;1mStatusctrl_chr[0m was: 1 now: 1 #hooks: 0 upnp: 0 v:0x79fa70/NONE duplicate:1 <0x2ccf3680>
06   05/07/13 6:24:09.026   Device_Variable::m_szValue_set device: 14 service: urn:futzle-com:serviceId:UPnPProxy1 variable: ctrl_chr[35;1mStatusTextctrl_chr[0m was: Running now: Running #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2ccf3680>
06   05/07/13 6:24:09.027   Device_Variable::m_szValue_set device: 14 service: urn:futzle-com:serviceId:UPnPProxy1 variable: ctrl_chr[35;1mAPIctrl_chr[0m was: 3 now: 3 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:1 <0x2ccf3680>
01   05/07/13 6:24:09.235   ctrl_chr[31;1mLuaInterface::CallFunction_Startup-1 device 24 function initialize failed [string "--..."]:132: attempt to concatenate field 'uuid' (a nil value)ctrl_chr[0m <0x2c0f3680>
01   05/07/13 6:24:09.235   ctrl_chr[31;1mLuImplementation::StartLua running startup code for 24 I_WeMo1.xml failedctrl_chr[0m <0x2c0f3680>

Offline futzle

  • Beta Testers
  • Master Member
  • *****
  • Posts: 3255
  • Karma: +191/-9
Re: Belkin WeMo plugin
« Reply #41 on: May 07, 2013, 05:28:46 pm »
Loaded up the Log Viewer. I think this is the section that may interest you:
07/13 6:24:09.235   ctrl_chr[31;1mLuaInterface::CallFunction_Startup-1 device 24 function initialize failed [string "--..."]:132: attempt to concatenate field 'uuid' (a nil value)ctrl_chr[0m <0x2c0f3680>

Yes indeed, that's just what I needed.

I'm submitting version 6 of the plugin to apps.mios.com.  This version has extra paranoia about the uuid string, so it should bypass the crash on line 132.

Thanks for the log.

There will probably be a few more cycles of this as every new UPnP device that a user has on their LAN subtly breaks the plugin.  It's not a poorly-written spec, so I don't know why so many devices implement it so poorly.

Offline LH

  • Sr. Newbie
  • *
  • Posts: 39
  • Karma: +0/-1
Re: Belkin WeMo plugin
« Reply #42 on: May 07, 2013, 05:57:18 pm »
Great. Glad I could help!

Online a-lurker

  • Hero Member
  • *****
  • Posts: 844
  • Karma: +58/-8
Re: Belkin WeMo plugin
« Reply #43 on: May 08, 2013, 12:30:59 am »
Hi Futzle - excellent work on this one.

Installation is a bit tricky with the two plugins and many restarts are needed to finally get the child device(s) showing. I was bit confused with the wording "Add Dynamic" / "Add Static". It's simple enough - I must be a bit slow, as I was wondering what was being "added" to. Maybe "Use Dynamic/Static IP" may be an option. While installing at one stage the status of the "UPnP Event Proxy" was showing as blank. Could it be defaulted to some message that means "not installed" as opposed to "running/not running". It's just a confidence thing during installation process.

For readers with an Android phone - there is now a WeMo Android app (App version Beta v0.2). Apparently it's only been tested on a Samsung Galaxy SIII
https://play.google.com/store/apps/details?id=com.belkin.controller&hl=en
I loaded it on to an older Samsung Galaxy S with Android Firmware 2.3.3. Using that I was able to set up my WeMo switch but that was all I wanted to do, so I haven't tested the app any further than that.

One slight problem on the display of the switch device in UI5 - the light bulb icon is always showing the "On" icon. Which is weird as this is the icon being used by my browser:  http://Vera_IP/cmh/skins/default/icons/Binary_Light_100.png  but  D_WeMo1_Controllee1.json  uses "Binary_Light_0.png" and "Binary_Light.png", which are both available on my Vera 3 but are both "Off" icons.

All the code was installed using the plugins from the 25th of April - should I update any files to cover any other bugs found since?

When I click on the on/off buttons in UI5, sometimes I get a "Device not ready" but I think that's some start up thing after a Luup restart. I'll keep an eye on it.

EDIT: well the lamp on/off icons have come good and now work. This may be due to some override by one of the other light switches? Which are now in use as as night has come. Icons in use are now "Binary_Light_0.png"  and "Binary_Light_100.png"


« Last Edit: May 08, 2013, 04:34:02 am by a-lurker »

Offline futzle

  • Beta Testers
  • Master Member
  • *****
  • Posts: 3255
  • Karma: +191/-9
Re: Belkin WeMo plugin
« Reply #44 on: May 08, 2013, 06:22:15 am »
Hi a-lurker,

Installation is a bit tricky with the two plugins and many restarts are needed to finally get the child device(s) showing.

Yeah, I'm sorry that it takes so many restarts.  Here's what they are all for, if you are curious:
  • First to initialize the WeMo plugin after you install it from apps.mios.com.
  • Second to populate the discovery results.
  • Third to commit the discovery to create child devices.
  • Fourth to initialize the UPnP event proxy plugin, which installs the daemon.
  • Fifth to ensure that the UPnP event proxy daemon is running when the WeMo plugin starts.

Quote
I was bit confused with the wording "Add Dynamic" / "Add Static". It's simple enough - I must be a bit slow, as I was wondering what was being "added" to. Maybe "Use Dynamic/Static IP" may be an option.

How about "Add (DHCP)" vs "Add (Static IP)"?  Is that any more informative?  I need a short name to prevent word wrap hassles.

Quote
While installing at one stage the status of the "UPnP Event Proxy" was showing as blank.  Could it be defaulted to some message that means "not installed" as opposed to "running/not running". It's just a confidence thing during installation process.

Yes, I think I can do this (but it will still not show anything until the first Luup restart, that's how all plugins work; this is related to the following point that you make).

Quote
One slight problem on the display of the switch device in UI5 - the light bulb icon is always showing the "On" icon. Which is weird as this is the icon being used by my browser:  http://Vera_IP/cmh/skins/default/icons/Binary_Light_100.png  but  D_WeMo1_Controllee1.json  uses "Binary_Light_0.png" and "Binary_Light.png", which are both available on my Vera 3 but are both "Off" icons.

EDIT: well the lamp on/off icons have come good and now work. This may be due to some override by one of the other light switches? Which are now in use as as night has come. Icons in use are now "Binary_Light_0.png"  and "Binary_Light_100.png"

This happens to me, sometimes, on other plugins.  It normally happens when the plugin is newly-installed, and it goes away if I clear the browser cache or reload Luup (or both).  As you've noticed, it comes good and it shouldn't reappear for you now.  I wish I knew what causes it.

Quote
When I click on the on/off buttons in UI5, sometimes I get a "Device not ready" but I think that's some start up thing after a Luup restart. I'll keep an eye on it.

Do, please.  That could happen in the ten or so seconds after a Luup restart.  It shouldn't happen during normal operation.

Thanks for the very valuable feedback.  There should be no reason for you to update to the newly-released version 6 unless you have discovery problems like LH reported.