X10 Community Forum

📱🖥️PiX10Hub ( Always Evolving Open Source) => 🏥Help and Trouble Shooting => HA-Bridge ⛑help => Topic started by: Tuicemen on December 15, 2018, 01:57:54 PM

Title: HA-Bridge Setup.
Post by: Tuicemen on December 15, 2018, 01:57:54 PM
Some have already jumped into this.
However it is imperative HG is working with all your devices before diving into this on the PiX10Hub Image.
Documentation on HA-Bridge is spares though it is getting better. https://github.com/bwssytems/ha-bridge#ha-bridge
I've asked that the developer create a helper for HG like he has done for other HA programs but until that is done we're stuck doing things manually.  :(  I have posted some tutorials with screen shots in my forum for setup however these show the old HA-Bridge configuration layout.
 The only real difference is the X10 calls as these must be now directed to HomeGenie (HG). However for those that wish more detailed info I'll post some new screen shots made up showing calls to HG and maybe even some calls directly to the PiX10Hub so you can do a voice command for shutdown, reboot or some other Linux command line call.
What I will not show is how to get another protocol working with HA-Bridge for that see the HA-Bridge GitHub pages.
Feel free to ask questions about any step of the setup procedure in the HA-Bridge help discussion thread. http://forums.x10.com/index.php?topic=30717.0
Title: Re: HA-Bridge Setup.
Post by: Tuicemen on December 20, 2018, 08:47:21 AM
If you haven't already done so go into your router and reserve the IP of the Pi so nothing steals the IP when the router reboots.
 Failing to do so will at some point in time cause you issues with Alexa

Initial Setup of HA-Bridge:
 To open HA-Bridge point your browser to the PiX10Hub's IP
it will open to the device screen with some sample X10 devices loaded these will not actually work straight out of the box.
there are few steps to take first.
1: at the top select bridge control
2: this opens the screen shown below

3: Here we need to change the UPNP IP address to that of your PI
4: Now click save once the Bridge has saved the info it will reload the Bridge Devices page(first image)
5: From here in row 1 of the first device go to the right and select Edit/Copy which opens the screen shown below:
6: here we can edit the device name to which ever you wish add  or remove the current description and add a comment if you wish.

7: Scroll down to the ON Items row and in the Target column change the IP  ( to that of your pi.  while here change the House code unit code  if needed (A1) to the corresponding device you named, do the same for the Off Items
8: Scroll back to the top and click either "Update Bridge device" (which overwrites that device) or "Add Bridge Device" which will keep the device  you edited but add a new device.
9: Once you have all your HG devices entered that you wish Alexa control of ask Alexa to discover devices.
Title: Re: HA-Bridge Setup.
Post by: Tuicemen on December 20, 2018, 10:22:08 AM
Setting Up Security:
Setting up security in HA-Bridge is one of the most important things to do. even if you don't have it accessible to the outside world of the web.
This uses scripts to perform actions and even actions of a supper user (sudo ) on a pi can be performed by it.
To set ip your security do the following:
1: With HA-Bridge open go to the Bridge control screen.
2: Click on Update security settings this will bring up the security screen to add users you can add as many users as you like but you realy only need one.
3: In the new screen that pops up typ in a user which will expand the window to add users
4: Once you have your info added click add user which opens the login screen behind the add user screen.
5: Close the security popup which will allow you to log in.
6: This will reopen HA-Bridge to the device screen
7: If you wish to be sure all is save reopen the Bridge Control screen and click Save
Title: Re: HA-Bridge Setup.
Post by: Tuicemen on December 20, 2018, 05:39:35 PM
Direct Command Calls to the PiX10Hub!
The main difference for creating a direct call to the Pi is you only want the On item or Off  items not both

So why would you wish one?
Well maybe you'd like to reboot or shutdown but don't wish to open PuTTY and a SSH session just to do that. or maybe you just dread using the terminal screen.
 The shutdown command is usefull for when you would like to do a SD card back up so I'll show it.
1:First we need to open HA-Bridge and click on the Add/Edit tab which will open the window to add a device.
2: Add a name in the name field
3: Add a description (optional)
4: In the Device Type (optional ) select "Execute Command/script"
5: select the same for Map Type (Legacy)
6: In the On Items row select the same for  the Type column
7: Under the Target item type sudo systemctl stop homegenie.service 
8: Then at the far right click Add to give us a ne on item line
9:Under the new Target item type sudo shutdown 1 the one gives a 1 min warning and allows the bridge to service stop safely
10: Then at the far right click Add again to give us the next line
11: Under the Target item type sudo systemctl stop ha-bridge.service
12:Then at the far right click Add again (very important)
 I most always forget that step! B:(
13: Go back to the top and click Add Bridge Device which takes us back to the device page where you can manualy test pressing the On button.
14: Finally tell Alexa to discover devices.

If you don't feel comfortable saying Alexa turn on (the command) you can say Alexa activate (the command)

As a alternate to this you could add the call to the Off Item row instead of the On Item row.
If you did that the Alexa command would be Alexa turn off..... or Alexa deactivate......