X10 Community Forum

📱🖥️PiX10Hub => 🏥Help and Trouble Shooting => 🧞 ⛑HomeGenie Help => Topic started by: dkbialik on December 22, 2019, 12:50:08 AM

Title: HomeGenie no longer works
Post by: dkbialik on December 22, 2019, 12:50:08 AM
I had a power outage.  When things came back, HA Bridge comes up and is able to be accessed but not Homegenie.  Of course I was planning on backing up my sd card today but that did not happen.  Is there a way to reinstall or restore Homegenie?  I was looking through the forum for the extensive help you gave and could not find it.
Title: Re: HomeGenie no longer works
Post by: Tuicemen on December 22, 2019, 08:16:30 AM
Sometimes on a hard reset (power outage ,blip...) HG will move to the next port so If you had been using port 8080 try 8081
Title: Re: HomeGenie no longer works
Post by: petera on December 22, 2019, 09:09:32 AM
In a PuTTY session use either of these commands to see what port HG is listening on

sudo ss -tulw
sudo ss -tulwn

Alternatively using the brute force method try ports in the range of 8080-8090 to see what port HG has started on. HG usually changes ports when the plug is pulled or in your case a power break occurs while the HG configuration file is still opened. When HG is restarted it sees it's previous port in use so assigns the next available port incrementally. In some cases if port 80 is available it will default to that one. If you do discover what port HG is running on ensure you amend the settings in HA Bridge to reflect this.

Don't assume that HG is broken because it doesn't start immediately.
Title: Re: HomeGenie no longer works
Post by: Tuicemen on December 22, 2019, 09:36:09 AM
Also check to see if HG service is running: sudo systemctl status homegenie.service
if it is stopped or failed try to restart it:  sudo systemctl start homegenie.service
Title: Re: HomeGenie no longer works
Post by: dkbialik on December 22, 2019, 11:32:45 AM
It looks like 8080 as it has been
Title: Re: HomeGenie no longer works
Post by: Tuicemen on December 22, 2019, 11:52:35 AM
status shows service dead exit it with ctl c then type sudo systemctl start homegenie.service
Title: Re: HomeGenie no longer works
Post by: dkbialik on December 22, 2019, 11:59:16 AM
Web page is still not coming up
Title: Re: HomeGenie no longer works
Post by: Tuicemen on December 22, 2019, 12:28:52 PM
Ok now it shows service is active but exited. ::) :' try a reboot: sudo reboot
Title: Re: HomeGenie no longer works
Post by: dkbialik on December 22, 2019, 12:43:17 PM
No change
Title: Re: HomeGenie no longer works
Post by: petera on December 22, 2019, 02:16:02 PM
No change

If you follow the procedure you used to troubleshoot your HA Bridge you should get this working but just to recap

Type the following

cd

sudo systemctl stop homegenie.service

cd /etc/systemd/system

ls

and screencap and post the output


Title: Re: HomeGenie no longer works
Post by: petera on December 22, 2019, 03:41:53 PM
Maybe @Tuicemen could post the path for WorkingDirectory and ExecStart.

In the meantime it looks like your init.d file may be corrupted. Since Raspbian Jessie,  init.d is not used to launch a service. Systemd is now the standard way to launch a service for the reason that is so simple to create and maintain.

Below is a sample Systemd file to launch the Homegenie service. You will need to adjust the paths of WorkingDirectory and ExecStart to reflect where your copy of HG is installed. If you want to reply back before you start work on what I have set out below it might be easier for you.

What you need to do is stop the current init.d service, disable it and create a new HG service and launch it. You will name the new service as homegenie1.service

cd

sudo systemctl stop homegenie.service

sudo systemctl disable homegenie.service

Now you create the new service called homegenie1.service

cd

sudo nano /etc/systemd/system/homegenie1.service

Now copy/paste the following lines below adjusting the paths as I mentioned above as soon Mr T supplies them. As soon as you finish press ctrl-x keys followed by the key y and press return.



[Unit]
Description=Homegenie Server
After=network.target

[Service]
WorkingDirectory=/home/pi/homegenie
ExecStart=/usr/bin/mono /home/pi/homegenie/HomeGenie.exe --log
Restart=always

[Install]
WantedBy=multi-user.target

Now you need to enable the new service you just created and start it.

cd

sudo systemctl enable homegenie1.service

sudo systemctl start homegenie1.service

To check your service is running type

sudo systemctl status homegenie1.service

Could you screen cap the output of the last command and post it.

Title: Re: HomeGenie no longer works
Post by: Tuicemen on December 22, 2019, 03:52:26 PM
The working directory would depend on if the installer was used or the tar file.
Working directory from installer I believe is /usr/local/bin/homegenie
I don't remember if the installer was used in the construction of the PiX10Hub but believe it was. so exe would be usr/local/bin/homegenie/HomeGenie.exe
if the Buster OS is in use then the working directory should be that of the tar install
Title: Re: HomeGenie no longer works
Post by: dkbialik on December 22, 2019, 04:12:17 PM
Here is the screen capture from Peter's post
Title: Re: HomeGenie no longer works
Post by: petera on December 22, 2019, 04:12:57 PM
I'm assuming from what I read the OP installed via your hub so what path does HG end up in.
Title: Re: HomeGenie no longer works
Post by: dkbialik on December 22, 2019, 04:16:04 PM
I am not sure.
Title: Re: HomeGenie no longer works
Post by: petera on December 22, 2019, 04:17:57 PM
Here is the screen capture from Peter's post

I'm assuming you installed Mr T's X10 hub. Is that correct. I need Mr T to confirm the path of WorkingDirectory and ExecStart before you can proceed with my instructions as they won't work otherwise.
Title: Re: HomeGenie no longer works
Post by: petera on December 22, 2019, 04:19:57 PM
I am not sure.

Ok. How did you manage to install HG and HA Bridge in the first place
Title: Re: HomeGenie no longer works
Post by: dkbialik on December 22, 2019, 04:20:30 PM
yes the X10 hub is installed.
Title: Re: HomeGenie no longer works
Post by: dkbialik on December 22, 2019, 04:22:12 PM
Originally installed from Tuiceman's image and then you personally assisted in getting them to work.
Title: Re: HomeGenie no longer works
Post by: Tuicemen on December 22, 2019, 04:24:34 PM
type cd /usr/local/bin then type dir to see if HG is there
Title: Re: HomeGenie no longer works
Post by: petera on December 22, 2019, 04:25:38 PM
yes the X10 hub is installed.

Ok we have that cleared up. Now all you need is for Mr T to confirm installation paths before you proceed. The default path for WorkingDirectory is /home/pi/homegenie but I'm not sure where yours is
Title: Re: HomeGenie no longer works
Post by: dkbialik on December 22, 2019, 04:29:45 PM
Looks like it is there
Title: Re: HomeGenie no longer works
Post by: Tuicemen on December 22, 2019, 04:32:52 PM
ok
WorkingDirectory=/usr/local/bin/homegenie
ExecStart=/usr/bin/mono /usr/local/bin/homegenie/HomeGenie.exe --log
Title: Re: HomeGenie no longer works
Post by: petera on December 22, 2019, 04:40:10 PM
Looks like it is there

Ok Mr T has just confirmed the paths so replace them with the ones I supplied in Post #10 and proceed with the rest of those instructions.
Title: Re: HomeGenie no longer works
Post by: dkbialik on December 22, 2019, 04:45:55 PM
does not seem to work
Title: Re: HomeGenie no longer works
Post by: petera on December 22, 2019, 04:56:09 PM
I'm reposting post #10 with the correct paths for HG as per Mr T. Please follow these instructions exactly as they are laid out
============================================================

Below is a sample Systemd file to launch the Homegenie service. You will need to adjust the paths of WorkingDirectory and ExecStart to reflect where your copy of HG is installed. If you want to reply back before you start work on what I have set out below it might be easier for you.

What you need to do is stop the current init.d service, disable it and create a new HG service and launch it. You will name the new service as homegenie1.service

cd

sudo systemctl stop homegenie.service

sudo systemctl disable homegenie.service

Now you create the new service called homegenie1.service

cd

sudo nano /etc/systemd/system/homegenie1.service

Now copy/paste the following lines below adjusting the paths as I mentioned above as soon Mr T supplies them. As soon as you finish press ctrl-x keys followed by the key y and press return.



[Unit]
Description=Homegenie Server
After=network.target

[Service]
WorkingDirectory=/usr/local/bin/homegenie
ExecStart=/usr/bin/mono /usr/local/bin/homegenie/HomeGenie.exe --log
Restart=always

[Install]
WantedBy=multi-user.target

Now you need to enable the new service you just created and start it.

cd

sudo systemctl enable homegenie1.service

sudo systemctl start homegenie1.service

To check your service is running type

sudo systemctl status homegenie1.service

Could you screen cap the output of the last command and post it.
Title: Re: HomeGenie no longer works
Post by: dkbialik on December 22, 2019, 05:04:27 PM
it is loading now.  Thank you
Title: Re: HomeGenie no longer works
Post by: dkbialik on December 22, 2019, 05:06:20 PM
All is restored.  Thank you, Petera an Tuiceman.
Title: Re: HomeGenie no longer works
Post by: petera on December 22, 2019, 05:25:37 PM
All is restored.  Thank you, Petera an Tuiceman.

There's no shortcuts to getting things working in Linux. Knocking out a few commands and crossing your fingers doesn't cut it.

You need to recognise the problem first and know where everything is located. Everything is located in particular folders for a reason, troubleshooting being one of them. It's best to stick with accepted norms.

 Raspbian is a subset of Debian the full Linux OS. Unfortunately short cuts and bad habits have creeped in to Raspbian to such an extent that mistakes are beginning to happen which makes troubleshooting quite difficult. You saw how quickly your problem was solved as soon as the correct paths were supplied.

You now have a functioning HG and HA Bridge and as I advised you before take an image of your SD card before you proceed any further. It saves everyone all the headaches
Title: Re: HomeGenie no longer works
Post by: dkbialik on December 22, 2019, 05:30:00 PM
thank you again.  I am still a novice with Raspberry and Linux, but intend on learning.
Title: Re: HomeGenie no longer works
Post by: Tuicemen on December 22, 2019, 05:30:13 PM
All is restored.  Thank you, Petera an Tuiceman.
Glad to see you have it working.
Seems to me I had this issue when I simply updated to Buster from stretch However how I fixed it I don't remember exactly but I did create a new HG service simular to how Petera walked you through.

@petera  #:)
Title: Re: HomeGenie no longer works
Post by: dkbialik on December 22, 2019, 05:36:14 PM
Is there a shutdown command to use when I go to backup the sd card?
Title: Re: HomeGenie no longer works
Post by: petera on December 22, 2019, 06:25:55 PM
sudo systemctl stop homegenie1.service

sudo systemctl stop ha-bridge.service

sudo shutdown now

Unplug your Pi remove the SD card and you’re good to go.
Title: Re: HomeGenie no longer works
Post by: dkbialik on December 22, 2019, 09:53:12 PM
Thank you.