Automation Fail Safe

Hi,
No matter how good the software and hardware is there is often a failure.

Say my Xiaomi motion Sensor is set to trigger a Tuya switch to turn on.
It works 90% of the time. But sometimes it does’nt due to an update or a network issue.

Any ideas to how to force a recheck every hour and make sure the light is off when there is no movement in the motion sensor.

Sometimes my lights are still on all night because of this, any solutions?

Add a time pattern trigger (every hour) to your critical automations. They will then probably require some extra conditions too.

1 Like

Thank you.
If the following is my automation, how do i append Time pattern trigger to this?

- alias: Kitchen Lights ON
  trigger:
    platform: state
    entity_id: binary_sensor.motion_sensor_158d0002732727
    from: 'off'
    to: 'on'
  condition:
    condition: numeric_state
    entity_id: sensor.illumination_158d0002732727
    below: 10
  action:
    service: switch.turn_on
    entity_id: switch.36418502807d3a3f88aa_1

- alias: Kitchen Lights OFF 
  trigger:
    platform: state
    entity_id: binary_sensor.motion_sensor_158d0002732727
    to: 'off'
    for:
      minutes: 3
  action:
    service: switch.turn_off
    entity_id: switch.36418502807d3a3f88aa_1

This will turn off the light if it has been on for 3 minutes, or if that is missed for some reason it will also check every hour and if the light has been on for at least 3 minutes it will switch off.

- alias: Kitchen Lights OFF 
  trigger:
  - platform: state
    entity_id: binary_sensor.motion_sensor_158d0002732727
    to: 'off'
    for:
      minutes: 3
  - platform: time_pattern
    hours: "/1"
  condition:
    condition: state
    entity_id: switch.36418502807d3a3f88aa_1
    state: 'on'
    for:
      minutes: 3
  action:
    service: switch.turn_off
    entity_id: switch.36418502807d3a3f88aa_1
2 Likes

Thank you so much!!

Throwing an error…

Configuration invalidCHECK CONFIG

Invalid config for [automation]: extra keys not allowed @ data['trigger'][0]['minutes']. Got None offset None should be format 'HH:MM' or 'HH:MM:SS' for dictionary value @ data['trigger'][0]['for']. Got None. (See /config/configuration.yaml, line 108). Please check the docs at https://home-assistant.io/integrations/automation/ Invalid config for [automation]: extra keys not allowed @ data['trigger'][0]['minutes']. Got None offset None should be format 'HH:MM' or 'HH:MM:SS' for dictionary value @ data['trigger'][0]['for']. Got None. (See /config/configuration.yaml, line 108). Please check the docs at https://home-assistant.io/integrations/automation/

Copy and paste exactly what you have for the automation.

2 Likes