Blueprints help

Hello everyone, I need your help please.
I have created a blueprint with ChatGPT that sends me a message when the humidity falls below or rises above a certain value.
Unfortunately it doesn’t work, so please help
Here is my attempt:

type or paste code here

blueprint:
name: Feuchtigkeit Benachrichtigung (Alle Sensoren)
description: Sendet eine Benachrichtigung, wenn die Luftfeuchtigkeit eines Sensors zu hoch oder zu niedrig ist.
domain: automation
input:
humidity_sensors:
name: Feuchtigkeitssensoren
description: Wähle alle Feuchtigkeitssensoren aus, die überwacht werden sollen.
selector:
target:
entity:
domain: sensor
device_class: humidity
min_humidity:
name: Minimaler Feuchtigkeitswert
description: Schwellenwert für zu geringe Luftfeuchtigkeit.
default: 30
selector:
number:
min: 0
max: 100
unit_of_measurement: “%”
max_humidity:
name: Maximaler Feuchtigkeitswert
description: Schwellenwert für zu hohe Luftfeuchtigkeit.
default: 60
selector:
number:
min: 0
max: 100
unit_of_measurement: “%”
notify_device:
name: Benachrichtigungsgerät
description: Das Gerät, auf dem Benachrichtigungen empfangen werden sollen.
selector:
device:
integration: mobile_app
message_low:
name: Nachricht bei zu niedriger Feuchtigkeit
description: Nachricht bei zu niedriger Feuchtigkeit.
default: “Warnung: Die Luftfeuchtigkeit von {{ trigger.entity_id }} ist zu niedrig!”
message_high:
name: Nachricht bei zu hoher Feuchtigkeit
description: Nachricht bei zu hoher Feuchtigkeit.
default: “Warnung: Die Luftfeuchtigkeit von {{ trigger.entity_id }} ist zu hoch!”

trigger:

  • platform: state
    entity_id: !input humidity_sensors

condition:

action:

  • choose:
    • conditions:
      • condition: numeric_state
        entity_id: “{{ trigger.entity_id }}”
        below: !input min_humidity
        sequence:
      • service: notify.mobile_app_{{ notify_device }}
        data:
        message: !input message_low
    • conditions:
      • condition: numeric_state
        entity_id: “{{ trigger.entity_id }}”
        above: !input max_humidity
        sequence:
      • service: notify.mobile_app_{{ notify_device }}
        data:
        message: !input message_high

Hello everyone, I need your help please.
I have created a blueprint with ChatGPT that sends me a message when the humidity falls below or rises above a certain value.
Unfortunately it doesn’t work, so please help
Here is my attempt:

type or paste code here

blueprint:
name: Feuchtigkeit Benachrichtigung (Alle Sensoren)
description: Sendet eine Benachrichtigung, wenn die Luftfeuchtigkeit eines Sensors zu hoch oder zu niedrig ist.
domain: automation
input:
humidity_sensors:
name: Feuchtigkeitssensoren
description: Wähle alle Feuchtigkeitssensoren aus, die überwacht werden sollen.
selector:
target:
entity:
domain: sensor
device_class: humidity
min_humidity:
name: Minimaler Feuchtigkeitswert
description: Schwellenwert für zu geringe Luftfeuchtigkeit.
default: 30
selector:
number:
min: 0
max: 100
unit_of_measurement: “%”
max_humidity:
name: Maximaler Feuchtigkeitswert
description: Schwellenwert für zu hohe Luftfeuchtigkeit.
default: 60
selector:
number:
min: 0
max: 100
unit_of_measurement: “%”
notify_device:
name: Benachrichtigungsgerät
description: Das Gerät, auf dem Benachrichtigungen empfangen werden sollen.
selector:
device:
integration: mobile_app
message_low:
name: Nachricht bei zu niedriger Feuchtigkeit
description: Nachricht bei zu niedriger Feuchtigkeit.
default: “Warnung: Die Luftfeuchtigkeit von {{ trigger.entity_id }} ist zu niedrig!”
message_high:
name: Nachricht bei zu hoher Feuchtigkeit
description: Nachricht bei zu hoher Feuchtigkeit.
default: “Warnung: Die Luftfeuchtigkeit von {{ trigger.entity_id }} ist zu hoch!”

trigger:

  • platform: state
    entity_id: !input humidity_sensors

condition:

action:

  • choose:
    • conditions:
      • condition: numeric_state
        entity_id: “{{ trigger.entity_id }}”
        below: !input min_humidity
        sequence:
      • service: notify.mobile_app_{{ notify_device }}
        data:
        message: !input message_low
    • conditions:
      • condition: numeric_state
        entity_id: “{{ trigger.entity_id }}”
        above: !input max_humidity
        sequence:
      • service: notify.mobile_app_{{ notify_device }}
        data:
        message: !input message_high

Hi @Thiedsche, welcome to the forum!
We don’t have a magic ball that tells us what your issue is…

Please follow Questions Guideline #11 by formatting code blocks properly including proper indentation. Otherwise, there is no way for us to know if issues are being caused by format issues.

ChatGPT and other LLMs are bullshit engines that are very bad at anything beyond the most basic Home Assistant configuration. They regularly fail to correctly configure even the simplest automations.

Issues in the posted blueprint:

  1. I’m not completely sure, but I don’t think templates are not allowed in input definitions as you have done in the default values for the messages.

  2. The entity_id key of numeric state conditions do not accept templates. In this case you can just use !input humidity_sensors.

  3. Inputs need to be declared as script variables to be used in templates. (https://community.home-assistant.io/t/blueprints-get-your-input-value-into-a-template/720983)

  4. Be aware that the Device selector used for notify_device will return a device ID which is very unlikely to be the correct thing to append to notify.mobile_app_.

  5. Though the trigger is correctly configured, it will cause the automation to be fired every time the state or any attribute changes value, this will lead to you being flooded with notifications.

1 Like

“It doesn’t work” tells us exactly nothing. You need to be specific with what does not work.

Also the code you’ve posted is unreadable. Edit your post and mark it as a code block.


I took a picture where the error is displayed

blueprint:
  name: Feuchtigkeit Benachrichtigung (Alle Sensoren)
  description: Sendet eine Benachrichtigung, wenn die Luftfeuchtigkeit eines Sensors zu hoch oder zu niedrig ist.
  domain: automation
  input:
    humidity_sensors:
      name: Feuchtigkeitssensoren
      description: Wähle alle Feuchtigkeitssensoren aus, die überwacht werden sollen.
      selector:
        target:
          entity:
            domain: 
              - sensor
            device_class: humidity
    min_humidity:
      name: Minimaler Feuchtigkeitswert
      description: Schwellenwert für zu geringe Luftfeuchtigkeit.
      default: 30
      selector:
        number:
          min: 0
          max: 100
          unit_of_measurement: "%"
    max_humidity:
      name: Maximaler Feuchtigkeitswert
      description: Schwellenwert für zu hohe Luftfeuchtigkeit.
      default: 60
      selector:
        number:
          min: 0
          max: 100
          unit_of_measurement: "%"
    notify_device:
      name: Benachrichtigungsgerät
      description: Das Gerät, auf dem Benachrichtigungen empfangen werden sollen.
      selector:
        device:
          integration: mobile_app
    message_low:
      name: Nachricht bei zu niedriger Feuchtigkeit
      description: Nachricht bei zu niedriger Feuchtigkeit.
      default: "Warnung: Die Luftfeuchtigkeit von {{ trigger.entity_id }} ist zu niedrig!"
    message_high:
      name: Nachricht bei zu hoher Feuchtigkeit
      description: Nachricht bei zu hoher Feuchtigkeit.
      default: "Warnung: Die Luftfeuchtigkeit von {{ trigger.entity_id }} ist zu hoch!"
trigger:
  - platform: state
    entity_id: !input humidity_sensors

condition: []

action:
  - choose:
      - conditions:
          - condition: numeric_state
            entity_id: "{{ trigger.entity_id }}"
            below: !input min_humidity
        sequence:
          - service: notify.mobile_app_{{ notify_device }}
            data:
              message: !input message_low
      - conditions:
          - condition: numeric_state
            entity_id: "{{ trigger.entity_id }}"
            above: !input max_humidity
        sequence:
          - service: notify.mobile_app_{{ notify_device }}
            data:
              message: !input message_high

You didn’t address any of the issues pointed out in my previous post. The error message displayed in the attached screenshot is issue #2 in my previous post.

sorry that I don’t understand you exactly, because I personally don’t speak English and always have to translate everything first

Greetings Thiedsche,

So the right way to write a Blueprint, (well let’s call it best practice and the method suggested in the docs), is to write an automation or script that does a simplified version of that you want first, then add the blueprint magic sauce. Getting the logic working is not always easy, and becomes obfuscated in all that variable substitution stuff, making everything frustrating.

Get what you want working, then make the blueprint out of that by adding the !inputs and variables and such. Try to avoid device triggers and selectors. You can make them work, but people tend to struggle with those when dealing with them outside of the GUI editor context.

Using an AI to write it for you wastes your time and ours. Make a flow chart, write an automation (using entities not device_id’s) and get that to work. Then convert it to a blueprint if you desire. Ask us questions about what you are having problems with, not on what fantasy code was written by an AI.