Home assistant companion app variable usage

Hi there,

I am trying to use a variable in my mobile app notification automation for color and ledColor but the variable is not being set, but is being set in “message”, is this possible for ledColor and color? see code below:

I am using a temporary toggle button to trigger the variable

platform: state
entity_id:
  - input_boolean.emergency_switch_helper
to: "on"
variables:
  bin: " {{state_attr ( 'calendar.calendar', 'message' ) | regex_replace(find='Blue bin collection', replace='\"red\"', ignorecase=False) | regex_replace(find='Black bin collection', replace='\"red\"', ignorecase=False) }} "
service: notify.mobile_app
data:
  message: >-
    It is Bin day tomorrow. It is {{ state_attr("calendar.calendar", "message")
    }} day on {{ state_attr("calendar.calendar", "start_time") }}, please put
    the Brown bin out as well. {{ bin }}
  data:
    ledColor: {{ bin }}
    color: {{ bin }}
    channel: Bin collection
    tag: bin-collection
enabled: true

Replying to my own post.

Fixed by removing escaped " marks in variable and using " marks when calling the variable instead.

Here are the corrections:

 bin: " {{state_attr ( 'calendar.calendar', 'message' ) | regex_replace(find='Blue bin collection', replace='blue', ignorecase=False) | regex_replace(find='Black bin collection', replace='black', ignorecase=False) }} "
 data:
    ledColor: " {{ (bin) }} "
    color: " {{ (bin) }} "