# Homey flows -\> script - How to pass the device.id to an script

**URL:** <https://community.homey.app/t/homey-flows-script-how-to-pass-the-device-id-to-an-script/81917>\
**Category:** Developers\
**Tags:** tools, homeyscript, flow, javascript, advancedflow\
**Created:** [June 8, 2023, 12:18pm UTC](https://community.homey.app/t/homey-flows-script-how-to-pass-the-device-id-to-an-script/81917 "2023-06-08T12:18:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tim\_R](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/tim_r/32/82292_2.png) [@Tim\_R](https://community.homey.app/u/Tim_R)\
**Post date:** [June 8, 2023, 12:18pm UTC](https://community.homey.app/t/homey-flows-script-how-to-pass-the-device-id-to-an-script/81917/1 "2023-06-08T12:18:52Z")

</div>

Hey all,

I’ve got several lights that should share/reuse a certain blinking event. For this I’ve made a Homey script.  
I now run it by starting with a advanced flow to listen to 3x pressing the button. Then run the script and pass a string with the device.name as an argument. The thing is that when I rename a device, for whatever reason, I have to remember I’ve got flows that have their old names hard programmed in them. So If I forget to change it, it will break the flow.

Now this is why I’m looking for a way to pass the device.id of the button just pressed to the Homey Script. And yes, the ID instead of the name. If there is a way to get the id or name an ID would be quicker. This since in the script I otherwise have to iterate over all the devices. (`const devices = await Homey.devices.getDevices({ filter: { name: device_name } });` seems not to work, but that’s off-topic)

How can I grab the just pressed device.id and pass it as an argument to a script?
