Creating blueprint number selector is saved as text?

I’m creating a blueprint to trigger when a brightness level matches the blueprint number selector

level:
      name: Trigger level
      description: Brightness of the light to trigger automation
      default: 0
      selector:
        number:
          min: 0.0
          max: 100.0
          mode: box
          step: 1.0

Im using this in a condition

condition:
  condition: state
  entity_id: !input "vbulb"
  attribute: brightness
  state: !input "level"

Its not working when I checked the automation

- id: '1608393746645'
  alias: Alexa
  description: ''
  use_blueprint:
    path: homeassistant/alexa_blueprint.yaml
    input:
      level: '20'
      vbulb: light.alexa_virtual

The number selector (level) is text , if i remove the quotes ’ the blueprint works. If this correct ? should a number selector be saved as text ? If so how can I convert the text to a number so my condition works

You could create a variable to represent the input selector’s value. Afterwards, you can convert the variable’s value to an int. However, I don’t believe you can use templates in a State Condition, so you’ll have to use a Template Condition.

Here’s an example of what I mean using the shorthand notation for a Template Condition:

  variables:
    lvl: !input level
    blb: !input vbulb
  trigger:
    ... whatever ...
  condition: "{{ is_state_attr(blb, 'brightness', lvl|int) }}"
  action:
    ... whatever ...
1 Like

Thanks @123. I had come to the same conclusion. Just wanted to make sure I wasn’t missing anything :slight_smile:

Your solution is simple and concise. edit i cannot add your comment as a solution tick box is missing ?

It just seems very odd and inelegant to setup one set of variables in the blueprint , just to replace them with another set in the automation.

Unfortunately I have discovered there is no actual text selector in the blueprint schema ?
The number selector is a text selector which you cannot use with text !!

So I cannot use the blueprint to quickly create multiple notifications . I could use input_text helpers, but again , the whole point of the blueprint is to create multiple automatons quickly without any programming skills.

I think blueprints will evolve quickly to add these features and become a very powerful script generator.

hooray https://rc.home-assistant.io/blog/2021/01/27/release-20212/#new-blueprint-selectors