Go Down

Topic: Temperature Web Panel doesn't run for me (Read 12312 times) previous topic - next topic

federicofissore

I'm puzzled. Does any other example work fine? "Bridge" example for example...

Out of curiosity, if you have 3 spare mins, do you mind uploading yunserialterminal (or SSH into the yun) and paste the output of
Code: [Select]

cat /etc/arduino/openwrt-yun-release

If that doesn't work, but instead
Code: [Select]

cat /etc/arduino/linino-release

works, then you should run the upgrade process again

pbeek

No one more puzzled than I.

Indeed, despite having run the linino update twice (I bricked the machine once on a power fail [my bad] and had to communicate using the Yun Console program) only the second command worked: cat /etc/arduino/linino-arduino-release

As said, I have downloaded and installed openwrt-ar71xx-generic-linino-yun-16M-250k-squashfs-sysupgrade.bin twice.  Is this not the latest version?  ... No, it isn't. Problem 1 solved.

I have now installed the Yun latest version (as opposed to the generic linino version).
Now I get...cat /etc/arduino/openwrt-yun-release=>built=Fri Apr 11 04:46:31 CEST 2014

Rerun the sketch: TemperatureWebPanel... and no joy.  I get the web page, open the javascript console and the JSON requests gets the dreaded 404, file not found error.

Rerun Bridge, it doesn't work either (also didn't work before.)  The communication port is open.  The web server gives pages stored on the SD card but it doesn't seem to filter the 'arduino' tag in the URL to send the rest of the tags to the coprocessor. I can SSH to the linino via wifi and wired ethernet.  No problem there either.  I just can't see what is happening inside the http server so I can't determine if it is the python bridge or the http code.

Is there a way to issue commands on the linino side to emulate what the http daemon is sending to the python code?


federicofissore

Yes, but skip that for now, otherwise we'll die focusing on one detail. You can test the same thing (Bridge sides communication) using the ConsoleRead example. Upload it with wifi, keep selected the 192.168.x.x port in the IDE and open serial monitor.
Can you run that sketch? Is it asking your name and replying "Hi pbeek" ?

pbeek

#18
May 06, 2014, 09:06 pm Last Edit: May 06, 2014, 09:12 pm by pbeek Reason: 1
Yes, this sketch talks to the console via wireless (as opposed to the USB console)

To save time: Process objects also successfully communicate with the shell.  For example...

   Process shell;
   shell.runShellCommand("date");

successfully returns the date.

So the arduino communication with the linux coprocessor seems to work.

federicofissore

Then I really don't know how the /arduino/ url shouldn't work. I'm sorry I can't help you further

pbeek

#20
May 06, 2014, 10:57 pm Last Edit: May 07, 2014, 01:02 am by pbeek Reason: 1
I need to find out how the uhttpd filters the incoming GET request to send the remainder of the incoming string (any incoming string with 'arduino' in it) to the code that transports the string to the arduino side of the Yun.  Or does it just  echo everything that comes in to port 5555?
Is this the way this works or does 'bridge.py' do all the heavy lifting?

A starting point would be to look at log files for incoming requests(*) so I could see what the daemon is getting and whether it is triggering special processing (like a cgi request).  Is the Yun's uhttpd the same as the generic version?

What role does bridge.py play?  Is it getting requests from uhttpd or is it listening only on another port for JSON requests?

The startup runs uhttpd with the following options:

/usr/sbin/uhttpd -f -h /www -r Arduino -x /cgi-bin -t 60 -T 30 -A 1 -n 2 -p 0.0.0.0:80 -C /etc/uhttpd.crt -K /etc/uhttpd.key -s 0.0.0.0:443
... and further down ...
python -u bridge.py


Well if I can't get help here then I'll return it and get another one.  Maybe there is some subtle wonky issue with this particular device.

BTW:  Thanks for all your time and effort, Frederico.

[update] I have tried all the different 'Bridge' examples except the ones that require outside accounts and they all work.  Only the examples based on YunServer and YunClient seem to fail.
(*) I understand why the lightweight uhttpd wouldn't have extensive logging built-in.  I was hoping for some undocumented switch that temporarily turned it on.  I have looked at the generic code for the base model uhttpd and it isn't there.

pbeek

I got it! XD

The problem was with the Javascript. 

I finally got the bridge sketch to work.  Perhaps chrome was logging in for me with the wrong password so that is why it was failing.  Now it's working.  Once I got the bridge sketch to work I went back to TempWebPanel.  The original javascript reads:
Code: [Select]

        function refresh() {
  $('#content').load('/arduino/temperature');
}

Which gets sent as a JSON request to http://Arduino.local/sd/TemperatureWebPanel/arduino/temperature
the bridge didn't seem to know what to do with this, it sent back '404, file not found'.  However, change the code to:
Code: [Select]

          function refresh() {
                        $('#content').load('../../arduino/temperature');
                }

and it works.  The down side is that I have to 'log in' but I only seem to need to do this once per browser so it may not be so bad.  (My DHCP server seems willing to give it the same IP address each time.)
Given the project I have in mind I can live with this.

Thanks for your suggestions, it kept me plugging away.

gorillapilot

#22
Jul 04, 2014, 10:20 pm Last Edit: Jul 04, 2014, 10:50 pm by gorillapilot Reason: 1
Does this ever work out of the box - or after just upgrading?

I upgraded.  

cat /etc/arduino/openwrt-yun-release works and returns a build date of June 20.

But it still doesn't work.  

I formatted the sd card on a Vista machine using FAT32.  I created arduino/www and I copied index.html and zepto.min.js into the www directory.  I put the SD card in the Arduino and cycled the power then uploaded TemperatureWebPanel from the examples directory.  Using Putty to access the Linino side over the wireless network I

cd /mnt/sd

and see arduino/www with the two files index.html and zepto.min.js.  But there is no TemperatureWebPanel to be found.

I use Chrome to go to http://mikesarduino.local/TemperatureWebPanel and it returns the message:

No such file or directory

I do see the admin panel if I go to http://mikesarduino.local

Anybody know what is wrong or what I should try next?


gorillapilot

More info:

I took Chrome to http://mikesarduino/sd

and I got a popup asking me to log into the server.  So I used the name of the arduino (mikesarduino) as the user name and entered the password.  The webpage now shows

0

It does not update. 

Help!

(Thanks in advance!)

gorillapilot

Yet more info on this problem.

It does not work when I take Chrome to http://mikesarduino/sd/TemperatureWebPanel

Again, it says No such file or directory

And I do not see any TemperatureWebPanel directory anywhere.

Thanks,
Mike

pbeek

As was pointed out in the other posts the number of ways this can go wrong are numerous.  To get this sketch to work requires the well oiled functioning of many moving parts.  It will work eventually.  I kept plugging away and got it to work looking in the last expected place.  I can only ask the question though, based on the URL shown below, how does your trigger the request to the DNS in order to go to the Yun?  Shouldn't mikesarduino be represented as mikesarduino.local  (or something that triggers a DNS lookup). Does it work if you type the IP address directly?  Maybe you tried this already.


It does not work when I take Chrome to http://mikesarduino/sd/TemperatureWebPanel

Again, it says No such file or directory

gorillapilot

My apologies, I typed the url wrong here.  Yes, I go to http://mikesarduino.local/sd/TemperatureWebPanel.

I discovered that the contents of the www directory are not uploaded to the SD card unless the sketch is uploaded using WiFi.  It certainly would have been nice to mention this in the documentation of the TemperatureWebPanel example. 

So I upload the sketch using wifi and the TemperatureWebPanel directory appears on the SC card in the arduino/www directory and index.html and zepto.min.js appear in that directory.

When I use the Chrome browser to go to http://mikesarduino.local/sd/TemperatureWebPanel it now returns a 0.  So it appears the index.html page is displaying as a static page.  But it never updates.

The sketch looks for the command "temperature".  I tried appending "temperature" to the url and several variations with no success.  Must the command "temperature" be sent to cause an update?  If so, how does one send that command?

Why is the documentation of the TemperatureWebPanel so incredibly lousy?  Is it documented somewhere else that I simply haven't found yet?

gorillapilot


federicofissore

You also need to open the REST api (the switch is in the web panel)
I've added a line in the sketch documentation and it will be available with the next nightly build http://arduino.cc/en/Main/Software#toc4

godo

#29
Aug 05, 2014, 03:03 pm Last Edit: Aug 05, 2014, 03:13 pm by godo Reason: 1
Quote
I discovered that the contents of the www directory are not uploaded to the SD card unless the sketch is uploaded using WiFi.  It certainly would have been nice to mention this in the documentation of the TemperatureWebPanel example.  

Thank you very much, gorillapilot. This little finding ended two frustrating weeks. Well.... not that it works already, but I get more than 404, finally.
I wrote my fair share of manuals and instructions, so I know it is easy to forget to mention some thing or other, or to assume that something is known. But a bit of information like this has to go asap to the sketch!
I find the documentation very unhelpful. I did a lot with classical arduinos, so I am not a total noob, but with the Yun I get nowhere. And most of the comments and posts seem like the geek-speak I am annoyed about when it comes to... well ... linux. Nevertheless, the Yun has wonderful potential, and maybe some of its fathers remember that
Quote
Arduino is an open-source electronics platform based on easy-to-use hardware and software. It's intended for anyone making interactive projects.

So let's keep it up, shall we?! After all, Arduino lives from its community as it does from its founders. Thanks to all for the collaborative effort!

PS: Thank you Federico, the REST switch did the trick. Cool!

Go Up