Alexa:修订间差异

来自Domoticz
(创建页面,内容为“You can setup the Amazon echo to voice trigger any scene/switch/activity in domoticz using HA-bridge (e.g. "Alexa, turn on living room lights" ). I have been using t...”)
 
无编辑摘要
 
第1行: 第1行:
'''Controlicz -
'''There is now a native Alexa skill for Domoticz - Controlicz!
Register at www.controlicz.com - Please read the FAQ first
Add the devices you want to control into Room Plans in your Domoticz instance
setup port forwarding for your SSL port - this only works with HTTPS
Enable the skill on your Alexa device - and you're done :)
'''HA Bridge'''
You can setup the Amazon echo to voice trigger any scene/switch/activity in domoticz using HA-bridge (e.g. "Alexa, turn on living room lights" ).
You can setup the Amazon echo to voice trigger any scene/switch/activity in domoticz using HA-bridge (e.g. "Alexa, turn on living room lights" ).
I have been using this setup with an amazon echo outside the target market for the echo (In India) and it works beautifully well.
I have been using this setup with an amazon echo outside the target market for the echo (In India) and it works beautifully well.

2017年7月27日 (四) 14:40的最新版本

Controlicz - There is now a native Alexa skill for Domoticz - Controlicz!

Register at www.controlicz.com - Please read the FAQ first

Add the devices you want to control into Room Plans in your Domoticz instance

setup port forwarding for your SSL port - this only works with HTTPS

Enable the skill on your Alexa device - and you're done :)


HA Bridge You can setup the Amazon echo to voice trigger any scene/switch/activity in domoticz using HA-bridge (e.g. "Alexa, turn on living room lights" ). I have been using this setup with an amazon echo outside the target market for the echo (In India) and it works beautifully well. The HA-bridge emulates Philips hue devices that is supported natively by the echo

Pre-requisites

  • An Amazon Echo device
  • A spare RPi/processing capacity on your domoticz box/ any other linux box
  • HA-bridge running on the above mentioned box


I use a spare Gen 2 Rpi B that I had lying unused The rest of the guide assumes that the HA-bridge is running on a separate box

Installing HA-bridge

On a vanilla Raspbian system, installing HA_bridge is relatively trivial

install java

Newer Raspbian images should have java pre-installed, if not:

 sudo apt-get update && sudo apt-get install oracle-java8-jdk 

Install HA-bridge

This guide assume installation of v2.07 at /home/pi/habridge - feel free to change location as you see fit

Make sure you get the latest release

cd /home/pi/
mkdir habridge
cd habridge
wget https://github.com/bwssytems/ha-bridge/releases/download/<your version1>/ha-bridge-<your version2>.jar

Note: 1) "your version" ie. "v3.5.1" with the "v" in front 2) without the "v"

Edit the shell script for starting:

pi@raspberrypi:~/habridge $ nano starthabridge.sh

Then cut and past this, modify any locations that are not correct


cd /home/pi/habridge
rm /home/pi/habridge/habridge-log.txt
nohup sudo java -jar /home/pi/habridge/ha-bridge-<your version>.jar > /home/pi/habridge/habridge-log.txt 2>&1 &
chmod 777 /home/pi/habridge/habridge-log.txt 

Make script executable

 pi@raspberrypi:~/habridge $ chmod u+x starthabridge.sh

Then execute the script:

pi@raspberrypi:~/habridge $ ./starthabridge.sh 

You should now be running the bridge. Check for errors:

pi@raspberrypi:~/habridge $ tail -f habridge-log.txt

By default, the bridge runs on port 8080 - if you running this on the same machine as domoticz, do not forget to change the port on either domoticz or HA-bridge

To change the port on HA-bridge, use the following argument

java -jar -Dserver.port=80 ha-bridge-<your version>.jar

Add to startup

Copy the script to your rc.local (or systemctl as your case may be)

 nano /etc/rc.local

add the lines between "fi" and "end"

/home/pi/habridge/starthabridge.sh

And you are all set

Configuring HA bridge

Navigate to the HA bridge configuration page on IP_of_server_running_bridge:8080 The first screen (bridge devices) shows the devices that Alexa would add to her list of available devices (nothing will be shown here if you didn't add devices yet).

Automatic configuration (HA bridge version 4.1.0 and higher)

From version 4.1.0 of the HA-bridge there is a built in feature for Domoticz. Do the following to set the HA bridge up for Domoticz:

  • Go to the Bridge Control page
  • Scroll down to "Domoticz Names and IP Addresses"
  • Fill in a name of your choice for your Domoticz device (e.g. "Domoticz"), enter your IP address and Domoticz port number (also username and password if you use that).
  • Click "Add" on the right hand side of what you just filled in.
  • A very important last step: scroll to the top of the page and click "Save"!

After you have done the above, a new tab called "Domoticz Devices" is created. In this tab you will see all your Domoticz devices. This is where you can add your devices to the HA bridge, after which they will appear on the Bridge Devices page and can be controlled via Alexa.

Manual device list pull (for older versions)

For older ha-bridge versions (before 4.1.0) you may use this script, which will automatically pull your device list from the Domoticz API and write them into the device configuration file for ha-bridge: https://github.com/dswinton/domoticz-habridge-sync

Adding devices to HA bridge

You can either use the Domoticz Devices page or a manually add devices to the HA bridge.

Via Domoticz Devices page

On the Domoticz Devices page you will see all your Domoticz devices.

  • Search the device you want to add and tick the box in the Name column.
  • If the device you are adding is a dimmer, select the dim control type via the drop down list at the top of the page. If it is not a dimmer, leave this on "none".
  • Click on the "Build item" button in the row of your ticked device.
  • The name you fill in here is how you will ask Alexa for this device.
  • The rest of the fields are already filled in for you so you don't need to do anything with it, but you can adjust things here if you like (e.g. the JSON URL).
  • Click at the top of the page on "Add bridge device".
  • At the Bridge devices page, you will now see your added device. You can click on the test buttons to see whether it does what you want.
  • Say to your Echo "Alexa, discover devices" or alternatively you can open the Alexa app on your phone and go to Menu > Smart Home > and click on "Discover devices".
  • The device(s) is/are now added in Alexa and are ready to use via voice command.

Manually add devices

Change the IP and idx as per your setup

Testing

  • Ask Alexa to Discover devices ("Alex, discover devices" or through the alexa app
  • Alexa should find a new device called porch lights
  • test by asking alexa to "turn porch lights on" (or off , or dim)

Finishing

  • I couldn't get the echo to recognize the new hue devices at the first attempt and required a restart of the echo device (not sure why)
  • I had to run my HA bridge (v3.2.1) on port 80 as root before Alexa would pick up any devices
  • Once the first device is added succesfully, you should be able to create as many new bridge devices as you want