Postal mail delivery notification using  Hue Motion Sensor

Update 06/06/2024: Philips Hue now also has a contact sensor which may work better depending on your mailbox type.

Update 04/06/2024: I suddenly stopped receiving notifications, and replaced the sensor with the outdoor model. Later I found switching my Google Home Assistant to Gemini also stopped the notifications, so in hindsight that may not have been necessary. But seems a better fit as it is outdoor anyway (and will repurpose the sensor for my security system).

Update 23/01/2023: The article below is now (fortunately) out of date. Using e.g. Alexa or Google Home you can now trigger an action on Philips Hue motion activity, so there is no longer a need to poll the local API yourself.

Update 28/03/2022: I did it all wrong! There is no need (anymore?) to activate a light using the sensor and read the state. Instead you can pull the sensor state straight from the API every 10 seconds and set the result in a global variable. Using a second macro monitoring for the variable to change (indicating an activated sensor) you can trigger your action. It works great! See screenshots.

Update 15/07/2021: I decided to leave an old Android phone active in my house for automation. It is set to check the light every 4 minutes. The motion sensor is configured to revert the light to the original state after 7 minutes. MacroDroid will always catch the event, and no longer needs the LampShade plugin to switch the light off. The setup described below worked well if you monitor on your own device (which won’t always be able to access the bridge). The new setup is slightly simplified and works great with a dedicated in-house monitoring phone.

Our postal mailbox is a few meters from the house. The delivery of (snail)mail is irregular. It’s annoying to have to walk out and check if mail has been delivered or not.

So I purchased a Philips Hue Motion Sensor (battery operated), and put it inside the mailbox. Unfortunately it can only be set to trigger an action on Philips Hue lights, it cannot e.g. natively trigger notifications on a phone. It appears Alexa would allow to create a routine somehow based on the motion sensor triggering, however I have no Alexa. Google Assistant and Google Home currently do not seem to support sensor notification routines.

As workaround, you have to store the motion detection value temporarily in a light. It can be a state change (e.g. off to on), or a slight color change (not visible to the eye).

Next, I use MacroDroid on my Android phone:

  • Set the trigger: If I am connected to my home wifi, execute every 15 minutes (the Hue bridge is only accessible from the local network, and I only care about the mail when I am home)
  • Set the action: query (using MacroDroid HTTP GET) the Hue Bridge for the device light state, storing the result in a local variable. Then search the output text variable using “contains” to match the triggered state change.
  • If the state has changed, notify my phone and revert the state change (using the LampShade MacroDroid plugin).

Not very clean but it seems to work! If I empty the mailbox it will notify me again, for now I can live with that (or add an additional constraint to MacroDroid e.g. based on GPS).

FWIW since I don’t use the “dimmed” state on a light, I configured the sensor to set it in activity and MacroDroid checks the variable for:


Leave a Reply