Triggering Callbacks on Attribute Change

I’m trying to trigger a callback based on an attribute changing from X to Y. I set up a sensor with an attribute attr_1 that changes between TurnedOn and TurnedOff based on the state of an input_boolean. This is handled in a sensor template:

test_sensor_attributes:
     friendly_name: Test Sensor with Changing Attribute
     value_template: "{{ states('input_boolean.test_12')}}"
     attribute_templates:
       attr_1: >
           {% if is_state('input_boolean.test_12','on') %} "TurnedOn"
           {% else %} "TurnedOff"
           {% endif %}

In an Appdaemon initialization, I setup the callback as:

self.listen_state(self.cb_actions_state, entity='sensor.test_sensor_attributes', attribute='attr_`1', old='TurnedOff', new='TurnedOn')

In the callback function, the first line is:

self.log("CB triggered by {} going from {} to {}. Attribute: {}  kwargs: {}".format(entity, old, new, attribute, kwarg_dicts))

So, at this point, I expect the callback to trigger when the input_boolean goes from off to on and the log to include the above output.

But nothing triggers.

If I remove the old and new from the listener, so the callback listener looks like this:

self.listen_state(self.cb_actions_state, entity='sensor.test_sensor_attributes', attribute='attr_`1')

it works (on any change to the attribute) and the log statement in the callback function shows the following when the boolean is turned off:

INFO test_attributes_trigger: CB triggered by sensor.test_sensor_attributes going from "TurnedOn" to "TurnedOff". Attribute: attr_1  kwargs: {'entity': 'sensor.test_sensor_attributes', '__thread_id': 'thread-30'}

and when it’s turned on:

INFO test_attributes_trigger: CB triggered by sensor.test_sensor_attributes going from "TurnedOff" to "TurnedOn". Attribute: attr_1  kwargs: {'entity': 'sensor.test_sensor_attributes', '__thread_id': 'thread-30'}

Everything is working properly when the old and new constraints are left out (except it triggers on any change, which is not what I’m after), but once one or both are included, the callback never triggers. I must be doing something wrong with the constraints, but I can’t figure it out. Anyone see what I’m doing wrong?

I’m not so smart. It was the quotes in the template that messed it up… So i get to give myself a “solution” but for being not-so-smart…