-
-
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
Freebox binding: fix initialization and add thing properties #1127
Conversation
This PR implements #1113. |
@@ -34,6 +34,15 @@ | |||
<channel id="bytes_down" typeId="bytes_down" /> | |||
</channels> | |||
|
|||
<properties> | |||
<property name="vendor">Freebox SAS</property> | |||
<property name="serialNumber"></property> |
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 do not like this - properties should not have an empty string as value. Either they are set or not.
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 mean I should only declare properties for which I already know the value ?
The others would just be added dynamically at runtime ?
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, exactly.
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.
Ok, will do the change.
I suppressed the empty properties from thing-types.xml. |
@@ -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()) { |
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.
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?
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.
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.
@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()); |
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.
@clinique All other bindings have the IP and port as separate config parameters - could that be applied for freebox as well?
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.
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.
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, I think the property name is then misleading, it would propably be better to name it FQDN
My PR is now updated and take into account your comments. |
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
The build seems to fail on compilation of harmony hub binding.
This PR only impacts the Freebox binding so the build was certainly broken by another PR ? |
The harmony error should be fixed by https://github.com/openhab/openhab2-addons/pull/1146 |
Ok. I can force a new push to trigger a new build of this PR i you wish ? |
* 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
* 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
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
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>
Signed-off-by: Laurent Garnier lg.hc@free.fr