Raspberry Pi Zero W Homebridge Camera

This is a combined set of instructions to install an Apple Home Kit compatible Raspberry Pi Camera v2 using Homebridge. I initially installed this using a Raspberry Pi 3 and then wanted to get it working on my Raspberry Pi Zero W to make it more compact. These instructions are specific  to Raspberry Pi Zero. If you want to install on a different Raspberry Pi, you need to determine the ARM version for your device. Then you need to download and install the correct Node.js version from their site. Use the “Linux Binaries (ARM)” distro and the correct ARM version. Other than that one change, all instructions below should work.

Install Raspbian on the Pi. Either desktop or lite version will work. These instructions assume that you have already done the normal Raspbian setup for locale, timezone, wifi, etc…

From a shell prompt, update the OS.

$ sudo apt-get update && sudo apt-get upgrade

Run the Raspberry Pi configuration and enable the Camera and SSH interfaces. Change the default password while you are at it.

Then install the camera hardware. (I am using the official Raspberry Pi Camera Camera V2.1)

$ nano /etc/modules

Add the following entry to the bottom of the file if it is missing.

# Camera with v4l2 driver
bcm2835-v4l2

At this point you need to reboot the system.

$ shutdown -r now

Next we need to download and install Node.js and npm. Because we are using the Raspberry Pi Zero W, we need to install the armv6 version.

$ cd ~/
$ wget httpd://nodejs.org/dist/v8.11.1/node-v8.11.1-linux-armv6l.tar.xz
$ tar xf node-v8.11.1-linux-armv6l.tar.xz
$ sudo cp -R node-v8.11.1-linux-armv6l/* /usr/local/

Once this has been completed, run the following scripts to verify that everything is working.

$ node -v
v8.11.1
$ npm -v
5.6.0

You can remove the downloaded node files if everything is working.

$ rm -fr ~/node-v8.11.1-linux-armv6l*

Now you can install Homebridge and the Raspberry Pi Camera plugin.

$ sudo apt-get update & sudo apt-get install libavahi-compat-libdnssd-dev ffmpeg
$ sudo npm install -g --unsafe-perm homebridge
$ sudo npm install -g homebridge-camera-rpi

From here, you can run the homebridge command to make sure that it starts up correctly.

$ homebridge

If you don’t get any errors then you can create the config.json file to setup the camera in homebridge. Create the following config.json file in the pi home directory.

$ nano ~/.homebridge/config.json

Then put this in the file.

{
    "bridge": {
        "name": "Homebridge"
        "username": "CC:22:3D:E3:CE:30",
        "port": 51826,
        "pin": "031-45-154"
    },
    "description": "",
    "platforms": [
        {
            "platform": "rpi-camera",
            "cameras": [{"name": "Front Door"}]
        }
    ]
}

You can change the camera name to something other than “Front Door” depending on what you want to display in HomeKit.

To have Homebridge startup automagically, you can follow the instructions on this link to get that done. One note, when you create the homebridge user account to run the service, add the video user group to that account so it has permissions to the camera.

$ sudo usermod -a -G video homebridge

Enjoy!

 

 

FreeNAS Jail IP Change

Recently I moved my FreeNAS server to a different internal IP. This required me to change the IP’s of all the jails I have installed on the server. After doing this in the web GUI, the jails could not contact the outside internet. Turns out that when you do this, the /etc/resolv.conf file does not get updated in each jail to the new IP. To fix this, from the FreeNAS console, run the following commands

$ cp /etc/resolv.conf <jail_root>/<jail_name>/etc/resolv.conf

After doing this, restart the jails and it should be working. There is an issue already opened up about this. I guess it will be fixed in the future.

Pebble 2.0 Weather

So I decided to release a BETA version on my new Pebble Watch application. I wanted to make this app so that it would work on all pebble devices without the need for a separate application to be installed on your iPhone/Android phone.

The only requirement for this application is that it only works on the Pebble 2.0 software. There also is a crash that happens randomly on the Today screen and I am still trying to track it down.

Let me know what you think.

IMPORTANT NOTICE FOR ANDROID USERS:

There is currently an issue with the BETA 2 software for Android and PebbleKit from the Pebble team.

  • JavaScript apps on Android will only run if the phone is turned on and the Pebble app running (the easiest way to check this is to bring it to the foreground). This will be fixed soon.

Release 0.1

  • Initial Release

Release 0.2

  • Changed settings to scroll between Celsius and Fahrenheit
  • Added degree symbol to 5 day forecast
  • Spelling error
  • Changed default temperature to Fahrenheit

Release 0.3

  • Changed the weather provider to Yahoo
  • Updated all the icons
  • Fixed a bug with the today screen crashing the app

Release 0.3.5

  • Added back High/Low temps on today screen
  • Moved Today description to just underneath temperature
  • Allow location to word wrap to second line
  • Updated the Flickr Lat/Lon query to City accuracy instead of Street
  • After pulling Today or 5 Day forecast, if you look at the about screen, it will display the Yahoo WOEID that is used to pull your forecast. You can check the raw output from this link. http://weather.yahooapis.com/forecastrss?w=YOUR-WOEID-HERE

Release 0.3.6

  • Move celsius/fahrenheit to be part of the query instead of calculating it.

Release 0.3.7

  • Added a menu icon.

Release 0.4.0

  • Moved settings to web configuration.
  • Added ability to use static city instead of GPS.

Release 0.4.1

  • Fixed a memory leak issue.

Release 0.4.2

  • Added another option to have an additional city. Choose city from phone settings.

Release 0.4.3

  • Update for Pebble 2.0 BETA 3

Release 0.4.4

  • Change messages for better notification of what is happening with application. First the message will display “Connecting to phone…”. Once it has confirmed a connection, the display will show “Getting location…”. If the display does not change to “Getting location…”, you will need to verify that the Pebble app is running on your phone. If you get the message “Location Not Set” you will need to verify that your settings are correct. Open the Pebble app and open the app settings for Weather. You will either need to have GPS enabled or have a static location set.

Release 0.4.5

  • Update for Pebble 2.0 BETA4

Release 0.4.7

  • Update for Pebble 2.0 BETA5
  • Fixed an issue with Configuration screen not saving the “Additional City” settings correctly
  • Added text to show user what time the conditions are from that is pulled from  Yahoo.

Release 0.5

  • Update for Pebble 2.0 BETA6

Release 0.5.1

  • Update for Pebble 2.0 BETA7

Weather 0.5.1 BETA

Code Share

So I needed a way to have two html select lists. One to show “Available” options and one to show “Selected” options. But the selected options needed to have a checkbox to allow the user to make a “read-only” selected option or a “full access” selected option. Got it? Good.

Continue reading “Code Share”

New Host

Just moved servers from GoDaddy to linode. So far I like it. The price went up a little bit but worth it for more freedom and larger hard drive space. We shall see how it goes.

Kindle 2 Hacks

I was able to get the jar files off the Kindle 2. Have been trying to decomplie the source code but it has been a little difficult. Some interesting things that I have found so far…

CONFIG_DIR: /opt/amazon/ebook/config
BOOKLET_DIR: /opt/amazon/ebook/booklet
BOOK_DIR_INTERNAL: /mnt/us/documents
BOOK_DIR_EXTERNAL: /mnt/mmc/documents
BOOK_DIR_DEFAULT_READ_ONLY: /opt/amazon/dict
MUSIC_DIR_INTERNAL: /mnt/us/music
MUSIC_DIR_EXTERNAL: /mnt/mmc/music
PICTURE_DIR_INTERNAL: /mnt/us/pictures
PICTURE_DIR_EXTERNAL: /mnt/mmc/pictures
SYSTEM_DIR_INTERNAL: /mnt/us/system
SYSTEM_DIR_EXTERNAL: /mnt/mmc/system
AUDIBLE_DIR_INTERNAL: /mnt/us/Audible
AUDIBLE_DIR_EXTERNAL: /mnt/mmc/Audible
DCIM_DIR_EXTERNAL : /mnt/mmc/dcim
SERVER_ALARM_PROC: /proc/serial_info
SERVER_ALARM_FILE: /var/run/.framework_error
TMP_ALL_LOG_FILE: /tmp/all_logs

LOG_DIR: /var/log
BASE_DIR : /opt/amazon/ebook
PREFS_DIR: /opt/amazon/ebook/prefs
WRITABLE_PREFS_DIR: /var/local/java/prefs
SCREEN_SAVE_DIR: /opt/amazon/screen_saver

#######################################################

shortcut.url_prefix.key1 = http://maps.google.com/maps?z=13&q=
shortcut.url_prefix.key2 = http://maps.google.com/maps?f=q&hl=en&q=gas+stations+near+
shortcut.url_prefix.key3 = http://maps.google.com/maps?f=q&hl=en&q=restaurants+near+
shortcut.url_prefix.location_query = http://maps.google.com/maps?f=q&hl=en&q=
(So the shortcuts are still there but I don't know if they are left over from the Kindle 1)
#######################################################

As I find more, I will continue to update.