home-assistant.io icon indicating copy to clipboard operation
home-assistant.io copied to clipboard

value_template not work

Open nm20220210 opened this issue 3 years ago • 4 comments
trafficstars

Feedback

Example not allowed in 2022.5.4 1 2 3

URL

https://www.home-assistant.io/docs/automation/condition/

Version

2022.5.4

Additional information

Test Conditions are not only strings. Value_template not worked with numeric

nm20220210 avatar May 15 '22 10:05 nm20220210

I have tried to re-create this and also got the same error message as your second screenshot when i press the Test button on the condition. image

The automation I created saved without any validation issue so not sure why it's giving the error message.

This is what it generated in my YAML file:

- id: '1652617644447'
  alias: New Automation
  description: ''
  trigger:
  - platform: state
    entity_id:
    - binary_sensor.office_motion
    to: 'on'
  condition:
  - condition: template
    value_template: '{{ state_attr(''sun.sun'', ''elevation'') < 4 }}'
  action:
  - service: scene.turn_on
    data: {}
    target:
      entity_id: scene.office_main_light_on
  mode: single

dannytsang avatar May 15 '22 12:05 dannytsang

The test button is to be expected, and has an open issue report @ the frontend (red herring).

frenck avatar May 16 '22 11:05 frenck

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved. If this issue is still relevant, please let us know by leaving a comment 👍 This issue has now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Jul 15 '22 12:07 github-actions[bot]

Error has not been eliminated

grafik

alias: Neue Automatisierung description: '' trigger:

  • platform: template value_template: >- {{ ( states( "sensor.min_eco_temperatur" ) | float == states( "var.callmon_offset" ) | float ) }} condition:
  • condition: template value_template: '{{ state_attr( "sun.sun", "elevation" ) < 4 }}' action:
  • service: var.set data: entity_id: var.callmon_test value: >- {{ ( states( "sensor.min_eco_temperatur" ) | float + 0.5 - states( "var.callmon_offset" ) | float ) }} mode: single

nm20220210 avatar Aug 01 '22 20:08 nm20220210

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved. If this issue is still relevant, please let us know by leaving a comment 👍 This issue has now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Sep 30 '22 21:09 github-actions[bot]