Just to recap on the installation instructions and the creation of a homeassistant service. I'ts all in the one place now for others to follow.
Assuming Home Assistant is where it should be on the Raspberry Pi the instructions below for creating the service should work.
1. You will need a fresh copy of Raspbian Stretch Lite (not the desktop version) written to an SD card. Details to achieve this here
https://hackernoon.com/raspberry-pi-headless-install-462ccabd75d02. Now that your Raspberry Pi setup and have SSH into it from another computer you will see the a prompt. Now its time to install Heyu on the Raspberry PI. Follow these instructions exactly as they are presented in this link. NOTE when you get to the section where it asks you who you want this to be available to select option 3 and NOT 1 as mentioned in the instructions
https://blog.wouterspaans.nl/2017/02/23/control-your-x10-lights-from-a-raspberry-pi/3. Now it's time to install Home Assistant. This is the manual install which is what you need here
https://www.home-assistant.io/docs/installation/raspberry-pi/4. Now that you have Home Assistant up and running you need to configure it to run X10. The following link will demonstrate how to configure it by editing what is called the configuration.yaml
https://www.home-assistant.io/components/light.x10/Creating the Home Assistant service as follows
Step 1 sudo nano /etc/systemd/system/homeassistant.service
It opens the editor so paste this text exactly as I've supplied it
[Unit]
Description=Home Assistant
After=network-online.target
[Service]
Type=simple
User=%i
ExecStart=/srv/homeassistant/bin/hass -c "/home/homeassistant/.homeassistant"
[Install]
WantedBy=multi-user.target
Step 2 Once you have pasted this text press ctrl-x then press y and press the return key.
Step 3 Now at the command prompt type sudo systemctl enable homeassistant.service and press the return key
Step 4 Now type sudo systemctl start homeassistant.service and press the return key.
If everything went well you should be able to access HA on the browser without your SSH session being opened.
Every time you restart the Raspberry Pi HA will start automatically.
If your homeassistant.service is not running type sudo systemctl status homeassistant.service and it will tell you what the status of the service is.
I strongly advise you start with a fresh install as you appear to have a rogue service running that has been enabled at some stage.