Please login or register.

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

Author Topic: Home Assistant and X10 on the Raspberrry Pi-Installation instructions (Revision)  (Read 16925 times)

petera

  • PI Expert
  • Hero Member
  • ******
  • Helpful Post Rating: 27
  • Posts: 1750

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-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.

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

« Last Edit: August 07, 2018, 03:24:23 PM by petera »
Logged

Tuicemen

  • Administrator
  • Hero Member
  • ****
  • Helpful Post Rating: 282
  • Posts: 10497
  • I don't work for X10, I use it successfuly!

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.
Done!

Many users are contemplating using the Zero W this doesn't have a ethernet port so you must use WI-Fi
Am I wrong in thinking the wi-fi is disabled on the pi until you configure it?
Also many old time Windows users like my self love the Desktop environment and are just more comfortable even if it is just displaying in the background.
Since it is possible to disable the Desktop environment after install (as well as other things) can the setup not be done on the full Debian installer? This would make it much easier for newbies as finding setup and configurations of the pi are easier Desktop.
Logged
Please Read Topic:
General Forum Etiquette
Before you post!

petera

  • PI Expert
  • Hero Member
  • ******
  • Helpful Post Rating: 27
  • Posts: 1750

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.
Done!

Many users are contemplating using the Zero W this doesn't have a ethernet port so you must use WI-Fi
Am I wrong in thinking the wi-fi is disabled on the pi until you configure it?
Also many old time Windows users like my self love the Desktop environment and are just more comfortable even if it is just displaying in the background.
Since it is possible to disable the Desktop environment after install (as well as other things) can the setup not be done on the full Debian installer? This would make it much easier for newbies as finding setup and configurations of the pi are easier Desktop.

This link shows you how to setup your Raspberry Zero W for wifi without the need to use a GUI. You just follow the instructions, pop your SD card into your Pi, power it up and your good to go.
https://www.raspberrypi-spy.co.uk/2017/04/manually-setting-up-pi-wifi-using-wpa_supplicant-conf/

Of course you can use a full desktop version of Raspbian OS with Home Assistant called Pixel. Very basic but it allows you the GUI look and feel. It does however use valuable resources and is not necessary to run Home Assistant. You can as you say disable it using the sudo raspi-config from the Terminal.
Logged

Tuicemen

  • Administrator
  • Hero Member
  • ****
  • Helpful Post Rating: 282
  • Posts: 10497
  • I don't work for X10, I use it successfuly!

Thanks, both options newbies should find useful. I didn't realize you could setup your Wi-fi prior to booting. A very good tip! :)%
Logged
Please Read Topic:
General Forum Etiquette
Before you post!

petera

  • PI Expert
  • Hero Member
  • ******
  • Helpful Post Rating: 27
  • Posts: 1750

Thanks, both options newbies should find useful. I didn't realize you could setup your Wi-fi prior to booting. A very good tip! :)%

Yes the lack of an Ethernet port on the Zero W prompted this solution. The Zero is effectively for embedded solutions so using a GUI would probably defeat the purpose. Works nicely with a standard Pi too. Really does make it plug'n'go unit once the OS is installed using this method.
Logged

Tuicemen

  • Administrator
  • Hero Member
  • ****
  • Helpful Post Rating: 282
  • Posts: 10497
  • I don't work for X10, I use it successfuly!

@petera
Since many here use either the CM15 or Cm19 in their setups I would assume step two in your OP should be replaced with a mochad install?
Maybe step two should be broken down to if using these transceivers install this.
Or is heyu still required regardless? I assume it isn't.
Logged
Please Read Topic:
General Forum Etiquette
Before you post!

petera

  • PI Expert
  • Hero Member
  • ******
  • Helpful Post Rating: 27
  • Posts: 1750

@petera
Since many here use either the CM15 or Cm19 in their setups I would assume step two in your OP should be replaced with a mochad install?
Maybe step two should be broken down to if using these transceivers install this.
Or is heyu still required regardless? I assume it isn't.

No it's Heyu CM11/CM17 or Mochad CM15.
Logged

Tuicemen

  • Administrator
  • Hero Member
  • ****
  • Helpful Post Rating: 282
  • Posts: 10497
  • I don't work for X10, I use it successfuly!

OK I have mochad installed and the service running ha installed and service running :)%
I can open the HA web page :)%
Now what most here will what to know.
How do I setup HA to control X10 modules on the CM15A? :o
Logged
Please Read Topic:
General Forum Etiquette
Before you post!

lviper

  • PI Expert
  • Hero Member
  • ******
  • Helpful Post Rating: 10
  • Posts: 294

Now what most here will what to know.
How do I setup HA to control X10 modules on the CM15A? :o

Edit your configuration.yaml and add the following:

Code: [Select]
mochad:
  host: localhost
  port: 1099

light:
  - platform: mochad
    devices:
      - address: a1
      - address: a5

Change the address to your device.
You can also add a name to the device. If memory serves me, using the above example.

Code: [Select]
mochad:
  host: localhost
  port: 1099

light:
  - platform: mochad
    devices:
      - address: a1
        name: a1 device name
      - address: a5
        name: a5 device name

When editing yaml files pay attention to the spacing.
The following WILL NOT work

Code: [Select]
mochad:
host: localhost
port: 1099

light:
- platform: mochad
devices:
- address: a1

Once you have your config completed you have to restart HA. The best way to do this is to open the HA frontend web page, click on Configuration on the left, then General. Click Check Config to make sure you don't have any errors in your configuration.yaml, then click Restart under Server Management. You will get a message saying something failed, just ignore it and click back to Overview. In a minute you will see a list of your x10 lights with lightening bolts for on and off. That's all you get in HA since mochad does not offer any state information.
Logged

lviper

  • PI Expert
  • Hero Member
  • ******
  • Helpful Post Rating: 10
  • Posts: 294

I forgot to add to my last. Use switch if you want to define your device as a switch.

Code: [Select]
switch:
  - platform: mochad
    devices:
      - address: a1
        name: my wall switch

Also remember, while mochad will see your palmpad and turn on your light, HA won't. It will still show off in HA. To turn off a light in HA that is currently on you will need to turn it on then off.
Logged

Tuicemen

  • Administrator
  • Hero Member
  • ****
  • Helpful Post Rating: 282
  • Posts: 10497
  • I don't work for X10, I use it successfuly!

I seen in the Mochad documentation to add this to the yam file but how do I find it?
whats the Path? I don't see where you can do it from the UI.
Also remember, while mochad will see your palmpad and turn on your light, HA won't. It will still show off in HA. To turn off a light in HA that is currently on you will need to turn it on then off.
Well that just sucks!
HG will see commands from a palm pad and reflect it in the UI. as well it will see security RF.
I can see this isn't the software for me, but since I've got it loaded I'll play a bit. ;)
The average long time AHP user won't do all this coding to get something that only half works with their X10. It is a shame there are lots of protocol options in HA
Logged
Please Read Topic:
General Forum Etiquette
Before you post!

bkenobi

  • PI Expert
  • Hero Member
  • ******
  • Helpful Post Rating: 24
  • Posts: 2081

Also remember, while mochad will see your palmpad and turn on your light, HA won't. It will still show off in HA. To turn off a light in HA that is currently on you will need to turn it on then off.
Are you saying that HA can't see incoming RF commands and act on them?  That can't be right since motion sensors send an RF command which many people use as triggers for other things.  The most basic config is to set a module to the same HU code as the motion sensor, but I certainly don't think that should be considered the only approach.

Tuicemen

  • Administrator
  • Hero Member
  • ****
  • Helpful Post Rating: 282
  • Posts: 10497
  • I don't work for X10, I use it successfuly!

Ok found the configuration.yaml file located here: homeassistant@raspberrypi:~/.homeassistant $ For those as lost as I am.

Now where do I add the mochad lines? ::) :'
all documentation just says add to the file. No location  :-[ beginning, end, under some special heading B:( B:(
I'm beginning t believe this is a total waste of my time, ::) :'
Logged
Please Read Topic:
General Forum Etiquette
Before you post!

petera

  • PI Expert
  • Hero Member
  • ******
  • Helpful Post Rating: 27
  • Posts: 1750

Ok found the configuration.yaml file located here: homeassistant@raspberrypi:~/.homeassistant $ For those as lost as I am.

Now where do I add the mochad lines? ::) :'
all documentation just says add to the file. No location  :-[ beginning, end, under some special heading B:( B:(
I'm beginning t believe this is a total waste of my time, ::) :'

Try reading up a little more on the configuration of Home Assistant before trying to configure it. This link will give you a little more insight into adding the Mochad service assuming the service is physically on the same Pi https://www.home-assistant.io/components/light.mochad/
Logged

petera

  • PI Expert
  • Hero Member
  • ******
  • Helpful Post Rating: 27
  • Posts: 1750

Does this link explain things a little clearer https://community.home-assistant.io/t/mochad-configuration/48649

The community forum has nearly all the answers you require.
Logged
Pages: [1] 2
 

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