New alert feature, problem in configuration

sometimes I think is all crap … temperature went down and notify did not notify, and I don’t know why in the hell is that

17-02-12 18:11:55 WARNING (MainThread) [homeassistant.core] Unable to find service notify/notify.push_html5

The example documentation doesn’t use the notify. prefix. Have you tried just notifiers: push_html5?

will try that.

Could be that I have an automation and this alert, triggered by the same event, and both the same notify.push_html5?

Because both failed: automation and alert.

Now I changed automation to pushbullet, and alert to your suggestion

if they would ask me 2 words to describe home assistant I would use: cool and unreliable

It’s not yet at version 1, and you’re using a feature that’s only just been released, of course you can expect some rough edges.

That said, I’ve never found it unreliable. Tricky to get working, sometimes :wink:

Now, the alerts work perfectly for me, here’s my notification and alert settings, both in separate files using includes:

# Notifications via Pushover
- name: pushover
  platform: pushover
  api_key: API_KEY
  user_key: USER_KEY

And then the alert:

garage_door:
  name: Garage is open
  entity_id: binary_sensor.garage_sensor_12_0
  state: 'on'
  repeat: 10
  can_acknowledge: True
  skip_first: True
  notifiers:
    - pushover

Maybe if you posted your automations and alerts, correctly formatted, somebody might be able to help you.

You can try this:

alert:
first_alert:
name: One
entity_id: abc

second_alert:
name: Two
entity_id: xyz

1 Like

will try, which indentation?

you have one alert only? If multiple, how do you do?

The simplest way to find these things out is to try it :wink: That’s all I do.

The following doesn’t generate errors, and I assume if I had a sensor on my front door it’d generate alerts.

garage_door:
  name: Garage is open
  entity_id: binary_sensor.garage_sensor_11_0
  state: 'on'
  repeat: 10
  can_acknowledge: True
  skip_first: True
  notifiers:
    - pushover
front_door:
  name: Front door is open
  entity_id: binary_sensor.front_door_sensor_12_0
  state: 'on'
  repeat: 10
  can_acknowledge: True
  skip_first: True
  notifiers:
    - pushover

Adding more just requires following the same structure.

what would be the code for an alert if a light stays ON too long (above XX minutes)?

You may want to read the fine documentation. It provides an example of how to use a template to do what you’re after (see Complex Alert Criteria).

I don’t get it, the example is of a battery level below a certain threshold

You need to create your own binary sensor that returns on or off for the light (replace switch.my_light_1_0 with the actual entity):

binary_sensor:
  - platform: template
    sensors:
      my_light:
        value_template: '{{ states.switch.my_light_1_0 = on }}'
        friendly_name: 'My light is on'

Then use that new binary sensor (binary_sensor.my_light) in the alert:

alert:
  light_on:
    - name: The light is on
      entity_id: binary_sensor.my_light
      repeat: XX
      skip_first: True
      can_acknowledge: True
      notifiers:
        - your_phone

You might find that just using the switch.my_light_1_0 entity works.

mmhhh all my lights are
light.name_of_light

not switch.name_of_light

So?

Just use light.name_of_light then :wink:

For creating multiple alert in conifguration.yaml.
It’s working fine and appearing multiple instance. There is no need to put “-” on the front.

In configuration.yaml

alert: !include alert.yaml

Then in alert.yaml

first_alert:
name: One
entity_id: abc

second_alert:
name: Two
entity_id: xyz

I’ve set up this component. While I can get the fist alert it doesn’t appear that the repeat option works in my configuration.

alert:
  light_still_on:
    name: light
    entity_id: light.his_lamp
    state: 'on'
    repeat: 5
    can_acknowledge: True
    skip_first: False
    notifiers:
      - pushover
      - iphone_7_plus

Here is the alert i’m getting.

17-02-18 03:03:14 ERROR (MainThread) [homeassistant.bootstrap] Invalid config for [alert]: required key not provided @ data['alert']['light_still_on']['name']. Got None. (See /home/hass/.homeassistant/configuration.yaml, line 315). Please check the docs at https://home-assistant.io/components/alert/

What version number of HA are you running?

Have you tried with a longer name, or one in quotes? It could be that light is a reserved name when used that way.

@Tinkerer I’m running .38.3. I changed the code to a binary sensor thinking the issue was with the light but i’m still seeing the same results. I’ve also noticed that i’m getting notification roughly every 5 hours instead of 5 minutes.

Since this is a duplicate of your other thread, I’ll respond over there.