My google home integration setup with old X10 units

Hi, my current raspberry pi is a trusty old home automation system still happily running various x10 units being controlled by a cm11 (with a serial to usb adaptor attached to the pi)

I have integrated this system so that I can switch x10 items on/off via voice control from google home devices as follows…

On the IFTT platform have setup a recipe so that if i say “switch off lounge lamp” it will create a webhook and call the web API (using json) in the form…

http://username:[email protected]:51437/api/HomeAutomation.X10/A3/Control.On

Its a bit of a hack, looking to resolve following issue…

Currently running HomeGenie Version v1.2-stable.39, if I upgrade to latest beta version will the web API json still work, read somewhere that it would have to be https access?

So if I upgraded, can I use letsencrypt with latest version of homegenie (easily) as I’m sure IFTT will not support self generated certificates.

I appreciate I’m now sending my username/password over plaintext so have to trust my ISP (I only access my homegenie remotely from my phone over vpn (I have a draytek router that support SSL VPN and a nice android client), but would like to change this and be able to access my homegenie over https from any device

PS The reason I stick to this old X10 system is if google/IFTTT ever close/change their systems, I’m not dependant on them, they are only an addition to my trusty reliable X10 remotely accessible standalone home automation system :slight_smile:

The newer versions of HG no longer send your password in clear text. Many old obsolete drivers & programs were updated and some additional programs are now included. As for Google Home you may wish to check this thread out Google Home plugin
I’ve used this for Google Home with good success. However my setup now is more intergrated for Alexa.

Have you tried the HG Android client to control remotely. I don’t use it but I imagine this would solve your problem re the https calls

hmmm, thats quite a lot changes to go through, I wonder if you can setup that interface on another pi at home isntead of being reliant on another site

I use the client all the time, but in the client settings its the http address that is added

I assumed the app was logging in same as a webpage, so in my app i use my internal ip address and run the vpn before opening the app

If you use a DSN like the free duckdns.org you can use it to connect to your HG from anywhere even from in your own network.

@saue0 ran the Google Home program originally from a pi so I don’t see a problem if that’s the route you wish to go. The process steps I’m sure have been stream lined some since the program was originally constructed.

Returning to your OP, you should be able to upgrade beyond v1.2 39 and using the certs installed via Mono and the API method /api/HomeAutomation.HomeGenie/Config/WebSocket.GetToken your JSON calls should work comfortably.

I wouldn’t bother with self signing as it’s more trouble than it’s worth trying to maintain them

What I suggest you could do is make a backup of your HG configuration take an image of your SD card and put it safely aside and install a fresh copy of HG on a new SD card.You can than restore your HG configuration to your new install and try out that setup. If it doesn’t function as expected you can just pop your old SD card back into your Raspberry Pi and you’ve lost nothing.

Thats good to know :slight_smile:

I followed your advice, got a pi 2, installed buster “server” headless

entered the following commands in order as per instructions at http://genielabs.github.io/HomeGenie/#/get_started

  1. sudo apt install apt-transport-https dirmngr gnupg ca-certificates
  2. sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
  3. echo “deb https://download.mono-project.com/repo/debian stable-buster main” | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
  4. sudo apt update
  5. wget https://github.com/genielabs/HomeGenie/releases/download/v1.3-stable.4/homegenie_1.3-stable.4_all.deb
  6. sudo apt-get update
  7. sudo apt-get install gdebi-core
  8. sudo gdebi homegenie_1.3-stable.4_all.deb

But got following error …


Processing triggers for mime-support (3.62) …
Processing triggers for libc-bin (2.28-10+rpi1) …
Errors were encountered while processing:
lirc
E:Sub-process /usr/bin/dpkg returned an error code (1)
Error during install: 'installArchives() failed’pi@raspberrypi:~ $ sudo gdebi homegenie_1.3-stable.4_all.deb
Reading package lists… Done
Building dependency tree
Reading state information… Done
Reading state information… Done

HomeGenie - open source, programmable, home automation server for smart connected devices and applications.
Do you want to install the software package? [y/N]:y
/usr/bin/gdebi:113: FutureWarning: Possible nested set at position 1
c = findall("[(/\S+[])]", msg)[0].lower()
Selecting previously unselected package homegenie.
(Reading database … 42662 files and directories currently installed.)
Preparing to unpack homegenie_1.3-stable.4_all.deb …
Unpacking homegenie (1.3-stable.4) …
dpkg: dependency problems prevent configuration of homegenie:
homegenie depends on lirc; however:
Package lirc is not configured yet.

dpkg: error processing package homegenie (–install):
dependency problems - leaving unconfigured
Errors were encountered while processing:
homegenie


So tried… sudo apt install lirc

got errors again…


eading package lists… Done
Building dependency tree
Reading state information… Done
lirc is already the newest version (0.10.1-5.2).
lirc set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n]
Setting up lirc (0.10.1-5.2) …
Job for lircd.service failed because a fatal signal was delivered to the control process.
See “systemctl status lircd.service” and “journalctl -xe” for details.
invoke-rc.d: initscript lircd, action “start” failed.
● lircd.service - Flexible IR remote input/output application support
Loaded: loaded (/lib/systemd/system/lircd.service; disabled; vendor preset: enabled)
Active: failed (Result: signal) since Thu 2020-03-05 12:04:52 GMT; 86ms ago
Docs: man:lircd(8)
http://lirc.org/html/configure.html
Process: 5063 ExecStart=/usr/sbin/lircd --nodaemon (code=killed, signal=SEGV)
Main PID: 5063 (code=killed, signal=SEGV)

Mar 05 12:04:52 raspberrypi systemd[1]: Starting Flexible IR remote input/output application support…
Mar 05 12:04:52 raspberrypi lircd[5063]: Warning: cannot open /etc/lirc/lirc_options.conf
Mar 05 12:04:52 raspberrypi lircd-0.10.1[5063]: Info: lircd: Opening log, level: Info
Mar 05 12:04:52 raspberrypi lircd-0.10.1[5063]: Notice: Version: lircd 0.10.1
Mar 05 12:04:52 raspberrypi lircd-0.10.1[5063]: Notice: System info: Linux raspberrypi 4.19.97-v7+ #1294 SMP Thu Jan 30 13:15:58 GMT 2020 armv7l GNU/Linux
Mar 05 12:04:52 raspberrypi systemd[1]: lircd.service: Main process exited, code=killed, status=11/SEGV
Mar 05 12:04:52 raspberrypi systemd[1]: lircd.service: Failed with result ‘signal’.
Mar 05 12:04:52 raspberrypi systemd[1]: Failed to start Flexible IR remote input/output application support.
dpkg: error processing package lirc (–configure):
installed lirc package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of homegenie:
homegenie depends on lirc; however:
Package lirc is not configured yet.

dpkg: error processing package homegenie (–configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
lirc
homegenie
E: Sub-process /usr/bin/dpkg returned an error code (1)
pi@raspberrypi:~ $


Any ideas please?

Yes the Gdeb package is broken. When you install Raspbian but before you install HG remove the current version of Lirc then install HG.

As you guessed HG already includes Lirc and you are experiencing a conflict between two versions.

Alternatively you can just remove Lirc from Raspbian as it is now and reinstall HG.

I already posted instructions for these procedures

Thanks that worked, got it up and running :slight_smile:

I then setup the new cm11 x10 inteface via usb serial adaptor, re-did all the X10 modules, updated and reset the port from 80 to 10840 and successfully accessed homegenie on this new port and also run an update that was available

But I then restarted the Pi (didnt make backup :frowning:) … now can’t seem to access it any longer on port 18040 (tried 80 too just in case), any ideas please?

PS netstat -l shows nothing listening on port 18040 (or 80), but it is running ok (no password yet set)…

pi@raspberrypi:~ $ sudo systemctl status homegenie.service
● homegenie.service - LSB: Run HomeGenie
Loaded: loaded (/etc/init.d/homegenie; generated)
Active: active (running) since Fri 2020-03-06 08:06:31 GMT; 13s ago
Docs: man:systemd-sysv-generator(8)
Process: 877 ExecStart=/etc/init.d/homegenie start (code=exited, status=0/SUCCESS)
Tasks: 18 (limit: 2200)
Memory: 23.2M
CGroup: /system.slice/homegenie.service
├─885 /bin/sh /usr/local/bin/homegenie/startup.sh /usr/local/bin/homegenie
├─887 sudo /usr/bin/mono HomeGenie.exe
└─895 /usr/bin/mono HomeGenie.exe

Mar 06 08:06:30 raspberrypi systemd[1]: Starting LSB: Run HomeGenie…
Mar 06 08:06:31 raspberrypi homegenie[877]: homegenie started.
Mar 06 08:06:31 raspberrypi systemd[1]: Started LSB: Run HomeGenie.
Mar 06 08:06:31 raspberrypi sudo[887]: root : TTY=unknown ; PWD=/usr/local/bin/homegenie ; USER=root ; COMMAND=/usr/bin/mono HomeGenie.exe
Mar 06 08:06:31 raspberrypi sudo[887]: pam_unix(sudo:session): session opened for user root by (uid=0)
pi@raspberrypi:~ $

Just use the netstat command to find out what port HG is listening on https://www.ionos.com/digitalguide/server/tools/introduction-to-netstat/

HG tends to jump port numbers when it struggles to find the configured one. Is their any reason why you are listening on such a high port number. I find a port number in the range of 8080 to 8090 usually works best.

Tried that but couldnt find it on any port… so tried the following commands in order…

cd /usr/local/bin/homegenie
sudo systemctl stop homegenie.service
sudo mono HomeGenie.exe

Output below is way above my understanding :slight_smile: … but can see quite a few “error” issues in the output below?


2020-03-06 11:23:31.4435 Debug Adding Gateway WebServiceGateway
2020-03-06 11:23:31.4729 Debug Setting Gateway options
2020-03-06 11:23:31.4780 Debug WebServiceGateway: BaseUrl=/hg/html
2020-03-06 11:23:31.4870 Debug WebServiceGateway: HomePath=html
2020-03-06 11:23:31.4870 Debug WebServiceGateway: Host=+
2020-03-06 11:23:31.4870 Debug WebServiceGateway: Port=18090
2020-03-06 11:23:31.4870 Debug WebServiceGateway: HttpCacheIgnore.1=^./pages/control/widgets/..(js|html)$
2020-03-06 11:23:31.4870 Debug WebServiceGateway: HttpCacheIgnore.2=^.*/html/index.html
2020-03-06 11:23:31.4870 Debug WebServiceGateway: UrlAlias.1=api/HomeAutomation.HomeGenie/Logging/RealTime.EventStream:events
2020-03-06 11:23:31.4870 Debug WebServiceGateway: UrlAlias.2=hg/html/pages/control/widgets/homegenie/generic/images/socket_on.png:hg/html/pages/control/widgets/homegenie/generic/images/switch_on.png
2020-03-06 11:23:31.4870 Debug WebServiceGateway: UrlAlias.3=hg/html/pages/control/widgets/homegenie/generic/images/socket_off.png:hg/html/pages/control/widgets/homegenie/generic/images/switch_off.png
2020-03-06 11:23:31.4954 Debug WebServiceGateway: UrlAlias.4=hg/html/pages/control/widgets/homegenie/generic/images/siren.png:hg/html/pages/control/widgets/homegenie/generic/images/siren_on.png
2020-03-06 11:23:31.4954 Debug WebServiceGateway: EnableFileCaching=false
2020-03-06 11:23:31.4954 Debug WebServiceGateway: AuthenticationRealm=HomeGenie Secure Zone
2020-03-06 11:23:31.4954 Debug Adding Gateway WebSocketGateway
2020-03-06 11:23:31.5070 Debug Setting Gateway options
2020-03-06 11:23:31.5070 Debug WebSocketGateway: Port=8188
2020-03-06 11:23:31.5070 Debug WebSocketGateway: Authentication=Token
2020-03-06 11:23:31.5318 Debug Adding Interface Protocols.UPnP Version: 1.0.7015.36812
2020-03-06 11:23:31.5473 Debug Setting Interface options
2020-03-06 11:23:31.5942 Debug Adding Interface HomeAutomation.ZWave Version: 1.0.7015.38112
2020-03-06 11:23:31.5975 Debug Setting Interface options
2020-03-06 11:23:31.5975 Trace HomeAutomation.ZWave: Port=
rmmod: ERROR: Module lirc_atiusb is not currently loaded
rmmod: ERROR: Module ati_remote is not currently loaded
rmmod: ERROR: Module rc_ati_x10 is builtin.
System.IO.FileNotFoundException: Could not find file “/usr/local/bin/homegenie/lib/mig/x10_security_modules.xml”
File name: ‘/usr/local/bin/homegenie/lib/mig/x10_security_modules.xml’
at System.IO.FileStream…ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0019e] in :0
at System.IO.FileStream…ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) [0x00000] in :0
at (wrapper remoting-invoke-with-check) System.IO.FileStream…ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
at System.IO.File.OpenRead (System.String path) [0x00000] in :0
at MIG.Interfaces.HomeAutomation.X10.DeserializeModules (System.String fileName, System.Collections.Generic.List`1[T] list) [0x00018] in :0
2020-03-06 11:23:31.9594 Debug Adding Interface HomeAutomation.X10 Version: 1.0.7015.38112
2020-03-06 11:23:31.9594 Debug Setting Interface options
2020-03-06 11:23:31.9875 Trace HomeAutomation.X10: Port=/dev/ttyUSB0
2020-03-06 11:23:31.9875 Trace HomeAutomation.X10: HouseCodes=A
2020-03-06 11:23:32.0095 Info HomeAutomation.X10
2020-03-06 11:23:33.5871 Info HomeAutomation.HomeGenie.Automation 6 Automation Program Program.Status Added
2020-03-06 11:23:33.6217 Info HomeAutomation.HomeGenie.Automation 7 Automation Program Program.Status Added
2020-03-06 11:23:33.6297 Info HomeAutomation.HomeGenie.Automation 16 Automation Program Program.Status Added
2020-03-06 11:23:33.6383 Info HomeAutomation.HomeGenie.Automation 26 Automation Program Program.Status Added
2020-03-06 11:23:33.6471 Info HomeAutomation.HomeGenie.Automation 34 Automation Program Program.Status Added
2020-03-06 11:23:33.6471 Info HomeAutomation.HomeGenie.Automation 82 Automation Program Program.Status Added
2020-03-06 11:23:33.6600 Info HomeAutomation.HomeGenie.Automation 88 Automation Program Program.Status Added
2020-03-06 11:23:33.6654 Info HomeAutomation.HomeGenie.Automation 90 Automation Program Program.Status Added
2020-03-06 11:23:33.6654 Info HomeAutomation.HomeGenie.Automation 91 Automation Program Program.Status Added
2020-03-06 11:23:33.6654 Info HomeAutomation.HomeGenie.Automation 142 Automation Program Program.Status Added
2020-03-06 11:23:33.6800 Info HomeAutomation.HomeGenie.Automation 200 Automation Program Program.Status Added
2020-03-06 11:23:33.6800 Info HomeAutomation.HomeGenie.Automation 81 Automation Program Program.Status Added
2020-03-06 11:23:33.6896 Info HomeAutomation.HomeGenie.Automation 93 Automation Program Program.Status Added
2020-03-06 11:23:33.6896 Info HomeAutomation.HomeGenie.Automation 145 Automation Program Program.Status Added
2020-03-06 11:23:33.6994 Info HomeAutomation.HomeGenie.Automation 77 Automation Program Program.Status Added
2020-03-06 11:23:33.6994 Info HomeAutomation.HomeGenie.Automation 8 Automation Program Program.Status Added
2020-03-06 11:23:33.7089 Info HomeAutomation.HomeGenie.Automation 78 Automation Program Program.Status Added
2020-03-06 11:23:33.7197 Info HomeAutomation.HomeGenie.Automation 505 Automation Program Program.Status Added
2020-03-06 11:23:33.7197 Info HomeAutomation.HomeGenie.Automation 29 Automation Program Program.Status Added
2020-03-06 11:23:34.1313 Info HomeAutomation.HomeGenie.Automation 400 Automation Program Program.Status Added
2020-03-06 11:23:34.1416 Info HomeAutomation.HomeGenie.Automation 401 Automation Program Program.Status Added
2020-03-06 11:23:34.1520 Info HomeAutomation.HomeGenie.Automation 402 Automation Program Program.Status Added
2020-03-06 11:23:34.1584 Info HomeAutomation.HomeGenie.Automation 403 Automation Program Program.Status Added
2020-03-06 11:23:34.1584 Info HomeAutomation.HomeGenie.Automation 404 Automation Program Program.Status Added
2020-03-06 11:23:34.1699 Info HomeAutomation.HomeGenie.Automation 133 Automation Program Program.Status Added
2020-03-06 11:23:34.3636 Debug WebServiceGateway: AuthenticationRealm=HomeGenie Secure Zone
2020-03-06 11:23:34.3700 Info HomeGenie.System 0 HomeGenie Boot Progress SystemInfo.BootProgress 0
2020-03-06 11:23:34.3700 Debug Starting Gateway WebServiceGateway
2020-03-06 11:23:34.3876 Error System.IO.FileNotFoundException: Could not load file or assembly ‘Mono.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756’ or one of its dependencies.
File name: ‘Mono.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756’
at MIG.Gateways.WebServiceGateway.Start () [0x0003a] in :0
2020-03-06 11:23:34.3876 Warn Error starting Gateway WebServiceGateway
2020-03-06 11:23:34.3972 Info HomeAutomation.HomeGenie.Automation 91 Automation Program Program.Status Idle
2020-03-06 11:23:34.3972 Info HomeAutomation.HomeGenie.Automation 93 Automation Program Program.Status Idle
2020-03-06 11:23:34.3972 Info HomeAutomation.HomeGenie.Automation 133 Automation Program Program.Status Idle
2020-03-06 11:23:34.4079 Info HomeGenie.System 0 HomeGenie Boot Progress SystemInfo.BootProgress 100
2020-03-06 11:23:34.4555 Info HomeAutomation.HomeGenie.Automation 93 Automation Program Program.Status Running
2020-03-06 11:23:34.4555 Info HomeAutomation.HomeGenie.Automation 91 Automation Program Program.Status Running
2020-03-06 11:23:34.4555 Info HomeAutomation.HomeGenie.Automation 133 Automation Program Program.Status Running
2020-03-06 11:23:34.4946 Info HomeAutomation.HomeGenie.Automation 91 Automation Program Program.Status Background
2020-03-06 11:23:34.5520 Info HomeAutomation.HomeGenie.Automation 93 Automation Program Program.Status Background
2020-03-06 11:23:34.6796 Debug Disabling Interface Protocols.UPnP
2020-03-06 11:23:34.6876 Debug Disabling Interface HomeAutomation.ZWave
2020-03-06 11:23:34.7017 Debug Enabling Interface HomeAutomation.X10
2020-03-06 11:23:34.7965 Info HomeAutomation.HomeGenie 0 HTTP binding failed. SystemInfo.HttpAddress +:18090
2020-03-06 11:23:35.1187 Debug 5A-00
2020-03-06 11:23:35.1257 Debug C3
2020-03-06 11:23:35.1801 Debug 5A-08-55-63-6F-63-6F-63-6F-63
2020-03-06 11:23:35.1801 Debug PLCRX: 5A-08-55-63-6F-63-6F-63-6F-63
2020-03-06 11:23:35.1801 Debug FNMAP: 01-00-01-00-01-00-01
2020-03-06 11:23:35.1801 Debug DATA : 63-6F-63-6F-63-6F-63
2020-03-06 11:23:35.1901 Debug 0) House code = A
2020-03-06 11:23:35.1901 Debug 0) Command = Off
2020-03-06 11:23:35.2026 Debug 1) Address = A10
2020-03-06 11:23:35.2123 Debug 2) House code = A
2020-03-06 11:23:35.2123 Debug 2) Command = Off
2020-03-06 11:23:35.2246 Info HomeAutomation.X10 A10 - Status.Level 0
2020-03-06 11:23:35.7583 Debug 3) Address = A10
2020-03-06 11:23:35.7583 Debug 4) House code = A
2020-03-06 11:23:35.7583 Debug 4) Command = Off
2020-03-06 11:23:35.7583 Info HomeAutomation.X10 A10 - Status.Level 0
HomeGenie is now exiting…
…QUIT!

Ok you can see that HG is listening on port 8188 so you can access it on that port.

What does the following command return

lirc —version

Chances are you will need to do a bit of work to get lirc working on your install.

Have a look at this link. It will give you an insight into what you need to do https://stackoverflow.com/questions/57437261/setup-ir-remote-control-using-lirc-for-the-raspberry-pi-rpi

hi just did apt remove lirc which removed homegenie as well

then did apt autoremove

then sudo gdebi homegenie_1.3-stable.4_all.deb

redid all my x10 and onewire configuration and this time made a backup

then changed port, restarted service, everything working ok on new port

then sudo reboot… and everything still working ok on new port :slight_smile:

One thing I’ve realised is by old homegenie is the one sending out the “off” signal to my A10 X10 unit every 30 seconds, have no idea how its sending it as have nothing in scheduler and “auotmatic turn off” program is disabled … odd?

Yes you can see that Lirc is problematic in HG installed on Raspbian Buster. At least you now know what was causing the problem.

Run HG in debug mode and watch the events as they are being executed. This should highlight what is triggering those random on/off commands to A1.

Do you have any other X10 controllers on the same power line or any other software running that might be triggering these commands. I assume you cleared your CM15 of all macros and timers that may have been downloaded to it. Also check for any remotes lying about that may faulty and are causing your problem.

Be mindful of that change in how Lirc operates with Raspbian Buster particularly when using GPIO pins.

Discovered it was a zwave module I had configured on the homegenie, (the pi also has a razberry connected to its gpio pins)

Also in latest version the following still works as before so no need to change my google home IFTT “recipes”…

http://myexternalip/api/HomeAutomation.X10/A3/Control.On :slight_smile:

But as mentioned earlier in your conversation, now that I’ve upgraded, what would be the direct https:// translation for the above json request using the alternative /api/HomeAutomation.HomeGenie/Config/WebSocket.GetToken API method please?

Thanks, with your help I should now be able to change my new homegenie’s ip address to my old one and just move the sdcard over to the old pi running the old homegenie

You’re welcome :+1:

It might be worth starting a new post on the api/HomeAutomation.HomeGenie/Config/WebSocket.GetToken API method so others can contribute their solutions

Ok will do

I was going to read up on the web API details for this new json calling method before posting the question, but I couldn’t find any mention of it here…

https://genielabs.github.io/HomeGenie/api/mig/overview.html

Can I ask were you found this new method documented please?

Thanks

Unfortunately documentation hasn’t been updated in quite a while. The only mention of the new method is here https://github.com/genielabs/HomeGenie/releases/tag/v1.3-beta.1