Is there a tutorial?

i’ve used home assistant for a while now, and i feel like i’m barely scratching the surface of what it can do. is there a tutorial or a reference manual i can use to learn about all the different trigger types and action types, what they are good for and how to use them?

for example, i want to trigger an automation every time an entity (like lightning distance) changes, not just when it crosses a threshold. is that possible? if so, how?

Everything you have requested is found in the official documentation. For example, here’s the section describing Triggers.

State Trigger

I find the glossary is often a good jumping off point.

There’s also an unofficial index.

as i said in the OP, i want to trigger an automation when lightning is detected. the problem is, i CAN’T get it to work. either i get tons of error messages (but no indication where the error is) or it just WILL NOT trigger. i don’t know enough about home assistant to figure out what i’m doing wrong. can someone point me in the right direction?

Your original question has been answered; use a State Trigger.

Your follow-up post indicates you have already attempted but failed to create a functional automation. Post the automation in YAML format (refer to guideline 11 in the FAQ).

ok, i’ve created a new automation using the state trigger. let’s see if it triggers…

it did. so now (i think) i can take it from here. thanks.

i’ve run into another problem: the trigger works, and so does the condition. BUT it does not set the input number.

here’s the action:

  - service: input_number.set_value
        "[object Object]": null            <- this is where the sensor value (sensor.blitzortung_lightning_distance) should go, but when i save the automation, it resets to this line :-(  what am i doing wrong?
      entity_id: input_number.minimum_lightning_distance

You must use a template in order to supply the value option with the state value of the entity called sensor.blitzortung_lightning_distance.

  - service: input_number.set_value
      value: "{{ states('sensor.blitzortung_lightning_distance') }}"
      entity_id: input_number.minimum_lightning_distance

Templating - States

i’ll try that, thanks. but right now i can’t test it because all the thunderstorms within 1000 km have disappeared.

You can simulate it by going to Developer Tools > States, selecting sensor.blitzortung_lightning_distance, enter a new value for the sensor’s state and then click the Set State button. Effectively, you are forcing the sensor’s value to change. The sensor’s new value will cause your automation to be triggered.

  • While you are performing the test, the sensor’s value may be changed by its underlying integration.
  • After you have finished testing the automation, you may need to set the sensor’s value back to its original value (unless the sensor’s integration has already done it).

I provided another user with similar instructions here: