#Yaml not triggered

163 messages · Page 1 of 1 (latest)

brittle apex
#

https://pastebin.com/ecsfmjYc
I am trying to understand why the automation does not just trigger when it needs to.

Intention is to be notified when either internet source goes down. The sensor pings the ip. The down notifications should repeat every 15 minutes. I also want to be notified when internet returns but only once.

#

Yaml not triggered

bitter widget
#

Did you check the trace?

brittle apex
#

Trace of what?

#

Traces you mean.

#

Maybe my use of the notification is incorrect. Should it not be part of the notifications area?

random karmaBOT
#

To test an automation there's three stages you can follow. Testing the action, the condition and action, and the whole automation:

  1. Use Configuration -> Automations to find the automation and then select Run in the three dots menu. If this fails your problem is in the action: section, and details should be found in your log file
  2. Use Developer tools -> Services and call automation.trigger on the automation with skip_condition: false. If the first passes but this fails then the problem is in your condition: block
  3. Use Developer tools -> States to find the trigger entity, click the name, then change the state (at the top) to something that'll trigger the automation before pushing Set State. If this fails then the problem is with your trigger: section, or the automation is turned off (you can check that in Automations, automations that are turned off will show Disabled)

You can also see this section in the docs about testing and automation traces.

wicked widget
#

The trace of the automation ☝️

brittle apex
#

Oh, that can run.

#

I have problem with the trigger.

#

Any time I run it, I get notifications on my watch.

#

This is not the intended normal behaviour. It should be looking at state changes.

wicked widget
#

And ... what does the trace show?

brittle apex
#

It would be easier for me if I knew which tab you wished?

wicked widget
#

it's called a trace

#

The bot message has a link that explains them

brittle apex
#

I am on the page.

#

Yes.

#

I am on the page.

wicked widget
#

Great, so find one that didn't work

brittle apex
wicked widget
#

You need an actual run, not a manual one

brittle apex
#

Alright.

#

I am having an information overload here.

#

I have so many options in so many places.

#

You are looking for something specific.

#

I am stuck at step 2.

#

There is no "services" tab or link that I can find.

random karmaBOT
#

To test an automation there's three stages you can follow. Testing the action, the condition and action, and the whole automation:

  1. Use Configuration -> Automations to find the automation and then select Run in the three dots menu. If this fails your problem is in the action: section, and details should be found in your log file
  2. Use Developer tools -> Services and call automation.trigger on the automation with skip_condition: false. If the first passes but this fails then the problem is in your condition: block
  3. Use Developer tools -> States to find the trigger entity, click the name, then change the state (at the top) to something that'll trigger the automation before pushing Set State. If this fails then the problem is with your trigger: section, or the automation is turned off (you can check that in Automations, automations that are turned off will show Disabled)

You can also see this section in the docs about testing and automation traces.

wicked widget
#

Let's go with the basics, do those tests

#

Services is now Actions - the bot message needs changed

brittle apex
#

Alright.

#

You can understand why I got stuck though. 🙂

#

So when I trigger the automation, I get notified and I normally should not be.

#

My YAML does not properly address this, I know.

#

Is there a way to make the triggers on change of state?

#

From anything other than present to Connected (on) or Disconnected (off)

bitter widget
#

If the triggers aren’t firing on state, that means the sensors aren’t changing. You can validate this by changing the state of the entity manually in developer tools > states.

brittle apex
#

It is a Ping (ICMP) sensor.

#

(I really hate the 12H time)

bitter widget
#

Hmmmmm interesting. And the trace isn’t showing them firing on that state change?

#

You can change the time display in your user settings.

brittle apex
#

Much better, the date ignored it though.

brittle apex
#

I am looking at this.

bitter widget
#

Yeah, but that’s a manual trace (you used the Run command that ignores conditions and triggers).

brittle apex
#

This one?

bitter widget
#

Go into dev tools > states, find one of the entities and manually switch it to “on” or “off” (using set state) and then see if there’s a trace for the automation.

bitter widget
# brittle apex This one?

Same thing. That’s basically the same as the Run command. It ignores triggers and conditions and just runs the actions of the automation.

brittle apex
#

Sure. I found the state and set it to off.

#

One thing that does not happen which makes this more frustrating is the notifications do not end up under notitficatoins. I just get push notifications on my smart watch and phone.

bitter widget
#

Are you sure the entity ids in your automation match the entity id defined from the ping integration?

brittle apex
#

I certainly want that but also in notificaitons.

bitter widget
#

You would need to use persistent_notification.create for that. Or the notifier, either or.

#

notify.notify should not be used. It can produce wonky results.

brittle apex
#

Alright. Should I replace it with this one? I am not sure of the Yaml syntax so I probably should use the UI.

bitter widget
#

Yeah, just use the UI until you learn the YAML syntax. You can always use the Edit in YAML menu to read what the UI generates.

#

Plus, it’ll also ensure that your triggers are correct and pointing to the proper entities. Just don’t use device triggers, conditions or actions.

brittle apex
#

Oh, just swap notify with persistent_notification. 😄

bitter widget
#

Or use notify.persistent_notification (I think that’s the action call).

brittle apex
brittle apex
bitter widget
#

Yup. Use that.

brittle apex
#

My Yaml has a 15 minute delay. Could this be the source of my problem.

#

I kind of do not want to be notified every minute.

#

But I want to check every minute.

bitter widget
#

And if you want to send to your phone: notify.mobile_app_[your device].

brittle apex
#

Ya, I want to notify everything when I do.

bitter widget
#

Yeah. If you are testing, remove the delay.

bitter widget
random karmaBOT
bitter widget
#

Look at the notify section in the docs.

brittle apex
#

I really would appreciate how I should structure this. The documentation is overwhelming for someone's first time.

bitter widget
#

You’re already mostly there, tbh. I suspect it’s the entity ids aren’t correct and that’s why you aren’t getting the triggers.

brittle apex
#

I know this is a lot to ask and I realise it is essentially spoon feeding. I am trying to understand a few key things.

#

First off... Is my 15 minute delay the way this should be?

#

It is meant to serve as a throttle once the action is taken.

#

Would it wait 15 minutes if none of the actions are triggered.

#

At the moment option 3 and 4 are triggered even though they really should not be.

bitter widget
#

Hold on, I think we can clean that up a lot.

brittle apex
#

Sure. I would appreicate that.

bitter widget
#

Note: I couldn't test this as the power is out at my house and my HA is down. lol

#

Regarding the 15 minute delay. You could do it that way, but that means that when the sensors flip back to on from off (or off from on), the automation will be blocked in that 15 minute window. 2 things you could do is change the mode: single to mode: restart. That will restart the automation when the sensor(s) change.

#

The other thing you could do is hold the state. What that means is only notifiy you of a change after the sensors have been down for 15 minutes. You could change the automation to alert both on the initial change AND after 15 minutes as well. Just depends on how you want the notifications and how often really.

bitter widget
#

lol I WISH. I want to play with the beta today and it's not looking like I'll be able to do that because tropical storms want to ruin my day.

brittle apex
#

The timer is intended to limit me recieving the same message more thaan once in 15 minutes.

bitter widget
#

Even if the internet gets restored in that 15 minutes?

brittle apex
brittle apex
#

My internet should never be off.

bitter widget
#

So, internet goes down, then 6 minutes later the internet comes back up. You don't want both of those notifications?

brittle apex
#

I do want both, yes.

#

I am interested in state change.

bitter widget
bitter widget
brittle apex
#

But what I do not want is more than one message that it is down. in the 15 minute bracket.

#

If it is down and the status does not change in 15 minutes, that is fine.

bitter widget
#

Ah, gotcha. Well, you shouldn't get a notification unless the state changes anyhow, so unless it's like a "up->down->up->down" type of thing, you should only see a notification for each sensor once.

brittle apex
#

Alright.

#

I think it is working now. The restart change made a huge difference.

#

I can turn off the router to induce the thing.

#

Let me do that.

bitter widget
#

Ok.

brittle apex
#
Proximus uptime was disconnected
18:23:51 - In 1 second
Proximus uptime was connected
18:22:04 - 2 minutes ago
Proximus uptime was disconnected
18:21:54 - 2 minutes ago
Proximus uptime was connected
17:56:00 - 28 minutes ago
Proximus uptime was disconnected
17:55:48 - 28 minutes ago
Proximus uptime was connected
17:54:52 - 29 minutes ago```
#

And, I got a notification. A bit late though.

#

I think I need to increase the ping from 1 every 60 seconds to something like one every 15 seconds.

bitter widget
#

I would recommend against doing that. You're doing nothing but saturating the device at that point.

brittle apex
#

Seems like math. 😄

bitter widget
#

amazing how one word changes the whole intent. lol

brittle apex
#

It is spamming me now.

bitter widget
#

Is the delay in there?

#

I removed from my paste.

brittle apex
#

I did not remove it since I just made one minor modification you suggested.

#

Let me better integrate your paste to what I have.

bitter widget
#

What sucks is that I have the automation for exactly what you want to do and it's stuck on a powered off machine. lol

brittle apex
#

So this would be triggered even if either one of the binary sensors changed, right?

bitter widget
#

Yup

brittle apex
bitter widget
#

lmao yeah, that wouldn't work. PoE = Power over email? lol

brittle apex
#

Hey, at least conspiracy theorists are plaming HAARP already.

#

If they have insane ideas, why cannot I? 😄

#

The persistant notificaiton is fine and all but I would want the push notificaiotn as well.

bitter widget
#

Is your mobile setup with the companion app?

brittle apex
#

Yes.

#

Everything is there.

#

All I need to do is use notify.notify in conjunction with persistent one. I wonder if I can do this more elegantly?

bitter widget
#

Ok, so then use the notify.mobile_app_[your_device] action. Replace [your_device] with the actual name.

brittle apex
#

How would I do that? I would truly appreciate this.

bitter widget
#
notify:
  - platform: group
    name: "Everything"
    services:
      - action: persistent_notification
      - action: [your_device]
      - action: [your_second_device]
brittle apex
#

😮

bitter widget
#

Did you read the docs I just linked?

brittle apex
#

I am reading but I am trying to figure out how to add members.

bitter widget
brittle apex
#

Ah.

#

I am unsure how to add them that way. Let me prod it a little.

bitter widget
#

You'll need to add the group(s) to your configuration.yaml and then restart HA.

brittle apex
#

Oh...

#

The truly old fashioned way.

#

Would it be better to use a different yaml and import that in config?

bitter widget
#

You could do that if you choose to, sure.

brittle apex
#

I am going to do that later today.

#

I am experiencing a harrowing experience with two addons.

#

I labe Let's Encrypt and Adnanced ssh web terminal shutting itself off.

#

I am unsure how to diagnose them.

#

Let's encrypt problem caused me significant stress yesterday since my UI stopped working completely.

#

Turns out my certificate expired.

#

Is it meant to be off?

brittle apex
#

How would I find the device name for that group?

#

I put this in configuraiton.yaml

notify: groups.yaml

And this as groups.yaml:

  • platform: group
    name: "Everything"
    services:
    • action: persistent_notification

Is this the correct syntax?