Garage Light image for openHab upgrade
|

Improving the Garage Light Controller

In my original garage light controller post, had prepared a script to automatically launch the beagle bone black (BBB) web server. When I implemented the kiln controller, I also upgraded the garage light controller to interface with openHab. The new code for the BBB is in a zip file below. To run them, I just logged into the BBB then added the new children scripts to the launcher script. I did have to add some sleep timers to the tmux commands so the scripts would start properly.Garage Light image for openHab upgrade

 ls /etc/systemd/system/myMakercise.service -l
/etc/systemd/system/myMakercise.service -> /lib/systemd/system/myMakercise.service

Contents of /lib/systemd/system/myMakercise.service:

#instruction from https://gist.github.com/tstellanova/7323116
# https://forums.opensuse.org/showthread.php/506589-How-to-start-application-in-tmux-on-boot

[Unit]
Description=My Makercise Service

[Service]
Type=forking
User=root
ExecStart=/home/makercise/myMakerciseBBIOLauncher.sh

[Install]
WantedBy=multi-user.target

Contents of /home/makercise/myMakerciseBBIOLauncher.sh:

#!/bin/bash
# goes in /home/makercise/myMakerciseBBIOLauncher.sh

# instructions from https://gist.github.com/tstellanova/7323116

echo "successfully ran myMakercise client script...." > /home/makercise/makercise_script.log
tmux new -d -s mcctrl 'sleep 30; python /home/makercise/openhab_bbb/Control_Lights.py'
echo "successfully initiate tmux listener sessions" >> /home/makercise/makercise_script.log
tmux new -d -s mcstat 'sleep 40; python /home/makercise/openhab_bbb/push_status_to_openhab.py'
echo "successfully initiate tmux pusher sessions" >> /home/makercise/makercise_script.log
echo `date` >> /home/makercise/makercise_script.log

To start the service on the BBB, I ran:

systemctl start myMakercise.service

Here are the files:

BBB_Garage_Light_Controller_openHab_Upgrade_Code.zip

Similar Posts

2 Comments

  1. test comments are here. Where do you get materials for this? I tried to find other info online.

Comments are closed.