- activate multiple configurations of flash briefings
- start playing music by providing the voice command as text (Works with all music providers)
- get last spoken voice command
- change the volume of the alarm
- change the equalizer settings
- get information about the next alarm, reminder and timer
- send a message to the echo devices
It also provides features to control devices connected to your echo:
- turn on/off your lights
- change the color
- control groups of lights or just single bulbs
- receive the current state of the lights
- turn on/off smart plugs (e. g. OSRAM)
Restrictions:
- groups can't receive their current color (multiple colors are possible)
- devices can only receive their state every 60 seconds
- turning on/off (or switch color, change brightness) will send a request for every single bulb in a group
Some ideas what you can do in your home by using rules and other openHAB controlled devices:
- Automatic turn on your amplifier and connect echo with bluetooth if the echo plays music
- If the amplifier was turned off, the echo stop playing and disconnect the bluetooth
- The echo starts playing radio if the light was turned on
- The echo starts playing radio at specified time
- Remind you with a voice message, that a window is open for a long time and it is winter
- Start a routine which welcome you, if you come home
- Start a routine which switch a smart home device connected to Alexa
- Start your briefing if you turn on the light first time in the morning
- Have different flash briefing in the morning and evening
- Let Alexa say 'welcome' to you if you open the door
- Implement own handling for voice commands in a rule
- Change the equalizer settings depending on the bluetooth connection
- Turn on a light on your alexa alarm time
- Activate or deactivate the Alexa Guard with presence detection
With the possibility to control your lights you could do:
- a scene-based configuration of your rooms
- connect single bulbs to functions of openHAB
- simulate your presence at home
- automatically turn on your lights at the evening
- integrate your smart bulbs with rules
## Binding Configuration
The binding does not have any configuration.
The configuration of your amazon account must be done in the 'Amazon Account' device.
## First Steps
1) Create an 'Amazon Account' thing
2) open the url YOUR_OPENHAB/amazonechocontrol in your browser (e.g. http://openhab:8080/amazonechocontrol/), click the link for your account thing and login.
3) You should see now a message that the login was successful
| discoverSmartHome | 0 | 0...No discover, 1...Discover direct connected, 2...Discover direct and Alexa skill devices, 3...Discover direct, Alexa and openHAB skill devices |
| pollingIntervalSmartHomeAlexa | 30 | Defines the time in seconds for openHAB to pull the state of the Alexa connected devices. The minimum is 10 seconds. |
| pollingIntervalSmartSkills | 120 | Defines the time in seconds for openHAB to pull the state of the over a skill connected devices. The minimum is 60 seconds. |
#### Channels
| Channel Type ID | Item Type | Access Mode | Thing Type | Description
| serialNumber | Serial number of the Amazon Echo in the Alexa app |
You will find the serial number in the Alexa app or on the webpage YOUR_OPENHAB/amazonechocontrol/YOUR_ACCOUNT (e.g. http://openhab:8080/amazonechocontrol/account1).
### Flash Briefing Profile
The flashbriefingprofile thing has no configuration parameters.
It will be configured at runtime by using the save channel to store the current flash briefing configuration in the thing.
#### Channels
| Channel Type ID | Item Type | Access Mode | Thing Type | Description
| player | Player | R/W | echo, echoshow, echospot, wha | Control the music player (Supported commands: PLAY or ON,PAUSE or OFF, NEXT,PREVIOUS, REWIND,FASTFORWARD)
| volume | Dimmer | R/W | echo, echoshow, echospot | Control the volume
| equalizerTreble | Number | R/W | echo, echoshow, echospot | Control the treble (value from -6 to 6)
| equalizerMidrange | Number | R/W | echo, echoshow, echospot | Control the midrange (value from -6 to 6)
| equalizerBass | Number | R/W | echo, echoshow, echospot | Control the bass (value from -6 to 6)
| shuffle | Switch | R/W | echo, echoshow, echospot, wha | Shuffle play if applicable, e.g. playing a playlist
| imageUrl | String | R | echo, echoshow, echospot, wha | Url of the album image or radio station logo
| title | String | R | echo, echoshow, echospot, wha | Title of the current media
| subtitle1 | String | R | echo, echoshow, echospot, wha | Subtitle of the current media
| subtitle2 | String | R | echo, echoshow, echospot, wha | Additional subtitle of the current media
| providerDisplayName | String | R | echo, echoshow, echospot, wha | Name of the music provider
| bluetoothMAC | String | R/W | echo, echoshow, echospot | Bluetooth device MAC. Used to connect to a specific device or disconnect if an empty string was provided
| bluetooth | Switch | R/W | echo, echoshow, echospot | Connect/Disconnect to the last used bluetooth device (works after a bluetooth connection was established after the openHAB start)
| bluetoothDeviceName | String | R | echo, echoshow, echospot | User friendly name of the connected bluetooth device
| radioStationId | String | R/W | echo, echoshow, echospot, wha | Start playing of a TuneIn radio station by specifying its id or stops playing if an empty string was provided
| radio | Switch | R/W | echo, echoshow, echospot, wha | Start playing of the last used TuneIn radio station (works after the radio station started after the openHAB start)
| amazonMusicTrackId | String | R/W | echo, echoshow, echospot, wha | Start playing of an Amazon Music track by its id or stops playing if an empty string was provided
| amazonMusicPlayListId | String | W | echo, echoshow, echospot, wha | Write Only! Start playing of an Amazon Music playlist by specifying its id or stops playing if an empty string was provided. Selection will only work in PaperUI
| amazonMusic | Switch | R/W | echo, echoshow, echospot, wha | Start playing of the last used Amazon Music song (works after at least one song was started after the openHAB start)
| remind | String | R/W | echo, echoshow, echospot | Write Only! Speak the reminder and sends a notification to the Alexa app (Currently the reminder is played and notified two times, this seems to be a bug in the Amazon software)
| nextReminder | DateTime | R | echo, echoshow, echospot | Next reminder on the device
| playAlarmSound | String | W | echo, echoshow, echospot | Write Only! Plays an Alarm sound
| nextAlarm | DateTime | R | echo, echoshow, echospot | Next alarm on the device
| nextMusicAlarm | DateTime | R | echo, echoshow, echospot | Next music alarm on the device
| nextTimer | DateTime | R | echo, echoshow, echospot | Next timer on the device
| startRoutine | String | W | echo, echoshow, echospot | Write Only! Type in what you normally say to Alexa without the preceding "Alexa,"
| musicProviderId | String | R/W | echo, echoshow, echospot | Current Music provider
| playMusicVoiceCommand | String | W | echo, echoshow, echospot | Write Only! Voice command as text. E.g. 'Yesterday from the Beatles'
| startCommand | String | W | echo, echoshow, echospot | Write Only! Used to start anything. Available options: Weather, Traffic, GoodMorning, SingASong, TellStory, FlashBriefing and FlashBriefing.<FlahshbriefingDeviceID> (Note: The options are case sensitive)
| announcement | String | W | echo, echoshow, echospot | Write Only! Display the announcement message on the display. See in the tutorial section to learn how it’s possible to set the title and turn off the sound.
| textToSpeech | String | W | echo, echoshow, echospot | Write Only! Write some text to this channel and Alexa will speak it. It is possible to use plain text or SSML: e.g. `<speak>I want to tell you a secret.<amazon:effect name="whispered">I am not a real human.</amazon:effect></speak>`
| textToSpeechVolume | Dimmer | R/W | echo, echoshow, echospot | Volume of the textToSpeech channel, if 0 the current volume will be used
| ascendingAlarm | Switch | R/W | echo, echoshow, echospot | Ascending alarm up to the configured volume
| sendMessage | String | W | account | Write Only! Sends a message to the Echo devices.
| save | Switch | W | flashbriefingprofile | Write Only! Stores the current configuration of flash briefings within the thing
| active | Switch | R/W | flashbriefingprofile | Active the profile
| playOnDevice | String | W | flashbriefingprofile | Specify the echo serial number or name to start the flash briefing.
## Advanced Feature Technically Experienced Users
The url <YOUR_OPENHAB>/amazonechocontrol/<YOUR_ACCOUNT>/PROXY/<API_URL> provides a proxy server with an authenticated connection to the Amazon Alexa server.
This can be used to call Alexa API from rules.
E.g. to read out the history call from an installation on openhab:8080 with an account named account1:
// These are only view of the possible options. Enable ShowIDsInGUI in the binding configuration and look in drop-down-box of this channel in the Paper UI Control section
The flashbriefingprofile thing has no configuration parameters.
It will be configured at runtime by using the save channel to store the current flash briefing configuration which is set in the alexa app in the thing. Create a flashbriefingprofile Thing for each set you need.
E.g. One Flashbriefing profile with technical news and wheater, one for playing world news and one for sport news.
| Channel Type ID | Item Type | Access Mode | Thing Type | Description
Note: the cannels of smartHomeDevices and smartHomeDeviceGroup will be created dynamically based on the capabilities reported by the amazon server. This can take a little bit of time.
The polling interval configured in the Account Thing to get the state is specified in minutes and has a minimum of 10. This means it takes up to 10 minutes to see the state of a channel. The reason for this low interval is, that the polling causes a big server load for the Smart Home Skills.
The only possibility to find out the id is by using the discover function in the PaperUI. You can use then the id, if you want define the Thing in a file.
#### Channels
The channels of the smarthome devices will be generated at runtime. Check in the paperUI thing configurations, which channels are created.
| Channel Type ID | Item Type | Access Mode | Thing Type | Description
| powerState | Switch | R/W | smartHomeDevice, smartHomeDeviceGroup | Shows and changes the state (ON/OFF) of your device
| brightness | Dimmer | R/W | smartHomeDevice, smartHomeDeviceGroup | Shows and changes the brightness of your lamp
| color | Color | R | smartHomeDevice, smartHomeDeviceGroup | Shows the color of your light
| colorName | String | R/W | smartHomeDevice, smartHomeDeviceGroup | Shows and changes the color name of your light (groups are not able to show their color)
| colorTemperatureName | String | R/W | smartHomeDevice, smartHomeDeviceGroup | White temperatures name of your lights (groups are not able to show their color)
| armState | String | R/W | smartHomeDevice, smartHomeDeviceGroup | State of your alarm guard. Options: ARMED_AWAY, ARMED_STAY, ARMED_NIGHT, DISARMED (groups are not able to show their state)
1) Open the url YOUR_OPENHAB/amazonechocontrol in your browser (e.g. http://openhab:8080/amazonechocontrol/)
2) Click on the name of the account thing
3) Click on the name of the echo thing
4) Scroll to the channel and copy the required ID
## Advanced Feature Technically Experienced Users
The url <YOUR_OPENHAB>/amazonechocontrol/<YOUR_ACCOUNT>/PROXY/<API_URL> provides a proxy server with an authenticated connection to the amazon alexa server. This can be used to call alexa api from rules.
E.g. to read out the history call from an installation on openhab:8080 with a account named account1:
You can also use [SSML](https://docs.aws.amazon.com/polly/latest/dg/supported-ssml.html) to provide a better voice experience
```php
rule "Say welcome if the door opens"
when
Item Door_Contact changed to OPEN
then
Echo_Living_Room_TTS.sendCommand('<speak>I want to tell you a secret.<amazon:effectname="whispered">I am not a real human.</amazon:effect>.Can you believe it?</speak>')
end
```
### Show an announcement on the echo show or echo spot:
Note: It is recommended to test the command send to play music command first with the voice and the real Alexa device. E.g. say 'Alexa, Playlist Party'
### Start playing weather/traffic/etc:
1) Pick up one of the available commands: Weather, Traffic, GoodMorning, SingASong, TellStory, FlashBriefing
2) Create a rule for start playing the information where you provide the command as string:
The url <YOUR_OPENHAB>/amazonechocontrol/<YOUR_ACCOUNT>/PROXY/<API_URL> provides a proxy server with an authenticated connection to the Amazon Alexa server.
This can be used to call Alexa API from rules.
E.g. to read out the history call from an installation on openhab:8080 with an account named account1:
To resolve login problems the connection settings of an `account` thing can be reset via the karaf console.
The command `amazonechocontrol listAccounts` shows a list of all available `account` things.
The command `amazonechocontrol resetAccount <id>` resets the device id and all other connection settings.
After resetting a connection, a new login as described above is necessary.
## Note
This binding uses the same API as the Web-Browser-Based Alexa site (alexa.amazon.de).
In other words, it simulates a user which is using the web page.
Unfortunately, this binding can break if Amazon changes the web site.
The binding is tested with amazon.de, amazon.fr, amazon.it, amazon.com and amazon.co.uk accounts, but should also work with all others.
## Credits
The idea for writing this binding came from this blog: https://blog.loetzimmer.de/2017/10/amazon-alexa-hort-auf-die-shell-echo.html (German).
Thank you Alex!
The technical information for the web socket connection to get live Alexa state updates cames from Ingo. He has done the Alexa ioBroker implementation https://github.com/Apollon77
Thank you Ingo!
## Trademark Disclaimer
TuneIn, Amazon Echo, Amazon Echo Spot, Amazon Echo Show, Amazon Music, Amazon Prime, Alexa and all other products and Amazon, TuneIn and other companies are trademarks™ or registered® trademarks of their respective holders.
Use of them does not imply any affiliation with or endorsement by them.