Automation with proximity

Hello, I created a small automation: when I approach my home (less than 1000 meters), and if the public charging station for my car is available, then I receive a message on my phone.

This works for 1 (one) charging station. Now I want to add a second one. I know I can make a new automation with another Charging station in the “And if” and send an other message in the “Then do”

It works, but I think it can be done better, more simple.

This is what I have:

In YAML (which I don’t prefer, because of not enough knowledge):

> Blockquote alias: Laadpaal test
description: ""
triggers:
  - trigger: numeric_state
    entity_id:
      - device_tracker.cph2207
    below: 1000
conditions:
  - condition: state
    entity_id: sensor.zeggehof_1_purmerend
    state: Available
actions:
  - action: notify.mobile_app_gsm_peter
    metadata: {}
    data:
      title: Laadpaal
      message: Zeggehof beschikbaar
mode: single

Can it be done in 1 (one automation)? And how?
I am willing to learn, but just don’t know how to start.

Regards, Peter

There are a few ways to do what you have described.

  1. The most UI Automation Editor-friendly way is to use an Or condition in the Conditions/“And if” block. Inside the Or use a State condition for each charger sensor.
  2. Switch the State condition to edit it in YAML, you can list both sensors and use the match key:
condition: state
entity_id: 
  - sensor.zeggehof_1_purmerend 
  - sensor.zeggehof_2_purmerend
match: any
state: Available

If you want to send a specific messages based in which chargers are available, you can use a Choose action or Templating. If you need help with either of those we will need you to describe the different messages for the different cases.

1 Like

Hi Didgeridrew,

Thanks for your reply.
I changed the automation. I think it should work.
When my phone enters a zone round my house, and if at least one charger is available, I receive the corresponding message. Like in the picture.

I will test it tomorrow.