How to pass a variable from one script to another

I have the following script to send notification to my iphone and my wifes iphone

notify.iphone1

service: notify.mobile_app_iphone
data:
  message: "{{message}}"

notify.iphone2

service: notify.mobile_app_iphone2
data:
  message: "{{message}}"

I then created a wrapper script to be able to send notification to both the iphones
notify.both_iphones. I disabled for debugging purpose iphone2

sequence:
  - service: script.notify_iphone2
    data:
      message: "{{message}}"
    enabled: false
  - service: script.notify_iphone1
    data:
      messsage: "{{message}}"

This used to be working but stopped working. Not sure why.
When looking an the automation that calls notify.both_iphones I see the script logs it looks like

Executed: July 20, 2023 at 11:56:13 AM
Result:
params:
  domain: script
  service: notify_iphone1
  service_data:
    messsage: How is this
  target: {}
running_script: true
child_id:
  domain: script
  item_id: notify_iphone1
  run_id: 06cf5bf35ff942acc872a52e2c6e20be

However in the script notify.iphone1 I see the logs the message is blank

Executed: July 20, 2023 at 11:56:13 AM
Result:
params:
  domain: notify
  service: mobile_app_iphone
  service_data:
    message: ''
  target: {}
running_script: false

The variable you are passing to your script should be message not messsage.

Geez I didn’t notice that, not sure how that happened as it was working just fine before. Thanks!

1 Like