Netatmo webhook based event cookbook

Hi, I want to create an automation so when I am in home the Netatmo Camara sets me up as in Home. I though the easiest way will be when I am wifi connected but I do not know how to call the service “set_persons_home”. Can someone assist me with this automatitation. I think it is also useful for the Netatmo community. Thank you!

  alias: Antonio en Casa Wifi
  description: ''
  trigger:
  - platform: state
    entity_id: sensor.kb2003_conexion_wifi
    to: WIFI_xxx
  condition: []
  action:
  - service: set_persons_home
    device_id: xxxxxxxx
    domain: netatmo
    entity_id: camera.netatmo_xxx
    value_template: '{{ trigger.event.data[''data''][''name''] == ''Antonio'' }}'
  mode: single

This will evaluate to trueand netatmo.set_persons_home is expecting a list of names. If you want to check if the the trigger contains “Antonio” you have to put that into the condition and the pass the name to the netatmo.set_persons_home service.

All of the code from this post can be changed since HA 2021.5 with the code below.
Less code and all in one file.

template:
# Netatmo human
  - trigger:
      - platform: event
        event_type: netatmo_event
        event_data:
          type: human
    binary_sensor:
      - name: netatmo_motion_human
        unique_id: f5b9c5eb-d2ee-46d3-ad6f-dbc9ba917ee9
        # We use auto_off, so just set it to true on each trigger
        state: "true"
        device_class: motion
        # Automatically turn off 120 seconds after the last event
        auto_off: 120
  # Netatmo vehicle
  - trigger:
      - platform: event
        event_type: netatmo_event
        event_data:
          type: vehicle
    binary_sensor:
      - name: netatmo_motion_vehicle
        unique_id: e334e36b-9405-40a8-ac32-e212c73381e2
        state: "true"
        device_class: motion
        auto_off: 120
  # Netatmo animal
  - trigger:
      - platform: event
        event_type: netatmo_event
        event_data:
          type: animal
    binary_sensor:
      - name: netatmo_motion_animal
        unique_id: 12fe2e12-2aab-4409-8fbf-e4d7144db271
        state: "true"
        device_class: motion
        auto_off: 120
6 Likes

@gerard33 : Thanks you very much!

Do you think there is a solution to get a secondary info into this sensor which camera has detected the motion?

Okay, a vehicle in the backyard should be very rare.

In the event data there is a camera_id / device_id present which is the MAC address of the camera, so you can use that in the trigger part to distinguish the cameras.
Then you can make sure there is actually no car in your backyard :wink:

1 Like

Reposting it here.

A blueprint for Netatmo indoor camera to use the ‘known person’ event into a MQTT device tracker: Netatmo Indoor Camera: Known person seen to device tracker

1 Like

Thank you!! Is it possible to create an snapshot when an event is triggered (person, movement…) and send the thrumbail through a notification to my phone? The service “camera.snapshot” is not working and I do not know how to send the native snapshot took by my netatmo inhome camera.

Your help will be highly appreciated!

As far as I can tell camera.snapshot is working fine for indoor and outdoor cameras. What exactly isn’t working for you? Do you get an error?

I had no error but no snapshot. I paste below the script

service: camera.snapshot
data:
entity_id: camera.netatmo_coti
filename: /local/MiniCamSnap.jpg

Have you tried from the services tab to ensure correct access to the specified folder?

It worked changing entity_id by target: device_id

Thank you!!

1 Like

Hi @cgtobi ,
I am also moving my motion sensors to the new trigger-based templates. I used this opportunity to also store in attributes the snapshot_url and vignette_url keys from the netatmo_event payload, to then use them in generic cameras.
But it seems that these two keys are absent from the netatmo_event when the type is vehicle. It is working fine for human, animal and movement (consistent with all my three cameras).
Should I create an issue in github, or is it a bug at Netatmo?

You can take a look at the raw webhook event sent by Netatmo by setting:

homeassistant.components.netatmo.webhook: debug

This should give some insights. The component does not treat vehicle events any different. If you can provide me with some test data I can take a closer look. (feel free to PM me here or on Discord)

Hi @cgtobi ,
This is how I found out about the missing keys in the payload, but I’ve just PMed you a fresh extract from my log. You will see that all the vignette* and snaphsot* related keys (*_id, *_key, *_url) are missing when type is vehicle.
Thanks again for your prompt reply!

Thanks @Friedrieck, I’m pretty sure that the events did contain those in the past. Not sure why they are not included right now. Unfortunately I don’t have an outdoor camera or access to a street facing camera. So, since we’re just passing the even along without removing any of that data this is not in our hands. I’ll pass that on to the Netatmo devs.

1 Like

Problem solved!
It appears that to have these vignette and snapshot data in the callback, one has to set in the Netatmo parameters at least to record the vehicle events, which I had not (I guess it is the same for the other types). It must be done in the Netatmo app or on the Netatmo website (as pictured below). Having done so, these keys are now in the netatmo_event (for type: vehicle), as expected.

1 Like

Thanks for sharing those insights.

3 posts were merged into an existing topic: Netatmo_event never fires

@gerad33

Hi, in which file do I have to put the code in? It would be great , if someone could help me :+1:

template:
# Netatmo human
  - trigger:
      - platform: event
        event_type: netatmo_event
        event_data:
          type: human
    binary_sensor:
      - name: netatmo_motion_human
        unique_id: f5b9c5eb-d2ee-46d3-ad6f-dbc9ba917ee9
        # We use auto_off, so just set it to true on each trigger
        state: "true"
        device_class: motion
        # Automatically turn off 120 seconds after the last event
        auto_off: 120
  # Netatmo vehicle
  - trigger:
      - platform: event
        event_type: netatmo_event
        event_data:
          type: vehicle
    binary_sensor:
      - name: netatmo_motion_vehicle
        unique_id: e334e36b-9405-40a8-ac32-e212c73381e2
        state: "true"
        device_class: motion
        auto_off: 120
  # Netatmo animal
  - trigger:
      - platform: event
        event_type: netatmo_event
        event_data:
          type: animal
    binary_sensor:
      - name: netatmo_motion_animal
        unique_id: 12fe2e12-2aab-4409-8fbf-e4d7144db271
        state: "true"
        device_class: motion
        auto_off: 120

You can add this in configuration.yaml.
See here for more info.

2 Likes