Netatmo webhook based event cookbook

Tags: #<Tag:0x00007f3281e7b8b8>

To make it easier for everyone I want this thread to become a collection of automations based on the webhook based Netatmo event. Feel free to contribute your automation snippets for others to use. I also try to collect links across the forum and other resources on this topic.

Documentation: Netatmo integration

Index:

Links:

4 Likes
# Example automation for a known person 
- alias: Tobi at home
  description: "Tobi detected at home"
  trigger:
    - event_type: netatmo_event
      platform: event
      event_data:
        type: person
  condition:
    - condition: template
      value_template: "{{ trigger.event.data['data']['name'] == 'Tobi' }}"
  action:
    - data_template:
        message: >
          {{ trigger.event.data["data"]["name"] }}
          at {{ trigger.event.data["data"]["home_name"] }}
        title: Netatmo event
      service: persistent_notification.create
2 Likes
# Relay Netatmo event to MQTT
- alias: Netatmo Event
  description: Netatmo event to MQTT relay
  trigger:
  - event_type: netatmo_event
    platform: event
  action:
  - service: mqtt.publish
    data_template:
      payload: '{{ trigger.event.data | tojson }}'
      retain: true
      topic: netatmo/update

See also @gieljnssns original post.

Author: @vlebourl original post

- id: netatmoevent
  alias: Netatmo Event
  description: door or window is open or was moved
  trigger:
  - event_data: {}
    event_type: netatmo_event
    platform: event
  condition:
  - condition: template
    value_template: '{{ trigger.event.data.data.snap != "topology_changed" }}'
  action:
  - service: shell_command.get_image_and_resize
    data_template:
      name: '"{{ trigger.event.data.data.snapshot_id }}"'
      url: '{{ trigger.event.data.data.snapshot_url }}'
  - service: persistent_notification.create
    data_template:
      message: >-
        {{ trigger.event.data.data.message }}\n
        {% if trigger.event.data.data.snapshot_url %}
          ![image](/local/snapshots/{{trigger.event.data.data.snapshot_id}}.png)
        {% endif %}
      notification_id: '{{ trigger.event.data.data.message }}'
      title: >-
        Netatmo event:  
        {% if trigger.event.data[\"type\"] == \"tag_big_move\" %}
          Big Move
        {% elif  trigger.event.data[\"type\"] == \"tag_small_move\" %}
          Small Move
        {% elif  trigger.event.data[\"type\"] == \"tag_open\" %}
          Still Open
        {% else %}
          {{trigger.event.data[\"type\"]}}
        {% endif %}

Author: @gerard33 original post

Create some input_boolean entities:

# Netatmo motion detection
netatmo_motion_human:
 name: Netatmo detected a person
 initial: off
 icon: mdi:motion-sensor
netatmo_motion_vehicle:
 name: Netatmo detected a car
 initial: off
 icon: mdi:car
netatmo_motion_animal:
 name: Netatmo detected an animal
 initial: off
 icon: mdi:dog

Add binary_sensor templates which use the state of the input_boolean entities:

# Netatmo camera presence detection
- platform: template
  sensors:
    netatmo_motion_human:
      friendly_name: "Netatmo beweging persoon"
      device_class: motion
      value_template: >-
        {{ is_state('input_boolean.netatmo_motion_human', 'on') }}
    netatmo_motion_vehicle:
      friendly_name: "Netatmo beweging auto"
      device_class: motion
      value_template: >-
        {{ is_state('input_boolean.netatmo_motion_vehicle', 'on') }}
    netatmo_motion_animal:
      friendly_name: "Netatmo beweging dier"
      device_class: motion
      value_template: >-
        {{ is_state('input_boolean.netatmo_motion_animal', 'on') }}

Use automations to use the new triggers to switch the input_booleans on and turn them off after 2 minutes (you can of course change this delay):

- alias: input_boolean to on if Netatmo camera detects a person
  trigger:
    - platform: event
      event_type: netatmo_event
      event_data:
        type: human
  action:
    - service: input_boolean.turn_on
      entity_id: input_boolean.netatmo_motion_human
    - delay: '00:02:00'
    - service: input_boolean.turn_off
      entity_id: input_boolean.netatmo_motion_human
- alias: input_boolean to on if Netatmo camera detects a vehicle
  trigger:
    - platform: event
      event_type: netatmo_event
      event_data:
        type: vehicle
  action:
    - service: input_boolean.turn_on
      entity_id: input_boolean.netatmo_motion_vehicle
    - delay: '00:02:00'
    - service: input_boolean.turn_off
      entity_id: input_boolean.netatmo_motion_vehicle
- alias: input_boolean to on if Netatmo camera detects an animal
  trigger:
    - platform: event
      event_type: netatmo_event
      event_data:
        type: animal
  action:
    - service: input_boolean.turn_on
      entity_id: input_boolean.netatmo_motion_animal
    - delay: '00:02:00'
    - service: input_boolean.turn_off
      entity_id: input_boolean.netatmo_motion_animal

This is reserved for later use.

On request I’ll share here how I use the Netatmo Welcome as a presence detection device.
First, I created a virtual device tracker in the known_devices.yaml file. This I then linked to a person in HA.

The following Node Red flow marks the virtual device “home” if that person is seen by the camera.

[{"id":"df805c17.53f41","type":"server-events","z":"19282270.eeccbe","name":"Netatmo event","server":"90595526.d9ab18","event_type":"netatmo_event","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"x":120,"y":1120,"wires":[["28cc6d97.440d62"]],"icon":"font-awesome/fa-video-camera"},{"id":"28cc6d97.440d62","type":"switch","z":"19282270.eeccbe","name":"Persoon check","property":"payload.event.data.name","propertyType":"msg","rules":[{"t":"eq","v":"Jasper","vt":"str"},{"t":"eq","v":"Selina","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":330,"y":1100,"wires":[["2b60d8b7.34bed8","5034ea97.60bf14"],["6a5bc39e.d0041c","dad64881.d992b8"]]},{"id":"2b60d8b7.34bed8","type":"api-call-service","z":"19282270.eeccbe","name":"Markeer virtual_jasper thuis","server":"90595526.d9ab18","version":1,"debugenabled":false,"service_domain":"device_tracker","service":"see","entityId":"","data":"{\"dev_id\":\"virtual_jasper\",\"location_name\":\"home\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":620,"y":1080,"wires":[[]]},{"id":"90595526.d9ab18","type":"server","z":"","name":"Home Assistant","addon":true}]

Then I also use an automation to mark the virtual device away when my phone changes to “not home”.

Hope this could be inspiring for anybody.

@repjas

Could you share all your config regarding netatmo :
Automations if any
The configuration for the virtual device
Etc?

I also use node red and want to do the same.
Thanks in advance

I have added this in my known_devices.yaml:

virtual_jasper:
  name: Netatmo Jasper
  track: true

Then add in the UI the virtual Netatmo device as a tracker to a person.

Then when Netatmo sees Jasper (using the Node Red flow I shared above), the virtual_jasper device will be marked home. This then marks the Person Jasper home.

Finally you will need to make a simple automation (I used Node Red) that will mark the virtual_jasper device away when your phone (or other device tracker) leaves the area. You can use the service device_tracker.see for this.

1 Like