Button for motion sensor


Currently I have a motion sensor in the mailbox, to let me know when mail has been delivered. I would have liked to have made a button that tells me whether there is mail or not, based on the motion sensor. If it has a certain color, it means that motion has been detected. How do I go about this? Examples are welcome.
With kind regards, Sven

Hi Sven,
Before providing examples.
What type of motion sensor do you have? Is it integrated into HA?
What do you mean by ”it has a certain color”?
Regards Mats

I installed a Eufy Motion sensor in the mailbox. I would like, for example, that the button turns red when a movement is detected and this color remains until the mailbox is emptied. For example, by clicking on the button, turns off the color again. This way, family members can indicate that they have emptied the mailbox.

Ok, some follow on questions:
And the motion sensor is integrated into Home Assistant? What type of button do you mean, a physical or one in a lovelace view?

Yes the Motion sensor is integrated and I would like a lovelace view

Seems very simple. Create a binary helper called ”mail”.
Create an automation that trigger on motion that sets the helper to ”on”:

alias: You got mail
description: ""
  - platform: state
      - binary_your_motion_sensor
    from: "off"
    to: "on"
condition: []
  - service: input_boolean.turn_on
    data: {}
      entity_id: input_boolean.mail
mode: single

Assuming the state of the sensor changes between ”off” and ”on”
Replace the binary_your_motion_sensor with entity_id of your sensor.

Create a simple button in lovelace, using the state of the helper ”mail”:

show_name: true
show_icon: true
type: button
  action: toggle
entity: input_boolean.mail
name: Mail
1 Like

That’s it! It works! Thanks a lot!


1 Like