How to program this automation:entrance door

I have an entrance (inside the house ) which is a bit dark.

The goal is

  • when entering home turning the light on (at night)
  • when exiting home turning the light off (if was on)

Preferably not using presence detection (mine is not reliable ) .But using door sensor, PIR sensor .

Ideas?

Main problem I see is to understand the difference between going in and going out

You can use 2 pir sensors, one outside the door, another one inside, and use conditions like if one was active when the other activates.
EDIT: Take a look at Fibaro’s counting people example here to make an idea of what I’m talking about.

1 Like

Perhaps the easiest way to go is to create a 2 scenes (indour and outdoor) which trigger by your PIR

Mmhh can you explain more. Sorry dumb newb here

I have xiaomi PIR sensor, and they are great, but I understand that once triggered, the next trigger will be recognizes only after 60 seconds. Is for all PIR so?

If not can you recommend which PIR to get (hopefully not too expensive) .

p.s. additional problem: in entrance (outside) I have 2 large dogs (yeah, don’t ask me why …) but I guess the PIR sensor can be put “higher”

Never compiled a scene before myself (just started with HA 3 weeks ago) but i’ll give it a try:

scenes:

scene:
  - name: Entering
    entities:
      light.entrance: on
        brightness: 125
        rgb_color: [255, 255, 255]
  - name: Leaving
    entities:
      light.entrance: off 

automation when entering:

  trigger:
    platform: switch
    entity_id: switch.pir_entrance
    state: on
### I'm not sure about the switch trigger syntax, my 433 mhz door sensors should be delivered today so I can test :slight_smile: 
  condition: and
    conditions:
    - condition: sun
      after: sunset
      after_offset: "-0:20:00"
    - condition: state
      entity_id: scene.Leaving
      state: on
  action:
    service: scene.turn_on
    entity_id: scene.Entering

automation when leaving:

  trigger:
    platform: switch
    entity_id: switch.pir_entrance
    state: on
### I'm not sure about the switch trigger syntax, my 433 mhz door sensors should be delivered today so I can test :slight_smile: 
  condition: and
    conditions:
    - condition: sun
      after: sunrise
      after_offset: "0:20:00"
    - condition: state
      entity_id: scene.Entering
      state: on
  action:
    service: scene.turn_on
    entity_id: scene.Leaving
1 Like

Hey! Thanks a lot for you time, I really appreciate.

The possibilites are:
ENTERING
The outside trigger changes state from OFF to ON, AND, is SUNSET, AND the inside trigger goes from OFF to ON … ACTION turn ON the light. Fine

EXITING
The inside trigger changes state from OFF to ON, AND, is SUNSET, AND the outside trigger goes from OFF to ON … ACTION turn OFF the light, Fine

MOVEMENT OUTSIDE (NOT ENTERING)
The internal light will not change state. Fine

MOVEMENT INSIDE (NOT EXITING)
The internal light will change state from OFF to ON (will need another automation including SUNSET trigger). FIne

AM I all set?

very cool link. Basically it says that TWO sensors are needed, and both need to have a 1 second maximum settings.

That’s for the Fibaro thing, but you can use it as a start. Unless you enter and exit in 10 seconds…you can use that idea to use it at your setup.

yes yes, of course. The Fibaro example is for an indoor door (like kitchen/living), and there the triggering can be more often then an entrance door (I think)