# Automação não entende a condition do tipo State

**URL:** <https://forum.cpha.pt/t/automacao-nao-entende-a-condition-do-tipo-state/2065>\
**Category:** Configuração\
**Created:** [8 Março , 2019 10:21 UTC](https://forum.cpha.pt/t/automacao-nao-entende-a-condition-do-tipo-state/2065 "2019-03-08T10:21:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jarmilitao](https://forum.cpha.pt/letter_avatar_proxy/v4/letter/j/fbc32d/32.png) [@jarmilitao](https://forum.cpha.pt/u/jarmilitao)\
**Post date:** [8 Março , 2019 10:21 UTC](https://forum.cpha.pt/t/automacao-nao-entende-a-condition-do-tipo-state/2065/1 "2019-03-08T10:21:56Z")

</div>

Viva!!!

Estou a tentar uma automação no

```auto
 Home Assistant
 0.88.2

```

O objectivo é quando ligo a _light.wc2\_luz\_tecto_ se a _light.wc2\_luz\_espelho_ estiver a ‘ON’ ligar o _switch.extractor\_wc2_.

Se não tiver a parte da condition o interruptor _switch.extractor\_wc2_ liga.  
Com a condition, qualquer que seja o estado do _light.wc2\_luz\_espelho_ não liga.

Qualquer dica é bem vinda.

Obrigado.

Lights

```auto
- platform: mqtt
  name: "wc2 luz tecto"
  state_topic: "piso_1/wc2_luz_tecto/status"
  command_topic: "piso_1/wc2_luz_tecto/set"
  availability_topic: "piso_1/wc2_luz_tecto/available"
  payload_available: "online"
  payload_not_available: "offline"
  payload_on: "ON"
  payload_off: "OFF"

- platform: mqtt
  name: "wc2 luz espelho"
  state_topic: "piso_1/wc2_luz_espelho/status"
  command_topic: "piso_1/wc2_luz_espelho/set"
  availability_topic: "piso_1/wc2_luz_espelho/available"
  payload_available: "online"
  payload_not_available: "offline"

```

Switch

```auto
- platform: mqtt
  name: "extractor wc2"
  state_topic: "piso_1/extractor_wc2/status"
  command_topic: "piso_1/extractor_wc2/set"
  availability_topic: "piso_1/extractor_wc2/available"
  payload_on: "ON"
  payload_off: "OFF"
  state_on: "ON"
  state_off: "OFF"

```

Autimations.yaml

```auto
- id: '1551794997061'
  alias: wc2_fan_start
  trigger:
  - payload: 'ON'
    platform: mqtt
    topic: piso_1/wc2_luz_tecto/status
  condition:
  - condition: state
    entity_id: light.wc2_luz_espelho
    state: 'ON'
  action:
  - data:
      entity_id: switch.extractor_wc2
    service: switch.turn_on

```

---

<div class="post-metadata">

**Author:** ![jarmilitao](https://forum.cpha.pt/letter_avatar_proxy/v4/letter/j/fbc32d/32.png) [@jarmilitao](https://forum.cpha.pt/u/jarmilitao)\
**Post date:** [8 Março , 2019 13:33 UTC](https://forum.cpha.pt/t/automacao-nao-entende-a-condition-do-tipo-state/2065/2 "2019-03-08T13:33:30Z")

</div>

Boas pessoal!

Penso que já descobri!!!

Passei todos os

`state_on: "ON"`

para

`state_on: "on"`

e a coisa passou a funcionar!!!

Obrigado.

---

<div class="post-metadata">

**Author:** ![system](https://forum.cpha.pt/user_avatar/forum.cpha.pt/system/32/2_2.png) [@system](https://forum.cpha.pt/u/system)\
**Post date:** [6 Junho , 2019 13:43 UTC](https://forum.cpha.pt/t/automacao-nao-entende-a-condition-do-tipo-state/2065/3 "2019-06-06T13:43:44Z")

</div>

Fechado em 6 Junho , 2019 13:43 UTC

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