write_presence scope

The Netatmo API is a set of webservices allowing developers and third parties to access Netatmo device's data.
openMind
Posts: 17
Joined: 23 Feb 2017, 09:31

Re: write_presence scope

Post by openMind » 26 Mar 2017, 18:24

@kiboost: Nice work. Does work perfectly so far. :P

I would prefer a official solution anyway...

kiboost
Posts: 585
Joined: 21 Jun 2013, 09:27

Re: write_presence scope

Post by kiboost » 26 Mar 2017, 19:44

openMind wrote:@kiboost: Nice work. Does work perfectly so far. :P
Thanks!
openMind wrote:I would prefer a official solution anyway...
Me too, but they don't seems to want to ... I had real need for it and I'm now fully automated, I don't have to go into the app to change settings anymore 8-)
php-simpleNetatmoAPI Simple to use php API based on official API.

knipz
Posts: 4
Joined: 09 Apr 2017, 11:54

Re: write_presence scope

Post by knipz » 09 Apr 2017, 12:02

@kiboost

Im trying to use your code "NetatmoPresenceAPI" (with IP-Symcon) but no success while getting my home data. The variable 'netatmopresencetoken' returns 'disabled'.
Am I doing anything wrong at the login? Or maybe netatmo changed the login procedures in the last days? Does the API still work for anybody? Thanks!

kiboost
Posts: 585
Joined: 21 Jun 2013, 09:27

Re: write_presence scope

Post by kiboost » 09 Apr 2017, 12:42

Hi,
I don't know IP-Symcon at all, so can't comment.
There is no such variable as 'netatmopresencetoken' in the API.
The API is running fine, I use it in home automation scripts several times a day so I would know if it break. Just check, all is fine.

To be sure, just do this in a php script:

$_Presence = new NetatmoPresenceAPI($Netatmo_user, $Netatmo_pass);
if (isset($_Presence->error)) echo($_Presence->error);
echo "<pre>_Presence:<br>".json_encode($_Presence, JSON_PRETTY_PRINT)."</pre><br>";

You should see all API variables, cameras datas, home datas etc.
php-simpleNetatmoAPI Simple to use php API based on official API.

knipz
Posts: 4
Joined: 09 Apr 2017, 11:54

Re: write_presence scope

Post by knipz » 09 Apr 2017, 18:27

Sorry, I wrote my answer by heart. The correct name of the variable name I meant is $token and is assigned with the return value of "netatmocomaccess_token=".
The following lines are my log output. Seems that it doesn't even get the contents of body, and there is a message "invalid access token" in the last line.
But if its running fine for you, I will try it further on :D


Notice: Undefined index: body in C:\IP-Symcon\scripts\56270.ips.php on line 373
Notice: Undefined index: body in C:\IP-Symcon\scripts\56270.ips.php on line 406
Warning: Invalid argument supplied for foreach() in C:\IP-Symcon\scripts\56270.ips.php on line 406
_Presence:{
"_version": "0.5",
"_home": {
"id": null,

[...]

"_cameras": [],
"_fullDatas": {
"error": {
"code": 2,
"message": "Invalid access token"
}
}
}

kiboost
Posts: 585
Joined: 21 Jun 2013, 09:27

Re: write_presence scope

Post by kiboost » 09 Apr 2017, 18:53

Hmm strange, are you sure to use the same login/password as you do on netatmo website to see your datas ?

Can you get version of php and curl run by thos IPsymcon ?

Do you have several homes on your account ? Actually the API doesn't support this, it take the first home. This can be fix very fast if needed anyway.
php-simpleNetatmoAPI Simple to use php API based on official API.

knipz
Posts: 4
Joined: 09 Apr 2017, 11:54

Re: write_presence scope

Post by knipz » 09 Apr 2017, 19:17

Im using the same login credentials as in the app or the web frontend, tried to write them between ' ' and also " ".
As username is my email adress there's an @ inside, password contains all types of chars.
Maybe a problem with the charset?

php 5.6.26
curl 7.50.1

only one home defined on account

kiboost
Posts: 585
Joined: 21 Jun 2013, 09:27

Re: write_presence scope

Post by kiboost » 09 Apr 2017, 19:25

Should works then, check your private messages please.
php-simpleNetatmoAPI Simple to use php API based on official API.

knipz
Posts: 4
Joined: 09 Apr 2017, 11:54

Re: write_presence scope

Post by knipz » 09 Apr 2017, 19:41

Got it!
My account password contained special chars that caused the problem, I suppose it was the dot (.)
Changed password and now it works like a charm. Thank you!

kiboost
Posts: 585
Joined: 21 Jun 2013, 09:27

Re: write_presence scope

Post by kiboost » 09 Apr 2017, 19:43

Ah!!! Nice find, will try to solve this ;)

I've updated a v0.52 with more robust connection, as I though this could be caused by something else.
php-simpleNetatmoAPI Simple to use php API based on official API.

Post Reply

Return to “Netatmo API”