X10 Community Forum
📱🖥️PiX10Hub => 🏥Help and Trouble Shooting => 🧞 ⛑HomeGenie Help => Topic started 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.
-
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
-
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.
-
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
-
It looks like 8080 as it has been
-
status shows service dead exit it with ctl c then type sudo systemctl start homegenie.service
-
Web page is still not coming up
-
Ok now it shows service is active but exited. ::) :' try a reboot: sudo reboot
-
No change
-
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
-
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.
-
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
-
Here is the screen capture from Peter's post
-
I'm assuming from what I read the OP installed via your hub so what path does HG end up in.
-
I am not sure.
-
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.
-
I am not sure.
Ok. How did you manage to install HG and HA Bridge in the first place
-
yes the X10 hub is installed.
-
Originally installed from Tuiceman's image and then you personally assisted in getting them to work.
-
type cd /usr/local/bin then type dir to see if HG is there
-
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
-
Looks like it is there
-
ok
WorkingDirectory=/usr/local/bin/homegenie
ExecStart=/usr/bin/mono /usr/local/bin/homegenie/HomeGenie.exe --log
-
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.
-
does not seem to work
-
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.
-
it is loading now. Thank you
-
All is restored. Thank you, Petera an Tuiceman.
-
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
-
thank you again. I am still a novice with Raspberry and Linux, but intend on learning.
-
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 #:)
-
Is there a shutdown command to use when I go to backup the sd card?
-
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.
-
Thank you.