Tomm206
(Tomm206)
1
Hi all,
I have following script and I would like to set the condition like this: above and equal 23, below and equal 26.
> choose:
> - conditions:
> - condition: numeric_state
> entity_id: sensor.temperature
> above: '23'
> below: '26'
> sequence:
> - service: scene.turn_on
> target:
> entity_id: scene.night
> metadata: {}
> default: []
I tried to add this:
> above: '23'
> equal: '23'
> below: '26'
> equal: '26'
But the following error appeared: Message malformed: extra keys not allowed @ data[‘sequence’][0][‘choose’][0][‘conditions’][0][‘equa’]
Thanks
tom_l
2
It cant be “above and equal” you mean “above or equal”
choose:
- conditions:
- condition: or
conditions:
- condition: numeric_state
entity_id: sensor.temperature
above: '23'
below: '26'
- condition: state
entity_id: sensor.temperature
state: '26'
- condition: state
entity_id: sensor.temperature
state: '23'
Or if you know that your sensor has only one decimal place of precision in the state you can do this:
choose:
- conditions:
- condition: numeric_state
entity_id: sensor.temperature
above: '22.9'
below: '26.1'
For two decimal places:
choose:
- conditions:
- condition: numeric_state
entity_id: sensor.temperature
above: '22.99'
below: '26.01'
You get the idea?
Also please don’t put >
characters at the beginning of every line. It makes it more difficult to copy and edit your config to show you the answer.
Tomm206
(Tomm206)
3
Understood, everything.
Thank you for your quick answer.
1 Like