Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 96121

Automation condition not working, lend me your eyes

$
0
0

@Fettkeewl wrote:

Hio.

One of my DW1 433mhz door sensors, setup as binary_sensor, has the audacity to send it’s open codes twice at times. I’ve added an condition to my automation to prevent notification spam to counter this.
However the condition does not seem to apply. DW1 only has 1 code so I’ve setup the sensor to revert to “closed” after 5 seconds and set a 10 sec “timeout” on the notification automation. However after 5 sec I can open the door and send another notification before the >10 sec condition is met.

What am I missing?

Binary sensor:

- platform: mqtt
  state_topic: "SonoffBridge/tele/RESULT"
  name: 'entre'
  value_template: '{{value_json.RfReceived.Data}}'
  payload_on: '086129'
  device_class: opening
  off_delay: 5
  qos: 1

My all-in-one automation for 4 DW1 units.

- alias: "SensorNotify"
  hide_entity: true
  initial_state: 'on'
  trigger:
  - platform: state
    entity_id:
    - binary_sensor.entre
    - binary_sensor.altan
    - binary_sensor.pannrum
    - binary_sensor.garage
    to: 'on'
  condition:
    condition: and
    conditions:
      - condition: state
        entity_id: input_boolean.notify_enabled
        state: 'on'
      - condition: template # only notify once every 10 seconds at most from the same sensor
        value_template: "{{ ( as_timestamp(now()) - as_timestamp(state_attr('{{trigger.entity_id}}', 'last_triggered')) |int(0) ) > 10 }}"
  action:
    - service: notify.all_devices
      data_template:
          title: "Varning, sensor utlöst"
          message: "Dörr vid {{ trigger.to_state.attributes.friendly_name }}"

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 96121

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>