Version 1.1.15 released

Just for anyone either coming to HomeGenie for the first time or are struggling to get HomeGenie working, this is the procedure I followed starting with a blank SD card and installing Raspbian Stretch Lite on a Raspberry Pi. If it’s not suitable here you can move it to somewhere else.

Remember I used this installation procedure only for Raspbian Stretch.

Raspbian Stretch Installation Instructions for a HomeGenie Setup

  1. Download latest Raspbian Stretch Lite image
  2. Write image to blank SD card using Win32 Disk imager ( or any other disk imaging software )
  3. Create a blank text file on the PC with the name SSH. with no extension. Place this file onto the the SD card. It allows you to SSH into the Raspberry Pi later. SSH is automatically disabled on all new Raspbian Stretch images.
  4. Remove SD card and put it in the Raspberry Pi and power up the Pi.

5 .Identify what ip address the Pi has booted on in your network. In a PuTTY session (or any other SSH software) log into the Pi from your PC using the address you identified
6. You will be asked for a login name. Use the default name pi and the default password raspberry. You are now logged into the Pi.
7. The first command to use is sudo raspi-config. First thing to do here is set a new password for your Pi. The next thing is to expand the file system so Raspbian uses the complete SD card for storage. Some other settings you might like to change too. Once finished save your settings and reboot your Pi.
8. When logging in now the login name is pi and the password is the new password you created.
9. At the prompt type sudo apt-get update
10. Next command is sudo apt-get upgrade. This will take quite a while to complete.
11 Next command at the prompt will be sudo apt-get install dirmngr This will allow you to install the latest version of Mono for your version of Raspbian.
12. The following will install Mono 5.4 on Raspbian Stretch.

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF

echo “deb http://download.mono-project.com/repo/debian raspbianstretch main” | sudo tee /etc/apt/sources.list.d/mono-official.list

sudo apt-get update

This will take a while too. You now have a version of Raspbian Stretch Lite which you can now install HomeGenie on.

HomeGenie installation as follows

From the command prompt in the PuTTY session on your PC use the following commands

wget https://github.com/Bounz/HomeGenie-BE/releases/download/V1.1.15/homegenie_1.1.15_all.deb

sudo apt-get update

sudo apt-get install gdebi-core

sudo gdebi homegenie_1.1.15_all.deb

You should now be prompted to access HomeGenie by typing the ip address of your Raspberry Pi in a browser session on your PC. You have already identified the ip address of your Raspberry Pi earlier.

Optional dependencies

In order to activate some features, optional dependencies may be required to install.

Audio playback utilities

sudo apt-get install alsa-utils lame

Embedded speech syntesys engine

sudo apt-get install libttspico-utils

SSL client support

sudo apt-get install ca-certificates-mono

LIRC Infrared inteface

sudo apt-get install lirc liblircclient-dev

Video4Linux camera

sudo apt-get install libv4l-0

X10 CM15 Home Automation interface

sudo apt-get install libusb-1.0-0 libusb-1.0-0-dev

Arduino™ programming from HG program editor

sudo apt-get install arduino-mk empty-expect

I added this because looks like that some package references it: https://plus.google.com/103363116404947540962/posts/87V5H2bHmyW
Maybe this is some other interface or automation program… I don’t know, this issue needs more investigation.

Here is are logs on installing r526 and V1.1.15. The error.log must be telling me something. I just don’t know what. I did look in the .deb file, thinking that gets to mirror servers might be the disconnect. Not sure the USA servers are up-to-date. However, both versions pull US servers. Maybe someone can pin point from the error.log where I am going wrong.HG install r526 01222018.zip (11.6 KB)
HG V1-1-15 install 01222018.zip (32.0 KB)

@tflemer, thank you for your logs, they contain comprehensive data.
Looks like one of the problems is corrupted database image (homegenie_stats.db file).

2018-01-22 08:46:25.9240|ERROR|MIG.MigService|HomeAutomation.HomeGenie  Service.StatisticsLogger        Database Error  Exception.StackTrace      SQLite.Interop.dll:   at (wrapper managed-to-native) System.Data.SQLite.UnsafeNativeMethods:sqlite3_config_none (System.Data.SQLite.SQLiteConfigOpsEnum)
  at System.Data.SQLite.SQLite3.StaticIsInitialized () [0x0001d] in <9ce7d8410bcd4d7f88eed4557d443345>:0
  at System.Data.SQLite.SQLiteLog.Initialize () [0x00000] in <9ce7d8410bcd4d7f88eed4557d443345>:0
  at System.Data.SQLite.SQLiteConnection..ctor (System.String connectionString, System.Boolean parseViaFramework) [0x00013] in <9ce7d8410bcd4d7f88eed4557d443345>:0
  at System.Data.SQLite.SQLiteConnection..ctor (System.String connectionString) [0x00000] in <9ce7d8410bcd4d7f88eed4557d443345>:0
  at (wrapper remoting-invoke-with-check) System.Data.SQLite.SQLiteConnection:.ctor (string)
  at HomeGenie.Service.Logging.StatisticsLogger.OpenStatisticsDatabase () [0x00023] in <8d43297479e340b0bc2b2a967fada7ef>:0 |

You see, there is text “Database Error” before the stack trace. I was able to reproduce this error by writing random characters in .db file.
So, as a solution, I can offer you to replace that file with one from the previous installation (r526), because it looks like default empty .db in distribution is also corrupted.

But the other error messages look weird. And as I can see corrupted database should not lead to the app crash.

P.S. Also, try to install Mono from official repositories. As I can see from your installation log mono’s package repository hosts are not added to your system’s apt-get sources. See http://www.mono-project.com/download/#download-lin-raspbian

@Petediscrete I wonder if we can mark those packages as dependencies in the .deb file…

If we could get some feedback from users on how successful they were installing from these repositories and getting Homegenie up and running as a result, it would certainly would be an ideal thing to do.

As Debian/Raspbian users know, Mono in their distribution repositories is usually a couple of releases behind and prevents users from taking full advantage of the current Mono development which is an ever evolving creature.

On a side note, Mono probably means absolutely nothing to Homegenie users on Windows. Maybe if we could try to keep these discussions clearly flagged as directed to Homegenie on Linux and its different flavours.

From what I am hearing, Windows 10 users are struggling running HA products in general so maybe the Linux platform and in particular Raspbian on the Raspberry Pi is the way forward. Just purely a personal opinion.

Bounz, Thanks and yes would like the .db file. Also, went nuts trying to find the find. Dumped the entire list and could not locate. So, where do I put the db. file?

On Mono - Yes, I will pull directly from their repository. Following Michel, I did install Mono on one of the load iterations. Did not help. Also, checked to see if Mono was installed with Raspian - no. So, It is coming in with the .deb file. The odd part is, both V1.1.15 and r526 are pulling from the same mirror server here in the US. Going step wise, will replace the .db file and then uninstall/install Mono directly.

It should be located in the root of HomeGenie installation folder (alongside HomeGenie.exe).

as i referenced in the camera thread… the build might be the issue for the camera, but looking at the linux.csproj file there is also a shared folder containing the system.Data.SQLite.dll file which may have been used for the required files on a linux build… which may be related to any above issues.

I think we may need to add this csproj file to the solution so that this is built to also include the V4L interop code.

David

Spent a lot of time investigating how SQLite works on different platforms and it’s a nightmare.
Going to try LiteDB, as it’s fully managed database and doesn’t require any native libraries.

Have you looked at MariaDB. Its working nicely in Stretch.

I know about MariaDB, but it doesn’t have an embeddable engine and therefore should be installed and managed separately, which will result in additional installation steps and new points of failure.

an interface, allowing people to use whatever, let the software create the db schema :))

1 Like

Thanks for posting this guide. I’ll be setting up my RPi3 soon and I’ll give your instructions a try.

I ran through all the steps including setting up SSL and X10. When I tried to access HG via a browser, I could not connect. I looked at the service and found it wasn’t working. Any thoughts?

pi@RPi3:~ $ sudo service homegenie status
● homegenie.service
Loaded: loaded (/etc/init.d/homegenie; generated; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2018-02-07 14:21:22 PST; 4min 11s ago
Docs: man:systemd-sysv-generator(8)
Process: 377 ExecStart=/etc/init.d/homegenie start (code=exited, status=203/EXEC)

Feb 07 14:21:22 RPi3 systemd[1]: Starting homegenie.service…
Feb 07 14:21:22 RPi3 systemd[1]: homegenie.service: Control process exited, code=exited status=203
Feb 07 14:21:22 RPi3 systemd[1]: Failed to start homegenie.service.
Feb 07 14:21:22 RPi3 systemd[1]: homegenie.service: Unit entered failed state.
Feb 07 14:21:22 RPi3 systemd[1]: homegenie.service: Failed with result ‘exit-code’.

When I start the service, I get notice that it failed and it directs me to 2 locations to debug:

pi@RPi3:~ $ sudo service homegenie start
Job for homegenie.service failed because the control process exited with error code.
See “systemctl status homegenie.service” and “journalctl -xe” for details.

The first shows the first set of error messages:

pi@RPi3:~ $ systemctl status homegenie.service
● homegenie.service
Loaded: loaded (/etc/init.d/homegenie; generated; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2018-02-07 14:38:27 PST; 43s ago
Docs: man:systemd-sysv-generator(8)
Process: 789 ExecStart=/etc/init.d/homegenie start (code=exited, status=203/EXEC)

Feb 07 14:38:27 RPi3 systemd[1]: Starting homegenie.service…
Feb 07 14:38:27 RPi3 systemd[1]: homegenie.service: Control process exited, code=exited status=203
Feb 07 14:38:27 RPi3 systemd[1]: Failed to start homegenie.service.
Feb 07 14:38:27 RPi3 systemd[1]: homegenie.service: Unit entered failed state.
Feb 07 14:38:27 RPi3 systemd[1]: homegenie.service: Failed with result ‘exit-code’.

The second generates a huge list of the same issue repeatedly:

pi@RPi3:~ $ journalctl -xe |more
– Logs begin at Thu 2016-11-03 10:16:42 PDT, end at Wed 2018-02-07 14:40:13 PST. –
Feb 07 14:32:04 RPi3 lircd-0.9.4c[536]: Error: Cannot glob /sys/class/rc/rc0/input[0-9]/event[0-9]
Feb 07 14:32:05 RPi3 lircd[536]: lircd-0.9.4c[536]: Error: Cannot glob /sys/class/rc/rc0/input[0-9]/event[0-9]
<…>
Feb 07 14:35:18 RPi3 sudo[684]: pi : TTY=pts/0 ; PWD=/home/pi ; USER=root ; COMMAND=/usr/sbin/service homegenie stop
Feb 07 14:35:18 RPi3 sudo[684]: pam_unix(sudo:session): session opened for user root by pi(uid=0)
Feb 07 14:35:18 RPi3 lircd[536]: lircd-0.9.4c[536]: Error: Cannot glob /sys/class/rc/rc0/input[0-9]/event[0-9]
Feb 07 14:35:18 RPi3 lircd-0.9.4c[536]: Error: Cannot glob /sys/class/rc/rc0/input[0-9]/event[0-9]
Feb 07 14:35:19 RPi3 sudo[684]: pam_unix(sudo:session): session closed for user root
Feb 07 14:35:19 RPi3 lircd[536]: lircd-0.9.4c[536]: Error: Cannot glob /sys/class/rc/rc0/input[0-9]/event[0-9]
Feb 07 14:35:19 RPi3 lircd-0.9.4c[536]: Error: Cannot glob /sys/class/rc/rc0/input[0-9]/event[0-9]
Feb 07 14:35:20 RPi3 lircd[536]: lircd-0.9.4c[536]: Error: Cannot glob /sys/class/rc/rc0/input[0-9]/event[0-9]
Feb 07 14:35:20 RPi3 lircd-0.9.4c[536]: Error: Cannot glob /sys/class/rc/rc0/input[0-9]/event[0-9]
Feb 07 14:35:21 RPi3 lircd[536]: lircd-0.9.4c[536]: Error: Cannot glob /sys/class/rc/rc0/input[0-9]/event[0-9]
Feb 07 14:35:21 RPi3 lircd-0.9.4c[536]: Error: Cannot glob /sys/class/rc/rc0/input[0-9]/event[0-9]
Feb 07 14:35:22 RPi3 sudo[716]: pi : TTY=pts/0 ; PWD=/home/pi ; USER=root ; COMMAND=/usr/sbin/service homegenie start
Feb 07 14:35:22 RPi3 sudo[716]: pam_unix(sudo:session): session opened for user root by pi(uid=0)
Feb 07 14:35:22 RPi3 lircd[536]: lircd-0.9.4c[536]: Error: Cannot glob /sys/class/rc/rc0/input[0-9]/event[0-9]
Feb 07 14:35:22 RPi3 lircd-0.9.4c[536]: Error: Cannot glob /sys/class/rc/rc0/input[0-9]/event[0-9]
Feb 07 14:35:22 RPi3 systemd[1]: Starting homegenie.service…

I’ve also noticed that when HG is running after install, my terminal window locks up periodically. It’s possible the RPi is rebooting, but I’m not sure how to test that. If I uninstall HG, the RPi seems to act normal again. This happens with both r526 and 1.1.15 installed.

I’m assuming you’ve attempted to start HG using sudo mono HomeGenie.exe with the debug option.

No, I forgot the option existed. Can you provide the command line?

cd \usr\local\bin\homegenie
sudo mono homegenie.exe

should do…