Here the blueprint, generated with Gpt5.0… because i know noooothing about code.
Quite simple for european mailbox:
1 sensor for the mailbox fence
1 sensor for the latch
notifier via the companion app, working well.
Using Gpt to generate a script : nightmare !
I have to say it’s very limited and hallucinating on code a lot…
this is the 10th generation, with trial and error.
The other thing it didn’t succeed doing it was multiple selection for mobile to notify.
- what do you think about the code quality ?
- anybody could correct/add the multiple mobile choice so i can post it for the others ?
blueprint:
name: Mail Notifier with cam snapshot
description: >
Counts the mail delivered by the postman and sends a notification with the time.
Resets the counter and notifies when the flap is open (mail collected).
Can send a photo if a camera is connected.
domain: automation
input:
fente_sensor:
name: Fense sensor
description: Sensor detecting the opening of the slot (post deposited)
selector:
entity:
domain: binary_sensor
trappe_sensor:
name: mailbox door
description: Sensor detecting the opening of the hatch (post collected)
selector:
entity:
domain: binary_sensor
compteur:
name: Mail counter
description: Counter entity
selector:
entity:
domain: counter
notif_device:
name: Notification device
description: Device (select the Mobile App device)
selector:
device:
integration: mobile_app
camera_entity:
name: IP Camera (optional)
description: Postbox camera to send a photo
default: ""
selector:
entity:
domain: camera
mode: restart
max_exceeded: silent
variables:
compteur: !input compteur
camera: !input camera_entity
notify_device: !input notif_device
trigger:
- platform: state
entity_id: !input fente_sensor
to: "on"
id: courrier
- platform: state
entity_id: !input trappe_sensor
to: "on"
id: releve
action:
- choose:
- conditions:
- condition: trigger
id: courrier
sequence:
- service: counter.increment
target:
entity_id: !input compteur
- choose:
- conditions:
- condition: template
value_template: "{{ camera != '' }}"
sequence:
- domain: mobile_app
type: notify
device_id: !input notif_device
title: "📬 Mail !"
message: >
The postman came by at {{ now().strftime('%H:%M') }}.
Number of letters in the post box : {{ states(compteur) }}
data:
image: "/api/camera_proxy/{{ camera }}"
default:
- domain: mobile_app
type: notify
device_id: !input notif_device
title: "📬 Mail !"
message: >
The postman came by at {{ now().strftime('%H:%M') }}.
Number of letters in the post box : {{ states(compteur) }}
- conditions:
- condition: trigger
id: releve
sequence:
- service: counter.reset
target:
entity_id: !input compteur
- domain: mobile_app
type: notify
device_id: !input notif_device
title: "📭 relevé..."
message: "The post has been collected. {{ now().strftime('%H:%M') }}."
All the best