Page 1 of 1

Webpage for mobile phone

Posted: Sun Oct 25, 2015 9:00 am
by pulse
Hi,

I was wondering if ONH comes with a mobile version of the site or is it possible to make it one yourself?


Image

regards,
pulse

Re: Webpage for mobile phone

Posted: Sun Oct 25, 2015 1:16 pm
by stefangsbb
Unfortunately I have not had time to add a more mobile adapted WEB interface. I do use the current one on my phone, but it is not really adapted for the use...

It is possible to build your own web interface on top of OpenNetHome, there is an open REST-Interface suited for building WEB interfaces. See the documentation on: http://opennethome.org/interfaces/rest/.

Re: Webpage for mobile phone

Posted: Tue Oct 27, 2015 10:48 am
by pulse
Thank you the answer, will look into the dokumentation!
regards/pulse

Re: Webpage for mobile phone

Posted: Wed Oct 28, 2015 7:05 am
by jas
There is a small error in the REST documentation. In the beginning of the document the "action" syntax is shown correctly (POST /items/[ItemId]/actions/[action]/invoke), but later in section 1.5 is is show as /rest/items/[ItemId]/action, which is not correct.

I stumbled to this when I was using the REST interface in Python code which I called from the server. I could not get the actions working until I checked from the Java source code how it is supposed to be working :)
Later I got a bit tired with the external Python code and integrated jython into the server. Now I can call Python functions directly and access all items from Python code without the REST interface.

Re: Webpage for mobile phone

Posted: Wed Oct 28, 2015 8:17 pm
by stefangsbb
Thanks for pointing out the typo on the REST page - fixed now!

The jython stuff sounded REALLY cool!! Integrating Python via jython into the server is on my (very long) wish list of things to have time to do... How did you do the integration? Is it something you would be willing to contribute to the project?

Re: Webpage for mobile phone

Posted: Thu Oct 29, 2015 10:16 am
by jas
The jython integration was not really that complicated.
The most difficult part (at least for me) was to get the correct jython library to the maven repository.
I downloaded a jython library to the repository, but could not get it working. In the end I had to manually add the .jar file to the library before I was able to call the jython functions I wanted. I'm not really familiar with maven, so probably someone who knows what he is doing doesn't need to spend so much time with that :)

Python functions are called in a similar way as set, exec, etc. from the server: python,functionName('parameters')
Function parameters are passed as is and are not expanded. Parameter evaluation is done inside jython with eval() function.
From nethome server jython can access server and log instances, which are used for accessing items and writing to the log file.

Of course I'm willing to contribute to the project, if you think this would be useful.

I've done some other stuff too, which might be of interest to nethome users.
OnOffLogger
- this is like a lamp and has on and off actions, but instead of turning anything on/off, it logs the on/off times to a file.

SmsClient
- similar to XmppClient, but can send text messages via Dovado router.