-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[bondhome] New binding: Bond Home #7260
Conversation
Travis tests were successfulHey @SRGDamia1, |
Travis tests were successfulHey @SRGDamia1, |
2 similar comments
Travis tests were successfulHey @SRGDamia1, |
Travis tests were successfulHey @SRGDamia1, |
Hi @SRGDamia1 , i had never heard of Bond Home, cool product. I took a minute to look at their api, i notice you mention you needed to manually find your Bond's IP address, but according to their docs, they support standard mDNS, and openHAB makes that very easy to add to your binding for auto discovery. http://docs-local.appbond.com/#section/Getting-Started/Finding-the-Bond-IP you can find a ton of examples from other bindings: Good Luck! |
@digitaldan - I'm pinging for the IP from the serial number, but using mDNS would probably be better to get the bridge into the inbox. I'll look into it. |
Travis tests were successfulHey @SRGDamia1, |
@digitaldan Implemented! |
Travis tests were successfulHey @SRGDamia1, |
2 similar comments
Travis tests were successfulHey @SRGDamia1, |
Travis tests were successfulHey @SRGDamia1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw that you put a lot of effort into this binding. Please take a look if you (or any user) really need all the trace log messages or if they can be replaced by using the debugger.
| shadeChannels | openShade | Switch | Opens or closes motorize shades | Motor Shades | | ||
| shadeChannels | hold | Switch | Tells a device to stop moving | Motor Shades | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you consider using the Rollershutter
item-type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes and there was some reason I decided not to use it. I don't remember why. I'll look into it again.
return packetIsDuplicate; | ||
} | ||
|
||
private void datagramSocketHealthRoutine() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should add a grace period of a few seconds here, to prevent hammering on the network (and local resources) when the error is persistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry. What's the best way to implement that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you run in your own thread, you can simply use Thread.sleep()
.
Travis tests have failedHey @SRGDamia1, |
3 similar comments
Travis tests have failedHey @SRGDamia1, |
Travis tests have failedHey @SRGDamia1, |
Travis tests have failedHey @SRGDamia1, |
Thank you so much for your time. I'm sorry I've been really slow to respond. And, obviously, java isn't my native tongue. I've fixed the quick and easy things. When implement asynchronous http requests, can I still make the function call "synchronous" so that no two requests to the bridge can overlap? That is, can I make sure I got a response to the last request before sending a new one? |
Travis tests were successfulHey @SRGDamia1, |
1 similar comment
Travis tests were successfulHey @SRGDamia1, |
Yes, you can do that, but I don't think this is natively supported by |
Travis tests were successfulHey @SRGDamia1, |
Travis tests have failedHey @SRGDamia1, |
Travis tests were successfulHey @SRGDamia1, |
Automatic code migration to openHAB 3 succeeded. The resulting code can be found at https://ci.openhab.org/job/openHAB-Addons-Migration/78/artifact/bundles/. You can download the migrated code from there and create a new PR against the master branch of the openhab-addons repo to contribute it for being included in openHAB 3.x. Please see this issue about the details on how to proceed with your existing PR. |
This indeed need to be brought into a non-conflicting state. The easiest might be to check out the new 2.5.x branch, copy your code to it and do a single commit. Just name your branch bondhome (rename your old one first to have no name clash) and do a force push to Github. |
Signed-off-by: Sara Damiano <[email protected]>
Mostly new null checks Signed-off-by: Sara Damiano <[email protected]>
Signed-off-by: Sara Damiano <[email protected]>
Signed-off-by: Sara Damiano <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution. The code looks great, I've made some general comments and some openHAB specific comments.
Additional, The readme needs to be written and please remove the jar file from this pr. If you want to provide a jar you can make a release on your GitHub fork of openHAB. This can be done on a branch. You can attach the jar file to this release. Than point people to this release tag page (not the jar). This gives a consist url. You can later edit the release and add an updated jar, without having to give a new url.
Also run mvn spotless:apply
on your binding to auto-format the code, and also auto update the copyright year. (You might need to rebase to the latest code of this repo).
@NonNullByDefault | ||
@Component(configurationPid = "binding.bondhome", service = ThingHandlerFactory.class) | ||
public class BondHomeHandlerFactory extends BaseThingHandlerFactory { | ||
private Logger logger = LoggerFactory.getLogger(BondHomeHandlerFactory.class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private Logger logger = LoggerFactory.getLogger(BondHomeHandlerFactory.class); | |
private final Logger logger = LoggerFactory.getLogger(BondHomeHandlerFactory.class); |
private final Logger logger = LoggerFactory.getLogger(BPUPListener.class); | ||
|
||
// To parse the JSON responses | ||
private Gson gsonBuilder; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private Gson gsonBuilder; | |
private final Gson gsonBuilder; |
|
||
public @Nullable String lastRequestId; | ||
private long timeOfLastKeepAlivePacket; | ||
private Boolean shutdown; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private Boolean shutdown; | |
private boolean shutdown; |
// State Variables | ||
// power: (integer) 1 = on, 0 = off | ||
// Actions | ||
TurnOn("TurnOn", CHANNEL_GROUP_COMMON, CHANNEL_POWER_STATE), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enum's should be uppercase:
TurnOn("TurnOn", CHANNEL_GROUP_COMMON, CHANNEL_POWER_STATE), | |
TURN_ON("TurnOn", CHANNEL_GROUP_COMMON, CHANNEL_POWER_STATE), |
* | ||
* @author Kai Kreuzer - Initial contribution | ||
*/ | ||
@Component(service = MDNSDiscoveryParticipant.class, immediate = true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Component(service = MDNSDiscoveryParticipant.class, immediate = true) | |
@Component(service = MDNSDiscoveryParticipant.class, configurationPid="discovery.mdns.bondhome") |
logger.info("Current version is {}, prior version was {}.", CURRENT_BINDING_VERSION, lastBindingVersion); | ||
|
||
// Update the thing with the new property value | ||
final Map<String, String> newProperties = new HashMap<>(thing.getProperties()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
final Map<String, String> newProperties = new HashMap<>(thing.getProperties()); | |
final Map<String, String> newProperties = editProperties(); |
final ThingBuilder thingBuilder = editThing(); | ||
thingBuilder.withProperties(newProperties); | ||
updateThing(thingBuilder.build()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not updateProperties(newProperties)
here?
|
||
private synchronized boolean wasThingUpdatedExternally(BondDevice devInfo) { | ||
// Check if the Bond hash tree has changed | ||
config = getConfigAs(BondDeviceConfiguration.class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the config changes initialize
is called again and that already sets the config
. Therefor it's not needed to set config
again here? Or did I miss some behavior here?
if (api == null) { | ||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, | ||
"Bridge API not available"); | ||
initialize(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should not be needed to call initialize
here. If some code in initialize
needs to be called this should be put into a separate method. initialize
is generally called when the thing itself is initialized by openHAB. So the binding should not do that itself.
logger.trace("Update Time for {}: {}", this.getThing().getLabel(), (new DateTimeType()).toFullString()); | ||
|
||
updateState(CHANNEL_POWER_STATE, updateState.power == 0 ? OnOffType.OFF : OnOffType.ON); | ||
updateState("timer", new DecimalType(updateState.timer)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put timer
in a constant, like the other channels?
No feedback since January, so I guess we should close this. If anyone picks it up in future, I'm happy to re-open the PR again. |
from openhab#7260 Signed-off-by: Cody Cutrer <[email protected]>
This pull request has been mentioned on openHAB Community. There might be relevant details there: https://community.openhab.org/t/bond-home-bondhome-io/46654/62 |
* First commit on newly created branch, taking code from c8b8e21 * [bondhome] update snapshot version, and some typos * [bondhome] Address (most) comments from prior review from #7260 * [bondhome] simplify channels * lastUpdate is unnecessary; turn on persistence or add a rule on update if you care to keep track of it * use a single string command channel for all shoot-and-forget commands, instead of multiple switch channels * use a rollershutter channel for shades (accepting UP, DOWN, STOP, 0%, and 100%) * on all dimmer channels, accept ON and OFF, as well as 0% to imply OFF, instead of having to write rules to control ON/OFF state separately. * if the dimmer channel exists, prune the corresponding power channel, since the dimmer channel is now a pure superset of its functionality * overload fan#speed to be ceiling fan or a fireplace's fan, depending on the device type * [bondhome] add bundle to the BOM pom * [bondhome] clean up BondDeviceHandler a bit * there's no need to delay initialization; ThingManager won't even attempt to initialize a child thing until its bridge is online * Remove some extra initialization checks that can never be false * slightly refactor some methods to return early, rather than nest a giant `else` * remove some info logging that will get triggered in normal usage * [bondhome] fix bridge discovery * Bridge property and config serial number need to be the same name * Don't arbitrarily delay the BPUPListener * Automatically update the IP if the BPUPListener finds it * Provide the new bridge with its discovered IP to avoid an additional DNS query * Don't get the bridge version after every keep-alive response * [bondhome] trigger end-device discovery as soon as the bridge comes online * [bondhome] remove internal binding version * [bondhome] change addr property to string Certain values seen in the wild when interpreted as a long are too big for that storage. Also, the Bond API documentation describes the addr property on a device to be a string. OpenHAB already has infrastructure to have things update their channel definitions when a binding is updated. * [bondhome] ignore any device that starts with _ In v3 of their API, Bond added a new special entry of __. Because no valid device id would start with an underscore, ignore everything that starts with an underscore to fix v3 and maybe futureproof. * address review comments mostly adding i18n to error states, and cleaning up error handling of HTTP requests. * use builtin translation services instead of plumbing our own provider through * use System.nanoTime instead of currentTimeMillis so that it will be a monotonic clock, not (as) susceptible to the clock changing * [bondhome] ignore BPUP messasges that aren't state In recent firmware, bond is now sending action messages via BPUP as well as state. This change ignores all messages that aren't state. * [bondhome] Improve error handling, and remove dummy constants Just use a single BondException class to communicate any sort of error from within bond, and avoid throwing, catching, and re-throwing the same (or slightly modified) exception. Also remove dummy constants that might give the wrong impression of the details of your Bond device. Then implement proper null checks, especially setting a configuration error if key config properties aren't set on the thing. * [bondhome] avoid setting device status when bridge just went offline * address static analysis tool problems Also-by: Sara Damiano <[email protected]> Also-by: Keith T. Garner <[email protected]> Signed-off-by: Cody Cutrer <[email protected]>
* First commit on newly created branch, taking code from c8b8e21 * [bondhome] update snapshot version, and some typos * [bondhome] Address (most) comments from prior review from openhab#7260 * [bondhome] simplify channels * lastUpdate is unnecessary; turn on persistence or add a rule on update if you care to keep track of it * use a single string command channel for all shoot-and-forget commands, instead of multiple switch channels * use a rollershutter channel for shades (accepting UP, DOWN, STOP, 0%, and 100%) * on all dimmer channels, accept ON and OFF, as well as 0% to imply OFF, instead of having to write rules to control ON/OFF state separately. * if the dimmer channel exists, prune the corresponding power channel, since the dimmer channel is now a pure superset of its functionality * overload fan#speed to be ceiling fan or a fireplace's fan, depending on the device type * [bondhome] add bundle to the BOM pom * [bondhome] clean up BondDeviceHandler a bit * there's no need to delay initialization; ThingManager won't even attempt to initialize a child thing until its bridge is online * Remove some extra initialization checks that can never be false * slightly refactor some methods to return early, rather than nest a giant `else` * remove some info logging that will get triggered in normal usage * [bondhome] fix bridge discovery * Bridge property and config serial number need to be the same name * Don't arbitrarily delay the BPUPListener * Automatically update the IP if the BPUPListener finds it * Provide the new bridge with its discovered IP to avoid an additional DNS query * Don't get the bridge version after every keep-alive response * [bondhome] trigger end-device discovery as soon as the bridge comes online * [bondhome] remove internal binding version * [bondhome] change addr property to string Certain values seen in the wild when interpreted as a long are too big for that storage. Also, the Bond API documentation describes the addr property on a device to be a string. OpenHAB already has infrastructure to have things update their channel definitions when a binding is updated. * [bondhome] ignore any device that starts with _ In v3 of their API, Bond added a new special entry of __. Because no valid device id would start with an underscore, ignore everything that starts with an underscore to fix v3 and maybe futureproof. * address review comments mostly adding i18n to error states, and cleaning up error handling of HTTP requests. * use builtin translation services instead of plumbing our own provider through * use System.nanoTime instead of currentTimeMillis so that it will be a monotonic clock, not (as) susceptible to the clock changing * [bondhome] ignore BPUP messasges that aren't state In recent firmware, bond is now sending action messages via BPUP as well as state. This change ignores all messages that aren't state. * [bondhome] Improve error handling, and remove dummy constants Just use a single BondException class to communicate any sort of error from within bond, and avoid throwing, catching, and re-throwing the same (or slightly modified) exception. Also remove dummy constants that might give the wrong impression of the details of your Bond device. Then implement proper null checks, especially setting a configuration error if key config properties aren't set on the thing. * [bondhome] avoid setting device status when bridge just went offline * address static analysis tool problems Also-by: Sara Damiano <[email protected]> Also-by: Keith T. Garner <[email protected]> Signed-off-by: Cody Cutrer <[email protected]> Signed-off-by: Ben Rosenblum <[email protected]>
* First commit on newly created branch, taking code from c8b8e21 * [bondhome] update snapshot version, and some typos * [bondhome] Address (most) comments from prior review from openhab#7260 * [bondhome] simplify channels * lastUpdate is unnecessary; turn on persistence or add a rule on update if you care to keep track of it * use a single string command channel for all shoot-and-forget commands, instead of multiple switch channels * use a rollershutter channel for shades (accepting UP, DOWN, STOP, 0%, and 100%) * on all dimmer channels, accept ON and OFF, as well as 0% to imply OFF, instead of having to write rules to control ON/OFF state separately. * if the dimmer channel exists, prune the corresponding power channel, since the dimmer channel is now a pure superset of its functionality * overload fan#speed to be ceiling fan or a fireplace's fan, depending on the device type * [bondhome] add bundle to the BOM pom * [bondhome] clean up BondDeviceHandler a bit * there's no need to delay initialization; ThingManager won't even attempt to initialize a child thing until its bridge is online * Remove some extra initialization checks that can never be false * slightly refactor some methods to return early, rather than nest a giant `else` * remove some info logging that will get triggered in normal usage * [bondhome] fix bridge discovery * Bridge property and config serial number need to be the same name * Don't arbitrarily delay the BPUPListener * Automatically update the IP if the BPUPListener finds it * Provide the new bridge with its discovered IP to avoid an additional DNS query * Don't get the bridge version after every keep-alive response * [bondhome] trigger end-device discovery as soon as the bridge comes online * [bondhome] remove internal binding version * [bondhome] change addr property to string Certain values seen in the wild when interpreted as a long are too big for that storage. Also, the Bond API documentation describes the addr property on a device to be a string. OpenHAB already has infrastructure to have things update their channel definitions when a binding is updated. * [bondhome] ignore any device that starts with _ In v3 of their API, Bond added a new special entry of __. Because no valid device id would start with an underscore, ignore everything that starts with an underscore to fix v3 and maybe futureproof. * address review comments mostly adding i18n to error states, and cleaning up error handling of HTTP requests. * use builtin translation services instead of plumbing our own provider through * use System.nanoTime instead of currentTimeMillis so that it will be a monotonic clock, not (as) susceptible to the clock changing * [bondhome] ignore BPUP messasges that aren't state In recent firmware, bond is now sending action messages via BPUP as well as state. This change ignores all messages that aren't state. * [bondhome] Improve error handling, and remove dummy constants Just use a single BondException class to communicate any sort of error from within bond, and avoid throwing, catching, and re-throwing the same (or slightly modified) exception. Also remove dummy constants that might give the wrong impression of the details of your Bond device. Then implement proper null checks, especially setting a configuration error if key config properties aren't set on the thing. * [bondhome] avoid setting device status when bridge just went offline * address static analysis tool problems Also-by: Sara Damiano <[email protected]> Also-by: Keith T. Garner <[email protected]> Signed-off-by: Cody Cutrer <[email protected]> Signed-off-by: Andras Uhrin <[email protected]>
* First commit on newly created branch, taking code from c8b8e21 * [bondhome] update snapshot version, and some typos * [bondhome] Address (most) comments from prior review from openhab#7260 * [bondhome] simplify channels * lastUpdate is unnecessary; turn on persistence or add a rule on update if you care to keep track of it * use a single string command channel for all shoot-and-forget commands, instead of multiple switch channels * use a rollershutter channel for shades (accepting UP, DOWN, STOP, 0%, and 100%) * on all dimmer channels, accept ON and OFF, as well as 0% to imply OFF, instead of having to write rules to control ON/OFF state separately. * if the dimmer channel exists, prune the corresponding power channel, since the dimmer channel is now a pure superset of its functionality * overload fan#speed to be ceiling fan or a fireplace's fan, depending on the device type * [bondhome] add bundle to the BOM pom * [bondhome] clean up BondDeviceHandler a bit * there's no need to delay initialization; ThingManager won't even attempt to initialize a child thing until its bridge is online * Remove some extra initialization checks that can never be false * slightly refactor some methods to return early, rather than nest a giant `else` * remove some info logging that will get triggered in normal usage * [bondhome] fix bridge discovery * Bridge property and config serial number need to be the same name * Don't arbitrarily delay the BPUPListener * Automatically update the IP if the BPUPListener finds it * Provide the new bridge with its discovered IP to avoid an additional DNS query * Don't get the bridge version after every keep-alive response * [bondhome] trigger end-device discovery as soon as the bridge comes online * [bondhome] remove internal binding version * [bondhome] change addr property to string Certain values seen in the wild when interpreted as a long are too big for that storage. Also, the Bond API documentation describes the addr property on a device to be a string. OpenHAB already has infrastructure to have things update their channel definitions when a binding is updated. * [bondhome] ignore any device that starts with _ In v3 of their API, Bond added a new special entry of __. Because no valid device id would start with an underscore, ignore everything that starts with an underscore to fix v3 and maybe futureproof. * address review comments mostly adding i18n to error states, and cleaning up error handling of HTTP requests. * use builtin translation services instead of plumbing our own provider through * use System.nanoTime instead of currentTimeMillis so that it will be a monotonic clock, not (as) susceptible to the clock changing * [bondhome] ignore BPUP messasges that aren't state In recent firmware, bond is now sending action messages via BPUP as well as state. This change ignores all messages that aren't state. * [bondhome] Improve error handling, and remove dummy constants Just use a single BondException class to communicate any sort of error from within bond, and avoid throwing, catching, and re-throwing the same (or slightly modified) exception. Also remove dummy constants that might give the wrong impression of the details of your Bond device. Then implement proper null checks, especially setting a configuration error if key config properties aren't set on the thing. * [bondhome] avoid setting device status when bridge just went offline * address static analysis tool problems Also-by: Sara Damiano <[email protected]> Also-by: Keith T. Garner <[email protected]> Signed-off-by: Cody Cutrer <[email protected]>
* First commit on newly created branch, taking code from c8b8e21 * [bondhome] update snapshot version, and some typos * [bondhome] Address (most) comments from prior review from openhab#7260 * [bondhome] simplify channels * lastUpdate is unnecessary; turn on persistence or add a rule on update if you care to keep track of it * use a single string command channel for all shoot-and-forget commands, instead of multiple switch channels * use a rollershutter channel for shades (accepting UP, DOWN, STOP, 0%, and 100%) * on all dimmer channels, accept ON and OFF, as well as 0% to imply OFF, instead of having to write rules to control ON/OFF state separately. * if the dimmer channel exists, prune the corresponding power channel, since the dimmer channel is now a pure superset of its functionality * overload fan#speed to be ceiling fan or a fireplace's fan, depending on the device type * [bondhome] add bundle to the BOM pom * [bondhome] clean up BondDeviceHandler a bit * there's no need to delay initialization; ThingManager won't even attempt to initialize a child thing until its bridge is online * Remove some extra initialization checks that can never be false * slightly refactor some methods to return early, rather than nest a giant `else` * remove some info logging that will get triggered in normal usage * [bondhome] fix bridge discovery * Bridge property and config serial number need to be the same name * Don't arbitrarily delay the BPUPListener * Automatically update the IP if the BPUPListener finds it * Provide the new bridge with its discovered IP to avoid an additional DNS query * Don't get the bridge version after every keep-alive response * [bondhome] trigger end-device discovery as soon as the bridge comes online * [bondhome] remove internal binding version * [bondhome] change addr property to string Certain values seen in the wild when interpreted as a long are too big for that storage. Also, the Bond API documentation describes the addr property on a device to be a string. OpenHAB already has infrastructure to have things update their channel definitions when a binding is updated. * [bondhome] ignore any device that starts with _ In v3 of their API, Bond added a new special entry of __. Because no valid device id would start with an underscore, ignore everything that starts with an underscore to fix v3 and maybe futureproof. * address review comments mostly adding i18n to error states, and cleaning up error handling of HTTP requests. * use builtin translation services instead of plumbing our own provider through * use System.nanoTime instead of currentTimeMillis so that it will be a monotonic clock, not (as) susceptible to the clock changing * [bondhome] ignore BPUP messasges that aren't state In recent firmware, bond is now sending action messages via BPUP as well as state. This change ignores all messages that aren't state. * [bondhome] Improve error handling, and remove dummy constants Just use a single BondException class to communicate any sort of error from within bond, and avoid throwing, catching, and re-throwing the same (or slightly modified) exception. Also remove dummy constants that might give the wrong impression of the details of your Bond device. Then implement proper null checks, especially setting a configuration error if key config properties aren't set on the thing. * [bondhome] avoid setting device status when bridge just went offline * address static analysis tool problems Also-by: Sara Damiano <[email protected]> Also-by: Keith T. Garner <[email protected]> Signed-off-by: Cody Cutrer <[email protected]>
* First commit on newly created branch, taking code from c8b8e21 * [bondhome] update snapshot version, and some typos * [bondhome] Address (most) comments from prior review from openhab#7260 * [bondhome] simplify channels * lastUpdate is unnecessary; turn on persistence or add a rule on update if you care to keep track of it * use a single string command channel for all shoot-and-forget commands, instead of multiple switch channels * use a rollershutter channel for shades (accepting UP, DOWN, STOP, 0%, and 100%) * on all dimmer channels, accept ON and OFF, as well as 0% to imply OFF, instead of having to write rules to control ON/OFF state separately. * if the dimmer channel exists, prune the corresponding power channel, since the dimmer channel is now a pure superset of its functionality * overload fan#speed to be ceiling fan or a fireplace's fan, depending on the device type * [bondhome] add bundle to the BOM pom * [bondhome] clean up BondDeviceHandler a bit * there's no need to delay initialization; ThingManager won't even attempt to initialize a child thing until its bridge is online * Remove some extra initialization checks that can never be false * slightly refactor some methods to return early, rather than nest a giant `else` * remove some info logging that will get triggered in normal usage * [bondhome] fix bridge discovery * Bridge property and config serial number need to be the same name * Don't arbitrarily delay the BPUPListener * Automatically update the IP if the BPUPListener finds it * Provide the new bridge with its discovered IP to avoid an additional DNS query * Don't get the bridge version after every keep-alive response * [bondhome] trigger end-device discovery as soon as the bridge comes online * [bondhome] remove internal binding version * [bondhome] change addr property to string Certain values seen in the wild when interpreted as a long are too big for that storage. Also, the Bond API documentation describes the addr property on a device to be a string. OpenHAB already has infrastructure to have things update their channel definitions when a binding is updated. * [bondhome] ignore any device that starts with _ In v3 of their API, Bond added a new special entry of __. Because no valid device id would start with an underscore, ignore everything that starts with an underscore to fix v3 and maybe futureproof. * address review comments mostly adding i18n to error states, and cleaning up error handling of HTTP requests. * use builtin translation services instead of plumbing our own provider through * use System.nanoTime instead of currentTimeMillis so that it will be a monotonic clock, not (as) susceptible to the clock changing * [bondhome] ignore BPUP messasges that aren't state In recent firmware, bond is now sending action messages via BPUP as well as state. This change ignores all messages that aren't state. * [bondhome] Improve error handling, and remove dummy constants Just use a single BondException class to communicate any sort of error from within bond, and avoid throwing, catching, and re-throwing the same (or slightly modified) exception. Also remove dummy constants that might give the wrong impression of the details of your Bond device. Then implement proper null checks, especially setting a configuration error if key config properties aren't set on the thing. * [bondhome] avoid setting device status when bridge just went offline * address static analysis tool problems Also-by: Sara Damiano <[email protected]> Also-by: Keith T. Garner <[email protected]> Signed-off-by: Cody Cutrer <[email protected]>
* First commit on newly created branch, taking code from c8b8e21 * [bondhome] update snapshot version, and some typos * [bondhome] Address (most) comments from prior review from openhab#7260 * [bondhome] simplify channels * lastUpdate is unnecessary; turn on persistence or add a rule on update if you care to keep track of it * use a single string command channel for all shoot-and-forget commands, instead of multiple switch channels * use a rollershutter channel for shades (accepting UP, DOWN, STOP, 0%, and 100%) * on all dimmer channels, accept ON and OFF, as well as 0% to imply OFF, instead of having to write rules to control ON/OFF state separately. * if the dimmer channel exists, prune the corresponding power channel, since the dimmer channel is now a pure superset of its functionality * overload fan#speed to be ceiling fan or a fireplace's fan, depending on the device type * [bondhome] add bundle to the BOM pom * [bondhome] clean up BondDeviceHandler a bit * there's no need to delay initialization; ThingManager won't even attempt to initialize a child thing until its bridge is online * Remove some extra initialization checks that can never be false * slightly refactor some methods to return early, rather than nest a giant `else` * remove some info logging that will get triggered in normal usage * [bondhome] fix bridge discovery * Bridge property and config serial number need to be the same name * Don't arbitrarily delay the BPUPListener * Automatically update the IP if the BPUPListener finds it * Provide the new bridge with its discovered IP to avoid an additional DNS query * Don't get the bridge version after every keep-alive response * [bondhome] trigger end-device discovery as soon as the bridge comes online * [bondhome] remove internal binding version * [bondhome] change addr property to string Certain values seen in the wild when interpreted as a long are too big for that storage. Also, the Bond API documentation describes the addr property on a device to be a string. OpenHAB already has infrastructure to have things update their channel definitions when a binding is updated. * [bondhome] ignore any device that starts with _ In v3 of their API, Bond added a new special entry of __. Because no valid device id would start with an underscore, ignore everything that starts with an underscore to fix v3 and maybe futureproof. * address review comments mostly adding i18n to error states, and cleaning up error handling of HTTP requests. * use builtin translation services instead of plumbing our own provider through * use System.nanoTime instead of currentTimeMillis so that it will be a monotonic clock, not (as) susceptible to the clock changing * [bondhome] ignore BPUP messasges that aren't state In recent firmware, bond is now sending action messages via BPUP as well as state. This change ignores all messages that aren't state. * [bondhome] Improve error handling, and remove dummy constants Just use a single BondException class to communicate any sort of error from within bond, and avoid throwing, catching, and re-throwing the same (or slightly modified) exception. Also remove dummy constants that might give the wrong impression of the details of your Bond device. Then implement proper null checks, especially setting a configuration error if key config properties aren't set on the thing. * [bondhome] avoid setting device status when bridge just went offline * address static analysis tool problems Also-by: Sara Damiano <[email protected]> Also-by: Keith T. Garner <[email protected]> Signed-off-by: Cody Cutrer <[email protected]> Signed-off-by: Andras Uhrin <[email protected]>
New Binding for Bond Home bridge and devices
A new binding for RF and IR remote control devices controlled by a Bond Bridge. (https://bondhome.io/products/bond-bridge/)