Page 1 of 2

netAtmoNet plugin

Posted: Fri Oct 20, 2023 9:14 pm
by davidefa
This is the the preview version of the netAtmoNet plugin.
I changed the name as this is a different 'kind' of plugin:
- the original netatmo is super simple, no configuration needed, it functions out-of-the-box ( but it requires updates as new sensors are added... and no configuration means also no flexibility )
- this one is more complex as it requires an initial 'long configuration' phase ( but it should support even future sensors giving you maximum flexibility )

Installation
- copy the archive in the plugins directory
- extract it, it will create the netAtmoNet directory

Configuration
- in the meteotemplate plugin setup
- insert client id, client secret and refresh token ( these are generated on the netatmo app configuration page, in the token generator scope choose at least read_station )
- click the save button and reload the page
- the page will now show all devices, modules and sensors available
- for each sensor you want to import, enable it, in MT field define the 'meteotemplate field name' ( see meteotemplate wiki ) and select a conversion if necessary


netatmonet02.png
netatmonet02.png (116.83 KiB) Viewed 55914 times

Test
To test that everything is working correctly point your browser to the following url:
url_of_your_site/template/plugins/netAtmoNet/updateNetAtmoNet.php?errors
you should see a page similar to the image below.

The warnings at point 1) are not important ( I momentarily disabled the password checking, I will reenable once everything is ok )
The part at point 2), beetween 'calling api.php' and 'exiting api.php' is important and should not contain any warnings or errors.
If part 2) contain any warnigs/error, try changing the last option ( calling api.php using curl ) from yes to no.
If this does not solve the issue, updating the api.php script to ver 3.5 should fix it

Cron job
Once everything is ok create a cron job that loads the following url:
url_of_your_site/template/plugins/netAtmoNet/updateNetAtmoNet.php?PASS=YUOR_UPDATE_PASSWORD
Alternatively if you already have a cron job that executes load/cron.php, simply copy the updateNetAtmoNet.php script to the load/crons directory and you are done



netatmonet01.png
netatmonet01.png (88.04 KiB) Viewed 55910 times


Note
In addition to sensor data the plugin setup page shows a lot of useful information on each device and module ( battery, rf signal, firmware... ).
These data will be available for the companion netAtmoNetModules block

Re: netAtmoNet plugin

Posted: Sat Oct 21, 2023 3:20 pm
by ugo.call
Hi, I tried to install the plugin but once I entered the data it doesn't open the page with the devices

Re: netAtmoNet plugin

Posted: Sat Oct 21, 2023 3:38 pm
by davidefa
After inserting your credentials, click the save button an then reload the page.
I can also add a status line with the result of the authentication call to netatmo site, to show what's going wrong.

P.S.
If you want you can pm me your credentials, so that I can check ( once everything is ok you can regenerate it )

Re: netAtmoNet plugin

Posted: Sun Oct 22, 2023 5:54 pm
by El_Viejo
Hello davidefa:

These are the results of my test.
With version 3.1 of the API.
With API version 3.5

I am not able to understand them. I look forward to your comments.

Thank you very much for your generous work.

Re: netAtmoNet plugin

Posted: Sun Oct 22, 2023 7:59 pm
by davidefa
Both version of the api scripts are ok in your case.
So if you were using api 3.1 you can continue using it.
As a further check, call again the update script with your browser ( http://rpimeteo/template/plugins/netAtm ... php?errors ), and verify the content of the cache/apiLog.txt file it should be similar to the following image ( note the highlighted part ):

apilog05.png
apilog05.png (65.93 KiB) Viewed 55847 times

If everything is ok you can point your 'chrome cron job' to the update script ( you can also remove the ending '?errors' which is used only for debug )

Re: netAtmoNet plugin

Posted: Sun Oct 22, 2023 8:23 pm
by El_Viejo
Hello davidefa:

I am very happy. After several months of searching, thanks to your work, I have the solution.

Tomorrow I will try to do the last tests. But, before using the "chrome cron job", I will have to configure the different fields of the plugin. I will consult the wiki and I hope I know how to do it.

Thank you very much again and best regards.

Re: netAtmoNet plugin

Posted: Sun Oct 22, 2023 10:56 pm
by davidefa
Ok, the configuration I have sent you, is a starting point, you can certainly modify as you like

Re: netAtmoNet plugin

Posted: Mon Oct 23, 2023 2:37 pm
by El_Viejo
Here is the graphical proof that Davide's plugin works.

I've been testing it for several hours and so far no errors have appeared.
I still need to check the rain data for the last hour, because, since the installation of the plugin, it hasn't rained.

In my opinion, it might be a good idea to keep this thread for the plugin installation and open a new one for the different configuration options.

Thank you very much Davide

Re: netAtmoNet plugin

Posted: Mon Oct 23, 2023 7:12 pm
by davidefa
Tanks for reporting.
I noticed you have a block reporting 'offline' on the left side of your page: is that the netatmonetModules block?
In my test installation it shows online.

blocknetatmonet01.png
blocknetatmonet01.png (44.4 KiB) Viewed 55822 times

Re: netAtmoNet plugin

Posted: Mon Oct 23, 2023 7:45 pm
by El_Viejo
Negative, this is the "stationStatus" block.

From the "netAtmoModules" block, although it is not visible, the original version of Jachym is installed and the image is the same.

But you sent me a block file, "netAtmoNetModules_1.0.zip" and this block is not installed.
What do you advise me to do?

Re: netAtmoNet plugin

Posted: Thu Oct 26, 2023 3:49 pm
by El_Viejo
Today is a rainy day and I was able to test the rain plugin.
I have come to the conclusion that the configuration, as shown in the picture, is not correct. However, the numerical data shown (0.101 - 6.161 - 32.3) is correct.
But I am not sure about the right way to do it.
I have consulted the wiki and I am not sure which parameters I should set "R" or "RR" and in which of the three fields of the plugin.
Can anyone help me?
Thank you very much.

Re: netAtmoNet plugin

Posted: Thu Oct 26, 2023 10:34 pm
by davidefa
Yes you are right, that was my erroneous assumption.
Can't find the description of these fields in netatmo documentation, but old netatmo plugin use the following setting:
R = sum_rain_24
RR = sum_rain_1
The Rain field should be an instantaneous reading ( the rain accumulated between two readings... ).

P.S.
Regarding the sensor block install the netAtmoNetModules I sent you, this is compatible with the new netAtmoNet plugin you are using

Re: netAtmoNet plugin

Posted: Fri Oct 27, 2023 6:24 am
by tobydude
Hi.


I have put updateNetAtmoNet.php in the load/crons folder.
(I have a cronjob at cron-job.org)
API version is v.4.0

The message on my weather page (at the bottom):
"The live conditions file was not found. Make sure you have the NetAtmo plugin installed and using at least version 2.0"
So, the block "netAtmoModules" doesnt seems to work.



"netAtmoNet
No password provided

Notice: Undefined variable: password in /home/fjrvofei/public_html/template/plugins/netAtmoNet/updateNetAtmoNet.php on line 41

Notice: Undefined variable: password in /home/fjrvofei/public_html/template/plugins/netAtmoNet/updateNetAtmoNet.php on line 43
Unauthorized
Current date/time: 2023-10-28 12:06:55
sensor Dato=Device[0][date_setup][value]=1625218647
sensor NetAtmo=Device[0][type][value]=NAMain
sensor Wifi Status=Device[0][wifi_status][value]=44
sensor Signal=Device[0][reachable][value]=1
sensor Bøveien 665=Device[0][home_name][value]=bøv655
sensor =DeviceDash[0][time_utc][value]=1698487535
sensor Barometer=DeviceDash[0][Pressure][value]=754.4891311545
sensor Batteri %=[0][0][battery_percent][value]=88
sensor Styrke=[0][0][reachable][value]=1
sensor Batter %=[0][1][battery_percent][value]=50
sensor Styrke=[0][1][reachable][value]=1
sensor BATTERI %=[0][2][battery_percent][value]=81
sensor Styrke=[0][2][reachable][value]=1
sensor UTC=Dash[0][0][time_utc][value]=1698487497
sensor Temperatur=Dash[0][0][Temperature][value]=33.98
sensor Min Temp=Dash[0][0][min_temp][value]=32.18
sensor Max Temp=Dash[0][0][max_temp][value]=35.6
sensor Tid Max=Dash[0][0][date_max_temp][value]=3057201851
sensor Tid Min=Dash[0][0][date_min_temp][value]=3057237748.4

Warning: A non-numeric value encountered in /home/fjrvofei/public_html/template/scripts/functions.php on line 227
sensor Trend Temperatur=Dash[0][0][temp_trend][value]=32
sensor UTC=Dash[0][1][time_utc][value]=1698487529
sensor Regn=Dash[0][1][Rain][value]=0
sensor Døgn=Dash[0][1][sum_rain_1][value]=0.0052755934
sensor År=Dash[0][1][sum_rain_24][value]=0.00393701
sensor UTC=Dash[0][2][time_utc][value]=1698487529
sensor Vind=Dash[0][2][WindStrength][value]=10.8
sensor Vindretning=Dash[0][2][WindAngle][value]=135
sensor Vindkast=Dash[0][2][GustStrength][value]=21.6
sensor Max Vind=Dash[0][2][max_wind_str][value]=24.60634
sensor Tid Max Vind=Dash[0][2][date_max_wind_str][value]=3799386261.6139
Calling api.php date/time: 2023-10-28 12:06:56
using require_once
Success
Exiting api.php date/time: 2023-10-28 12:06:56"

Re: netAtmoNet plugin

Posted: Fri Oct 27, 2023 8:20 am
by El_Viejo
Thanks davidefa for your help in setting up the rain data. It's scheduled to rain this afternoon and I'll take the opportunity to test the new configuration.
Yesterday I installed your "netAtamoNetModules" block and it works perfectly. The sensor readings, especially the battery charge data, are now correct.
I can't thank you enough for your patience and generous dedication.

Re: netAtmoNet plugin

Posted: Sat Oct 28, 2023 10:48 am
by davidefa
@tobydude

Try the following setup for the plugin ( see attached images ).
The concept is. for every sensor that you want to import:
- in the first column 'MT field' set the 'meteotemplate field name'. for example T for the main outdoor temperature sensor ( see meteotemplate wiki for available field names )
- in the second column select the 'unit of measure conversion' ( no conversion needed, in your case as netatmo sensors are 'metric' and your database should be 'metric' too )
- set the 'enabled' column to yes

Regarding the block that shows the netatmo sensors/modules status, use this one.

netatmonet_conf01.png
netatmonet_conf01.png (131.81 KiB) Viewed 55742 times
netatmonet_conf02.png
netatmonet_conf02.png (119.93 KiB) Viewed 55742 times
netatmonet_conf03.png
netatmonet_conf03.png (121.74 KiB) Viewed 55742 times

Re: netAtmoNet plugin

Posted: Sat Oct 28, 2023 10:49 am
by davidefa
netatmonet_conf04.png
netatmonet_conf04.png (122.28 KiB) Viewed 55742 times
netatmonet_conf05.png
netatmonet_conf05.png (122.46 KiB) Viewed 55742 times

Re: netAtmoNet plugin

Posted: Sat Oct 28, 2023 11:00 am
by davidefa
ver 1.2
The last option now selects the use of the curl library to coll both api.php and netatmo servers.
If you have problems connecting try both options.

Re: netAtmoNet plugin

Posted: Sun Oct 29, 2023 6:07 am
by tobydude
Got the block, netAtmoNetModules installed.
Placed it at the bottom of my weatherpage. https://fjærvollan.no/template/indexDesktop.php

Thanks for help.

Image

Re: netAtmoNet plugin

Posted: Fri Dec 01, 2023 11:14 am
by BONSAI
Thank you all very much for your help... especially to David

Re: netAtmoNet plugin

Posted: Tue Dec 05, 2023 3:39 pm
by El_Viejo
Last night, suddenly and without previous modifications in the template, the new davidefa plugin stopped working. First, on the server installed on RPI5 and, a little later, on the RPi4 server.

I installed V1.1 of the plugin, with new tokens and got it working again. But, this morning, I have been able to verify that its correct functioning has not exceeded 120 minutes.

From this point on, my haste led me to make the wrong decisions.
First I reset my credentials: I now have new Clien ID, Client Secret and Tokens.

Then, I tried versions 1.1 and 1.2 of the plugin without success.
When I try to update the data in the plugin, something very strange happens. I enter the new credentials and save them. The message "Settings file created/upadted" appears, I restart the template, reopen the plugin settings and find to my surprise that the changes have not been made.

My precipitation has served to ruin davidefa's work. What should I do to make the plugin work again?
Thank you very much.
P. S. I have disconnected the RPi 5 server.

Re: netAtmoNet plugin

Posted: Tue Dec 05, 2023 4:00 pm
by davidefa
Pm me your new credentials I can check it later what's going wrong.

Re: netAtmoNet plugin

Posted: Tue Dec 05, 2023 4:17 pm
by El_Viejo
Sent Pm.

Thank you very much

Re: netAtmoNet plugin

Posted: Thu Dec 07, 2023 3:15 pm
by El_Viejo
Again, the generous help of davidefa has solved my problem with the plugin (thank you very much).
The sensor data is updated correctly since two days.
But, now, an error message appears in the netAtmoNetModules block. I describe it in the thread dedicated to the block.
http://www.meteotemplate.com/forum/viewtopic.php?t=2446

Re: netAtmoNet plugin

Posted: Tue Jan 16, 2024 5:51 pm
by ugo.call
Hi, Davide, the plugin is giving me problems again

Image

Re: netAtmoNet plugin

Posted: Sun Mar 24, 2024 6:50 pm
by El_Viejo
Netatmo has just announced a new way to access station data. This change will start on May 24.

I am not able to understand if the change will affect the excellent work that "davidefa" did to change the plugin.

Can anyone find out?

Thank you very much.