Xaiomi Motion Sensors

Hello,

I have 5 Xaiomi motion sensors

  1. Bathroom
  2. Hallway
  3. Bedroom
  4. Livingroom
  5. Diningroom/Kitchen

I’m trying to get the bathroom and hall turn on somewhere around 70% during late afternoon 3pm or so to 1:00am the at 1:01am i would like them to switch lights to a very dim “night light”

I’m having a few problems and It may be related to the dimmer switches that im using but they don’t always dim or brighten to the asked percentage. They pair with my hue hub and it sees it as a bulb.

besides that Im having a issue with after motion is detected after it stops being detected my lights turn off.
I believe there should be a way to tell it not to shut off or change in any way if maybe the Tv was on? or something that would only be on if somebody was up.
It has given me a issue in the shower turning off the lights and there I am standing naked in the shower in the dark. so I have to wait for the timeout until it finally sees motion and activates the lights again. lol

Does anybody have a example of a setup that you have that is working good? I do have the Xaiomi hub too if that makes a difference.

Thanks!

Hi,
I am doing a similar thing in my ensuite.
When motion is detected switch on the light.
If it is “night” then switch to blue and less bright.

https://github.com/Data-Monkey/Home-Assistant-Config/blob/master/includes/automations/ensuite.yaml

I have defined different “time of day” values in a separate sensor, this way I don’t have to redefine times everywhere.

  sensors:
    time_of_day:
      friendly_name: 'Time of Day'
      value_template: >-
        {% if   now().strftime("%H:%M") < "06:00" %} night
        {% elif now().strftime("%H:%M") < "09:00" %} early morning
        {% elif now().strftime("%H:%M") < "11:30" %} morning
        {% elif now().strftime("%H:%M") < "13:30" %} lunchtime
        {% elif now().strftime("%H:%M") < "16:00" %} afternoon
        {% elif now().strftime("%H:%M") < "19:00" %} evening
        {% elif now().strftime("%H:%M") < "21:00" %} late evening
        {% elif now().strftime("%H:%M") < "24:00" %} night
        {% endif %}

hope that helps

3 Likes

Sorry, I haven’t replied in a few days, I have been working alot lately.

This is what I have so far.
My goal is when switch.flower_lamp (or a different device) to keep the sensors from changing the lights if they are already on. this seems to work good, but will not turn the lights off if dimmed. Im sure theres a better way but I cant seem to figure it out.
im sure theres better logic that im not seeing.
any suggestions?

    - alias: Motion - Livingroom
      trigger:
        platform: state
        entity_id:
          - binary_sensor.motion_sensor_158d00023e32ee
          - binary_sensor.motion_sensor_158d000237550f
        to: 'on'
      action:
        - condition: state
          entity_id: switch.flower_lamp
          state: 'off'
        - service: script.turn_on
          entity_id: script.livingroom_motion_dim
        - wait_template: "{{is_state('binary_sensor.motion_sensor_158d00023e32ee', 'off')}}"
        - wait_template: "{{is_state('binary_sensor.motion_sensor_158d000237550f', 'off')}}"
        - delay: 00:00:30
        - wait_template: "{{is_state('binary_sensor.motion_sensor_158d00023e32ee', 'off')}}"
        - wait_template: "{{is_state('binary_sensor.motion_sensor_158d000237550f', 'off')}}"
        - condition: state
          entity_id: switch.flower_lamp
          state: 'on'
        - service: script.turn_on
          entity_id: script.livingroom_motion_dim_off