Computing stuff tied to the physical world

DIJN.09 – Install the HouseMon server

In Uncategorized on Feb 16, 2013 at 00:01

Welcome to the ninth instalment of Dive Into JeeNodes. We’re going to install HouseMon!

If you’ve followed all the steps up to this point, then getting HouseMon running will be a piece of cake. We need to do exactly three things:

  1. Download the HouseMon source code
  2. Install the packages used by HouseMon
  3. Launch the HouseMon server

All of this can be accomplished by typing just a few commands, as described here:

    git clone https://git.jeelabs.org/housemon.git
    cd housemon
    git checkout 0.7.x    # <== this is ESSENTIAL
    npm install
    npm start

Here’s what the above will look like in the terminal:

Screen Shot 2013-02-08 at 23.33.55

I haven’t typed the final return yet, as this will generate lots of gibberish while npm does its thing. There is some package compilation involved, which means that the “npm install” step will in fact take a couple of about 10 minutes to complete.

The real fun begins when we enter that final command to start the server: “npm start”. Here’s what you’ll see after a few seconds, while the system initialises itself:

Screen Shot 2013-02-08 at 23.53.47

Now we can use the web browser to connect to HouseMon. In my case, the RPi is running as IP address 192.168.1.127, so I can point my browser to http://192.168.1.127:3333/, and something like this will appear:

Screen Shot 2013-02-08 at 23.59.45

You’ll need to replace the IP address by the one assigned to your own RPi setup, but apart from that it should all work in exactly the same way. HouseMon is now up and running.

Onwards!

(This series of posts is also available from the Dive Into JeeNodes page on the Café wiki.)

PS. Note that HouseMon is still evolving a lot (read: things change and things do break, sometimes). So be prepared to update it often, with: cd ~/housemon && git pull

  1. “npm install” step will in fact take a couple of minutes to complete.

    More like 10 mins, what’s your RPi clock ??

    Never mind, all seems to be working, simulated messages appearing in readings.

    So far so good, can’t wait for the next installment :-)

  2. Yahoo — it works! very cool!

  3. Great stuff! Raspberry Pi and all of the node.js and associated software is fun to learn with your pioneering – onwards!

  4. LOL, this is getting seriously addictive. It’s sad (says SWMBO) that first thing I do after firing up the laptop in the morning is checking out what goodies you left for us..

    What happens if I kill all the ss-ticks and ss_stores? (or is there a quick way to divert them. (I know, why don’t I read the friendly manuals. Will do, honestly..

  5. What happens if I kill all the ss-ticks and ss_stores?

    It’s a known flaw of SocketStream that it currently always spews some console output. Diverting stdout (and maybe also stderr) to a file or to /dev/null is enough to take care of it for now. There was a note somewhere that this will be fixed in ss. The seconds tick is not essential (yet) – it merely affects the time shown at the bottom of the Admin page in the browser. The ss-store events represent new readings getting collected and sent out to the browser.

  6. Hi, This is the stupid question time ….. when I boot up the RPi how do I start the housemon again, when I SSH in and type npm start, I get a lot of errors reported, my router has assigned a different IP address from yesterday, does this matter?

    Errors

    pi@raspberrypi ~ $ sudo npm start npm ERR! Error: ENOENT, open ‘/home/pi/package.json’ npm ERR! If you need help, you may report this log at: npm ERR! http://github.com/isaacs/npm/issues npm ERR! or email it to: npm ERR! npm-@googlegroups.com

    npm ERR! System Linux 3.6.11+ npm ERR! command “/usr/local/bin/node” “/usr/local/bin/npm” “start” npm ERR! cwd /home/pi npm ERR! node -v v0.8.19 npm ERR! npm -v 1.2.10 npm ERR! path /home/pi/package.json npm ERR! code ENOENT npm ERR! errno 34 npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /home/pi/npm-debug.log npm ERR! not ok code 0

    • Quick answer: cd ~/housemon && npm start

      Better answer: wait a couple of days, the last post in this series will cover how to set things up so HouseMon auto-starts on power-up.

  7. I’ve got a Raspi here but I have other plans for it. I’m thinking about using a Snowball or Beagleboard I have around, just for the kicks :)

  8. Thanks, it’s always obvious after someone tells you how… well nearly always. :-)

  9. As stated before I am using a netbook running Jolicloud and hoping to follow this series but replacing the Pi with the Netbook. Have been able to do everything so far ,ie up to the housemon install.

    I am in process of getting a Pi, but am still interested in the netbook.

    If it is too complicated maybe it is best to stick to the Pi and tackle the netbook later when I might have some sort of clue. What do you think ?

    I get this following error list:

    lenj@jolicloud:~/housemon$ npm start

    housemon@0.4.2 start /home/lenj/housemon node app.js

    Starting SocketStream 0.3.2 in development mode… briqs loaded

    events.js:71 throw arguments[1]; // Unhandled ‘error’ event ^ Error: Redis connection to localhost:6379 failed – connect ECONNREFUSED at RedisClient.on_error (/home/lenj/housemon/node_modules/redis/index.js:148:24) at Socket. (/home/lenj/housemon/node_modules/redis/index.js:83:14) at Socket.EventEmitter.emit (events.js:96:17) at Socket._destroy.self.errorEmitted (net.js:329:14) at process.startup.processNextTick.process._tickCallback (node.js:244:9) npm ERR! housemon@0.4.2 start: node app.js npm ERR! sh "-c" "node app.js" failed with 1 npm ERR! npm ERR! Failed at the housemon@0.4.2 start script. npm ERR! This is most likely a problem with the housemon package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node app.js npm ERR! You can get their info via: npm ERR! npm owner ls housemon npm ERR! There is likely additional logging output above.

    npm ERR! System Linux 2.6.35.10-1-jolicloud-atom npm ERR! command “/usr/local/bin/node” “/usr/local/bin/npm” “start” npm ERR! cwd /home/lenj/housemon npm ERR! node -v v0.8.19 npm ERR! npm -v 1.2.10 npm ERR! code ELIFECYCLE npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /home/lenj/housemon/npm-debug.log npm ERR! not ok code 0 lenj@jolicloud:~/housemon$ lenj@jolicloud:~/housemon$

  10. I saw an unusual message during npm install but it still appears to be working fine:

    ws@0.4.25 install /home/pi/housemon/node_modules/socketstream/node_modules/engine.io/node_modules/ws (node-gyp rebuild 2> builderror.log) || (exit 0)

    npm http 304 https://registry.npmjs.org/tinycolor npm http 304 https://registry.npmjs.org/options

    I hope it will be possible to direct RFDemo input from /dev/ttyAMA0 has well as USB devices.

    • No idea what that is, I’m afraid. You could do “cd ~/housemon && npm update” to retry.

  11. Just as an info. As I cannot wait to get my PI, I decided to re-use old laptop, with fresh Lubuntu install. as many I had to use sudo for rsync, add few apt-get install (make, g++) to make npm install and start going, but ended up with nice housemon website :)

    • A quick way to get all the basic compiler stuff is with “apt-get install build-essential”.

  12. I’ve been reading along, but may have missed something. My Raspi uses avahi to broadcast its inet address and name so it is known as raspberrypi.local on other hosts on the same net. Connections like ssh are simply made using “ssh pi@raspberrypi.local“. Same with web servers.

    I set up avahi on raspi using apt-get install avahi. I think this is all called “zero configuration” and it has smoothed my operations a lot.

    Did I miss this discussion?

    • Thx – that’s an excellent suggestion, but keep in mind that the DIJN series assumes no keyboard or monitor (just power and an Ethernet cable) – so there’s a chicken-and-egg issue hiding in there…

      I think this shows that we need to start thinking about a place to collect such tips. Either github or the cafe wiki…

  13. I don’t want to swamp your site, but I thought a little more detail might help here. BTW, thanks for the fine work and your contributions to physical computing and programming theory and practice.

    I only needed to look up the IP address and log on to the Raspi using ssh one time to install the avahi software using apt-get.

    Subsequently the daemon starts up each reboot and through the “magic” of zero configuration it seems to broadcast its name so that other computers on the same subnet can associate its name in the .local domain with its current IP address, which can change depending on the router’s whims (DHCP.) My printer and beaglebone work the same way. The printer has a web server I can use to do most printing and scanning functions, plus diagnostics, and it uses zero configuration to broadcast its name.

    I think Apple came up with this concept long ago (in computer time anyway) and for some reason I did not catch on until I started working with these headless computers recently.

    To inspect the .local domain from my Linux system I use “avahi-browse” command to list known hosts and services. Here’s the output on my net, which shows the Raspi and printer services. Sorry for the squished text:

    john@john-ThinkPad-T42:~$ avahi-browse -a
    +   eth1 IPv6 john-ThinkPad-T42 [00:12:f0:13:32:c1]         Workstation          local

    • eth1 IPv4 john-ThinkPad-T42 [00:12:f0:13:32:c1] Workstation local

    • eth1 IPv4 raspberrypi [80:1f:02:9a:88:5c] Workstation local

    • eth1 IPv6 john-ThinkPad-T42 Remote Disk Management local

    • eth1 IPv4 john-ThinkPad-T42 Remote Disk Management local

    • eth1 IPv4 raspberrypi Remote Disk Management local

    • eth1 IPv6 desktopcouch e8d41640-f325-4019-a69e-bfbdc99408a4 _couchdb_location._tcp local

    • eth1 IPv4 desktopcouch e8d41640-f325-4019-a69e-bfbdc99408a4 _couchdb_location._tcp local

    • eth1 IPv4 Photosmart D110 series [89E19F] _http-alt._tcp local

    • eth1 IPv4 Photosmart D110 series [89E19F] _scanner._tcp local

    • eth1 IPv4 Photosmart D110 series [89E19F] Web Site local

    • eth1 IPv4 Photosmart D110 series [89E19F] Internet Printer local

    • eth1 IPv4 Photosmart D110 series [89E19F] PDL Printer local

  14. I see I made a mistake in the name of the avahi package you need to install. I believe it should be “sudo apt-get install avahi-daemon”. While you are at it, I believe you might want to install avahi-utils to be able to query the local domain with avahi-browse. Sorry for the misleading post.

  15. Just for info – just finish working through DIJN 9 but had problem when viewing HouseMon web page with Internet 9. Web page is there but IE9 show HouseMon as {Local.exactName} and ADmin etc as {r.tile}.

    Works fine with Firefox – any ideas why? On to DIJN 10,11,12 etc. Riveting stuff!

    • Hmmm… can you get to the JavaScript error console? Anything mentioned there?

  16. Looking at the script indicates error at line 3452 – “Object does not support this property or method”

    Just as an aside, Google Chrome displays HouseMon web OK.

    • Would you happen to have IE10 to compare against? I suspect that one of the components has an “IE is not supported” warning, but it’s hard to say which one. As I understand it, each new IE release tends to adhere better to standards.

  17. Will install IE10 and see what happens. Regards

  18. IE10 appears to resolve the problem, but can’t see where the problem was.

Comments are closed.