Trying to make a simple Blueprint but currently stuck on a trigger numeric_state . I take in a value from a sensor and want to check this against a vest I am sitting with number in the Blueprint. I’ve tried to set both as an input value but it doesn’t work I’ve tried to set them as trigger_varibal but no matter how I write them in the trigger I get an error tried “{{value}}” tried “{{states (value)} }” “{{states (value)|int}}” and float. also tried doing this under trigger_varibal and called on that variable.
Post your blueprint configuration.
blueprint:
name: belysning 231025
description: test av blueprint belysning
domain: automation
input:
tidmorgon:
name: Tid tistad till fredag morgon
description: När lampor ska tändas
selector:
time:
#############################
tidmorgon_monday:
name: Tid på måndag morgon
description: När lampor ska tändas
selector:
time:
#############################
tidslackamorgon:
name: När på morgonen ska lampor släckas
description: När lampor ska tändas
selector:
time:
#############################
tidmorgonhelg:
name: Tid på morgonen Lördag Söndag
description: När lampor ska tändas
selector:
time:
###############################
tidkvall:
name: Tid på kvällen
description: När lampor ska tändas
selector:
time:
##############################
lux:
name: Lux sensor
description: "Väj sensor för lux värde"
selector:
entity:
domain:
- sensor
- input_number
###############################
lux_morgon:
name: Lux värde morgon
description: Värde på lux då belysningen ska släckas på morgonen default 930
selector:
number:
min: 700
max: 1100
step: 5
unit_of_measurement: "lux"
mode: slider
default: 930
###################################
lux_kvall:
name: Lux värde kväll
description: Värde på lux då belysningen ska tändas på kvällen default 600
selector:
number:
min: 450
max: 700
step: 5
unit_of_measurement: "lux"
mode: slider
default: 600
##############################
light_on_off:
name: Välj denna ifall automationen innnehåller light
selector:
boolean:
default: false
light_taget:
name: Välj vilka lampor som ska ingå in automatioinen
selector:
entity:
domain: light
multiple: true
#########################################
switch_on_off:
name: Välj denna ifall automationen innnehåller switch
selector:
boolean:
default: false
switch_target:
name: Vilka brytare använder automationen
selector:
entity:
domain: switch
multiple: true
##########################################
trigger_variables:
lux1: !input lux
lux: "{{(lux1)| int}}"
lux_k: !input lux_kvall
lux_kvall: "{{(lux_k)| int -90}}"
lux_m: !input lux_morgon
lux_morgon: "{{(lux_m)| int -90}}"
trigger:
- platform: time
at: !input tidmorgon
id: Morgon
- platform: time
at: !input tidmorgonhelg
id: Morgon Helg
- platform: time
at: !input tidmorgon_monday
id: Morgon M
- platform: time
at: !input tidkvall
id: Kväll off
- platform: time
at: !input tidslackamorgon
id: Slack morgon
- platform: numeric_state
entity_id: !input lux
below: !input lux_kvall
id: Sunset
- platform: numeric_state
entity_id: !input lux
above: !input lux_morgon
id: Sunrice
condition: []
action:
- alias: Morgon Tis-Fre
choose:
- conditions:
- condition: trigger
id: Morgon
enabled: true
- condition: and
conditions:
- condition: time
weekday:
- fri
- thu
- wed
- tue
before: "11:00:00"
- condition: numeric_state
entity_id: !input lux
below: !input lux_morgon
sequence:
- service: switch.turn_on
data: {}
target:
entity_id: !input switch_target
enabled: !input switch_on_off
- service: light.turn_on
data: {}
target:
entity_id: !input light_taget
enabled: !input light_on_off
enabled: true
- alias: "Off"
choose:
- conditions:
- condition: or
conditions:
- condition: trigger
id: Kväll off
- condition: or
conditions:
- condition: trigger
id: Sunrice
- condition: or
conditions:
- condition: trigger
id: Slack morgon
sequence:
- delay:
hours: 0
minutes: "{{ (range(0, 15)|random|int) }}"
seconds: 0
milliseconds: 0
- service: switch.turn_off
data: {}
target:
entity_id: !input switch_target
enabled: !input switch_on_off
- service: light.turn_off
data: {}
target:
entity_id: !input light_taget
enabled: !input light_on_off
enabled: true
- alias: "Kväll "
choose:
- conditions:
- condition: trigger
id: Sunset
enabled: true
- condition: and
conditions:
- condition: time
after: "13:00:00"
before: "21:45:00"
sequence:
- delay:
hours: 0
minutes: "{{ (range(0, 10)|random|int) }}"
seconds: 0
milliseconds: 0
- service: switch.turn_on
data: {}
target:
entity_id: !input switch_target
enabled: !input switch_on_off
- service: light.turn_on
data: {}
target:
entity_id: !input light_taget
enabled: !input light_on_off
enabled: true
- alias: Morgon Måndag
choose:
- conditions:
- condition: trigger
id:
- Morgon M
enabled: true
- condition: and
conditions:
- condition: time
before: "11:00:00"
weekday:
- mon
- condition: numeric_state
entity_id: !input lux
below: !input lux_morgon
sequence:
- service: switch.turn_on
data: {}
target:
entity_id: !input switch_target
enabled: !input switch_on_off
- service: light.turn_on
data: {}
target:
entity_id: !input light_taget
enabled: !input light_on_off
enabled: true
- alias: Morgon Helg
choose:
- conditions:
- condition: trigger
id:
- Morgon Helg
enabled: true
- condition: and
conditions:
- condition: time
before: "11:00:00"
weekday:
- sat
- sun
- condition: numeric_state
entity_id: !input lux
below: !input lux_morgon
sequence:
- service: switch.turn_on
data: {}
target:
entity_id: !input switch_target
enabled: !input switch_on_off
- service: light.turn_on
data: {}
target:
entity_id: !input light_taget
enabled: !input light_on_off
enabled: true
mode: single
Tested quickly and wonder if it has to do with the fact that I put everything under trigger_varibals
tried moving some to varibals
trigger_variables:
lux1: !input lux
variables:
lux2: !input lux
lux: "{{states (lux2)}}"
Will try to test this later in the evening.
Is there an easy way to test a blueprint (similar to automation run )
trigger_variables
only have access to limited templates, so you cannot use state-based functions there. However, I don’t see anywhere you are actually using the state of the lux sensor in a template i.e. "{{lux}}"
.
FWIW, you don’t need to use all those And conditions, the basic logic of a series of conditions is that each must be true. Also, the way you have used the Or conditions is unnecessary. You can get the equivalent by listing acceptable trigger ids in a Trigger condition.
- condition: trigger
id:
- "Kväll off"
- "Sunrice"
- "Slack morgon"
Not that I’m aware of, and the Automation run function only partly tests a automation. In fact, if this was an automation it would not be testable because every option of the Choose requires a trigger id.
None of your trigger variables are used. Just delete the whole section.
You don’t have a template in any of your triggers or in your conditions or actions that would use variables.
Also I loaded your blueprint and it does not error that I can tell.
Follow Didgeri’s rec on formatting, and there is some deprecated code that will still work in the selectors, but it runs and created an automation.
filter: key was missing on entity selectors.
##############################
lux:
name: Lux sensor
description: "Väj sensor för lux värde"
selector:
entity:
filter:
domain:
- sensor
- input_number
'''
light_taget:
name: Välj vilka lampor som ska ingå in automatioinen
selector:
entity:
filter:
domain: light
multiple: true
...
switch_target:
name: Vilka brytare använder automationen
selector:
entity:
filter:
domain: switch
multiple: true