Fields should be outside the action sequence… but everything else looks okay. If you don’t have an “Else” or further actions, the If/Then isn’t really necessary, but it doesn’t hurt anything.
alias: notify_humidity_alert
mode: queued
description: Send a notification if the humidity is too high
fields:
humidity:
name: Humidity
description: "The humidity"
example: "75"
room:
name: Room
description: "The room"
example: "Man Cave"
myperson:
name: Person
description: "For whom"
example: "person.jane"
selector:
entity:
filter:
- domain: person
mobile_app:
name: Notify Action
description: "The device"
example: "notify.mobile_app_jane"
sequence:
- if:
- alias: Check if person is home
condition: template
value_template: "{{ is_state(myperson, 'home') }}"
then:
- action: "{{ mobile_app }}"
metadata: {}
data:
message: "The humidity ({{ humidity }}%) is too high in the room {{ room }}."
title: Warning!
data:
clickAction: /dashboard-caves/man-cave
I think you need to restructure it so the message is generated by whatever automation is calling the script, and just have the script check that the target people are home and link them to their notifier.
The links provided in this previous thread may be useful to you: Template in the action block (send dynamically) notification - #3 by Didgeridrew