Installing ETHA Light Switch on the Raspberry Pi Zero W

Now that we have prepared the Raspberry Pi Zero W and installed all the hardware components, it’s time to actually install and configure the ETHA Light Switch Python program. So without further ado, enter the following commands in your ssh terminal:

mkdir -p /opt/etha
cd /opt/etha
wget "https://www.etha.erik.terwan.nl/Downloads/Raspberry Pi Zero W/Latest version/etha-light-switch"
chmod +x etha-light-switch

That takes care of the Python program. Then we setup the configuration:

mkdir -p /etc/etha
cd /etc/etha
wget "https://www.etha.erik.terwan.nl/Downloads/Raspberry Pi Zero W/Latest version/etha-light-switch.conf"

This creates a minimum configuration file that you’ll have to flesh out. The meaning of all configuration options are explained here. Edit this file according to your needs.

Now test the ETHA Light Switch Python program. You can start it by entering /opt/etha/etha-light-switch on the command line (ssh). If all goes well you’ll be getting a lot of log messages. If something goes wrong, try to locate the error and fix it. If you’ve got problems and you have no idea how to fix them, make a comment on this website with as much information as you can. I will try to remedy them.

If all goes well, and you’ve installed and configured the ETHA Manager Android app the right way, you should see your ETHA Light Switch time switch on the home screen of your Android app. Congratulations! You now have a working system, yet to be finetuned with clock rules, your location and the like. See here for the manual of the Android app.

But wait, there’s more to be done here. You’re now running the ETHA Light Switch Python program in a terminal. It’s much more convenient to automatically start the Python program when the Raspberry Pi Zero W starts up. Since Raspbian runs systemd, you can accomplish this by:

cd /etc/systemd/system
wget "https://www.etha.erik.terwan.nl/Downloads/Raspberry Pi Zero W/Latest version/etha-light-switch.service"
systemctl daemon-reload
systemctl enable etha-light-switch
systemctl start etha-light-switch

The next time your Raspberry Pi Zero W boots up, the ETHA Light Switch Python program starts automatically. The state led should indicate that.

Leave a Reply

Your email address will not be published.