# 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
# 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
For a more recent implementation see this post by @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.
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.
Hello, someone could help me to translate the node red flow into an automation.yaml??
Tks a lot,
Matteo
Hello, thanks cgtobi for the helpful summary. I have a technical question about netatmo_event. Does this event function on its own, for example as a trigger (after addition) to automation? Or is it necessary to first “activate” netatmo_event by calling “netatmo register webhook” in the developer tools?
As long as the webhook is not banned for your account on the Netatmo dev portal the integration should register the webhook automatically as long as the requirements are fulfilled. So ideally once the integration is set up you should be able to use the event right away.
Hmm. I started with the webhook ok tag on the dev.netatmo app tab, after which I searched for what it was and found a mention of the possibility of using netatmo_event (which is a good added value for the already good netatmo camera in HA). When nothing happened after two days, I run “register netatmo webhook” in the developer tools, after which the automation containing netatmo_event trigger started working for me.
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 true
and 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
@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
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
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?