-
-
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
[withings] Initial contribution (#4395) #9154
Conversation
Signed-off-by: Sven Strohschein <sven.strohschein@gmail.com>
Signed-off-by: Sven Strohschein <sven.strohschein@gmail.com>
Signed-off-by: Sven Strohschein <sven.strohschein@gmail.com>
Signed-off-by: Sven Strohschein <sven.strohschein@gmail.com>
Signed-off-by: Sven Strohschein <sven.strohschein@gmail.com>
Signed-off-by: Sven Strohschein <sven.strohschein@gmail.com>
(pls don't blame me, I am not a developer) |
Unfortunately not (yet). That would require that the OpenHAB installation is public accessible via the internet. Without that, the Withings API does provide the sleep start information unfortunately only after the sleep session is ended (when the user stands up after sleeping). |
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.
Thanks for your contribution! I reviewed your code and here is my feedback.
There are some checkstyle warnings left. You could take a look at target/code-analysis/report.html
.
|
||
### 2. Bridge Configuration | ||
|
||
- Create a new Withings API Thing with Paper UI |
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.
Can you express this more abstract, as PaperUI will be removed in OH3?
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, and what is the name of the new configuration UI?
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.
Main UI. But it's better to express it abstractly, that no mention of a specific UI is necessary.
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, I changed that to Main UI. As I know there is currently no other configuration/setup UI and I wouldn't recommend to configure the things with the configuration files, because it would be complicated and the users would have to remove the auth-code manually at the right time, that may cause problems. That problem causes still many support questions at the Innogy binding.
public class WithingsHandlerFactory extends BaseThingHandlerFactory { | ||
|
||
private final Logger logger = LoggerFactory.getLogger(WithingsHandlerFactory.class); | ||
private final Map<ThingUID, @Nullable ServiceRegistration<?>> discoveryServiceRegs = new HashMap<>(); |
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 could use the ThingHandlerService to make discovery registration code simpler. See the yet unmerged documentation: https://github.com/openhab/openhab-docs/pull/1262/files#diff-c4a4d8725430bc2ea046182bfc73ac51349d989c7f6a8a6fa3001a226a09ad98R932
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.
Hm, there is no binding / example which already uses that and the documentation doesn't help me to imagine how can help that to simplify it. :-(
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.
There are several addons using it. E.g. the LCN binding.
...ing.withings/src/main/java/org/openhab/binding/withings/internal/WithingsHandlerFactory.java
Outdated
Show resolved
Hide resolved
...ing.withings/src/main/java/org/openhab/binding/withings/internal/api/AbstractAPIHandler.java
Show resolved
Hide resolved
bundles/org.openhab.binding.withings/src/main/resources/OH-INF/thing/person.xml
Outdated
Show resolved
Hide resolved
bundles/org.openhab.binding.withings/src/main/resources/OH-INF/thing/person.xml
Outdated
Show resolved
Hide resolved
bundles/org.openhab.binding.withings/src/main/resources/OH-INF/thing/scale.xml
Outdated
Show resolved
Hide resolved
bundles/org.openhab.binding.withings/src/main/resources/OH-INF/thing/sleepmonitor.xml
Outdated
Show resolved
Hide resolved
Signed-off-by: Sven Strohschein <sven.strohschein@gmail.com>
Signed-off-by: Sven Strohschein <sven.strohschein@gmail.com>
Signed-off-by: Sven Strohschein <sven.strohschein@gmail.com>
Signed-off-by: Sven Strohschein <sven.strohschein@gmail.com>
Signed-off-by: Sven Strohschein <sven.strohschein@gmail.com>
Signed-off-by: Sven Strohschein <sven.strohschein@gmail.com>
|
||
### 1. Application Creation | ||
|
||
Register a new Withings application here: https://account.withings.com/partner/add_oauth2 |
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.
How can I create an application there? What is the Callback URL? Everyone needs to register openHAB as an application at this site?
I'm sorry but I recall the pull-request for the moment, because...
|
I am interested in the binding! :) |
This pull-request (re-)adds support for Withings devices and data. There was already a binding with OpenHAB 1 which isn't working with OpenHAB 2 anymore. This binding is now a new rewritten binding for OpenHAB 3 which uses newer features like things and discovery.
This first version supports scales and sleep monitors.
See issue #4395 for more information.