Native types support for Templates

I’ve just tried turning on native types support for templates with the following YAML in my configuration.yaml file:

homeassistant:
  # enable typed templates
  legacy_templates: false

I’m seeing this error for the condition template of an automation that had previously been working:

2020-10-30 09:15:17 INFO (MainThread) [homeassistant.components.automation.rf_door_state] rf_door_state: Running automation actions
2020-10-30 09:15:17 INFO (MainThread) [homeassistant.components.automation.rf_door_state] rf_door_state: Executing step rf_door_state
2020-10-30 09:15:17 ERROR (MainThread) [homeassistant.helpers.condition] Error during template condition: TypeError: the JSON object must be str, bytes or bytearray, not Wrapper

What exactly does this error mean?

I assume that the template that’s giving me the error is the following, because it is the only condition in the listed automation:

          {%- set operationCodes = ['A', 'E', '6', '7'] -%}
          {%- set operation = trigger.event.data.code[-1:] -%}
          {{ operation in operationCodes }}

For some context, this condition is receiving the hex code from an MQTT message from my RFBridge and checking the last character to see if is a valid one for the door sensors that I have.

Still no answer?

I’m seeing the same issue.

printing:

{{ (state_attr("sensor.iotawatt", "data")) }}

will output

{"AC": 28.8, "Main": 2283.7, "Tesla": 3.4, "Total": 2315.9, "Export": 0, "Import": 2017.3, "Phase3_VT": 245.8, "Total_Solar": -298.7}