Test if 1 condition does not match

I have this code :

id: '1687454410263'
alias: whatsapp_Recycle
description: ''
trigger:
  - platform: time
    at: '20:00:00'
condition:
  - condition: not
    conditions:
      - condition: state
        entity_id: sensor.recycleapp_vuilnis_morgen
        state: 'false'
action:
  - service: whatsapp.send_message
    data:
      clientId: default
      to: [email protected]
      body:
        text: >-
          Ivago komt morgen langs om {{
          state_attr('sensor.recycleapp_vuilnis_eerst_volgende','Upcoming_waste_types') 
          }} op te halen
mode: single

So when the sensor is false, I don’t want to get a message. you can see here in the status of the sensor it is false

afbeelding

Why am I still getting a message every day at 8 ?

Google translate tells me that “Geen” is “none”, not “false”.

Also why the double negative?

Instead of “not false” why not test for “true”?

Or does the sensor have more than two states?

If it only has the two states true/false it should really be a binary_sensor. How did you make this sensor?

When I trace the automation it gives me “false”

Because it is never true but a choice of 4 values…

Sensor is part of a custom component from “afvalbeheer”

What do you mean by double negative ?

I mean “not false” is usually the same as “true”, except it is not in your case, as you have 4 other possible values.

What does this return in the developer tools template editor:

{{ states('sensor.recycleapp_vuilnis_morgen') }}

Also the automation trace is giving you the result of the condition. Not the state of the sensor. Pretty sure you need this:

condition:
  - condition: not
    conditions:
      - condition: state
        entity_id: sensor.recycleapp_vuilnis_morgen
        state: 'Geen'

Though it is really hard to tell what is translated and what isn’t.

gives me “geen” :slight_smile:

I tried this before, but not using ’ '. So I think that was the problem. I changed the time to now, and the automation is not executed. so I think that is the solution…
thanks

1 Like