Nmap home trigger will not work

Hi all,
I’m new to this with home automation and specially Home assistant. But now i have a slight problem with my zone script or automation that use the zone.
When i arrive home and get connected with my Wifi network my status change from Away to home. But that will not trigger the door lock. When i trigger my automation manually it works. The door locks or unlocks as it should.
EDIT: I was only allowed to upload only one picture this time. :frowning:

Why does it not work?!Automation%20yaml

It would be good to insert your code as text and format it as code - see that blue box at the very top of the page.

Even if it might not be strictly necessary, I always use lower case letters and single quotes '.
The states of the device trackers are called home and not_home.
The ‘service’ line might need to be intended another two spaces.
The ‘-’ before the entity_id is not required, neither is the one before ‘data’…

Here is an automation that works fine for me:

- alias: Actions when people come home
  trigger:
    platform: state
    entity_id: group.people
    to: 'home'
  action:
# Action 1 - Turn CPump on immediately
    - service: homeassistant.turn_on
      entity_id: switch.mplug2

P.S.:
I prefer to enter my automations in the yaml files directly rather then through the frontend - I can ensure that it’s all in the logical sequence I’m use to seeing it (alis - trigger - condition - action) rather than having it all displayed in a random order. But that might just be the German in me :wink:

2 Likes

I agree.

But then I’m part German too. So you may be on to something there. :grinning:

The trigger should be to: 'home'

All lowercase and in quotes.

@chairstacker and @finity , same for us Brits too!

Imagine that! The other half of me is British!

:laughing:

1 Like

Thank you all for your answers. I still have problem with the trigger when i’m home or away. It’s strange.
Picture 1 shows when I’m home or away, and it works. The info get HA from my router when the mobile connects to wifi network or disconnects.
I use Hass.io on a Raspberry Pi 3.
Peter%20hemma

I have tried with zone and now i try with “state”. Nothing trigger my lock. But as i wrote above, when i trigger the automation manuel it works.
So far i only use the frontend and do som small changes in yaml-file.

@anon43302295
I have tried with and without quotes but still no luck. I have changed everything to lowercase.

@chairstacker
I don’t have “entity_id: group.people” so that i can’t try.

My scrip look like this

configuration.yaml

device_tracker:

  • platform: nmap_tracker
    hosts: 192.168.1.1/24
    track_new_devices: True
    interval_seconds: 30
    consider_home: 360

Automations.yaml

  • action:
    • data:
      entity_id: lock.locked
      service: lock.unlock
      alias: Lock_Open
      condition: []
      id: ‘1523017674184’
      trigger:
    • entity_id: device_tracker.peter
      from: away
      platform: state
      to: home
  • action:
    • data:
      entity_id: lock.locked
      service: lock.lock
      alias: Lock_Close
      condition: []
      id: ‘1523031905770’
      trigger:
    • entity_id: device_tracker.peter
      from: home
      platform: state
      to: away

You forgot to format that as code, so we can see what you’ve done. Please read the big blue box at the top of every page on the forum - select your text and select </>.

I have solved the trigger problem. :slight_smile:

entity_id: device_tracker.peter
from: home
platform: state
to: not_home

It should be not_home instead of away.
Thank you for all help.