Announcement

Collapse
No announcement yet.

Headless HomeSeer/deConz Linux Server

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Headless HomeSeer/deConz Linux Server

    I just rebuilt my HS and deCONZ server after a power supply failure. I finally got the system working as a normal headless server and will document the process here for anyone who may be assisted with the steps. I used a Dell 3040 that has an external power supply, laptop grade cpu and small form factor so there will be less heat in my server closet. I use vi as a text editor and if you are new to it, it has a steep learning curve...there are alternatives.

    Do a fresh install of the Linux of your choice. I use Xubuntu. You can use generally any distro. Get your system working on your internal network and to a point where you can ssh into it. These steps are outside of this scope and well documented elsewhere.

    Since distros have different mono support, you may be fine, but for me I need to install the full mono suite (all commands are by root, use sudo if you don't use a root account):

    Code:
    apt install mono-complete mono-vbnc
    From there I downloaded the HS3 zip file for linux. (as root with your install file in place of <hs3.tgz>. If you are stuck trying to get the file to your new server, you can use wget or download it via another system and put it on a USB.

    Code:
    mkdir /opt
    mv <hs3.tgz> /opt
    cd /opt
    tar zxvf <hs3.tgz>
    This puts HomeSeer in /opt/HomeSeer.

    Add the deCONZ repository to your system, and install - see the deCONZ site for more up to date instructions:

    Code:
    wget -O - http://phoscon.de/apt/deconz.pub.key | sudo apt-key add -
    sh -c "echo 'deb [arch=amd64] http://phoscon.de/apt/deconz $(lsb_release -cs) main' > /etc/apt/sources.list.d/deconz.list"
    apt update
    apt install deconz
    deCONZ put a systemctl framework in /lib/systemd/system. Since HomeSeer will run on port 80, you need to edit the /lib/systemd/system/deconz.service file to move the port that it runs on. This is generally poorly documented, but you can run deCONZ without a GUI:

    Code:
    vi /lib/systemd/system/deconz.service
    Edit:

    Code:
    [Unit]
    Description=deCONZ: ZigBee gateway -- REST API
    Wants=deconz-init.service deconz-update.service
    StartLimitIntervalSec=0
    
    [Service]
    User=1000
    ExecStart=/usr/bin/deCONZ -platform minimal --http-port=8080
    Restart=on-failure
    RestartSec=30
    AmbientCapabilities=CAP_NET_BIND_SERVICE CAP_KILL CAP_SYS_BOOT CAP_SYS_TIME
    
    [Install]
    WantedBy=multi-user.target
    I put deCONZ on port 8080. That is the only change I made to the file.

    Create a framework file in /lib/systemd/system for HomeSeer:

    Code:
    vi /lib/systemd/system/homeseer.service
    Enter:

    Code:
    [Unit]
    Description=HS3 Server
    After=network.target
    After=deconz.service
    
    [Service]
    WorkingDirectory=/opt/HomeSeer
    ExecStart=/usr/bin/mono /opt/HomeSeer/HSConsole.exe --log
    ExecStop=/opt/HomeSeer/stop_homeseer.sh
    Restart=on-failure
    TimeoutStopSec=90
    StandardOutput=syslog
    StandardError=syslog
    SyslogIdentifier=HSserver
    
    [Install]
    WantedBy=multi-user.target
    Things to note here: Logging goes to syslog, but we will intercept it in a bit. It will not start until deCONZ is started (the "after" section). It includes verbose logging from HSConsole.exe (the --log). Remove this if you don't want to see device level activity in your log. You can start HSConsole a variety of other ways (old init code etc) but the current and likely future method for all autostarting services is systemctl, so it is best to learn it. Don't get me wrong, I hate it and an old school rc.d or init.d guy, but those have been outgrown. Don't fight the change!

    Create the stop shell script file:

    Code:
    vi /opt/HomeSeer/stop_homeseer.sh
    Put in the following:

    Code:
    /usr/bin/curl --user YOURUSERNAME:YOURPASSWORD 'http://127.0.0.1/LinuxTools' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' --data 'ConfirmShutdownhs=Yes' --compressed
    sleep 10s
    (not my code, pulled from a howto here on the forum). Put in your user credentials in place of the obvious. You can skip this step until after you have setup your HomeSeer system. You can also skip this bit for shutdown and remove the ExecStop portion of the systemctl file if you want to manually stop HomeSeer via the web interface before taking the system down. I don't like that as I want all services to gracefully stop when I issue a restart or shutdown command via the terminal.

    Make the file executable and readable by the system (this is an internal system, so I don't mind the 777):

    Code:
    chmod 777 /opt/HomeSeer/stop_homeseer.sh
    Update the systemctl daemon (you edited two files so this will put updated copies into /etc/systemd/system. Some instructions you will find here and elsewhere tell you to manually copy the files from /lib/systemd/system to /etc/systemd/system. Don't):

    Code:
    systemctl daemon-reload
    Enable these new services:

    Code:
    systemctl enable deconz.service
    systemctl enable homeseer.service
    Modify rsyslog to pipe HomeSeer and deCONZ messages to your own log:

    Code:
    touch /var/log/Homeseer.log
    chmod 777 /var/log/Homeseer.log
    Create log file directors for rsyslog, cd in /etc/rsyslog.d and create the following files so that log entries will go to the right file:

    Code:
    cd /etc/rsyslog.d
    vi homeseer.conf:
    Enter:

    Code:
    if $programname == 'HSserver' then /var/log/Homeseer.log
    & stop
    Code:
    vi deconz.conf
    Enter:

    Code:
    if $programname == 'deCONZ' then /var/log/Homeseer.log
    & stop
    Code:
    vi mono.conf
    Enter

    Code:
    if $programname == 'mono' then /var/log/Homeseer.log
    & stop
    Restart syslog:

    Code:
    systemctl restart rsyslog
    Start HomeSeer and deCONZ:

    Code:
    systemctl start deconz.service
    systemctl start homeseer.service
    View log (cat /var/log/Homeseer.log) and use ps -ax or top to verify they are running. At this point each service should be up and you can access the configuration/management tools for each at their respective web interfaces (port 80 for HomeSeer and port 8080 for deCONZ).

    Restart the system and verify that deCONZ and HomeSeer start as they should. From there you can add your license, devices, events etc, or proceed to restoring configuration files that you backed up from a prior install.

    Once your system is running and configured, setup simple backups.

    Code:
    mkdir /backups
    vi /usr/local/bin/backup.sh
    Enter, replace USER with your account:

    Code:
    backup_files="/etc /opt/HomeSeer /usr/share/deCONZ /home/USER/.local /root /lib/systemd/system"
    day=$(date +%Y%m%d)
    dest="/backups"
    archive_file=$day.tgz
    echo "Backing up!"
    date
    echo
    tar cvfz $dest/HomeSeer-$archive_file $backup_files
    cp $dest/HomeSeer-$archive_file /home/USER/Dropbox/Apps
    echo
    echo
    echo "Backup Finished"
    echo
    ls -lh $dest
    ls -lh /home/USER/Dropbox/Apps
    This makes a backup of all the files edited above, my user account and root's account history and the config files for HomeSeer and deCONZ. I copy them to my dropbox folder, but you could put then into a web accessible location and download them or get them with sftp or similar. Of all the items listed here, you will likely want to modify the backup file the most so it puts the output in a place you can pull from the server. I don't bother automating the backup.sh program as I only run it when there is a change (adding a device/event etc and once a system is working that is rare).

    Running headless and without a window environment saves considerable on RAM. With each running, ram usage is less than a gig and there is no swap usage on a system with 4 gig of ram.

    #2
    The new small system ($70 from eBay):

    Click image for larger version  Name:	2021-12-26 10.57.19.jpg Views:	0 Size:	68.3 KB ID:	1516635

    Comment


      #3
      Very nice BlueRidgeDog !!!!

      BTW Linux (OS of choice here) runs on anything is is way more efficient to run than Windows these days.

      For Firewalls (PFSense) and NAS (XigmaNAS) boxes OS of choice here is BSD.

      Noticed that the Dell 3040 is a 6th generation motherboard and CPU. For $70 it is a very good deal!!!

      Here using the Lenova Tiny M93p which is a 4th generation motherboard and CPU which are still over $100 refurbished.

      On the computer rack running four of these. Two are running Windows 2016 server and two are running Ubuntu 20.04 server.

      These are separate from HS3-4.

      I am current running HS3 on a Micro PC originally with Windows 10 on it on an eMMC and switched that one over to Ubuntu 18.04 wiping out the Windows partition.

      The other HS3 machine is running on a mITX Haswell chipped motherboard running in Ubuntu 18.04.

      Homeseer 4 is running on a newer 6-7 generation mITX board in Linux 20.04 and a new but older Jetway micro computer (tiny thing).



      - Pete

      Auto mator
      Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb
      Homeseer Zee2 (Lite) - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro
      HS4 Lite - Ubuntu 22.04 / Lenovo Tiny M900 / 32Gb Ram

      HS4 Pro - V4.1.18.1 - Ubuntu 22.04 / Lenova Tiny M900 / 32Gb Ram
      HSTouch on Intel tabletop tablets (Jogglers) - Asus AIO - Windows 11

      X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Alexa, Cheaper RFID, W800 and Home Assistant

      Comment


        #4
        Thanks Pete. I use Linux exclusively for server related tasks as you can simply install the services you want and don't need the hardware footprint to support the weight of the OS. I do have a "leg up" on many folks, having used it since the early days (mail order floppies, and the requirement to compile your own kernel) and worked supporting and deploying Linux servers back in the 90's and early 00's.

        I would so love love a HS version that is Linux native.

        I have an HS4 license and will try it at some point, but have no functional issues pushing me to upgrade. I was going to jump on it if HS4 supported Zigbee natively so I could drop deCONZ, but alas, the developers don't seem to want to extend the product. I hope they change their approach when Matter hits the streets.

        I bought two of these Dell units so the next time I have a hardware failure, I can just plug in the other. I am not Mr. Geek anymore (once had a server array that would rival yours), so I don't keep spare hardware around much. I have a good Mac Mini that was my HS server for a long time that I may set up for HS4 to test.

        Comment


          #5
          Here too did the same....only started with CPM (Kaypro) and Commodore Pet (for a BBS) in the 1980's and first X86's with DOS in the 1990's...well and Linux for stuff that need to work 24/7...(for work then it was Red Hat / Fedora and first over sized commercial routers / switches. Best commercial servers in the 1990's were Novell (that never failed). At home always a hardware tinkerer. Never much venture down to the basement these days and wife has mentioned more than once if I pass before she does she will just power off everything in the basement....

          HS Rich is / was a native Linux person. HS3-4 is a port over using Mono from Windows HS3-4. I installed Home Assistant with HS4 on the new Linux box here. Home Assistant is mostly Python.

          Nice to meet you James (virtually). A belated Merry Christmas to you and your family and a Happy New Years!!!
          - Pete

          Auto mator
          Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb
          Homeseer Zee2 (Lite) - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro
          HS4 Lite - Ubuntu 22.04 / Lenovo Tiny M900 / 32Gb Ram

          HS4 Pro - V4.1.18.1 - Ubuntu 22.04 / Lenova Tiny M900 / 32Gb Ram
          HSTouch on Intel tabletop tablets (Jogglers) - Asus AIO - Windows 11

          X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Alexa, Cheaper RFID, W800 and Home Assistant

          Comment


            #6
            How do you use Home Assistant and HS4 together?

            I was Novel certified, along with Cisco back in the day...god that was a lifetime ago though.

            Comment


              #7
              How do you use Home Assistant and HS4 together?

              MQTT and a Home Assistant to Homeseer 3-4 Plugin

              Yes the Novell servers abended only for software or hardware maintenance....well similar to AS400's (in the 1990's).....yes lifetime ago...
              - Pete

              Auto mator
              Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb
              Homeseer Zee2 (Lite) - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro
              HS4 Lite - Ubuntu 22.04 / Lenovo Tiny M900 / 32Gb Ram

              HS4 Pro - V4.1.18.1 - Ubuntu 22.04 / Lenova Tiny M900 / 32Gb Ram
              HSTouch on Intel tabletop tablets (Jogglers) - Asus AIO - Windows 11

              X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Alexa, Cheaper RFID, W800 and Home Assistant

              Comment


                #8
                Well, I gave HA a good hard look last night. Though I long for a Linux native HomeSeer, HA seems to be still in the growing stage and they are eager for you to run it as a virtual system or in a container so you don't "break" things by using your system for other operations. I may test it, but my current setup works and works robustly without issues (and has for years). I spent some time on the forums there and the product has promise, but the complexity versus HS is shocking. Home automation is not a complex or resource intensive task and the footprint of HS is about right for the job. I will tinker some.

                Comment


                  #9
                  While I have been using Homeseer since Homeseer version 1 have always tinkered with different automation software here (Open source free and paid for automation software).

                  I do not find Home Assistant complex and has evolved much since the early days.

                  Out in Internetlandia there is an Open Source "copy cat" version of Homeseer that has also evolved much over the years. It worked fine when I tested it for a few months a few years back.

                  HomeGenie - EU

                  There is much more open source automation software out there today. Homeseer is rated one of the best and its been around since the late 1990's.

                  Rambling....

                  For years used X10 then Insteon then UPB while tinkering with Zigbee and Z-Wave and lately MQTT. I have left house #1 using UPB for in wall switches although continue to have Z-Wave, Zigbee and X10 controllers on line. Many sensors (contact, PIR, temperature, et al) in the house #1 are hard wired to a Leviton Omni Pro 2 combo automation / alarm panel and I get instant notifications. In house #2 using wireless sensors for almost but not instant notifications. Much easier to install wireless with battery sensors but a PITA to have to change batteries.

                  I have never liked using wireless anything for automation or media and now tinkering with MQTT wireless in House #2.

                  Homeseer has done it all nicely for me and open source is catching up bit by bit. (literally).

                  Main house has always been a sandbox for automation always tinkering. WAF is good because it keeps me busy and the automation is for me and not for her. She could care less about it.


                  they are eager for you to run it as a virtual system or in a container so you don't "break" things by using your system for other operations

                  Understood...have it configured here both natively and as a container on Ubuntu 20.04.

                  Everything works fine natively for me except for seeing these messages.

                  You are running an unsupported installation


                  - Pete

                  Auto mator
                  Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb
                  Homeseer Zee2 (Lite) - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro
                  HS4 Lite - Ubuntu 22.04 / Lenovo Tiny M900 / 32Gb Ram

                  HS4 Pro - V4.1.18.1 - Ubuntu 22.04 / Lenova Tiny M900 / 32Gb Ram
                  HSTouch on Intel tabletop tablets (Jogglers) - Asus AIO - Windows 11

                  X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Alexa, Cheaper RFID, W800 and Home Assistant

                  Comment


                    #10
                    HA is complex because you can do virtually anything automation related with it. It supports almost every smart home branded product that can be supported. However, with this breath of support comes more complexity. Also, the nature of being an open source project means that if you encounter a bug or problem it’s down to the community (or you) to figure out and submit a fix.

                    I made a decision a little while ago to streamline my home automation and just focus on buying a few types of technology (namely Caseta for lighting and ZWave for everything else) and stuck with HomeSeer. My system isn’t complex and doesn’t need to be to achieve what I want. The bonus is that HS has been extremely stable for me which earns bonus points with my wife.

                    Comment

                    Working...
                    X