Controlar um sonoff através de um Xiaomi Aqara Body Sensor

Não estou a conseguir efectuar o controle através do nível da luz, nem se esta a desligar ao fim de 1 minuto, que estou a fazer mal???

 automation:
  - alias: 'alarme telegram porta rua'
    trigger:
     platform: state
     entity_id: binary_sensor.door_window_sensor_158d00022b9f67
     to: 'on'
    action:
      - service: notify.telegram
        data:
          title: "Alarme"
          message: "porta da rua"

  - alias: 'alarme telegram movimento pir1'
    trigger:
     platform: state
     entity_id: binary_sensor.motion_sensor_158d0001e0af13
     to: 'on'
    action:
      - service: notify.telegram
        data:
          title: "Alarme"
          message: "sensor de movimento pir1"

  - alias: Alerta telegram Para Substituir a Bateria dos Sensores
    initial_state: 'on'
    trigger:
      platform: numeric_state
      entity_id:
        - sensor.pir1_battery_level
        - sensor.p_da_rua_battery_level
      below: 4
    condition:
      - condition: template
        value_template: '{{ states.input_boolean.battery_notifications.state == "on" }}'
    action:
      - service: notify.telegram
        data_template:
          message: 'Alerta! {{ trigger.from_state.attributes.friendly_name }} necessita de ser substituída, apenas tem {{ trigger.from_state.state }}% de bateria restante!!'
##### TECTO FALSO ####
  - alias: Automatico Luz Tecto Falso
    trigger:
      platform: state
      entity_id: binary_sensor.motion_sensor_158d0001e0af13
      from: 'off'
      to: 'on'
#    condition:
#      condition: numeric_state
#      entity_id: sensor.illumination_158d0001e0af13
#      below: 300
    action:
      - service: switch.turn_on
        entity_id: switch.Luz_Tecto_Falso
      - service: automation.turn_on
        data:
          entity_id: automation.MOTION_OFF
  - alias: If there no motion for 5 minutes turn off the gateway light
    trigger:
      platform: state
      entity_id: binary_sensor.motion_sensor_158d0001e0af13
      from: 'on'
      to: 'off'
      for:
        minutes: 1
    action:
      - service: switch.turn_off
        entity_id: switch.Luz_Tecto_Falso
      - service: automation.turn_off
        data:
          entity_id: automation.Motion_off

@Paulo_Morgado testa sff

##### Liga a luz do tecto falso quando existe um movimento e quando o sensor lux está abaixo dos 300
  - alias: Automatico Luz Tecto Falso
    trigger:
      platform: state
      entity_id: binary_sensor.motion_sensor_158d0001e0af13
      from: 'off'
      to: 'on'
    condition:
      condition: numeric_state
      entity_id: sensor.illumination_158d0001e0af13
      below: 300
    action:
      - service: switch.turn_on
        entity_id: switch.Luz_Tecto_Falso
      
#Se o sensor  de movimento estiver off mais de 5 min desligar a luz do tecto
  - alias: If there no motion for 5 minutes turn off the gateway light
    trigger:
      platform: state
      entity_id: binary_sensor.motion_sensor_158d0001e0af13
      to: 'off'
      for:
        minutes: 5
    action:
      - service: switch.turn_off
        entity_id: switch.Luz_Tecto_Falso

agora ja liga, mas continua a nao desligar ao fim do tempo

Se o binary_sensor.motion_sensor_158d0001e0af13 estiver off mais de 5 min tem que desligar. Por favor testa novamente.

Se nao tenta colocar o initial_state: true como mostro abaixo:

 - alias: If there no motion for 5 minutes turn off the gateway light
   initial_state: true
   trigger:
     platform: state
     entity_id: binary_sensor.motion_sensor_158d0001e0af13
     to: 'off'
     for:
       minutes: 5
    action:
      - service: switch.turn_off
        entity_id: switch.Luz_Tecto_Falso
1 Curtiu

esta feito, era mesmo isso, muito obrigado Rodolfo

Este tópico foi automaticamente fechado 90 dias após a última resposta. Novas respostas não são permitidas.


Copyright © 2017-2021. Todos os direitos reservados
CPHA.pt - info@cpha.pt


FAQ | Termos de Serviço/Regras | Política de Privacidade