5

netatmo welcome – read the presence-status with the Fibaro HomeCenter 2

by boomx24. November 2015

After we published the test of the netatmo welcome on Monday, you can already read the camera-API with the Fibaro HomeCenter 2 only 2 days later.

First of all, you need to create a new LUA-scene via “Scenes”, “Add Scenes”. You then copy the LUA-Code (can be found further below) into the window for the code. You do not have to adjust a lot in the script. Only lines 8 – 11 have to be adjusted.

The client ID/client secret can be found under the app-settings on dev.netatmo.com. Your login-data for the netatmo-web site are your mail-address and password.

Credential on the netatmo-web site

Credential on the netatmo-web site

After you have installed the scene this far, you will receive an error message in the debug-window when starting the scene for the first time. At the start, the installed users are read on the netatmo welcome, which then have to be installed as variables. You can create those under “Panels”, “Variables Panel” and then with a click on “Add”. The script is then going to show you, which variables have to be installed. (As shown on the picture; in this case Daniel_status & Daniel_lastseen)

The debug after the first start

The debug after the first start

After you installed the variable in your Fibaro HomeCenter 2, there should not appear any red debug, anymore. Absence messages are debugged in orange and attendance messages in green.

The debug after creating the variables

The debug after creating the variables

Only one debug is written in the default setting of the scene, if the status of a registered person changed. Through that, it stays a bit clearer. In case anything should not work, you can activate the debug via line 13 in the script. Simply replace the 0 with a 1 for this matter.

Restraints of the natatmo API

There unfortunately is a restraint on the side of the API. “Only” 2000 requests per hour can be put. In the reverse, this means, that the scene can only be implemented every 4 seconds (60 min * 60 sec = 3600 seconds/4 seconds pause = 900 calls * 2 = 1800 calls; scene is made up of 2 API-calls). Though, our test phase showed that 4 seconds often lead to a mistake and nothing is returned by the API, resp. the account for API-Calls is blocked. With 8 seconds on the other hand, we made good results. In case you should have other devices by netatmo connected under your netatmo-account, please do not forget, that the weather station, for instance, generates API-Calls via the Fibaro Plugin or when using the anemometer-script, additional API-Calls are being sent to netatmo as well.

Error message at too low refreshing-times

Error message at too low refreshing-times

At this point, 8 seconds are our suggestion. Though, you can also experiment with the values on your own. To do so, you can find a local variable “refresh” in line 12 of the script, with which you can adjust the seconds on your own.

The script can be found on here:

Virtual device for the netatmo welcome

If next to the variables, you want to use a virtual device as well, there is one available for download on here. You can just import it under “devices”.

netatmo_vd1

In the further settings of the virtual device the following code can be found under the refresh-button three times:

You then obviously need to enter your variables in here In case less persons should be living in your house, you can delete the not needed code, resp. the not needed lables of the virtual device.

In the scene you need to change the local variable vd_ID in line 15 and enter the ID of your own virtual device. The Refresh-button will then be pressed at every run of the scene and the values are going to be updated.

Of course, there are matching icons again on here. This time, you will have the agony of choice, though

Area of application for the netatmo welcome integration

Due to the already mentioned restraints of the netatmo-API (API only retrievable every 8 seconds), the low possibility that because of certain reasons your face (wearing a hat in the winter, sun glasses in the summer) will not be recognized and the API is only retrievable via internet (danger of a failure), the areas of application are reduced significantly. For instance, to automatically deactivate the alarm when coming home would in my opinion be too risky.

A single netatmo welcome cannot be used as pure presence detection, because after a certain time, the camera puts the person on absent, as far as that person has not been seen during this time. Theoretically, there would have to be cameras placed in every room. In my opinion, this would be a little too-much though, since I would reluctantly send pictures of my couch, or people sitting on my couch to the cloud.

I actually only want to monitor the hall so that I am able to know who just opened the door, resp. who is coming home. In this case the netatmo welcome integration could probably be used as fallback level in case of an alarm. This would mean you come home and forget to deactivate the alarm: Your sirens go on and you receive wild push-notifications, saying that somebody broke into your apartment/house. You could theoretically deactivate the alarm right away, if your face was recognized. This would most certainly go faster than having to get your phone out of your pocket, starting the Fibaro-App and then deactivating the alarm.

Another possibility would also be a personal welcoming via a TTS-system or a color-matching RGBW-light, as soon as the status of a person goes from absent to present. You might have other ideas as well… If that is the case, we would certainly be happy, if you would write a comment about them. :)

Linda translator

This text was translated by Linda

Hi! My name is Linda and I graduated high school with great interest in English language. I help with mein-cleveres-haus.de and translate texts for siio.de in my spare time.

You can read the original in German on siio.de.

About The Author
boomx
boomx
  • barthelet
    9. January 2016 at 14:40

    Hi,
    your script is very good, but there is a little issue when people have special chars in there name. Indeed, hc2 variables cannot accept special chars, so when you call b.pseudo _status… it doesn’t work. I have used gsub to fix this and remove special chars from pseudo.

    Regards

  • Szymon
    31. March 2016 at 16:58

    whether it is possible to add an image from natatmo ? what path syntax http to Fibaro

  • gernot
    7. August 2016 at 19:07

    Hi the script is only usefull if it handles failure of the requested Netatmo api also – pls can you add an exception and error handling for this LUA also
    thnx in advance

  • 18. August 2016 at 23:45

    That is not as easy as it sounds and I do not have the perfect solution for that yet. I avoided this error by triggering with a motion sensor, then it does not matter any longer if the error occures because the scene restarts automatically :-)

Leave a Response