How to Use Openhab on Raspberry Pie

Step 1:

Always make sure you are using the latest updated packages, so start from here:

sudo apt-get updatesudo apt-get upgrade

Some applications may require you to update firmware, but it is usually not necessary. I suggest doing so.

sudo rpi-update

You can use any method to copy files to PI. I choose to download them. I also like to download them directly to the folder from which they will be extracted. Then I'll do some tidying up and delete unnecessary zip files. First, let's create the required folder.

sudo mkdir /opt/openhab

Then you will download the latest version to this folder. You can do this by going to the openhab download page, then right clicking the runtime core download and copying the link address to get the latest version. You can then replace the following URL with the one you copied.

cd /opt/openhab

wget https://github.com/openhab/openhab/releases/download/v1.5.1/distribution-1.5.1-runtime.zip

OK, let's install this B * tch. The zip file you downloaded should have been extracted to the correct location. If you haven't, go to the openhab folder and unzip the runtime zip file in it.

cd /opt/openhabsudo

unzip distribution-1.5.1-runtime.zip

Now let's delete the zip file that will no longer be included.

rm distribution-1.5.1-runtime.zip

Well, the runtime has been installed and the zip file has been removed, but in order for openhab to work properly, you need to add bindings. After extracting the runtime zip, an add ons folder is created. All bindings belong to this folder. Go to the addons folder and unzip the addons zip. First, let's download them to the appropriate folder.

cd addons/

wget https://github.com/openhab/openhab/releases/download/v1.5.1/distribution-1.5.1-addons.zip

It contains all the bindings available for openhab. As described in the openhab wiki, bindings are optional packages that can be used to extend the functionality of openhab. With the help of binding, openhab users can access asterisk communication software or connect to KNX home automation bus, for example.

Let's install all of these first, and then we can filter and decide which one to keep. You simply delete the. Jar file from the addons folder.

Sudo unzip distribution-1.5.1-addons.zip delete or erase the zip file.

rm distribution-1.5.1-addons.zip

Next, we return a folder to the openhab folder and copy the "openhab_default. CFG" file. You call it "openhab. CFG". If you have to update your openhab, the default file will also be updated. By copying this file, openhab will use it for configuration and will not update it. Since you will make your own custom configuration, be sure to write these files to the "openhab. CFG" file to ensure security.

cd 。. sudo cp configurations/openhab_ default.cfg configurations/openhab.cfg

In order to understand how this crazy thing works, I recommend deploying a demo application. This is a good way to get a foothold and understand it.

cd /opt/openhab

wget https://github.com/openhab/openhab/releases/download/v1.5.1/distribution-1.5.1-demo-configuration.zip

Go to the openhab folder and extract the demo zip file there. cd /opt/openhab

sudo unzip distribution-1.5.1-demo-configuration.zip

Delete junk file

rm distribution-1.5.1-demo-configuration.zip

By default, the "start. Sh" script is not an executable. To make it executable:

sudo chmod x start.sh

sudo 。/ start.sh

Then the fun begins! You should have a fully loaded demo to familiarize yourself with openhab. Just go to your phone or computer and put the following URL in your favorite browser. Make sure to replace the IP address with the IP address of PI.

http://192.168.X.XXX:8080/openhab.app ? sitemap=demo

Step 2: configure openhab to start automatically at startup

If there is a power surge, power failure, or the decision to restart PI, you need to restart your openhab program. Back end that is a big pain, so we will configure it to start at startup.

First, you will create a new file called "openhab" in the / etc / init. D folder.

You will use the nano editor to add a few lines of code or your favorite editor to the openhab file.

sudo nano /etc/init.d/openhab

Add this Code:

#! / bin/sh

### BEGIN INIT INFO # Provides: openhab # Required-Start: $remote_ fs $syslog # Required-Stop: $remote_ fs $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: OpenHAB Daemon ### END INIT INFO# Author: Thomas Brettinger# Do NOT “set -e”# PATH should only include /usr/* if it runs after the mountnfs.sh script PATH=/sbin:/usr/sbin:/bin:/usr/binDESC=“Open Home Automation Bus Daemon” NAME=openhab DAEMON=/usr/bin/java PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME ECLIPSEHOME=“/opt/openhab”; HTTPPORT=8080 HTTPSPORT=8443 TELNETPORT=5555 # be sure you are adopting the user to your local OH user RUN_ AS=pi# get path to equinox jar inside $eclipsehome folder cp=$(find $ECLIPSEHOME/server -name “org.eclipse.equinox.launcher_*.jar” | sort | tail -1); DAEMON_ ARGS= “-Dosgi.clean=true -Declipse.ignoreApp=true -Dosgi.noShutdown=true -Djetty.port=$HTTPPORT -Djetty.port.ssl=$HTTPSPORT -Djetty.home=$ECLIPSEHOME -Dlogback.configurationFile=$ECLIPSEHOME/configurations/logback.xml -Dfelix.fileinstall.dir=$ECLIPSEHOME/addons -Djava.library.path=$ECLIPSEHOME/lib -Djava.security.auth.login.config=$ECLIPSEHOME/etc/log in.conf -Dorg.quartz.properties=$ECLIPSEHOME/etc/quartz.properties -Djava.awt.headless=true -jar $cp -console $TELNETPORT”# Exit if the package is not installed [ -x “$DAEMON” ] || exit 0# Read configuration variable file if it is present [ -r /etc/default/$NAME ] && 。 /etc/default/$NAME# Load the VERBOSE setting and other rcS variables 。 /lib/init/vars.sh# Define LSB log_* functions. # Depend on lsb-base (》= 3.2-14) to ensure that this file is present # and status_of_proc is working. 。 /lib/lsb/init-functions# # Function that starts the daemon/service # do_start() # Return # 0 if daemon has been started # 1 if daemon was already running # 2 if daemon could not be started start-stop-daemon --start --quiet --make-pidfile --pidfile $PIDFILE --chuid $RUN_AS --chdir $ECLIPSEHOME --exec $DAEMON --test 》 /dev/null || return 1 start-stop-daemon --start --quiet --background --make-pidfile --pidfile $PIDFILE -- chuid $RUN_AS --chdir $ECLIPSEHOME --exec $DAEMON -- $DAEMON_ARGS || return 2 # Add code here, if necessary, that waits for the process to be ready # to handle requests from services started subsequently which depend # on this one. As a last resort, sleep for some time. return 0 # # Function that stops the daemon/service # do_stop() # Return # 0 if daemon has been stopped # 1 if daemon was already stopped # 2 if daemon could not be stopped # other if a failure occurred start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME RETVAL=“$?” [ “$RETVAL” = 2 ] && return 2 # Wait for children to finish too if this is a daemon that forks # and if the daemon is only ever run from this initscript. # If the above conditions are not satisfied then add some other code # that waits for the process to drop all resources that could be # needed by services started subsequently. A last resort is to # sleep for some time. start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON [ “$?” = 2 ] && return 2 # Many daemons don‘t delete their pidfiles when they exit. rm -f $PIDFILE return “$RETVAL” # # Function that sends a SIGHUP to the daemon/service # do_reload() # # If the daemon can reload its configuration without # restarting (for example, when it is sent a SIGHUP), # then implement that here. # do_stop sleep 1 do_start return 0 case “$1” in start) log_daemon_msg “Starting $DESC” do_start case “$?” in 0|1) log_end_msg 0 ;; 2) log_end_msg 1 ;; esac ;; stop) log_daemon_msg “Stopping $DESC” do_stop case “$?” in 0|1) log_end_msg 0 ;; 2) log_end_msg 1 ;; esac ;; status) status_of_proc “$DAEMON” “$NAME” && exit 0 || exit $? ;; #reload|force-reload) # # If do_reload() is not implemented then leave this commented out # and leave ’force-reload‘ as an alias for ’restart‘。 # #log_daemon_msg “Reloading $DESC” “$NAME” #do_reload #log_end_msg $? #;; restart|force-reload) # # If the “reload” option is implemented then remove the # ’force-reload‘ alias # log_daemon_msg “Restarting $DESC” do_stop case “$?” in 0|1) do_start case “$?” in 0) log_end_msg 0 ;; 1) log_end_msg 1 ;; # Old process is still running *) log_end_msg 1 ;; # Failed to start esac ;; *) # Failed to stop log_end_msg 1 ;; esac ;; *) #echo “Usage: $SCRIPTNAME start|stop|restart|reload|force-reload” 》&2 echo “Usage: $SCRIPTNAME start|stop|status|restart|force-reload” 》&2 exit 3 ;; esac :

You can also go here to see the readable version, or copy and paste the code from here.

You may need to change run_as = Pi to the current user.

Finally, you will make it an executable.

sudo chmod ax /etc/init.d/openhab

And make it start automatically at the beginning of PI

sudo update-rc.d openhab defaults

If the following error occurs:

insserv: Script openhab is broken: incomplete LSB comment. insserv: missing Provides:’ entry: please add. insserv: missing Required-Start:‘ entry: please add even if empty. insserv: missing Required-Stop:’ entry: please add even if empty. insserv: missing Default-Start:‘ entry: please add even if empty. inss erv: missing Default-Stop:’ entry: please add even if empty. insserv: Default-Start undefined, assuming empty start runlevel(s) for script openhab‘ insserv: Default-Stop undefined, assuming empty stop runlevel(s) for script openhab’

Then there is an indentation problem. Sometimes, when pasting into the editor, the text is placed in an easy to read format, so that indents are placed in some initial lines of code. Any information written for update RC. D must be in the first column. And there should be no tables or spaces before "" "". If there is any, delete them, otherwise you will generate this error.

Return your file and check it carefully.

sudo nano /etc/init.d/openhab

The first few columns should be as follows (do not copy and paste, including a

How to Use Openhab on Raspberry Pie 1

get in touch with us
مقالات مقترحة
Think Green Collection: Editors Choice 10 Best Images
Today weve chosen Pixabay 10 best green color images. Enjoy the green choice of our team.Green is the color of nature. It is associated with growth, harmony, freshness, and fertility. Green has strong emotional correspondence with safety. Dark green is also commonly associated with money.There lots of shades of green, natural and man-made. Check them all in our collection!Image by ju1959jjjGreen is the prime color of the world, and that from which its loveliness arises. Pedro Calderon de la Barca Image by SkitterphotoI just need green. I need to wake up and see grass and squirrels. I dont want to see skyscrapers. Andre Leon Talley Image by cegohI always say that candy is the perfect studio food it keeps your energy going. Nick Cannon Image by jeonsangoI believe a leaf of grass is no less than the journey-work of the stars. Walt Whitman Image by Free-PhotosIf there is a future, it will be Green. Petra Kelly Image by cocoparisienneDont be a fish; be a frog. Swim in the water and jump when you hit ground. Kim Young-ha Image by ulleoColorless green ideas sleep furiously. Noam Chomsky Image by jplenioFor in the true nature of things, if we rightly consider, every green tree is far more glorious than if it were made of gold and silver. Martin Luther Image by NietjuhWhen youre green, your growing. Ray Kroc Image by SkitterphotoNo object is mysterious. The mystery is your eye. Elizabeth Bowen All images and videos on Pixabay are released free of copyrights under Creative Commons CC0. You may download, modify, distribute, and use them royalty free for anything you like, even in commercial applications. Attribution is not required·RELATED QUESTIONI painted my bedroom a dark teal color and need some suggestions on color of bed set or accent colors?Turquoise or white would look great with teal
Where Can I Find Plastic Injection Molding Manufacturers in China?
How to Curl Your Hair Like This?
What Is Preventing the Solar Energy and Other Renewables to Replace the Oil?
What Matches This Formal Dress?
Why Does an Air Conditioner Sometimes Take so Much Time to Cool a Room?
Want to Play a Killer Video Game?
Netizens' Self Photographing Tutorial Reveals the Secret of "self Photographing Artifact" to Create
Are Hairy Legs Unattractive to Girls/women?
Is It a Good Idea to Cover Up Your Outdoor Air Conditioning Unit (compressor) with a Plastic Tarp fo
عمليات البحث ذات الصلة
Think Green Collection: Editors Choice 10 Best Images
Where Can I Find Plastic Injection Molding Manufacturers in China?
How to Curl Your Hair Like This?
What Is Preventing the Solar Energy and Other Renewables to Replace the Oil?
What Matches This Formal Dress?
Why Does an Air Conditioner Sometimes Take so Much Time to Cool a Room?
Want to Play a Killer Video Game?
Netizens' Self Photographing Tutorial Reveals the Secret of "self Photographing Artifact" to Create
Are Hairy Legs Unattractive to Girls/women?
Aminica Wigs are dedicated to providing top quality virgin human hair for large trader and wholesaler. Usually they resell it to the retailers then to customers, which results in high price that makes customers awe-stricken.
Contact Us

+86 020-22139352

If you have a question, please contact at contact

Copyright © 2021 Aminica humain Wigs |Sitemap