Postal mail delivery notification using  Hue Motion Sensor

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:

{"state":{"on":true,"bri":77,

Leave a Reply