Adafyn kuulumisia

Link Netatmo product into Slack

Lately I have been working with Netatmo API. I own the in-house Netatmo weather station with one extra module. The extra module is located in our storage room where we have also water pipe. I have set-up an alarm for my phone which will send me notification if temperature drops below 4 Celsius. This all works nicely, but I wanted to tinker with my weather station and add new way to interact with it.

We use Slack in our company and I have a Slack window open all day. Why wouldn’t I integrate Netatmo product into Slack!

I started this project from Netatmo side. They offer nice API for data, but I wanted .NET SDK to access it more easily. I couldn’t find any suitable so I decided to created my own.

First I created data classes from their swagger documentation with Autorest. Then I removed Autorest ready made client because it couldn’t handle authentication. Next I implemented authentication into NetatmoAuth class using Restsharp rest client library. Restsharp brings few nice things which helps working with rest apis, but on the other hand it has few weirdness, like the default serialization is done in xml if server doesn’t return json content type.

After clearing default client and implementing authentication I created a new client class which handles login and wraps rest API into nice .NET SDK.

Next I will create Microsoft Bot Framework App which integrates into Slack. This bot app will fetch weather data form Netatmo station and provide it into Slack channel.

Feel free to contribute into NetatmoCore project and implement methods for your devices, like thermostats and security cameras.