lilp69
(lilp)
June 26, 2024, 12:14pm
1
Hi,
I have Frigate and telegram installed with a Camera R4252.
I try to create an automation to notify when something it’s triggered on the camera.
My camera have those sensors :
My automation :
alias: Alarm
description: Alarme
trigger:
- platform: state
entity_id:
- binary_sensor.detecteur_ouverture_porte_baie_vitree_contact
from: "off"
to: "on"
- platform: state
entity_id:
- sensor.r4252_smart_outdoor_camera_cat_count
from: "0"
to: "1"
condition:
- condition: state
entity_id: input_boolean.alarm_override
state: "on"
action:
- choose:
- conditions:
- condition: state
entity_id: sensor.r4252_smart_outdoor_camera_cat_count
state: "1"
sequence:
- service: notify.lilp_bot
metadata: {}
data:
message: Un chat a été détecté
title: Alarm Chat
mode: single
The entity image.r4252_smart_outdoor_camera_cat who can see as 4 entity on picture have those attributes :
access_token: XxX
entity_picture: >-
/api/image_proxy/image.r4252_smart_outdoor_camera_cat?token=XxX
friendly_name: R4252 Smart Outdoor Camera Cat
The notification is trigged well when the cat entity count change from 0 to 1, and send a message.
But I wish add picture or snapshot of the trigged.
I try to add it by using :
entity_picture: >-
/api/image_proxy/image.r4252_smart_outdoor_camera_cat?token=XxX
But don’t know how to.
Thanks.
crzynik
(Nicolas Mowen)
June 26, 2024, 5:38pm
2
For this it’s recommended to use the frigate notification blueprint
cloom
June 26, 2024, 6:47pm
3
@crzynik the Frigate notification blueprint does not support Telegram AFAIK:
Preamble
In 2022, a home assistant release caused issues with the original blueprint . It seems @hunterjm has not visited that thread in some time. I have updated the blueprint and added dozens of new features. I am continuing to do so and the mods have split the thread here to make things simpler. Thank you very much Hunterjm for the foundational blueprint which has taught me a great deal and made this possible.
Please feel free to visit Github for the latest releases or use the import buttons…
And there is not much movement on the pull requests (last in February 2024):
SgtBatten:main
← SgtBatten:telegram
opened 10:31AM - 24 May 23 UTC
crzynik
(Nicolas Mowen)
June 26, 2024, 7:01pm
4
Is a good one to look at as well
lilp69
(lilp)
June 27, 2024, 3:15pm
5
Yes Frigate Notification Blueprint doesn’t support Telegram notification.
Also, I wish add more sensor than frigate. Like my windows sensor and Frigate Notification blueprint don’t allow that.
cloom
July 2, 2024, 9:58pm
6
In Home Assistant 2024.7 you will be able to convert blueprint into an editable automation. You can then replace the notification with Frigate:
lilp69
(lilp)
July 3, 2024, 7:28am
7
It will be a nice new feature.
Still in 2024.6, I’m waiting the official 2024.7 so.
cloom
July 3, 2024, 7:40am
8
It should be released today after the release party:
lilp69
(lilp)
July 3, 2024, 8:42am
9
For now, I’m testing a solution like.
3 frigate automations (night, home, away)
With another automations to enable theses by times :
alias: Activation auto alarme nuit
description: Activation auto alarme nuit
trigger:
- platform: time
at: "00:00:00"
- platform: time
at: "06:00:00"
condition:
- condition: state
entity_id: automation.frigate_away
state: "off"
- condition: state
entity_id: automation.frigate_notifications
state: "off"
enabled: false
action:
- choose:
- conditions:
- condition: time
after: "12:00:00"
before: "06:00:00"
sequence:
- service: automation.toggle
metadata: {}
data: {}
target:
entity_id:
- automation.frigate_night
- automation.frigate_notifications
- conditions:
- condition: time
after: "06:00:00"
before: "12:00:00"
sequence:
- service: automation.toggle
metadata: {}
data: {}
target:
entity_id:
- automation.frigate_night
- automation.frigate_notifications
mode: single
And another for better away mode with windows sensor
alias: Alarm
description: Alarme
trigger:
- platform: state
entity_id:
- binary_sensor.detecteur_ouverture_porte_baie_vitree_contact
from: "off"
to: "on"
condition:
- condition: state
entity_id: automation.frigate_away
state: "on"
action:
- choose:
- conditions:
- condition: state
entity_id: sensor.r4252_smart_outdoor_camera_cat_count
state: "1"
sequence:
- service: notify.lilp_bot
metadata: {}
data:
message: Un chat a été détecté
title: Alarm Chat
enabled: false
- service: notify.mobile_app_oneplus
metadata: {}
data:
message: Un chat a été détecté dehors
- conditions:
- condition: state
entity_id: sensor.r4252_smart_outdoor_camera_dog_count
state: "1"
sequence:
- service: notify.lilp_bot
metadata: {}
data:
message: Un chien a été détecté
title: Alarm Chien
enabled: false
- service: notify.mobile_app_oneplus
metadata: {}
data:
message: Un chien a été détecté dehors
- conditions:
- condition: state
entity_id: sensor.r4252_smart_outdoor_camera_person_count
state: "1"
sequence:
- service: notify.lilp_bot
metadata: {}
data:
message: Une personne a été détecté
title: Alarm Personn
enabled: false
- service: notify.mobile_app_oneplus
metadata: {}
data:
message: Une personne a été détecté dehors
cloom
July 3, 2024, 9:57am
10
It seems you are using the same services to get notified. You should use a script to do so, it will make your automation more readable and then you can adapt your notifications there.
I have this script:
alias: Notify People in the building
sequence:
- parallel:
- service: notify.telegramcloom
data:
title: "*{{ title }}*"
message: |
```b {{ message }}```
- service: notify.persistent_notification
data:
title: "{{ title }}"
message: |
{{ message }}
- service: notify.cloomwhatsapp
data:
message: |
*{{ title }}*
{{ message }}
enabled: false
- service: notify.anaconciergewhatsapp
data:
message: |
*{{ title }}*
{{ message }}
enabled: false
- service: notify.mobile_app_rs_403
data:
title: "{{ title }}"
message: "{{ message }}"
enabled: true
mode: single
icon: mdi:message-badge-outline
There are some disabled because Whatsapp messages are not free anymore. You can use come up with something if you don’t want to notify all the services in your script.
Then I call this script from automations:
service: script.notify_sbs_lofts
data:
title: "Problem detected on {{ trigger.from_state.attributes.friendly_name }}"
message: >
{{"\n"}}ECS: {{ states('sensor.sonde_ecs') }} {{"\n"}}Retour coge circuit
chauffage: {{ states('sensor.sonde_retour_coge_circuit_chauffage') }}
{{"\n"}}Retour Cogénération: {{ states('sensor.retour_cogeneration') }}
{{"\n"}}Cogénération en défaut: {{ "YES!!!" if
states('binary_sensor.i7_default_coge') == "on" else "NO" }}
lilp69
(lilp)
July 3, 2024, 1:55pm
11
Don’t really understand your tips.
I create a script
alias: Notify
sequence:
- parallel:
- service: notify.lilp_bot
data:
title: "*{{ title }}*"
message: |
```b {{ message }}```
- service: notify.mobile_app_oneplus
data:
title: "{{ title }}"
message: |
{{ message }}
mode: single
icon: mdi:message-badge-outline
Then an automation :
alias: Test notification
description: ""
trigger: []
condition: []
action:
- service: script.test
metadata: {}
data:
title: Problem detected on {{ trigger.from_state.attributes.friendly_name }}
message: >
{{"\n"}}ECS: {{ states('sensor.sonde_ecs') }} {{"\n"}}Retour coge
circuit chauffage: {{
states('sensor.sonde_retour_coge_circuit_chauffage') }} {{"\n"}}Retour
Cogénération: {{ states('sensor.retour_cogeneration') }}
{{"\n"}}Cogénération en défaut: {{ "YES!!!" if
states('binary_sensor.i7_default_coge') == "on" else "NO" }}
mode: single
But when I run the automation nothing happen.
cloom
July 3, 2024, 2:12pm
12
It’s normal, you re-used my sensors in the message.
Create a script that is taking 2 arguments: title and message
alias: Notify
sequence:
- parallel:
- service: notify.lilp_bot
data:
title: "{{ title }}"
message: "{{ message }}"
- service: notify.mobile_app_oneplus
data:
title: "{{ title }}"
message: "{{ message }}"
mode: single
icon: mdi:message-badge-outline
[/quote]
Then you can use the developer tools and call the script:
service: script.notify_script_name
data:
title: "Test"
message: "Ne rien faire"
Then if you have a sensor living_room_temperature you can put it in the message:
service: script.notify_script_name
data:
title: "Too Hot!"
message: "Living room is burning hot, temperature is {{ states('sensor.living_room_temperature') }} degrees!"
cloom
July 3, 2024, 2:16pm
13
For automation templates you can look at the official documentation:
lilp69
(lilp)
July 4, 2024, 2:53pm
14
I make the changes
Script
alias: Notify
sequence:
- parallel:
- service: notify.lilp_bot
data:
title: "*{{ title }}*"
message: |
```b {{ message }}```
- service: notify.mobile_app_oneplus
data:
title: "{{ title }}"
message: |
{{ message }}
mode: single
icon: mdi:message-badge-outline
description: Script Notify
The automation
alias: Alarm
description: Alarme
trigger:
- platform: state
entity_id:
- binary_sensor.detecteur_ouverture_porte_baie_vitree_contact
from: "off"
to: "on"
condition:
- condition: state
entity_id: automation.frigate_away
state: "on"
action:
- choose:
- conditions:
- condition: state
entity_id: sensor.r4252_smart_outdoor_camera_cat_count
state: "1"
sequence:
- service: script.notify
data:
title: Mouvement détecté
message: >
{{"\n"}}Mouvement détecté: {{
states('sensor.r4252_smart_outdoor_camera_cat_count') }}
personne détectée.
- conditions:
- condition: state
entity_id: sensor.r4252_smart_outdoor_camera_dog_count
state: "1"
sequence:
- service: script.notify
data:
title: Mouvement détecté
message: >
{{"\n"}}Mouvement détecté: {{
states('sensor.r4252_smart_outdoor_camera_cat_count') }}
personne détectée.
- conditions:
- condition: state
entity_id: sensor.r4252_smart_outdoor_camera_person_count
state: "1"
sequence:
- service: script.test
metadata: {}
data:
title: Mouvement détecté
message: >
{{"\n"}}Mouvement détecté: {{
states('sensor.r4252_smart_outdoor_camera_cat_count') }}
personne détectée.
- service: script.notify
data:
title: Mouvement détecté
message: >
{{"\n"}}Mouvement détecté: {{
states('sensor.r4252_smart_outdoor_camera_cat_count') }}
personne détectée.