@megapearl wrote:
Hi,
Hope someone can help me out.
I have a pushbutton (binary_sensor) and a door relay (switch) which are operated through mqtt, how can I prevent them from triggering when restarting homeassistant or reloading the automations?
My configuration:
Raspberry Pi with homeassistant v0.106.6
configuration.yaml
binary_sensor: - platform: rpi_gpio ports: 4: Frontdoor Pushbutton 27: Backdoor Pushbutton switch: - platform: rpi_gpio ports: 5: Frontdoor Lock 6: Backdoor Lock invert_logic: true lock: - platform: template name: Frontdoor value_template: "{{ is_state('switch.frontdoor_lock', 'off') }}" unlock: service: script.turn_on entity_id: script.unlock_frontdoor lock: service: switch.turn_off entity_id: switch.frontdoor_lock - platform: template name: Backdoor value_template: "{{ is_state('switch.backdoor_lock', 'off') }}" unlock: service: script.turn_on entity_id: script.unlock_backdoor lock: service: switch.turn_off entity_id: switch.backdoor_lock mqtt_statestream: base_topic: home-domotica publish_attributes: true publish_timestamps: true include: entities: - binary_sensor.backdoor_pushbutton - binary_sensor.frontdoor_pushbutton - lock.frontdoor - lock.backdoor
scripts.yaml
unlock_frontdoor: alias: Frontdoor Unlock sequence: - service: switch.turn_on entity_id: switch.frontdoor_lock - delay: 00:00:04 - service: switch.turn_off entity_id: switch.frontdoor_lock unlock_backdoor: alias: Backdoor Unlock sequence: - service: switch.turn_on entity_id: switch.backdoor_lock - delay: 00:00:04 - service: switch.turn_off entity_id: switch.backdoor_lock
automations.yaml
- id: '154895186df23' alias: Frontdoor Lock trigger: - platform: mqtt topic: home-domotica/lock/frontdoor/set condition: - condition: state entity_id: script.unlock_frontdoor state: 'off' action: - service_template: lock.{{trigger.payload}} entity_id: lock.frontdoor - id: '154895142df79' alias: Backdoor Lock trigger: - platform: mqtt topic: home-domotica/lock/backdoor/set condition: - condition: state entity_id: script.unlock_backdoor state: 'off' action: - service_template: lock.{{trigger.payload}} entity_id: lock.backdoor
Ubuntu VM with homeassistant v0.106.6 in venv.
configuration.yaml:
lock: - platform: mqtt name: "Frontdoor" state_topic: "home-domotica/lock/frontdoor/state" command_topic: "home-domotica/lock/frontdoor/set" payload_unlock: "unlock" payload_lock: "lock" state_locked: "locked" state_unlocked: "unlocked" # qos: 1 # retain: true # optimistic: false value_template: '{{ value }}' - platform: mqtt name: "Backdoor" state_topic: "home-domotica/lock/backdoor/state" command_topic: "home-domotica/lock/backdoor/set" payload_unlock: "unlock" payload_lock: "lock" state_locked: "locked" state_unlocked: "unlocked" # qos: 1 # retain: true # optimistic: false value_template: '{{ value }}'
Tried with retain: false and/or optimistic: true but as soon as the raspberry pi is booting or homeassistant is restarting or I reload the automations or I turn off and on the lock automation both frontdoor and backdoor locks are cycling, as in opening and closing. How can I prevent this?
Any help will be appreciated!
Regards,
Donald.
Posts: 1
Participants: 1