This page last changed on Apr 24, 2014 by cramar.

Hi I have just started using OpenRemote and a search suggests this has been asked before but I still cant figure out what I am doing wrong.

I have a small HelloWorld.html file in the root directory of the controller. Yep all the file contains is Hello World

I have created a command called TEST using the HTTP protocol, GET method and URL http://localhost:8080/controller/helloworld.html polling every 5 seconds

I then have created a sensor called CheckHTML with the command TEST with a custom type and no state items.

For the UI I have a simple panel with a 1x1 grid containing a label with text lblTest with the sensor CheckHTML selected.

I saved and sync'd with the online designer.

When I check the device where I expect to see Hello World, I see N/A.

What am I doing wrong

Thanks.


command.JPG (image/jpeg)
sensor.JPG (image/jpeg)
command.JPG (image/jpeg)
Capture.JPG (image/jpeg)

The "root directory" in this case should be 'OR/webapps/controller', it's not clear from your post if that's the case?

Posted by juha at Apr 25, 2014 00:42

Thanks Juha, Yes it think it is in the correct directory. The full path is user/craig/project/ORC/webapps/controller/helloworld.html

I can browse to the html document using http://localhost:8080/controler/helloworld.html. Therefore I am a bit puzzled. I can get a sensor to work connecting yahoo weather the only difference here is I am trying to reads a html not xml document (cant see the difference) and on the local webserver not the internet. It will be something stupid on my part that will make me looks like a real NOOB which I may well be

Craig

Posted by cramar at Apr 25, 2014 01:18

I have made some progress.. As suspected it was a noob error. My .html was actually .htm so it was never going to work...

So now that is rectified instead of N/A the interface is returning the text of the label (lblTest) but still not Hello World as I expected.

Hmmm...

Posted by cramar at Apr 25, 2014 03:42

a screendump of your http command would be helpful. (please add url seperately if it is very long)

Posted by pz1 at Apr 25, 2014 08:15

Thanks Peter,
The URL is HTTP://localhost/8688/controller/helloworld.html

Below are two screen grabs of the command and sensor

Posted by cramar at Apr 25, 2014 08:42

I did replicate this, and for me it works fine. I do notice you use port 8688. Are you indeed using the professional controller? If not I think you need to use 8080 (I am on Pro)

PS: Next time you update a screenshot select thumbnail. Takes less space here, and with a click on the image the reader gets full size.

Posted by pz1 at Apr 25, 2014 08:51

Thanks Peter - not sure what is going on then..

I changed the port number as described here as I had a port conflict.

Thanks for the note about the thumbnail, will do that in future.

Posted by cramar at Apr 25, 2014 09:07

There is nothing special about the html the command is expecting is there?

I simply have "Hello World" in a file called helloworld.html with no tags.

Craig

Posted by cramar at Apr 25, 2014 09:12

That is what I did too. just:

hello world

without quotes, and the same url in the command.
On the panel I only added a label (no grid)

  • Does the weather example work on a URL on the WEB?
  • Can you access your helloworld.html with a brower? Just enter the url from the command there.

pz

Posted by pz1 at Apr 25, 2014 10:12

Now I am getting frustrated.

The weather example works on the yahoo weather.

Yes hello world can be accessed from the browser. Not sure what you mean by 'Just enter the URL from the command there'. I browsed to the URL and returned the expected page.

Posted by cramar at Apr 25, 2014 22:44

just found the HTTP.log file, there appears to be an odd control character in my hello world.html. I suspect that is the cause. See below.

INFO 2014-04-26 09:39:15,294 (HTTP): received message: ÿþH e l l o W o r l d

it appears that Powershell, where I created the html file adds in the control character....

Problem solved. Thanks for the help...

Craig

Posted by cramar at Apr 26, 2014 00:43

It's a byte-order mark for UTF-16. For regular text files UTF-8 tends to be sufficient and it's usually not recommended to include byte order mark in those cases. In general byte order mark still cause all kinds of strangeness (developers rarely remember to handle them correctly).

http://en.wikipedia.org/wiki/Byte_order_mark#UTF-8

Posted by juha at Apr 26, 2014 03:39

I have the same problem. I am doing the same simple project. I found the control character too and so I changed the codification. Nothing doing. Still N/A showing up. It looks like my smartphone can't connect to my localhost.
Any idea what should I do?
Thank you very much

Posted by mcberta2 at Dec 18, 2014 10:17
Document generated by Confluence on Jun 05, 2016 09:36