Advertisements
20 Apr

Only run the scene at night

This is a very simple LUUP snippet. The Vera has a handy function .is_night() which, as you’d expect, simply returns true or false depending on if its day or night.

Vera doesn’t need an attached light sensor for this, instead it uses local weather data – so if you’ve opted to keep your Vera offline this will not work.

First create your scene based on your chosen trigger and add the lights you want turned on, or what ever actions you want it to do, then under Also, execute the following Luup code add the following.

This works because if your LUUP code returns true, which it will at night, the scene runs and if the return value is false it want.

Tenvis MINI319W Review
19 Apr

Tenvis MINI319W Review

My trusty Panasonic BL-C10 IP camera finally failed after years of faithful service, so I went online searching for a replacement. After some searching I came across the Tenvis Mini319W for a low budget of about £32 it seemed like a good replacement.

Installation was very easy, but instead of trying to make a dry unboxing event into interesting reading see the video bellow from the Ultimate Handyman as he installs his in his garage.

https://www.youtube.com/embed/ABRS3gVEzPg

Now here is my take on it. With a price tag of just £32 the Tenvis Mini319W camera is definitely in the lower price bracket, but I was still hoping for more.

The setup and installation was very easy. After connecting a Cat5 network cable and adding power the camera set its self up on my network using DHCP and from there it was a simple case of connecting to its admin page to setup the WiFi connection – a small point of note is the camera will not connect to both WiFi and Cat5 at the same time, took me a while to work that out.

The infrared (night vision) is really quite impressive. The view is very bright and far more impressive than I’ve seen in other cameras. But setup and night vision are about the best bits.

Once your into the admin screen there are few controls. You can change the brightness or contrast and flip the image but there is no zoom. The UI is also fairly poor, loading the page to look like an iPad with the camera on display:
Web Admin

The resolution is disappointingly poor. As you can see my camera is pointed at the window, looking out to anything happening the other side of the glass is all but indistinguishable. You can make out people and colours but the image is so poor you can barely work out if their wearing a jacket or not. The best point of view is anyone standing just in front of the flowers, but even that is a blur when there’s is any motion at all.

In fairness, other than the web UI, the negatives are not deal killers. It’s the field of view that is really disappointing. My camera – in the photo above – is mounted on the wall about 5 meters from the window and you can see from the image how little of the room is actually visible.

Overall I was extremely disappointed with this camera and will be not be buying another one. The Ultimate Handyman’s video shows are far better UI and video quality than is my experience. I’m not exactly sure why but it’s possible I ended up with a different model than he has in his video. For my next camera I will just have to look a little harder.

Raspberry Pi Powered OpenVPN – Client Side
19 Apr

Raspberry Pi Powered OpenVPN – Client Side

This is part two of my series on creating your own, private, VPN server at home using a Raspberry Pi. If you have followed on from my Raspberry Pi Powered OpenVPN – Server post you will have a fully working OpenVPN server. You probably also noticed it took you a good portion of your afternoon, but with bugs and hacks being found in more and more Linux software and libraries it is well worth having a server you can trust.

You’ll have noticed though we’re missing a vital step before we can make use of our new server. In part three of my tutorial we created some access keys to allow our phones and laptops (from here on called clients) to access our server, but we haven’t told the clients.

OpenVPN software gets all the information about where your server is, how to connect, what keys to use and what connections to create from a configuration file called and .ovpn. Since you need a separate OVPN file for each client we’ll use a script to do our heavy lifting.

Eric Jodoin first created this script while at the SANS institute, and with some basic template files, it can create configuration files for all our clients.

As with the Raspberry Pi Powered OpenVPN – Server tutorial the following commands still need executed as root, so remember ether add sudo infront of them or make sure you still have root from the sudo -s command.

Setting the defaults

Eric’s script works by combining a default configuration file with the keys specific to client, so we need to create it first.

Create a new blank file:

nano /etc/openvpn/easy-rsa/keys/Default.txt

Then copy and past in this:


Remember to change the line remote to match your setup. Include the public IP address of your OpenVPN server and make sure the port and proto are correct. If in on page four you opted to use TCP or a non standard port, one other than 1194, you need to make sure this is correct here as well.

If you are not sure what your public IP address is you can ask Google.

Some ISPs will rotate your IP address regularly which causes a problem when trying to access your new server. There are however many services that offer dynamic domain names (DDNS). These give you a static domain name but make sure the IP address always points to your home PC. First thing I would do is check your router to see if it supports a DDNS provider. If it doesn’t then you can use a free service like DNS Dynamic, but you will have to setup and run the ddclient on the Pi to keep your IP address updated.

As in the previous tutorials use control+x and save the new file.

Creating the script

Now we’ll create a copy of the script Eric produced, the original PDF download of his research paper can be found online.

First create a new file in nano:

nano -w /etc/openvpn/easy-rsa/keys/ovpn_gen.sh

Get a copy of the script from my gitlab server and past it into this new file. Lastly control+x and save the new script.

By default new files created in nano are just text files, they do not have permission to execute commands. This command will give only the root user permission to read, write or execute our new file:

chmod 700 /etc/openvpn/easy-rsa/keys/ovpn_gen.sh

We can now run the script, but first make sure we are in the keys folder:


The first thing we’re asked for is the Client Name. This must be the same as we used in page three of the server side tutorial. I’ll continue using KEYNAME here, but if I was setting up the key for my Nexus 5 I would use stuart.nexus5.

If everything worked as expected you’ll see a message like this:


Now just rinse and repeat for as many clients as you have setup, but make sure to only run the command for keys you already created. If you need a new device go back to page three and create a new set of keys first.

Downloading the OVPN files

You now have to download your new OVPN file from the /etc/openvpn/easy-rsa/keys/ folder onto your clients. If you are on a link system I would use the scp command, but for Windows users WinSCP would work as well.

If you are using WinSCP you will not have permission to access the /etc/openvpn/easy-rsa/keys/, this is by design and adds additional protect to your server. So you can cp the file into the pi home directory first and download it from there, but make sure to delete it once you have it on the client.

cp /etc/openvpn/easy-rsa/keys/KEYNAME.ovpn /home/pi/

and then

rm /home/pi/KEYNAME.ovpn

In part two of this tutorial we’ll take a look at setting up our client and getting OpenVPN installed and running on your Android phone or tablet.