Start server at boot
If you want to start the server at boot, type the following:
sudo nano /etc/rc.local
This opens a texteditor inside the terminal.
Paste the command for starting the server in the second last line of the file, right above
Now press CTRL+O and hit Return to save the file, then press CTRL+X to leave the texteditor.
The RC Plugs server starts at boot now!
Configure global access
If you want to connect to the server over the internet, a few more steps are necessary:
- You need a DynDNS URL, that links permanently to the current global ip address of your home network. So, register a
DynDNS-Service at a provider of your choice!
- Set up the DynDNS account info in your home router
- Add a port forward in your router that links from global port to the IP-address of your Raspberry Pi and the local port on which the RC Plugs server runs.
I recommend using
443 as local and global port.
- Set your DynDNS-URL and the global port in the admin area of the webinterface. This is used for the app's automatic server detection.
- Set the DynDNS-URL and the global port in the app's connection settings. They will be used automatically if you are not connected to a WiFi-network or the current WiFi-SSID does not match one of the SSIDs specified.
Run scripts in groups
You can attach two scripts to each group - one for 'on' and one for 'off'. Simply attach the script path to the group, for example
Keep in mind that the scripts need the execute flag in order to work. You can achieve that with
sudo chmod +x /home/pi/scriptOn.sh.
[App]: configure "automatic light"
The app provides a feature that checks whether you are near your home or not and automatically switches a specified group when you enter/leave the area.
You can enable the feature in the app's settings:
- First make sure you have global access. Otherwise it won't work.
Longitude: The longitude of your address (e.g.
Latitude: The latitude of your address (e.g.
Radius [meter]: The radius around your home which defines the range and the border where to switch (
300 is a good value!)
Select group: Here you can select the group to be switched.
Active hours: Set the timespan when this feature should do its work (e.g. only from 8pm to 8am: "only turn lights on when it is dark outside"). Set from 00:00 until 00:00 to disable the time restriction.