Gerard f495cff725
Add examples of events (#12534)
* Add examples of events

As discussed with @cgtobi in https://community.home-assistant.io/t/netatmo-in-ha-0-105/169377/133?u=gerard33

* Update according to review comments
2020-03-29 11:34:25 +02:00

6.2 KiB

title, description, ha_category, ha_release, ha_iot_class, ha_codeowners, ha_config_flow, ha_domain
title description ha_category ha_release ha_iot_class ha_codeowners ha_config_flow ha_domain
Netatmo Instructions on how to integrate Netatmo integration into Home Assistant.
Hub
Environment
Weather
Sensor
Climate
Camera
0.20 Cloud Polling
@cgtobi
true netatmo

The netatmo integration platform is the main integration to integrate all Netatmo related platforms.

There is currently support for the following device types within Home Assistant:

Configuration

To enable the Netatmo component, add the following lines to your configuration.yaml:

# Example configuration.yaml entry
netatmo:
  client_id: YOUR_CLIENT_ID
  client_secret: YOUR_CLIENT_SECRET

{% configuration %} client_id: description: The client id from your Netatmo app. required: true type: string client_secret: description: The client secret from your Netatmo app. required: true type: string {% endconfiguration %}

After the client_id and client_secret is added to your configuration.yaml you must enable Netatmo through the integrations page.

Get API and Secret Key

To get your API credentials, you have to declare a new application in the Netatmo Developer Page. Sign in using your username and password from your regular Netatmo account. Open the app creator form.

You have to fill the form, but only two fields are required: Name and Description. It doesn't really matter what you put into those. Just write something that make sense to you. To submit your new app, click on create at the bottom of the form.

That's it. You can copy and paste your new client id and client secret in your Home Assistant configuration file just as described above, in the configuration example.

Camera

The netatmo camera platform is consuming the information provided by a Netatmo Smart Indoor or Outdoor camera. This integration allows you to view the current live stream created by the camera.

Climate

The netatmo thermostat platform is consuming the information provided by a Netatmo Smart Thermostat or Netatmo Smart Radiator Valve. This integration allows you to view the current temperature and control the setpoint.

Sensor

The netatmo sensor platform is consuming the information provided by a Netatmo Smart Home Weather Station or a Netatmo Smart Indoor Air Quality Monitor device.

Webhooks

The Netatmo Smart Indoor or Outdoor cameras, Smart Door and Window Sensors, as well as the Netatmo Smart Smoke Alarm, send instant events to Home Assistant by using webhooks. It is required to have your camera enabled in Home Assistant.

To be able to receive events from Netatmo, your Home Assistant instance needs to be accessible from the web over port 80 or 443. To achieve this you can either use your Nabu Casa account or for example Duck DNS (Home Assistant instructions). You also need to have the base_url configured for the HTTP integration (documentation).

Events coming in from Netatmo will be available as an event in Home Assistant and are fired as netatmo_event, along with their data. You can use these events to trigger automations.

You can find the available event types at the official Netatmo API documentation.

Example:

{% raw %}

# Example automation for webhooks based Netatmo events
- alias: Netatmo event example
  description: "Count all events pushed by the Netatmo API"
  trigger:
    - event_data: {}
      event_type: netatmo_event
      platform: event
  action:
    - data: {}
      entity_id: counter.event_counter
      service: counter.increment

{% endraw %}

Example:

{% raw %}

# Example automation for Netatmo Welcome
- alias: Motion at home
  description: 'Motion detected at home'
  trigger:
  - event_type: netatmo_event
    platform: event
    event_data:
      type: movement
  action:
  - data_template:
      message: >
        {{ trigger.event.data["data"]["message"] }}  
        at {{ trigger.event.data["data"]["home_name"] }}
      title: Netatmo event
    service: persistent_notification.create

{% endraw %}

Example:

{% raw %}

# Example automation for Netatmo Presence
- alias: Motion at home
  description: 'Motion detected at home'
  trigger:
  - event_type: netatmo_event
    platform: event
    event_data:
      type: human # other possible types: animal, vehicle
  action:
  - data_template:
      message: >
        {{ trigger.event.data["data"]["message"] }}  
        at {{ trigger.event.data["data"]["home_name"] }}
      title: Netatmo event
    service: persistent_notification.create

{% endraw %}

Example:

{% raw %}

# Example automation
- alias: door or window open or movement
  description: 'Notifies which door or window is open or was moved'
  trigger:
  - event_type: netatmo_event
    platform: event
    event_data:
      type: tag_open
  - event_type: netatmo_event
    platform: event
    event_data:
      type: tag_big_move
  - event_type: netatmo_event
    platform: event
    event_data:
      type: tag_small_move
  action:
  - data_template:
      message: >
        {{ trigger.event.data["data"]["message"] }}  
      title: Netatmo event
    service: persistent_notification.create

{% endraw %}