We have moved at community.getvera.com

Author Topic: sPhone plugin modification  (Read 17708 times)

guest4690

  • Guest
Re: sPhone plugin modification
« Reply #15 on: February 18, 2010, 06:42:23 am »
Well, finally got some time to check this plugin...

First of all, I see the stream camera has been removed.  Any reason for that?

Then, I did two new versions.  The first one has only slight changes:
  • added some missing local kewords.
  • wrapped the whole code in a do ... end block, that allows for better encapsulation.  For example, html_header is a local variable for the whole block, almost like a global but isolated from globals from other plugins (which run on the same Lua context).
  • Used 'long string' syntax ([[ .... ]])where appropriate.

I'm attaching this version.  Should be equivalent to the last contributed one, please test and comment.

guest4690

  • Guest
Re: sPhone plugin modification
« Reply #16 on: February 18, 2010, 06:52:04 am »
... And here's the other version I did.  This one has a bigger restructuring, and is so far incomplete.  I'm attaching it mostly to show where i'm going in terms of Lua code, check the first few functions to see this modifications:
  • Added a simple string:template(vars) function.
  • Replaced the lul_html = lul_html .. "....." with table.insert (out, ".........'), where 'out' is a table of strings that get concatenated at the very end (return table.concat (out)).  This is more efficient both in terms of time and space.  Especially noticeable on long loops that add content to the page.

As said, it's still unfinished.  i'm posting mostly to hear some feedback.

Offline denix

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1088
  • Karma: +1/-0
Re: sPhone plugin modification
« Reply #17 on: February 18, 2010, 05:13:06 pm »
@javier,

Oh, how I wish we had a version control system at the moment to easily compare versions... :)

Anyway, our changes were relatively simple. We tried to not change the code structure or its flow, just add the missing functionality with the limited intervention.

So, umtauscher used the version of the plugin available at that moment and just modified lug_sPhoneRequest_sensor() function to add the sensor's tripped state indicator in form of green/red dot. And I added two new functions - lug_sPhoneRequest_temp() and lug_sPhoneRequest_bright(), as well as the necessary hooks into the lug_sPhoneRequest_room() function where it checks for DEVICE_CATEGORY_* values of the devices...

I see that you are now rewriting parts of the plugin to be more elegant and easy to read, which is always appreciated. I'm still not done reading through your changes yet, so I'll provide my feedback later. Thanks.
Veras (1, 2, 3, Lite, Plus), lots of different Z-Wave modules, Luup plugins and theater/security integration.

Offline mrFicha

  • Sr. Newbie
  • *
  • Posts: 22
  • Karma: +0/-0
Re: sPhone plugin modification
« Reply #18 on: September 05, 2010, 08:10:11 am »
Hello
do you have instruction how to use this plagins?
i've instaled it but i don't know how to connect to it from my local network (i have problems with findvera.com on the scope on my isp and i use dynamic dns)
please provide for advantage guide of how to connect to it

Offline umtauscher

  • Full Member
  • ***
  • Posts: 223
  • Karma: +0/-0
Re: sPhone plugin modification
« Reply #19 on: September 05, 2010, 08:21:29 am »
Hi MrFicha,

try this:
http://192.168.1.4/port_49451/data_request?id=lr_sPhone_room&room=0&time=4.71&js=1

Just replace the ip-address (192.168.1.4) with the one of your Vera.
The sceenes are a bit messed up in the rooms now, but I really don't mind any more. I use SQRemote instead.
Hope this helps

Umtauscher
« Last Edit: September 05, 2010, 08:24:42 am by umtauscher »

Offline mrFicha

  • Sr. Newbie
  • *
  • Posts: 22
  • Karma: +0/-0
Re: sPhone plugin modification
« Reply #20 on: September 05, 2010, 08:39:17 am »
thank you,
but the error occured:
No handler

could you help me fide the reason of this error please

http://192.168.81.1/port_49451/data_request?id=lr_sPhone_room&room=0&time=4.71&js=1

Offline umtauscher

  • Full Member
  • ***
  • Posts: 223
  • Karma: +0/-0
Re: sPhone plugin modification
« Reply #21 on: September 05, 2010, 08:46:04 am »
Yeah, sorry,

I realized that too, after trying to update the plugin via Mios. I had a fairly working plugin before, but that seems out of the windows now.
I will report, if I get it runniung again.

Umtauscher

Offline umtauscher

  • Full Member
  • ***
  • Posts: 223
  • Karma: +0/-0
Re: sPhone plugin modification
« Reply #22 on: September 05, 2010, 09:07:08 am »
Ok, I got mine working again. I uninstalled the plugin. Reinstalled it. After that the response of the address was plain text. I let it sit for about half an hour. After that it miraculously worked again.

This is a rather frustrating explanation, I know. Anyway you could try it.
I will now firewall Vera again, so that MCV cannot fiddle around with it any more.

Umtauscher

Offline mrFicha

  • Sr. Newbie
  • *
  • Posts: 22
  • Karma: +0/-0
Re: sPhone plugin modification
« Reply #23 on: September 05, 2010, 09:19:24 am »
thanks for this advice!
but how do you uninstall plugin? i don't see such option in luup files tab

Offline umtauscher

  • Full Member
  • ***
  • Posts: 223
  • Karma: +0/-0
Re: sPhone plugin modification
« Reply #24 on: September 05, 2010, 09:27:59 am »
Good question,

I suppose you are on that "great" UI4 interface? It is so unintuitive, that I really can't stand it.  Concerning your question:

Click on the "Smartphone Webinterface" plugin in the Mios Marketplace window and click on the bin/trashcan icon in the headline. It also took me a while to see this.

Umtauscher
« Last Edit: September 05, 2010, 09:29:33 am by umtauscher »

Offline mrFicha

  • Sr. Newbie
  • *
  • Posts: 22
  • Karma: +0/-0
Re: sPhone plugin modification
« Reply #25 on: September 05, 2010, 09:36:12 am »
Yes, this is realy good quistion

I use UI4, but on the score of my ISP, i can connect to mios marketplace :(
in spite of i have internet connection (network troubleshooting test ends with success) MarketPlace is unavailable for me.
so, due to this situation, i instaled this plugin manualy, download this file, and download it to my vera throw mios developers luup files (with restart option)
but using the same way, i cannot uninstall it (only available options are: view and download)


Offline umtauscher

  • Full Member
  • ***
  • Posts: 223
  • Karma: +0/-0
Re: sPhone plugin modification
« Reply #26 on: September 05, 2010, 09:46:30 am »
Here, the Mios Marketplace window is always there. It shows the plugins that vera considers to be installed.
You only have to connect to the MCV-Webserver for installing plugins. So I understand you can delete installed plugins, but are now able to install them? I think, this is a case for tech support, but I know this is a lame advice. I'm really sorry and I feel your pain.

If you want, I can attach the plugins lua file, that I just updated and you can try locally again.
I have never installed plugins using lua-files with UI4 and I don't intend to.
I'd rather go back to UI2.

Umtauscher
« Last Edit: September 05, 2010, 09:50:09 am by umtauscher »

Offline mrFicha

  • Sr. Newbie
  • *
  • Posts: 22
  • Karma: +0/-0
Re: sPhone plugin modification
« Reply #27 on: September 05, 2010, 10:05:38 am »
this is realy strange, couse I have manualy nistaled 2 plugins: ip camera and smartphone interface
but vera doesn't display it in mios marketplace window! Under this - i can't uninstall it.
May I intrested, do you use UI2? why not UI3? do you have problems with hardware support in UI2 or UI2 and UI4 absolutly equivalent ?

Offline umtauscher

  • Full Member
  • ***
  • Posts: 223
  • Karma: +0/-0
Re: sPhone plugin modification
« Reply #28 on: September 05, 2010, 10:24:05 am »
I used to have UI2.
UI3 really is out of the question. It is ugly, sloooow and a mess and even was abandoned by MCV. I don't know of any user who has upgraded to UI3 and stayed there.

Recently I updated to UI4 because it is the only version that is currently being worked on by MCV, but honestly, I think this is a brilliant example (again) how NOT to design a user interface. For me the decision is quite obvious: I will stay with what I have at the moment and will switch to something else, once I found a substitute.

Don't get me wrong, I don't think UI2 is a good user interface but it still is least bad from what I can see.

Cheers
Umtauscher

Offline mrFicha

  • Sr. Newbie
  • *
  • Posts: 22
  • Karma: +0/-0
Re: sPhone plugin modification
« Reply #29 on: September 05, 2010, 10:28:36 am »
partially i agree with you.
user interface of ui3 is quite difficult and uncomfortable
i decided to go to ui4 only because i think that it is support more devices that ui2
it it is not true - i think that ui2 more intrested
which vertion of ui2 are you using?