Files
ad_toolbox/unit_tests/test_smart_conditions.yaml

61 lines
1.6 KiB
YAML

fake_entities:
binary_sensor.true: True
binary_sensor.false: False
binary_sensor.off: 'off'
binary_sensor.on: 'on'
sensor.int17: 17
sensor.int170: 170
sensor.int200: 200
sensor.int3: 3
sensor.float10: 10.0
sensor.float5: 5.0
sensor.strNuit: 'Nuit'
sensor.strHome: 'home'
sensor.strNuit.int80: 70
constants:
self: binary_sensor.true
tests:
test_1:
expected_result: Succeeded
conditions:
trigger_conditions:
- sensor.int170 < 10 and sensor.int17 >= 28
- self and not sensor.strNuit == 'Nuit'
- sensor.int170 >= 34
test_2:
expected_result: Disabled
conditions:
trigger_conditions:
- binary_sensor.false and sensor.int170 > 15
- not binary_sensor.off and sensor.int170 > 65
disable_conditions:
- sensor.strNuit.int80 < 80 and sensor.strNuit.int80 > 40
- sensor.strNuit == 'Nuit'
test_3:
expected_result: Failed
conditions:
trigger_conditions:
- binary_sensor.off and binary_sensor.true
- binary_sensor.true
blocking_conditions: self and not binary_sensor.off
disable_conditions: binary_sensor.off
test_4:
expected_result: Disabled
conditions:
trigger_conditions:
- binary_sensor.true and (not binary_sensor.on or binary_sensor.off)
- binary_sensor.false and binary_sensor.on
- binary_sensor.on and not binary_sensor.true
blocking_conditions: not binary_sensor.off
disable_conditions:
- binary_sensor.off
- not binary_sensor.false and sensor.strNuit == 'Nuit'