Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[amazonechocontrol] Initial contribution for the Amazon Echo Control Binding (#3083) #3087

Merged
merged 59 commits into from
May 24, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
7d97f67
[amazonechocontrol] Initial commit for the Amazon Control Binding (#3…
Jan 6, 2018
c73afb9
[amazonechocontrol] bugfixes, support of amzon.co.uk accounts
Jan 9, 2018
3812b09
[amazonechocontrol] package dependencies fixed, readme changed
Jan 10, 2018
92a04d7
[amazonechocontrol] fix duplicate line in manifest
Jan 10, 2018
7cc41ba
[amazonechocontrol] german translations and thing-types cleanup
Jan 10, 2018
a14859c
[amazonechocontrol] improve logging, correct copyrights, create speci…
Jan 10, 2018
6e1941e
[amazonechocontrol] fix spelling, fix wrong copyright header
Jan 10, 2018
dffe04c
[amazonechocontrol] fix null annotation, fix wrong licence in copyright
Jan 10, 2018
adec353
[amazonechocontrol] fix problems with redirects to insecure sites and…
Jan 14, 2018
7f5cfa1
[amazonechocontrol] code cleanup
Jan 14, 2018
5e5b913
[amazonechocontrol] bugfix configuration update, better error handlin…
Jan 18, 2018
3d2dfe2
[amazonechocontrol] new channels, new thing types, dynamic state pro…
Jan 27, 2018
7acb509
[amazonechocontrol] fix wrong readme item sample
Jan 27, 2018
d42b52e
[amazonechocontrol]
Mar 9, 2018
b3148a8
[amazonechocontrol]
Mar 9, 2018
a48e1fa
[amazonechocontrol]
Mar 9, 2018
9229be2
[amazonechocontrol]
Mar 11, 2018
0664c0e
[amazonechocontrol]
Mar 14, 2018
d31595b
[amazonechocontrol]
Mar 15, 2018
cbdcf76
[amazonechocontrol]
Mar 15, 2018
e83e845
Merge branch 'master' of https://github.com/openhab/openhab2-addons i…
Mar 25, 2018
6fbf8ea
[amazonechocontrol]
Mar 26, 2018
2ca24c8
[amazonechocontrol]
Mar 31, 2018
e90b9f4
[amazonechocontrol]
Mar 31, 2018
87bfddb
[amazonechocontrol]
Apr 4, 2018
011734a
[amazonechocontrol]
Apr 14, 2018
b0d7cc5
[amazonechocontrol]
Apr 6, 2018
52ca33e
[amazonechocontrol]
Apr 6, 2018
0752d68
[amazonechocontrol]
Apr 7, 2018
c7dd651
[amazonechocontrol]
Apr 7, 2018
6945fdd
[amazonechocontrol]
Apr 8, 2018
5cae50f
[amazonechocontrol]
Apr 8, 2018
edc38e3
[amazonechocontrol]
Apr 8, 2018
339b5e3
[amazonechocontrol]
Apr 9, 2018
563bdba
[amazonechocontrol]
Apr 17, 2018
e8d8f2f
[amazonechocontrol]
Apr 17, 2018
bf57fac
[amazonechocontrol]
Apr 24, 2018
0246673
[amazonechocontrol]
Apr 25, 2018
ae0346e
[amazonechocontrol]
Apr 29, 2018
05978c1
[amazonechocontrol]
Apr 29, 2018
53046c2
[amazonechocontrol]
Apr 29, 2018
6d590f0
[amazonechocontrol]
May 2, 2018
d0b21f3
[amazonechocontrol]
May 5, 2018
19c7d53
[amazonechocontrol]
May 6, 2018
cf8b5dc
[amazonechocontrol]
May 6, 2018
c2dfa61
[amazonechocontrol]
May 10, 2018
90fc5d3
[amazonechocontrol]
May 11, 2018
b7332a8
[amazonechocontrol]
May 12, 2018
5a95a10
[amazonechocontrol]
May 18, 2018
4d7c603
[amazonechocontrol]
May 20, 2018
e53330e
[amazonechocontrol]
May 22, 2018
8c3913c
[amazonechocontrol]
May 22, 2018
296dbf4
[amazonechocontrol]
May 22, 2018
7103e62
[amazonechocontrol]
May 23, 2018
19a430f
[amazonechocontrol]
May 23, 2018
c93df72
[amazonechocontrol]
May 23, 2018
22bdc27
[amazonechocontrol]
May 23, 2018
eede1de
[amazonechocontrol]
May 23, 2018
d03fdb8
[amazonechocontrol]
May 23, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
33 changes: 33 additions & 0 deletions addons/binding/org.openhab.binding.amazonechocontrol/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.openhab.binding.amazonechocontrol</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ds.core.builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<binding:binding id="amazonechocontrol"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:binding="http://eclipse.org/smarthome/schemas/binding/v1.0.0"
xsi:schemaLocation="http://eclipse.org/smarthome/schemas/binding/v1.0.0 http://eclipse.org/smarthome/schemas/binding-1.0.0.xsd">

<name>Amazon Echo Control Binding</name>
<description>Binding for controlling Amazon Echo (Alexa). This binding enables openhab to control the volume, playing state, bluetooth connection of your amazon echo devices.
</description>
<author>Michael Geramb</author>


</binding:binding>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# FIXME: please substitute the xx_XX with a proper locale, ie. de_DE
# FIXME: please do not add the file to the repo if you add or change no content
# binding
binding.amazonechocontrol.name = <Your localized Binding name>
binding.amazonechocontrol.description = <Your localized Binding description>

# thing types
thing-type.amazonechocontrol.sample.label = <Your localized Thing label>
thing-type.amazonechocontrol.sample.description = <Your localized Thing description>

# channel types
channel-type.amazonechocontrol.sample-channel.label = <Your localized Channel label>
channel-type.amazonechocontrol.sample-channel.description = <Your localized Channel description>
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
<?xml version="1.0" encoding="UTF-8"?>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have expected tabs in that file - could you re-apply the auto formatter, please?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

<thing:thing-descriptions bindingId="amazonechocontrol"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0"
xsi:schemaLocation="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0 http://eclipse.org/smarthome/schemas/thing-description-1.0.0.xsd">


<bridge-type id="account">
<label>Amazon Account</label>
<description>Amazon Account where your amazon echo is registered.</description>

<config-description>
<parameter name="amazonSite" type="text" required="true">
<default></default>
<label>Amazon site</label>
<default></default>
<limitToOptions>false</limitToOptions>
<options>
<option value="amazon.de">amazon.de</option>
<option value="amazon.com">amazon.com</option>
<option value="amazon.ca">amazon.ca</option>
<option value="amazon.it">amazon.it</option>
<option value="amazon.fr">amazon.fr</option>
<option value="amazon.co.uk">amazon.co.uk</option>
</options>
<description>Select the site where your amazon account is created.</description>
</parameter>

<parameter name="email" type="text" required="true">
<default></default>
<label>Amazon account email</label>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the bridge is called "Amazon Account", I would think that "Email address" would be better here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

<description>Enter the email address of the amazon account which is used for the amazon echo devices. Note: 2 factor authentication is currently not supported.</description>
</parameter>
<parameter name="password" type="text" required="true">
<default></default>
<context>password</context>
<label>Amazon account password</label>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-> Password

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

<description>Enter the password of the amazon account which is used for the amazon echo devices.</description>
</parameter>
<parameter name="pollingIntervalInSeconds" type="integer" min="10" max="65535" required="true" unit="s">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not required as you have a default

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it save to remove the required? I though the default is only the default value for the user and the value can be removed.

<default>60</default>
<label>Refresh state interval</label>
<description>Refresh state interval in seconds. Lower time causes more network traffic.</description>
<unitLabel>Seconds</unitLabel>
</parameter>


</config-description>

</bridge-type>



<thing-type id="echo">
<supported-bridge-type-refs>
<bridge-type-ref id="account" />
</supported-bridge-type-refs>


<label>Amazon Echo</label>
<description>Amazon Echo device (Amazon Echo, Amazon Echo Dot, Amazon Echo Plus...)</description>


<channels>
<channel id="player" typeId="player"/>
<channel id="volume" typeId="volume"/>
<channel id="shuffle" typeId="shuffle"/>
<channel id="imageUrl" typeId="imageUrl"/>
<channel id="title" typeId="title"/>
<channel id="subtitle1" typeId="subtitle1"/>
<channel id="subtitle2" typeId="subtitle2"/>
<channel id="providerDisplayName" typeId="providerDisplayName"/>
<channel id="bluetoothId" typeId="bluetoothId"/>
<channel id="bluetooth" typeId="bluetooth"/>
<channel id="bluetoothDeviceName" typeId="bluetoothDeviceName"/>
<channel id="radioStationId" typeId="radioStationId"/>
<channel id="radio" typeId="radio"/>
</channels>


<representation-property>serialNumber</representation-property>

<config-description>
<parameter name="serialNumber" type="text" required="true">
<label>Serial Number</label>
<description>You will find the serial number of your device in the Alexa app</description>
</parameter>
</config-description>

</thing-type>


<channel-type id="bluetoothDeviceName">
<item-type>String</item-type>
<label>Bluetooth device</label>
<description>Connected bluetooth device</description>
<state readOnly="true"></state>
</channel-type>

<channel-type id="radioStationId">
<item-type>String</item-type>
<label>Radio station id</label>
<description>Id of the radio station</description>
</channel-type>

<channel-type id="name">
<item-type>String</item-type>
<label>Name</label>
<description>Name of Alexa</description>
<state readOnly="true"></state>
</channel-type>

<channel-type id="providerDisplayName">
<item-type>String</item-type>
<label>Provider Name</label>
<description>Name of music provider</description>
<state readOnly="true"></state>
</channel-type>


<channel-type id="bluetoothId">
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this channel be written or is it read only?

Copy link
Member Author

@mgeramb mgeramb Apr 25, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@htreu
Do you mean the providerDisplayName (Name of music provider) -> this is readOnly
The bluetoothId can be written.
So, I think this is correct.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bluetoothId can be written.

What does it mean if you write a MAC address to this channel? What will happen? Isn't rather the bluetoothIdSelection the writable channel?

<item-type>String</item-type>
<label>Bluetooth connection</label>
<description>Id of the bluethooth connected device</description>
</channel-type>

<channel-type id="imageUrl">
<item-type>String</item-type>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nicer to have a Image type here instead of a url.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, because I would have to download every image of every song which was played on any echo. But only very view of them are really used, but the user opens the UI. But it would be nice to have an attribute for it in the xml to mark it as image url, so that the paper UI can display it as image in the same way as it is done in the sitemap.

<label>Image url</label>
<description>Url of the album image or radio station logo</description>
<state readOnly="true"></state>
</channel-type>

<channel-type id="title">
<item-type>String</item-type>
<label>Title</label>
<description>Title</description>
<state readOnly="true"></state>
</channel-type>

<channel-type id="subtitle1">
<item-type>String</item-type>
<label>Subtitle 1</label>
<description>Subtitle 1</description>
<state readOnly="true"></state>
</channel-type>

<channel-type id="subtitle2">
<item-type>String</item-type>
<label>Subtitle 2</label>
<description>Subtitle 2</description>
<state readOnly="true"></state>
</channel-type>

<channel-type id="radio">
<item-type>Switch</item-type>
<label>Radio</label>
<description>Alexa plays radio</description>
</channel-type>

<channel-type id="bluetooth">
<item-type>Switch</item-type>
<label>Bluetooth Connection</label>
<description>Connect to last used device</description>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is also a candidate for trigger actions, see eclipse-archived/smarthome#5099
Nothing to do here atm.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, exactly, there a lot of such channels in my binding! I have attributed these channels as write only in my readme.

</channel-type>

<channel-type id="loop">
<item-type>Switch</item-type>
<label>Loop</label>
<description>Loop</description>
</channel-type>

<channel-type id="shuffle">
<item-type>Switch</item-type>
<label>Shuffle</label>
<description>Shuffle play</description>
</channel-type>

<channel-type id="player">
<item-type>Player</item-type>
<label>Player</label>
<description>Content Playing</description>
</channel-type>


<channel-type id="volume">
<item-type>Dimmer</item-type>
<label>Volume</label>
<description>Volume of the sound</description>
</channel-type>

</thing:thing-descriptions>
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Manifest-Version: 1.0
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .
Bundle-ManifestVersion: 2
Bundle-Name: AmazonEchoControl Binding
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change to "Amazon Echo Control Binding"

Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-SymbolicName: org.openhab.binding.amazonechocontrol;singleton:=true
Bundle-Vendor: openHAB
Bundle-Version: 2.3.0.qualifier
Export-Package:
org.openhab.binding.amazonechocontrol,
org.openhab.binding.amazonechocontrol.handler
Import-Package:
org.apache.commons.lang.time;version="2.6.0",
org.eclipse.jdt.annotation;resolution:=optional,
org.eclipse.smarthome.config.core,
org.eclipse.smarthome.config.discovery,
org.eclipse.smarthome.core.library.types,
org.eclipse.smarthome.core.thing,
org.eclipse.smarthome.core.thing.binding,
org.eclipse.smarthome.core.thing.binding.builder,
org.eclipse.smarthome.core.thing.type,
org.eclipse.smarthome.core.types,
org.openhab.binding.amazonechocontrol,
org.openhab.binding.amazonechocontrol.handler,
org.openhab.core.library.types,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This dependency causes problems, please refactor to no be dependent on it anymore.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Martin, I do not what you mean with remove these dependencies, because the are used, but I have copied now the dependencies from the icloud binding (I only changed the names from icloud with amazonechocontrol). Now Jenkis is green again. But the build goes red again, but it has produced my binding: https://openhab.jfrog.io/openhab/libs-pullrequest-local/org/openhab/binding/org.openhab.binding.amazonechocontrol/2.3.0-SNAPSHOT/
I do not know what's wrong. Thanks for your help!

org.osgi.framework;version="1.8.0",
org.slf4j
Service-Component: OSGI-INF/*.xml
Require-Bundle: com.google.gson
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.xml
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing newline

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have not created this file? Is it part of the template? Anyway I have added the newline

Loading