Automation with Blinds numeric_state below or above not working

I want to start the automation if the blinds have a special position, i.e. below 50%.
At present I have problems with the below code: condition entity_id: cover.storeroom
There is no action if the blinds is below 50%
How can I solve this issue, has anybody some ideas?

- id: '1592315250625'
  alias: Blind_test
  description: ''
  trigger:
    - entity_id: input_boolean.test
    platform: state
    to: 'on'
  condition:
  - below: '50'
    condition: numeric_state
    entity_id: cover.storeroom
  action:
  - data: {}
    entity_id: light.storeroom
    service: light.turn_on

What is the state of cover.storeroom when the blinds are below 50%? Specifically, what is shown for that entity on the STATES tab of the Developer Tools page?

Isn’t below 50% <= 0.5 ?

The state is 15%. But never mind I have test all positions of the blinds even the condition below or above. The results are always the same: no action

You haven’t answered my question. I suspect the state is not “15%”, but probably open, and there is an attribute (such as current_position) that indicates the percentage it is open.

Please find the state (including attributes) for the entity on the STATES tab of the Developer Tools page and report back what you find.

The upper position is 100 and the lower position 0. If I move to position 10 the rules should work.

I can’t help if you won’t provide the details I’m asking for. I’m pretty sure I know why your automation isn’t working, and how to fix it, but I need these details.

Have you gone to the STATES tab of the Developer Tools page? If you can’t find that page then you probably need to turn on Advanced Mode.

Yes, I have checked the states tab in dev.:
current_position: 15
friendly_name: storeroom
supported_features: 15

Ok, thank you. That is what I needed (although you only showed the values from the attributes column.) It confirms what I suspected.

The state of the entity is not 15, or even 15%. Although you didn’t say what you saw in the State column, I’m guessing it is as I said before, i.e., open.

You’re using a numeric_state condition in your automation. So it is trying to interpret the state – i.e., open – as a number, which it is not. Therefore the condition is always false.

You need to use the current_position attribute instead. The way you do that is:

- id: '1592315250625'
  alias: Blind_test
  description: ''
  trigger:
    - entity_id: input_boolean.test
    platform: state
    to: 'on'
  condition:
  - below: '50'
    condition: numeric_state
    entity_id: cover.storeroom
    value_template: "{{ state.attributes.current_position }}"
  action:
  - data: {}
    entity_id: light.storeroom
    service: light.turn_on

Yes, many thanks for the fast reply. That was the solution!

1 Like