For anyone wanting to try X10 on the Raspberry Pi using the Home Assistant platform the following steps should get you there. Maybe the mods could add it as a sticky. I'll gladly answer any questions but purely on topic.
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.
If you find that the blue sliders on your X10 lights are not turning from blue to yellow and will not turn off your lights you need to setup a service to run Heyu on start up. Just copy and paste the following at the Terminal/Command prompt.
Here's a heyu.service file based on the install instructions I supplied.
sudo nano /etc/systemd/homeassistant.service
Now copy and past this text into the editor and press ctrl x then press y When you have finished type sudo systemctl enable heyu.service followed by sudo systemctl start heyu.service. That should sort out the Heyu service not working properly
[Unit]
Description=Heyu Engine
Wants=network.target
After=network.target
[Service]
Type=oneshot
RemainAfterExit=yes
WorkingDirectory=/home/pi/heyu-2.10
ExecStart=/usr/local/bin/heyu engine
[Install]
WantedBy=multi-user.target
You now need to modify the homeassistant.service to delay the startup of Home Assistant while Heyu starts first.
This is the modified homeassistant.service file with the extra line added to allow heyu start before home assistant
[Unit]
Description=Home Assistant
After=network-online.target
[Service]
ExecStartPre=/bin/sleep 20
Type=simple
User=%i
ExecStart=/srv/homeassistant/bin/hass -c "/home/homeassistant/.homeassistant"
[Install]
WantedBy=multi-user.target
Don't forget to stop your service file before you edit them.
These two files will get heyu running first and then launch Home Assistant all at boot time