Announcement

Collapse
No announcement yet.

My HomeSeer Based Smart Home

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

    #31

    Comment


      #32
      Originally posted by mwolter View Post
      Upgrading SEL to Ubuntu 16.04 and Mono 5.0.1.1

      First up is upgrading your HomeTroller SEL from Libuntu 14.04 with Mono 3.2.8 to Ubuntu Server 64 bit with Mono 5.0.1.1. This was no easy task but with my notes, it should be much easier for you! These steps should work with the standard Linux version and possibly the Pi version as well.

      I have been playing around with scripting on HomeSeer and using TenScripting but noticed that Mono 3.2.8 uses an older version of VB .Net. After helping my Mother install her SEL I noticed that HS is now shipping it with Mono v5. So I decided to update the OS and Mono at the same time and did a complete rebuild of the system.

      I was able to save my devices, zwave info, most of the events and now my system appears to be faster as well. All functionality has been maintained. Linux Tools, updating HS through the web interface, plugin installation, lighthttpd (for disaster recovery) and also added support for proper HS shutdown from Linux. For Linux, I decided to go with a server version of Ubuntu and use Webmin for administration. If you have a Linux based HS system, I highly recommend Webmin. It's a very easy to use web-based administration for GUI file access and exiting, Linux logs, user administration and a whole lot more. Far better than VNC or any other remote access system IMO. I've used it on other work-related projects in the past and it was perfect for this.

      HS process startup was moved to a system service and can be properly started and stopped from within systemd. I used the screen method from one of Pete's scripts, modified and split in two. One for start-up and another for shutdown. Made a simple systemd script and it appears to be working perfectly. Through monitoring of systemd and HS logs everything is started and shutdown properly and the HS web-based startup and shutdown work as well. Events and device operation appear to be faster than before (if that's even possible).

      Be very careful which version of Mono you install. As I am aware, the only Mono versions 100% compatible with HS are 3.2.8 and 5.0.1.1.

      Systemd Scripts

      HomeSeer.service
      Code:
      [Unit]
      Description=HomeSeer Home Automation
      After=network.target
      
      [Service]
      Restart=on-failure
      RestartSec=30
      TimeoutStartSec=60
      Type=forking
      ExecStart=/usr/local/HomeSeer/HomeSeer_start.sh
      PIDFile=/usr/local/HomeSeer/HomeSeerScreen.pid
      ExecStop=/usr/local/HomeSeer/HomeSeer_stop.sh
      
      [Install]
      WantedBy=multi-user.target
      HomeSeer_start.sh
      Code:
      #!/bin/bash
      DIR='/usr/local/HomeSeer' # HomeSeer Directory
      NAME='HomeSeer' # Server handle for the screen session
      HSPID="$DIR/HomeSeer.pid" # HomeSeer Process ID
      PID="$DIR/HomeSeerScreen.pid" # Screen Process ID
      if [ "$(pgrep -cf "mono.+HSConsole")" -ge 1 ]; then # Test if HS is running
      echo -e "$NAME is already running."
      else # If not running start HS
      if [ "$(pgrep -cf "[S]CREEN.+${NAME}")" -ge 1 ]; then pkill -cf "[S]CREEN.+${NAME}"; fi # Stop screen if running
      /usr/bin/screen -dm -S $NAME # Start detached screen
      sleep 2
      /usr/bin/screen -S $NAME -X stuff "export LANG=en_US.UTF-8; echo 0403 c07f > /sys/bus/usb-
      serial/drivers/ftdi_sio/new_id; cd $DIR; mono $DIR/HSConsole.exe --log; exit^M" # Start HomeSeer
      sleep 2
      pgrep -f "mono.+HSConsole" > $HSPID # Obtain HomeSeer Process ID
      pgrep -f "[S]CREEN.+${NAME}" > $PID # Obtain screen Process ID
      [ -s $HSPID ] && echo "$NAME started." # If HSPID exists and the size is greater than zero, echo
      fi
      HomeSeer_stop.sh
      Code:
       #!/bin/bash
      HSPID='/usr/local/HomeSeer/HomeSeer.pid'
      PID='/usr/local/HomeSeer/HomeSeerScreen.pid'
      NAME='HomeSeer'
      if [ -f $HSPID ]; then # Test if PID file exists
      if [ -s $HSPID ]; then # Test if PID is not empty
      if [ "$(pgrep -cf "mono.+HSConsole")" -ge 1 ]; then # If HS is running
      for char in $(printf "\\r s h u t d o w n \\r") ; do #invoke shutdown command to homeseer screen instance...
      /usr/bin/screen -p 0 -S $NAME -X stuff "$char"
      sleep 0.1
      done
      fi
      for number in {1..4} ; do # Allow time for HS and plugins to gracefully shutdown
      sleep 10
      if [ "$(pgrep -cf "mono.+HSConsole")" -lt 1 ]; then break; fi # If HS has closed, stop waiting
      done
      if [ "$(pgrep -cf "mono.+HSConsole")" -ge 1 ]; then # Kill HS if it was not stopped gracefully
      echo -e "$NAME did not stop gacefully. Killing it"
      kill "$(cat $HSPID)"
      else
      echo -e "$NAME was stopped."
      fi
      if [ "$(pgrep -cf "[S]CREEN.+${NAME}")" -ge 1 ]; then /usr/bin/screen -S $NAME -X stuff "exit^M"; fi # Gracefully close screen if running
      fi
      rm -f $HSPID; rm -f $PID # Remove PID files
      else
      echo -e "$NAME is not running."
      fi
      So here you go, my notes in PDF. Please take a look and let me know if you find anything that needs correction.

      Change Log:
      180104: Updated PDF with auto reboot and importing events
      180107: Found aspx pages were not loading properly. Spent quite a bit of time on this. Tried going to a 32 bit version of linux. Tried installing other Mono related packages. In the end had to revert to Mono 5.0.1.1. Updated the PDF with several new steps regarding this.
      180203: Removed unnecessary lines and made systemd scripts available directly in the post to avoid formatting issues.
      I Think later build of mono are x64. Do you think the change from 32 to 64 bit mono is causing the issue with .aspx page? I dont really understand the .aspx bug on resent mono stable release.. but maybe trying to use the --arch=32 option to load aspx page would be an option..? or try forcing the --arch=32 option with hs3 entirely..somehow...on stable mono release?

      https://www.mono-project.com/docs/ab...eleases/5.2.0/

      Comment


        #33
        Here using updated HS3 Lite (ARM) and HS3 Pro (Intel) on Ubuntu 18.04 and latest release of Mono Homeseer aspx pages do not load.

        Since day one of using RPi or Linux with Homeseer have kept the base OS updated. (RPi Raspberian, Linux 14.04, 16.04 and 18.04).

        I have not and will not be freezing a build of Mono to run aspx in Homeseer.

        Onus should be on Microsoft Mono to fix this as it is working with a previous version of Mono (there are many bug #'s posted relating to this issue on the Mono forums).

        Pine64:/HomeSeer/html# lsb_release -a
        LSB Version: core-9.20170808ubuntu1-noarch:security-9.20170808ubuntu1-noarch
        Distributor ID: Ubuntu
        Description: Ubuntu 18.04.1 LTS
        Release: 18.04
        Codename: bionic

        Pine64:/HomeSeer/html# mono -V
        Mono JIT compiler version 5.12.0.301 (tarball Wed Jul 25 16:41:47 UTC 2018)
        SIGSEGV: normal
        Notifications: epoll
        Architecture: arm64
        Disabled: none
        Misc: softdebug
        Interpreter: yes
        LLVM: supported, not enabled.
        GC: sgen (concurrent by default)

        Test aspx shows:
        System.Web.Compilation.CompilationException
        Error VBNC30248: CHANGEME

        Description: Error compiling a resource required to service this request. Review your source file and modify it to fix this error.
        Details: error VBNC30248: CHANGEME
        Error origin: Compiler
        Error source file: ~/Global.asax
        Exception stack trace:
        Version Information: 5.12.0.301 (tarball Wed Jul 25 16:57:14 UTC 2018); ASP.NET Version: 4.0.30319.42000

        Last edited by Pete; August 4, 2018, 06:52 PM.
        - Pete

        Auto mator
        Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb- Mono 6.12.X - HSTouch on Intel tabletop tablets
        Homeseer Zee2 (Lite) - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro - Mono 6.12.X
        HS4 Pro - V4.1.11.0 - Ubuntu 20.01/VB W7e 64 bit Intel Kaby Lake CPU - 32Gb - Mono
        6.10.0.104
        HS4 Lite -

        X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Smartthings hub, Hubitat Hub, and Home Assistant

        Comment


          #34
          Hi Pete,

          Thank you for your message.

          Yesterday, (with the half-awareness of knowing i was delaying my school thèsis again..lol), I wrote on Mono’s Github aboute the aspx issue. I Wrote to HST and I navigated the web about this issue as well.

          The issues seems to not be related to homeseer at all. Just wondering what changed from 5.0.1.1 to post 5.0.1.1...

          I think the mono-xbnc package is diferent now 4.7 vs 4.6)..but it can be a lot of things(depndencies, library) related (more or less) to that.

          Finally , i also tried the mono 5.14 preview relaese in the hope something was different. But got the same aspx page issue. Same with nightly 5.17 ( and 30% of my plugin didnt load and was not able to install them)

          Someone needs to investigate what did brake after 5.0.1.1...


          So From the official stable 5.12 ..I switched to 5.0.1.1 5 days ago. I think it uses more cpu and ram and has more cpu peaks, but not sure about this.
          I run this on a debian 9.5 x64 system, headless.
          I really wanted to use the grouping utility of Jon00 to clean my devices page. After this is done, i will maybe revert to the stable mono release.
          And i discovered you can output a txt file from the device and event viewer of Jon00 without having to show the .aspx page..
          So there is little use, in my case , of the 5.0.1.1 package.

          Last edited by MattL0; August 4, 2018, 09:39 PM.

          Comment


            #35
            My HS3 install using the scripts and steps in the original post had been running well for for almost three years. Decided to update to HS4 recently and the Systemd scripts still work well.

            Had to update Mono to version 6.10.0.104 using the commands below.
            Code:
            sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
            sudo apt install apt-transport-https ca-certificates
            echo "deb http://download.mono-project.com/repo/ubuntu xenial/snapshots/6.10.0.104 main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
            sudo apt update
            Was also able to make ASPX pages (@jon00 's plugins) work by editing /usr/bin/vbnc and replacing
            Code:
            #!/bin/sh
            exec /usr/bin/mono --debug $MONO_OPTIONS /usr/lib/mono/4.5/vbnc.exe "$@"
            with
            Code:
            #!/bin/bash
            exec /usr/bin/mono --gc-params=nursery-size=64m $MONO_OPTIONS /usr/lib/mono/4.5/vbc.exe "$@"

            Comment

            Working...
            X