Motion sensor recommendation

I am very happy with the Xiaomi PIR as well. Good sensor with fast response time. And the battery seems to last very long.

I created a timer on HA so every time my Xiaomi is detecting movement it is turning on the lights and starts a countdown timer. The timer can be set to any interval so you can save on the light :slight_smile:)

My problem still to solve is when i return on the stairs area just before the timer goes to 0. The HA is not setting the timer to my standard 60 seconds so I will be in the dark if I am passing the sensor just before the light turning off.

The WirelessTag PIR worked very reliably for me. Unfortunately, the Tag Manager didn’t last long - poor build quality it seems. So this is a not-recommendation from me.

That is why I just trigger on on/off signal (movement detected, no movement). It takes cca 1 minute for Xiaomi to go from detected to no movement, but that way I avoid the problem you have. And it’s easier to handle power bill for a few minutes of low power LED lamps that wife walking down the stairways in the dark:)

1 Like

Well if that’s the case, then go for it and report back:) Shelly sense would be quite expensive for me, since I need 10-15 motion sensors and only motion sensors, so Xiaomi is the way for me.

Just to follow up on then. When movement is detected, a MQTT message is sent telling HA that he detected movement and that the current illumination is so and so. So when the automation runs, it already has all the latest data, so everything works. This is fine by me. But if you want to have constant illumination report, then Xiaomi sensor is not a good choice.

Well I need 4 and have much need for the temp sensor as trigger for the heating. Then I try to only use wifi devices where possible for stability

Thank you. However, you have the same problem if you pass by the PIR in the first minute … since it is not going to see you once triggered … Or I did not understand well?

The motion sensor will still see you during that minute, it simply resets the 1 minute timer so it will still be telling HA that it has detected motion, then 1 minute after the motion stops it sends a ‘no-motion’ status to HA

If you’re having problems with the automation side of things, check out my motion lighting component:

It is now a home assistant component (appdaemon not required)

2 Likes

Very cool, finally!

Is this coming with 0.85?

Maybe in the future :slight_smile:

To use it now we need to put 1 file (lithingsf.py) under custom_component and that’s it, or more files are needed?

Put the file in custom_component
This in configuration

lightingsm:
motion_light:
sensor: binary_sensor.pir_entrance2
entity: light.table_lamp

2019-01-05 14:53:10 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/homeassistant/setup.py", line 56, in async_setup_component
return await task # type: ignore
File "/usr/local/lib/python3.6/site-packages/homeassistant/setup.py", line 103, in _async_setup_component
component = loader.get_component(hass, domain)
File "/usr/local/lib/python3.6/site-packages/homeassistant/loader.py", line 92, in get_component
module = importlib.import_module(path)
File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 674, in exec_module
File "<frozen importlib._bootstrap_external>", line 781, in get_code
File "<frozen importlib._bootstrap_external>", line 741, in source_to_code
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/config/custom_components/lightingsm.py", line 7
<!DOCTYPE html>
^
SyntaxError: invalid syntax

Use the file under custom_components folder on GitHub. There are no html tags in that file. Not sure what you copied.

Ahhh ops, I was downloading the file from my smartphone, still do not know how to correctly downloa/copy file from github and uploading to /config using my smartphone

Use a computer and click on the raw button on GitHub.

1 Like

Cool it works fine, I like the new entity_id created.

Now will need to see how to differently program it with the different PIR sensor I have

  • motion sensor 433MHz simple, (I think sending one state ON only)
  • motion sensor xiaomi zigbee (sending ON and then OFF after 60s not programmable)
  • motion sensor coolcam zwave (sending ON and then OFF after XXs programmable)
  • door sensor xiaomi zigbee (sending on and off at event change)

Sure, but sometimes I do not have a computer at hand, and wish to use my phone insead

Just tested with a 433 motion sensor. Works fine, but after a second trigger the expires_at and reset_at are correctly updated, but the last_triggered_at stays the same, is it intended?

Very cool app, I think with the right settings no more lights off when people are in a room!

sensor_type: event
last_triggered_by: binary_sensor.pir_entrance2
last_triggered_at: 2019-01-05 15:19:07.397920
mode: day
delay: 180s
expires_at: 2019-01-05T15:24:21.549119
service_data: {
“entity_id”: “light.table_lamp”
}
reset_at: 2019-01-05T15:21:21.549024

Thanks again for the component, I am playing with it right now.

Is it possible to use also the lux sensor as trigger? I mean motion AND lux level (below a threshhold for those grey/dark days, during the day) to trigger a light

Try like this:

- alias: Motion Detection - Kitchen Light off
  trigger:
    platform: state
    entity_id: binary_sensor.motion_sensor_158d00016db13b
    to: 'off'
    for: '00:01:00' ## <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ADD THIS DELAY
  action:
    service: light.turn_off
    entity_id: light.kitchen 
1 Like