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

Freebox binding: fix initialization and add thing properties #1127

Merged
merged 1 commit into from
Jul 25, 2016
Merged

Freebox binding: fix initialization and add thing properties #1127

merged 1 commit into from
Jul 25, 2016

Conversation

lolodomo
Copy link
Contributor

Signed-off-by: Laurent Garnier lg.hc@free.fr

@lolodomo
Copy link
Contributor Author

This PR implements #1113.
IAnd it fixed initialization process that was failing in recent snapshots.

@lolodomo lolodomo changed the title Fix initialization and add thing properties Freebox binding: fix initialization and add thing properties Jul 15, 2016
@@ -34,6 +34,15 @@
<channel id="bytes_down" typeId="bytes_down" />
</channels>

<properties>
<property name="vendor">Freebox SAS</property>
<property name="serialNumber"></property>
Copy link
Member

Choose a reason for hiding this comment

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

I do not like this - properties should not have an empty string as value. Either they are set or not.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You mean I should only declare properties for which I already know the value ?
The others would just be added dynamically at runtime ?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, exactly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, will do the change.

@lolodomo
Copy link
Contributor Author

I suppressed the empty properties from thing-types.xml.
And I updated the documentation (I forgot to do it in my initial PR).

@@ -99,6 +100,9 @@ public void onDataFetched(ThingUID bridge, LanHostsConfig hostsConfig) {
if (thingUID != null) {
logger.trace("Adding new Freebox Network Device {} to inbox", thingUID);
Map<String, Object> properties = new HashMap<>(1);
if (!hostConfig.getVendorName().isEmpty()) {
Copy link
Member

Choose a reason for hiding this comment

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

The vendor is always set, because you define it in the thing type, don't you?
Otherwise, I would expect that hostConfig.getVendorName() can be null, which would result in an NPE. Or am I missing something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No the vendor property I set in thing-types.xml is for the bridge thing. Here I set the vendor property on other things (network devices).

I will check again but I think getVendorName(l never returns null.

@kaikreuzer
Copy link
Member

@clinique As this contains quite some changes, could you please review this PR?

@@ -71,12 +72,15 @@ public DiscoveryResult createResult(ServiceInfo service) {
if (thingUID != null && ip != null) {
logger.info("Created a DiscoveryResult for Freebox Server {} on IP {}", thingUID, ip);
Map<String, Object> properties = new HashMap<>(1);
properties.put(FreeboxServerConfiguration.IP_ADDRESS, ip);
properties.put(FreeboxServerConfiguration.IP_ADDRESS, ip + ":" + service.getPort());
Copy link
Member

Choose a reason for hiding this comment

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

@clinique All other bindings have the IP and port as separate config parameters - could that be applied for freebox as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In fact this parameter contains a FQDN, it can be 192.168.0.254:80 but it can be mafreebox.free.fr.
Maybe the name of the parameter could have been different.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I think the property name is then misleading, it would propably be better to name it FQDN

@kaikreuzer kaikreuzer added awaiting feedback Awaiting feedback from the pull request author enhancement An enhancement or new feature for an existing add-on labels Jul 20, 2016
@lolodomo
Copy link
Contributor Author

My PR is now updated and take into account your comments.

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
@lolodomo
Copy link
Contributor Author

lolodomo commented Jul 23, 2016

The build seems to fail on compilation of harmony hub binding.

08:51:48.556  |  [ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:0.24.0:compile (default-compile) on project org.openhab.binding.harmonyhub: Compilation failure: Compilation failure:
08:51:48.556  |  [ERROR] /scratch/jenkins/workspace/PR-openHAB2-Addons/addons/binding/org.openhab.binding.harmonyhub/src/main/java/org/openhab/binding/harmonyhub/handler/HarmonyHubHandler.java:[274]
08:51:48.556  |  [ERROR] BridgeBuilder thingBuilder = BridgeBuilder.create(getThing().getUID())
08:51:48.556  |  [ERROR] .withConfiguration(getThing().getConfiguration()).withProperties(getThing().getProperties());
08:51:48.556  |  [ERROR] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
08:51:48.557  |  [ERROR] Type mismatch: cannot convert from ThingBuilder to BridgeBuilder
08:51:48.557  |  [ERROR] 1 problem (1 error)

This PR only impacts the Freebox binding so the build was certainly broken by another PR ?

@kaikreuzer
Copy link
Member

The harmony error should be fixed by https://github.com/openhab/openhab2-addons/pull/1146

@lolodomo
Copy link
Contributor Author

lolodomo commented Jul 23, 2016

Ok. I can force a new push to trigger a new build of this PR i you wish ?

@kaikreuzer kaikreuzer removed the awaiting feedback Awaiting feedback from the pull request author label Jul 25, 2016
@kaikreuzer kaikreuzer merged commit 57d7d1e into openhab:master Jul 25, 2016
@kaikreuzer kaikreuzer added this to the 2.0.0.b4 milestone Jul 25, 2016
@lolodomo lolodomo deleted the freebox_properties branch July 25, 2016 09:03
cdjackson added a commit to cdjackson/openhab2-addons that referenced this pull request Jul 28, 2016
* master: (44 commits)
  ZWave fix Barrier Operator converter (openhab#1155)
  Added Groovy Eclipse compiler to master pom. (openhab#1141)
  added HD Powerview binding to build
  Initial contribution of HD PowerView binding (openhab#660)
  ZWave database update (openhab#1153)
  added Onkyo binding to build
  initial version of a Onkyo binding (openhab#768)
  Fix initialization and add thing properties (openhab#1127)
  ZWave: Add extra debugging when updating properties. (openhab#1147)
  ZWave database update (openhab#1148)
  fixed compilation error due to changed ESH API (openhab#1146)
  ZWave database updates (openhab#1145)
  Add example things definition (openhab#1144)
  ignore commands other than ON/OFF
  applied code formatter
  Meteostick binding (openhab#455)
  Fix for multiple tags and HomeKit (openhab#1138)
  ZWave database update (openhab#1136)
  Fix wording and typos. Alphabetise supported channel list. (openhab#1134)
  ZWave database updates (openhab#1132)
  ...

Signed-off-by: Chris Jackson <chris@cd-jackson.com>

# Conflicts:
#	addons/binding/org.openhab.binding.zwave/src/main/java/org/openhab/binding/zwave/handler/ZWaveThingHandler.java
cdjackson added a commit to cdjackson/openhab2-addons that referenced this pull request Aug 6, 2016
* master: (257 commits)
  Delete pom.xml.orig
  Update README.md
  Remove ZWave binding (openhab#1169)
  Update README.md (openhab#1168)
  ZWave check that serial port is open before sending data (openhab#1167)
  ZWave change polling to use BigDecimal rather than Integer (openhab#1166)
  ZWave fix processing of alarm supported report (openhab#1165)
  ZWave add network update method (openhab#1162)
  Zwave association refactor and consolidation (openhab#893)
  Update README.md (openhab#1159)
  ZWave database update (openhab#1161)
  ZWave fix Barrier Operator converter (openhab#1155)
  Added Groovy Eclipse compiler to master pom. (openhab#1141)
  added HD Powerview binding to build
  Initial contribution of HD PowerView binding (openhab#660)
  ZWave database update (openhab#1153)
  added Onkyo binding to build
  initial version of a Onkyo binding (openhab#768)
  Fix initialization and add thing properties (openhab#1127)
  ZWave: Add extra debugging when updating properties. (openhab#1147)
  ...

# Conflicts:
#	addons/binding/pom.xml
doubled-ca pushed a commit to doubled-ca/openhab-addons that referenced this pull request Aug 14, 2016
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Flole998 pushed a commit to Flole998/openhab-addons that referenced this pull request Dec 30, 2021
Mockito 3 does not introduce any breaking API changes, but now requires Java 8 over Java 6 for Mockito 2.

Signed-off-by: Wouter Born <github@maindrain.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An enhancement or new feature for an existing add-on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants