{"action":"created","comment":{"url":"https://api.github.com/repos/openhab/openhab2/pulls/comments/49264532","id":49264532,"diff_hunk":"@@ -0,0 +1,96 @@\n+/**\n+ * Copyright (c) 2014-2015 openHAB UG (haftungsbeschraenkt) and others.\n+ * All rights reserved. This program and the accompanying materials\n+ * are made available under the terms of the Eclipse Public License v1.0\n+ * which accompanies this distribution, and is available at\n+ * http://www.eclipse.org/legal/epl-v10.html\n+ */\n+package org.openhab.binding.netatmo.handler;\n+\n+import static org.openhab.binding.netatmo.NetatmoBindingConstants.*;\n+\n+import java.util.concurrent.TimeUnit;\n+\n+import org.eclipse.smarthome.core.library.types.DateTimeType;\n+import org.eclipse.smarthome.core.library.types.DecimalType;\n+import org.eclipse.smarthome.core.library.types.PointType;\n+import org.eclipse.smarthome.core.thing.Bridge;\n+import org.eclipse.smarthome.core.thing.Thing;\n+import org.eclipse.smarthome.core.thing.binding.ThingHandler;\n+import org.eclipse.smarthome.core.types.State;\n+import org.openhab.binding.netatmo.config.NetatmoDeviceConfiguration;\n+\n+import io.swagger.client.model.NADevice;\n+import io.swagger.client.model.NAPlace;\n+\n+/**\n+ * {@link NetatmoDeviceHandler} is the handler for a given\n+ * device accessed through the Netatmo Bridge\n+ *\n+ * @author Gaël L'hopital - Initial contribution OH2 version\n+ *\n+ */\n+public abstract class NetatmoDeviceHandler extends AbstractNetatmoThingHandler {\n+    protected NADevice device;\n+    private NetatmoDeviceConfiguration configuration;\n+\n+    public NetatmoDeviceHandler(Thing thing) {\n+        super(thing);\n+    }\n+\n+    @Override\n+    protected void bridgeHandlerInitialized(ThingHandler thingHandler, Bridge bridge) {\n+        super.bridgeHandlerInitialized(thingHandler, bridge);\n+        this.configuration = this.getConfigAs(NetatmoDeviceConfiguration.class);\n+\n+        scheduler.scheduleAtFixedRate(new Runnable() {\n+            @Override\n+            public void run() {\n+                updateChannels();\n+            }\n+        }, 1, configuration.refreshInterval, TimeUnit.MILLISECONDS);\n+    }\n+\n+    @Override\n+    protected void updateChannels() {\n+        dashboard = device.getDashboardData();\n+\n+        super.updateChannels();\n+\n+        updateConnectedModules();\n+    }\n+\n+    @Override\n+    protected State getNAThingProperty(String chanelId) {\n+        switch (chanelId) {\n+            case CHANNEL_LAST_STATUS_STORE:\n+                return new DateTimeType(timestampToCalendar(device.getLastStatusStore()));\n+            case CHANNEL_LOCATION:\n+                NAPlace place = device.getPlace();\n+                return new PointType(new DecimalType(place.getLocation().get(1)),","path":"addons/binding/org.openhab.binding.netatmo/src/main/java/org/openhab/binding/netatmo/handler/NetatmoDeviceHandler.java","position":70,"original_position":70,"commit_id":"021235a6f02f3329574c1b10c65208995809a64e","original_commit_id":"021235a6f02f3329574c1b10c65208995809a64e","user":{"login":"robnielsen","id":838221,"avatar_url":"https://avatars.githubusercontent.com/u/838221?v=3","gravatar_id":"","url":"https://api.github.com/users/robnielsen","html_url":"https://github.com/robnielsen","followers_url":"https://api.github.com/users/robnielsen/followers","following_url":"https://api.github.com/users/robnielsen/following{/other_user}","gists_url":"https://api.github.com/users/robnielsen/gists{/gist_id}","starred_url":"https://api.github.com/users/robnielsen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robnielsen/subscriptions","organizations_url":"https://api.github.com/users/robnielsen/orgs","repos_url":"https://api.github.com/users/robnielsen/repos","events_url":"https://api.github.com/users/robnielsen/events{/privacy}","received_events_url":"https://api.github.com/users/robnielsen/received_events","type":"User","site_admin":false},"body":"@clinique, when you set the location for the Netatmo device with the Netatmo web app, Google Maps is used and it's precision is 6 digits. For some reason, the API is returning extra digits. Can you change this to scale the longitude and latitude:\r\n```java\r\nreturn new PointType(new DecimalType(new BigDecimal(place.getLocation().get(1))).setScale(6, BigDecimal.ROUND_HALF_UP)),\r\n    new DecimalType(new BigDecimal(place.getLocation().get(0))).setScale(6, BigDecimal.ROUND_HALF_UP)),\r\n    new DecimalType(place.getAltitude()));\r\n```\r\n6 digits of precision is about 1 meter.","created_at":"2016-01-09T14:35:42Z","updated_at":"2016-01-09T14:35:42Z","html_url":"https://github.com/openhab/openhab2/pull/586#discussion_r49264532","pull_request_url":"https://api.github.com/repos/openhab/openhab2/pulls/586","_links":{"self":{"href":"https://api.github.com/repos/openhab/openhab2/pulls/comments/49264532"},"html":{"href":"https://github.com/openhab/openhab2/pull/586#discussion_r49264532"},"pull_request":{"href":"https://api.github.com/repos/openhab/openhab2/pulls/586"}}},"pull_request":{"url":"https://api.github.com/repos/openhab/openhab2/pulls/586","id":54725025,"html_url":"https://github.com/openhab/openhab2/pull/586","diff_url":"https://github.com/openhab/openhab2/pull/586.diff","patch_url":"https://github.com/openhab/openhab2/pull/586.patch","issue_url":"https://api.github.com/repos/openhab/openhab2/issues/586","number":586,"state":"open","locked":false,"title":"Version 2 of the Netatmo Binding","user":{"login":"clinique","id":3328789,"avatar_url":"https://avatars.githubusercontent.com/u/3328789?v=3","gravatar_id":"","url":"https://api.github.com/users/clinique","html_url":"https://github.com/clinique","followers_url":"https://api.github.com/users/clinique/followers","following_url":"https://api.github.com/users/clinique/following{/other_user}","gists_url":"https://api.github.com/users/clinique/gists{/gist_id}","starred_url":"https://api.github.com/users/clinique/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clinique/subscriptions","organizations_url":"https://api.github.com/users/clinique/orgs","repos_url":"https://api.github.com/users/clinique/repos","events_url":"https://api.github.com/users/clinique/events{/privacy}","received_events_url":"https://api.github.com/users/clinique/received_events","type":"User","site_admin":false},"body":"Signed-off-by: Gaël L'hopital <glhopital@gmail.com>\r\n\r\nThis new PR includes : \r\nAll known modules for Weather Station (inc. rain/wind)\r\nThermostat plug and module\r\n\r\nRemoved dependency to Jackson libs.\r\n","created_at":"2015-12-29T13:04:39Z","updated_at":"2016-01-09T14:35:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"12024b0bee5894184377564c09110d02b5b2e064","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/openhab/openhab2/pulls/586/commits","review_comments_url":"https://api.github.com/repos/openhab/openhab2/pulls/586/comments","review_comment_url":"https://api.github.com/repos/openhab/openhab2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openhab/openhab2/issues/586/comments","statuses_url":"https://api.github.com/repos/openhab/openhab2/statuses/021235a6f02f3329574c1b10c65208995809a64e","head":{"label":"clinique:netatmo","ref":"netatmo","sha":"021235a6f02f3329574c1b10c65208995809a64e","user":{"login":"clinique","id":3328789,"avatar_url":"https://avatars.githubusercontent.com/u/3328789?v=3","gravatar_id":"","url":"https://api.github.com/users/clinique","html_url":"https://github.com/clinique","followers_url":"https://api.github.com/users/clinique/followers","following_url":"https://api.github.com/users/clinique/following{/other_user}","gists_url":"https://api.github.com/users/clinique/gists{/gist_id}","starred_url":"https://api.github.com/users/clinique/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clinique/subscriptions","organizations_url":"https://api.github.com/users/clinique/orgs","repos_url":"https://api.github.com/users/clinique/repos","events_url":"https://api.github.com/users/clinique/events{/privacy}","received_events_url":"https://api.github.com/users/clinique/received_events","type":"User","site_admin":false},"repo":{"id":27430103,"name":"openhab2","full_name":"clinique/openhab2","owner":{"login":"clinique","id":3328789,"avatar_url":"https://avatars.githubusercontent.com/u/3328789?v=3","gravatar_id":"","url":"https://api.github.com/users/clinique","html_url":"https://github.com/clinique","followers_url":"https://api.github.com/users/clinique/followers","following_url":"https://api.github.com/users/clinique/following{/other_user}","gists_url":"https://api.github.com/users/clinique/gists{/gist_id}","starred_url":"https://api.github.com/users/clinique/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clinique/subscriptions","organizations_url":"https://api.github.com/users/clinique/orgs","repos_url":"https://api.github.com/users/clinique/repos","events_url":"https://api.github.com/users/clinique/events{/privacy}","received_events_url":"https://api.github.com/users/clinique/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/clinique/openhab2","description":"The next-generation open Home Automation Bus (openHAB)","fork":true,"url":"https://api.github.com/repos/clinique/openhab2","forks_url":"https://api.github.com/repos/clinique/openhab2/forks","keys_url":"https://api.github.com/repos/clinique/openhab2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/clinique/openhab2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/clinique/openhab2/teams","hooks_url":"https://api.github.com/repos/clinique/openhab2/hooks","issue_events_url":"https://api.github.com/repos/clinique/openhab2/issues/events{/number}","events_url":"https://api.github.com/repos/clinique/openhab2/events","assignees_url":"https://api.github.com/repos/clinique/openhab2/assignees{/user}","branches_url":"https://api.github.com/repos/clinique/openhab2/branches{/branch}","tags_url":"https://api.github.com/repos/clinique/openhab2/tags","blobs_url":"https://api.github.com/repos/clinique/openhab2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/clinique/openhab2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/clinique/openhab2/git/refs{/sha}","trees_url":"https://api.github.com/repos/clinique/openhab2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/clinique/openhab2/statuses/{sha}","languages_url":"https://api.github.com/repos/clinique/openhab2/languages","stargazers_url":"https://api.github.com/repos/clinique/openhab2/stargazers","contributors_url":"https://api.github.com/repos/clinique/openhab2/contributors","subscribers_url":"https://api.github.com/repos/clinique/openhab2/subscribers","subscription_url":"https://api.github.com/repos/clinique/openhab2/subscription","commits_url":"https://api.github.com/repos/clinique/openhab2/commits{/sha}","git_commits_url":"https://api.github.com/repos/clinique/openhab2/git/commits{/sha}","comments_url":"https://api.github.com/repos/clinique/openhab2/comments{/number}","issue_comment_url":"https://api.github.com/repos/clinique/openhab2/issues/comments{/number}","contents_url":"https://api.github.com/repos/clinique/openhab2/contents/{+path}","compare_url":"https://api.github.com/repos/clinique/openhab2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/clinique/openhab2/merges","archive_url":"https://api.github.com/repos/clinique/openhab2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/clinique/openhab2/downloads","issues_url":"https://api.github.com/repos/clinique/openhab2/issues{/number}","pulls_url":"https://api.github.com/repos/clinique/openhab2/pulls{/number}","milestones_url":"https://api.github.com/repos/clinique/openhab2/milestones{/number}","notifications_url":"https://api.github.com/repos/clinique/openhab2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/clinique/openhab2/labels{/name}","releases_url":"https://api.github.com/repos/clinique/openhab2/releases{/id}","created_at":"2014-12-02T11:46:38Z","updated_at":"2014-12-02T11:46:39Z","pushed_at":"2015-12-29T13:02:13Z","git_url":"git://github.com/clinique/openhab2.git","ssh_url":"git@github.com:clinique/openhab2.git","clone_url":"https://github.com/clinique/openhab2.git","svn_url":"https://github.com/clinique/openhab2","homepage":null,"size":26937,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"openhab:master","ref":"master","sha":"4cbd8f2d4904a30a697b30b7ff8f68e434d18c78","user":{"login":"openhab","id":1007353,"avatar_url":"https://avatars.githubusercontent.com/u/1007353?v=3","gravatar_id":"","url":"https://api.github.com/users/openhab","html_url":"https://github.com/openhab","followers_url":"https://api.github.com/users/openhab/followers","following_url":"https://api.github.com/users/openhab/following{/other_user}","gists_url":"https://api.github.com/users/openhab/gists{/gist_id}","starred_url":"https://api.github.com/users/openhab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openhab/subscriptions","organizations_url":"https://api.github.com/users/openhab/orgs","repos_url":"https://api.github.com/users/openhab/repos","events_url":"https://api.github.com/users/openhab/events{/privacy}","received_events_url":"https://api.github.com/users/openhab/received_events","type":"Organization","site_admin":false},"repo":{"id":19753195,"name":"openhab2","full_name":"openhab/openhab2","owner":{"login":"openhab","id":1007353,"avatar_url":"https://avatars.githubusercontent.com/u/1007353?v=3","gravatar_id":"","url":"https://api.github.com/users/openhab","html_url":"https://github.com/openhab","followers_url":"https://api.github.com/users/openhab/followers","following_url":"https://api.github.com/users/openhab/following{/other_user}","gists_url":"https://api.github.com/users/openhab/gists{/gist_id}","starred_url":"https://api.github.com/users/openhab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openhab/subscriptions","organizations_url":"https://api.github.com/users/openhab/orgs","repos_url":"https://api.github.com/users/openhab/repos","events_url":"https://api.github.com/users/openhab/events{/privacy}","received_events_url":"https://api.github.com/users/openhab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openhab/openhab2","description":"The next-generation open Home Automation Bus (openHAB)","fork":false,"url":"https://api.github.com/repos/openhab/openhab2","forks_url":"https://api.github.com/repos/openhab/openhab2/forks","keys_url":"https://api.github.com/repos/openhab/openhab2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openhab/openhab2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openhab/openhab2/teams","hooks_url":"https://api.github.com/repos/openhab/openhab2/hooks","issue_events_url":"https://api.github.com/repos/openhab/openhab2/issues/events{/number}","events_url":"https://api.github.com/repos/openhab/openhab2/events","assignees_url":"https://api.github.com/repos/openhab/openhab2/assignees{/user}","branches_url":"https://api.github.com/repos/openhab/openhab2/branches{/branch}","tags_url":"https://api.github.com/repos/openhab/openhab2/tags","blobs_url":"https://api.github.com/repos/openhab/openhab2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openhab/openhab2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openhab/openhab2/git/refs{/sha}","trees_url":"https://api.github.com/repos/openhab/openhab2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openhab/openhab2/statuses/{sha}","languages_url":"https://api.github.com/repos/openhab/openhab2/languages","stargazers_url":"https://api.github.com/repos/openhab/openhab2/stargazers","contributors_url":"https://api.github.com/repos/openhab/openhab2/contributors","subscribers_url":"https://api.github.com/repos/openhab/openhab2/subscribers","subscription_url":"https://api.github.com/repos/openhab/openhab2/subscription","commits_url":"https://api.github.com/repos/openhab/openhab2/commits{/sha}","git_commits_url":"https://api.github.com/repos/openhab/openhab2/git/commits{/sha}","comments_url":"https://api.github.com/repos/openhab/openhab2/comments{/number}","issue_comment_url":"https://api.github.com/repos/openhab/openhab2/issues/comments{/number}","contents_url":"https://api.github.com/repos/openhab/openhab2/contents/{+path}","compare_url":"https://api.github.com/repos/openhab/openhab2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openhab/openhab2/merges","archive_url":"https://api.github.com/repos/openhab/openhab2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openhab/openhab2/downloads","issues_url":"https://api.github.com/repos/openhab/openhab2/issues{/number}","pulls_url":"https://api.github.com/repos/openhab/openhab2/pulls{/number}","milestones_url":"https://api.github.com/repos/openhab/openhab2/milestones{/number}","notifications_url":"https://api.github.com/repos/openhab/openhab2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openhab/openhab2/labels{/name}","releases_url":"https://api.github.com/repos/openhab/openhab2/releases{/id}","created_at":"2014-05-13T19:41:58Z","updated_at":"2016-01-07T15:09:59Z","pushed_at":"2016-01-09T07:53:34Z","git_url":"git://github.com/openhab/openhab2.git","ssh_url":"git@github.com:openhab/openhab2.git","clone_url":"https://github.com/openhab/openhab2.git","svn_url":"https://github.com/openhab/openhab2","homepage":null,"size":174589,"stargazers_count":351,"watchers_count":351,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":486,"mirror_url":null,"open_issues_count":47,"forks":486,"open_issues":47,"watchers":351,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openhab/openhab2/pulls/586"},"html":{"href":"https://github.com/openhab/openhab2/pull/586"},"issue":{"href":"https://api.github.com/repos/openhab/openhab2/issues/586"},"comments":{"href":"https://api.github.com/repos/openhab/openhab2/issues/586/comments"},"review_comments":{"href":"https://api.github.com/repos/openhab/openhab2/pulls/586/comments"},"review_comment":{"href":"https://api.github.com/repos/openhab/openhab2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openhab/openhab2/pulls/586/commits"},"statuses":{"href":"https://api.github.com/repos/openhab/openhab2/statuses/021235a6f02f3329574c1b10c65208995809a64e"}}}}