Please login or register.

Login with username, password and session length
Pages: 1 2 [3] 4 5

Author Topic: Install X10 on Home Assistant on Raspberry Pi-Instructions  (Read 33308 times)

npaisnel

  • Full Member
  • ***
  • Helpful Post Rating: 0
  • Posts: 63
Re: Install X10 on Home Assistant on Raspberry Pi-Instructions
« Reply #30 on: July 31, 2018, 09:27:19 AM »


Make sure you create this file in the root folder. The best way to ensure this happens is reboot your Pi, SSH into it and as soon as you see the prompt create the file.


When you reboot and ssh back it drops you into the root of the home folder,  /home/pi/
and the cmd prompt is:

pi@raspberrypi:~ $


 or do I need to cd twice back up the structure to the root of the complete FS  /
indicated by a cmd prompt of:

pi@raspberrypi :/ $



When you exit from Home Assistant during the SSH session you are still in the virtual environment. You need to type exit and the return key to get back to the root folder.
Yep, ununderstood

I'm trying to avoid using technical terms here as I'm not sure what your level of Linux experience is. Once you have Home Assistant up and running from boot the only other thing you will have to think about is the configuration.yaml file to customise Home Asssistant.

well been using it on / off for years with NAS4Free/ FreeNAS distros and can do basic stuff like 'dmesg, mkdir/ rm/ cp ls cd etc but a lot of this apt-get stuff is new, always used the Synaptic package manager before.


I'll rebuild, add HA again and try and get it auto starting and see where we go from there.
Logged

petera

  • PI Expert
  • Hero Member
  • ******
  • Helpful Post Rating: 27
  • Posts: 1751
Re: Install X10 on Home Assistant on Raspberry Pi-Instructions
« Reply #31 on: July 31, 2018, 09:33:42 AM »


Make sure you create this file in the root folder. The best way to ensure this happens is reboot your Pi, SSH into it and as soon as you see the prompt create the file.


When you reboot and ssh back it drops you into the root of the home folder,  /home/pi/
and the cmd prompt is:

pi@raspberrypi:~ $


 or do I need to cd twice back up the structure to the root of the complete FS  /
indicated by a cmd prompt of:

pi@raspberrypi :/ $



When you exit from Home Assistant during the SSH session you are still in the virtual environment. You need to type exit and the return key to get back to the root folder.
Yep, ununderstood

I'm trying to avoid using technical terms here as I'm not sure what your level of Linux experience is. Once you have Home Assistant up and running from boot the only other thing you will have to think about is the configuration.yaml file to customise Home Asssistant.

well been using it on / off for years with NAS4Free/ FreeNAS distros and can do basic stuff like 'dmesg, mkdir/ rm/ cp ls cd etc but a lot of this apt-get stuff is new, always used the Synaptic package manager before.


I'll rebuild, add HA again and try and get it auto starting and see where we go from there.

Yes the /home/pi folder. The folder you are presented with on reboot. That's why you use the sudo command all the time in the Raspberry Pi. Unless you specifically need to sudo su into the Pi stay away from it.
Logged

npaisnel

  • Full Member
  • ***
  • Helpful Post Rating: 0
  • Posts: 63
Re: Install X10 on Home Assistant on Raspberry Pi-Instructions
« Reply #32 on: July 31, 2018, 06:47:29 PM »


Make sure you create this file in the root folder. The best way to ensure this happens is reboot your Pi, SSH into it and as soon as you see the prompt create the file.

When you exit from Home Assistant during the SSH session you are still in the virtual environment. You need to type exit and the return key to get back to the root folder.


Saw HA running in a web page, all good

typed exit in the SSH and shut down the Pi and rebooted.
 as soon as restarted ssh back in and followed the instructions to create service file etc..

Code: [Select]
pi@raspberrypi:~ $ sudo nano /etc/systemd/system/homeassistant.service

pi@raspberrypi:~ $ sudo systemctl enable homeassistant.service
Created symlink /etc/systemd/system/multi-user.target.wants/homeassistant.service → /etc/systemd/system/homeassistant.service.
pi@raspberrypi:~ $  sudo systemctl start homeassistant.assistant
Failed to start homeassistant.assistant.service: Unit homeassistant.assistant.service not found.


« Last Edit: July 31, 2018, 07:52:16 PM by npaisnel »
Logged

petera

  • PI Expert
  • Hero Member
  • ******
  • Helpful Post Rating: 27
  • Posts: 1751
Re: Install X10 on Home Assistant on Raspberry Pi-Instructions
« Reply #33 on: July 31, 2018, 07:39:04 PM »

You create, enable and finally start the service.

My instructions from the earlier post.



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.
« Last Edit: July 31, 2018, 07:47:46 PM by petera »
Logged

petera

  • PI Expert
  • Hero Member
  • ******
  • Helpful Post Rating: 27
  • Posts: 1751
Re: Install X10 on Home Assistant on Raspberry Pi-Instructions
« Reply #34 on: July 31, 2018, 07:55:38 PM »

Remember you are working in the Python virtual environment. The instructions I supplied were for that install. That's why you have to type exit to get back to the /home/Pi folder.

I'm five hours ahead of you and it's been a long day.What I've given you now should get Home Assistant up and running on boot up.
Logged

npaisnel

  • Full Member
  • ***
  • Helpful Post Rating: 0
  • Posts: 63
Re: Install X10 on Home Assistant on Raspberry Pi-Instructions
« Reply #35 on: July 31, 2018, 07:57:47 PM »


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.

.

I am more than happy with how to use nano, copy and paste the text in and to save it, that is not the issue.
The issue is when getting to your Step 4.  I get the failure message as I posted in the CODE box on my previous post

Code: [Select]
pi@raspberrypi:~ $  sudo systemctl start homeassistant.assistant
Failed to start homeassistant.assistant.service: Unit homeassistant.assistant.service not found.

it is now 1 oclock in the morning here and I have been working on this on and off since about  this morning.  Been doing an SDR server that also starts the RTL_TCP service from system...that firers up fine …

anyway, will look again in the morning



Logged

npaisnel

  • Full Member
  • ***
  • Helpful Post Rating: 0
  • Posts: 63
Re: Install X10 on Home Assistant on Raspberry Pi-Instructions
« Reply #36 on: July 31, 2018, 08:01:22 PM »

Remember you are working in the Python virtual environment. The instructions I supplied were for that install. That's why you have to type exit to get back to the /home/Pi folder.

Yep that is what I have used. 



I'm five hours ahead of you and it's been a long day.What I've given you now should get Home Assistant up and running on boot up..

your 5 hours ahead yikes,..so you've been up all night ..1 in the morngn here and I ahve had enough..not stamina liek you to go all through the night after starting at 8 this morning



shutting it all down for now

Thanks for the help



Logged

petera

  • PI Expert
  • Hero Member
  • ******
  • Helpful Post Rating: 27
  • Posts: 1751
Re: Install X10 on Home Assistant on Raspberry Pi-Instructions
« Reply #37 on: July 31, 2018, 09:41:16 PM »

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-462ccabd75d0

2. 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.
« Last Edit: July 31, 2018, 09:50:19 PM by petera »
Logged

npaisnel

  • Full Member
  • ***
  • Helpful Post Rating: 0
  • Posts: 63
Re: Install X10 on Home Assistant on Raspberry Pi-Instructions
« Reply #38 on: August 01, 2018, 02:07:43 AM »

OK, well 5 hours sleep and I am back at it. 
Despite the

Code: [Select]
pi@raspberrypi:~ $  sudo systemctl start homeassistant.assistant
Failed to start homeassistant.assistant.service: Unit homeassistant.assistant.service not found.

after a re-boot the HA WebGUI DOES start.

Would the error above be caused by the fact that the command
sudo systemctl start homeassistant.assistant
is not being issued from within the Virtual Environment

Why is a VE being used?  cant it run in the 'standard environment'  and save all this comlication of the Python VE?

My last install was from a totally fresh Stretch Lite install to a freshly formatted SD card, with clones taken at every stage..after intial boot and SSH enable, after samba enable, after update/upgrade, after heyu install, etc


Either way it is working now thanks to your guide.  have added x10 test devices to configuration.yaml  and yes it does turn them on via the Home page.  But not off,  the little slider  after 1 second slides back to 'off'  but the device stays on.  But that for another thread.

Thanks for your help and patience in this..


Logged

petera

  • PI Expert
  • Hero Member
  • ******
  • Helpful Post Rating: 27
  • Posts: 1751
Re: Install X10 on Home Assistant on Raspberry Pi-Instructions
« Reply #39 on: August 01, 2018, 05:13:49 AM »

The slider is a simple one. Open another SSH terminal and type heyu engine. That should sort that problem.
Logged

petera

  • PI Expert
  • Hero Member
  • ******
  • Helpful Post Rating: 27
  • Posts: 1751
Re: Install X10 on Home Assistant on Raspberry Pi-Instructions
« Reply #40 on: August 01, 2018, 05:23:57 AM »

The command to start the service is

sudo systemctl start homeassistant.service

You are typing in the wrong command. Just cut and paste that command.
Logged

npaisnel

  • Full Member
  • ***
  • Helpful Post Rating: 0
  • Posts: 63
Re: Install X10 on Home Assistant on Raspberry Pi-Instructions
« Reply #41 on: August 01, 2018, 05:37:23 AM »

The slider is a simple one. Open another SSH terminal and type heyu engine. That should sort that problem.

I guess run it as a service too..

https://cylkedowney.wordpress.com/2017/05/19/starting-heyu-using-systemd/
The command to start the service is

sudo systemctl start homeassistant.service

You are typing in the wrong command. Just cut and paste that command.
B:( oh god ! that is embarrassing...and using the SSH reply last entry.   ooops .very embarrassed   :-[
Logged

petera

  • PI Expert
  • Hero Member
  • ******
  • Helpful Post Rating: 27
  • Posts: 1751
Re: Install X10 on Home Assistant on Raspberry Pi-Instructions
« Reply #42 on: August 01, 2018, 05:43:48 AM »

The slider is a simple one. Open another SSH terminal and type heyu engine. That should sort that problem.

I guess run it as a service too..

https://cylkedowney.wordpress.com/2017/05/19/starting-heyu-using-systemd/
The command to start the service is

sudo systemctl start homeassistant.service

You are typing in the wrong command. Just cut and paste that command.
B:( oh god ! that is embarrassing...and using the SSH reply last entry.   ooops .very embarrassed   :-[

Yes you need Heyu running as a service too so you need to create one. Once you have created the Heyu service you need to add an extra line into the Home Assistant service to instruct it to wait loading until the Heyu service has loaded first.

Have you got the slider buttons turning yellow when you switc them on now.
Logged

npaisnel

  • Full Member
  • ***
  • Helpful Post Rating: 0
  • Posts: 63
Re: Install X10 on Home Assistant on Raspberry Pi-Instructions
« Reply #43 on: August 01, 2018, 06:04:06 AM »

Quote
Have you got the slider buttons turning yellow when you switc them on now.
Yes slider buttons sticking and staying on and can turn on and off  , sliders are blue and little light bulbs go yellow, but other wise yes.

I did the heyu service engine start

I put the following in /etc/systemd/system/heyu.service
Code: [Select]
[Unit]
Description=Heyu Engine
Wants=network.target
After=network.target
 
[Service]
Type=oneshot
RemainAfterExit=yes
User=pi
Group=pi
WorkingDirectory=/home/pi
ExecStart=/usr/local/bin/heyu start
ExecReload=/usr/local/bin/heyu restart
ExecStop=/usr/local/bin/heyu stop
 
[Install]
WantedBy=multi-user.target

Then
Code: [Select]
sudo systemctl enable heyu.service
sudo systemctl start heyu.service


From this link:
https://cylkedowney.wordpress.com/2017/05/19/starting-heyu-using-systemd/



I'll have a look at what you suggest and see if I can see how to do that
« Last Edit: August 01, 2018, 06:07:49 AM by npaisnel »
Logged

petera

  • PI Expert
  • Hero Member
  • ******
  • Helpful Post Rating: 27
  • Posts: 1751
Re: Install X10 on Home Assistant on Raspberry Pi-Instructions
« Reply #44 on: August 01, 2018, 06:21:38 AM »

Here's a heyu.service file based on the install instructions I supplied.

[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

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

Logged
Pages: 1 2 [3] 4 5
 

X10.com | About X10 | X10 Security Systems | Cameras| Package Deals
© Copyright 2014-2016 X10.com All rights reserved.