Blueprints not sending notifications

Calm down, I’m not behind my pc 24/7. Think I’m even in another time zone as well. The good thing about this kind of platform is that you can answer when you have time. Else it would be better to do live chat.

It’s about the ‘Battery level notification’ and ‘Entity unavailable notification’

Tried with empty message field, which should give a default message, as well as with a modified message.

In my case even manual execution doesn’t work.

My apologies I thought the 1st response was from you. anyway, no one is going to diagnose without the info :wink:

I mentioned two blueprints. Non of my notifiers work with it. iPhone, Whatsapp, Telegram, whatever.

Don’t know what more information I can give.

Links to those blueprints…

Error logs…

Hope this helps

2020-12-16 16:15:18 ERROR (MainThread) [homeassistant.components.automation.battery_level_notification] Error rendering variables: UndefinedError: ‘trigger’ is undefined

You get that when you manually execute automations that use the trigger context in the action, that is expected.

You should rather modify the state of the entity it listens to under /developer-tools/states

Thanks. That seems to work. Never experienced anything like this in other automations.

Solved

This is the automation that was made from the blueprint:

- id: '1608108681796'
  alias: Zone Notification test
  description: ''
  use_blueprint:
    path: homeassistant/notify_leaving_zone.yaml
    input:
      person_entity: person.jacqui
      zone_entity: zone.home
      notify_device: 7a19d15b040a11eb96ed4feaa5f55cff

There’s nothing in the error logs - it doesn’t look like it triggered, yet person.jacqui’s state went from home to not_home.

I don’t know what blueprint this is for, but I suspect that the problem here is using a ‘notify device’ rather than a notify service.

This is one of the two blueprints that shipped with core 2020.12.0.

Can you paste it?

blueprint:
  name: Zone Notification
  description: Send a notification to a device when a person leaves a specific zone.
  domain: automation
  source_url: https://github.com/home-assistant/core/blob/295b1a91c3017258b2743f951e2d2bdb2a5690da/homeassistant/components/automation/blueprints/notify_leaving_zone.yaml
  input:
    person_entity:
      name: Person
      selector:
        entity:
          domain: person
    zone_entity:
      name: Zone
      selector:
        entity:
          domain: zone
    notify_device:
      name: Device to notify
      description: Device needs to run the official Home Assistant app to receive notifications.
      selector:
        device:
          integration: mobile_app

trigger:
  platform: state
  entity_id: !input person_entity

variables:
  zone_entity: !input zone_entity
  # This is the state of the person when it's in this zone.
  zone_state: "{{ states[zone_entity].name }}"
  person_entity: !input person_entity
  person_name: "{{ states[person_entity].name }}"

condition:
  condition: template
  value_template: "{{ trigger.from_state.state == zone_state and trigger.to_state.state != zone_state }}"

action:
  domain: mobile_app
  type: notify
  device_id: !input notify_device
  message: "{{ person_name }} has left {{ zone_state }}"

I still haven’t quite got my head around the selectors, but try changing the blueprint to this…

blueprint:
  name: Zone Notification
  description: Send a notification to a device when a person leaves a specific zone.
  domain: automation
  source_url: https://github.com/home-assistant/core/blob/295b1a91c3017258b2743f951e2d2bdb2a5690da/homeassistant/components/automation/blueprints/notify_leaving_zone.yaml
  input:
    person_entity:
      name: Person
      selector:
        entity:
          domain: person
    zone_entity:
      name: Zone
      selector:
        entity:
          domain: zone
    notify_device:
      name: Device to notify
      description: Device needs to run the official Home Assistant app to receive notifications.
      selector:
        service:
          domain: notify

trigger:
  platform: state
  entity_id: !input person_entity

variables:
  zone_entity: !input zone_entity
  # This is the state of the person when it's in this zone.
  zone_state: "{{ states[zone_entity].name }}"
  person_entity: !input person_entity
  person_name: "{{ states[person_entity].name }}"

condition:
  condition: template
  value_template: "{{ trigger.from_state.state == zone_state and trigger.to_state.state != zone_state }}"

action:
  service: !input notify_device
  data:
    message: "{{ person_name }} has left {{ zone_state }}"

… and the automation to this…

- id: '1608108681796'
  alias: Zone Notification test
  description: ''
  use_blueprint:
    path: homeassistant/notify_leaving_zone.yaml
    input:
      person_entity: person.jacqui
      zone_entity: zone.home
      notify_device: YOUR NOTIFY SERVICE ( notify.mobile_app_pixel_4 or whatever) 

Reload automations, see if any errors, if not trigger it (not manually, with an actual state change) and see if it works.

If it does, see if you get the correct selectors in the ui for creating an automation from the modified blueprint.

Thanks, I’ll give that a go when I have the opportunity.

My real point here is that one of the two blueprints that shipped with 2020-12.0 doesn’t seem to be working as expected.

1 Like

I have the same issue, but it seems that this issue is only when you use zone.home. For every other zone notify_leaving_zone.yaml and notify_entering_zone.yaml the templates are working.

2 Likes

Hi, I’m trying to use the blueprint project you did to notify to telegram but it doesn’t works.
I’m trying to monitor the spathiphyllum_ble Battery (72 %)
Do you know why?
Can you help me please?


UPDATE!!!
In my opinion the problem are in the quotes!
The field “message”, in the service notify.telegram, doesn’t work if it contain quotes.
message: test WORKS
message: ‘test’ DOESN’T WORKS

So that
message: ‘{{sensors}}’ DOESN’T WORKS

Any suggestions???

Take out the quotes

I’ve tried but it doesn’t works

SOLVED

message: ‘{{sensors|replace(’’_’’,’’ ‘’)}}’

1 Like