Blueprint/Automation 'off' value changed to 'false' by HASSIO

I created a blueprint to for all my window sensors and radiators to automatically turn the selected radiator off if for some reason the radiator is turned to heat mode while the window is open. I’m seeing an error in my logs and the automations are failing to trigger because even though I have hard coded in the blueprint the ‘off’ value hassio is sending ‘false’ to the radiator which is an invalid hvac_mode.

Blue print

blueprint:
  name: Check Window
  description: Check if the window is open before allowing heat
  domain: automation
  input:
    window_sensor:
      name: Window Sensor
      selector:
        entity:
          domain: binary_sensor
    target_climate:
      name: Climate
      selector:
        entity:
          domain: climate

trigger:
  - platform: state
    entity_id: !input target_climate
    attribute: system_mode
    to: heat
    for: 00:00:10

condition:
  - condition: state
    entity_id: !input window_sensor
    state: 'on'

action:
  - service: climate.set_hvac_mode
    entity_id: !input target_climate
    data:
      hvac_mode: off

Automation trace

Executed: May 20, 2021, 8:49:56 AM
Result:
params:
  domain: climate
  service: set_hvac_mode
  service_data:
    hvac_mode: false
    entity_id:
      - climate.bath_1_heat
  target:
    entity_id:
      - climate.bath_1_heat
running_script: false
limit: 10

Error message

Bath 1 Check Window: Error executing script. Invalid data for call_service at pos 1: value must be one of ['auto', 'cool', 'dry', 'fan_only', 'heat', 'heat_cool', 'off'] for dictionary value @ data['hvac_mode']

The trace clearly shows it is sending ‘false’ as a value when my blueprint had ‘off’ written.

Try sending 'off' rather than off.

See this issue referencing YAML spec for booleans, which drove the warning note on the input-select docs.

There should probably be a warning on the Climate page also.

Thanks, that fixes it. I find that really confusing and inconsistent. If I use 'around some states I get an error but if I don’t use them around other states I also get an error. All different depending on whether this is a trigger, a condition, or an action and which device it is targeting.

Just for anyone else that might happen upon his same issue. If you do it as a scripting condition then it automatically wraps the result as a string with '.

Example

action:
  - service: climate.set_hvac_mode
    entity_id: !input target_climate
    data:
      hvac_mode: >
        {% if trigger.to_state.state == "on" %}
          off
        {% else %}
          heat
        {% endif %}