No announcement yet.

Desktop HomeSeer Log Monitoring

  • Filter
  • Time
  • Show
Clear All
new posts

    Desktop HomeSeer Log Monitoring

    Firstly, this is for Linux based systems (Zee and Full Linux install).

    Problem: The HS log is a small Sqlite3 database and monitoring it involves a web browser, that then activates a back end program that then sends a request to the database, gets the data and then updates a display. This process is slow and resource intensive.

    Solution: Use Conky to parse the log and display the most recent events as part of your home automation server's desktop.

    The Conky configuration file:

    # **********************************************************************
    #    HomeSeer Conky config File
    # **********************************************************************
    background yes
    double_buffer yes
    minimum_size             399 193
    maximum_width            850
    alignment top_left
    border_width 1
    default_color white
    default_outline_color white
    default_shade_color white
    draw_borders no
    draw_graph_borders yes
    draw_outline no
    draw_shades no
    gap_x 30
    gap_y 40
    no_buffers yes
    out_to_console no
    out_to_stderr no
    extra_newline no
    own_window yes
    own_window_type normal
    own_window_transparent yes
    own_window_colour 000000
    own_window_argb_visual no
    own_window_argb_value 0
    own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
    stippled_borders 0
    update_interval 2.0
    uppercase no
    use_spacer none
    show_graph_scale no
    show_graph_range no
    use_xft yes
    xftalpha 0.1
    xftfont Droid Sans:size=10
    color0 white
    color1 EAEAEA
    color2 FFA300
    color3 grey
    ${color2}${font bold:size=16}HomeSeer ${font size=8}${color0}
    ${alignr}${execp /usr/bin/sqlite3 /opt/HomeSeer/Logs/HomeSeerLog.hsd 'SELECT Log_DateTime, Log_Type, Log_Entry FROM Log ORDER BY Log_DateTime DESC LIMIT 10' | sed -e 's/<font color=..\([0-9]*\).>/${color #\1} /g' -e 's/<.font>/${color0}/g'
    Conky looks for configuration files in /home/$home/.conky (my user is 'jervin', so this expands to /home/jervin/.conky). The Conky configuration file directory states with a "." which simply means it is hidden. Many Linux/Unix programs store configuration in formation in directories in the user's home directory, naming the directory with a starting ".".

    The code above is saved as /home/$home/.conky/HomeSeer/HomeSeer - though "where" it is and what it is called is moot as long as you point to it when you run Conky.

    (a file called HomeSeer in a directory called HomeSeer in the Conky setting directory)

    You can run this with conky (installed by default in most distros) with:

    conky -c "/home/jervin/.conky/HomeSeer/HomeSeer" &
    The "&" simply tells the process to fork to the background.

    The end result is:

    Click image for larger version  Name:	HomeSeerLog.png Views:	0 Size:	294.4 KB ID:	1329590

    This is accomplished via a single line of code that gets the ten most recent entries from the database, strips the HTML formatting that HS uses and replaces it with Conky formatting.

    It only pulls the most recent ten entries. If you want more or less, you can alter "DESC LIMIT 10" to your desired limit.

    The update frequency is 2 seconds, but you can change that in the configuration file.

    Though it only opens the database in read mode, it will still lock the database and you may see one or two instances a day of HomeSeer complaining that the database is locked.

    I addressed that by converting the database to WAL access mode. This is not required and I don't recommend it as I am still testing to see if HS objects to a change in the database. So far it appears to not care or even realize the change was made and it should be transparent to clients.

    root@MiniUntu:/opt/HomeSeer/Logs# sqlite3 ./HomeSeerLog.hsd
    SQLite version 3.22.0 2018-01-22 18:45:57
    Enter ".help" for usage hints.
    sqlite> PRAGMA journal_mode=WAL;
    So, if you have a dedicated home automation server and want to have simple access to your log, you can use Conky to have a display always handy.

    Conky config file not working anymore, I get conky: Unknown setting on each line in the config file. Probably Conky changed syntax...


      That is odd. Conky is not a dynamic product and few see to be using it anymore. I will see if anything has changed.