# Sending notification will not work in Homeyscript

**URL:** <https://community.homey.app/t/sending-notification-will-not-work-in-homeyscript/79235>\
**Category:** Developers\
**Created:** [April 13, 2023, 6:02pm UTC](https://community.homey.app/t/sending-notification-will-not-work-in-homeyscript/79235 "2023-04-13T18:02:11Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![owuerker](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/owuerker/32/39707_2.png) [@owuerker](https://community.homey.app/u/owuerker)\
**Post date:** [April 13, 2023, 6:02pm UTC](https://community.homey.app/t/sending-notification-will-not-work-in-homeyscript/79235/1 "2023-04-13T18:02:11Z")

</div>

Dear developers

I hope somebody can point me to the right direction.  
I have started me first homeyscript adventures but I struggle with notification.

I have written a homey script which will be started at 17 o’clock. It’s looking for all plant and those having not enough water will be published at the console. That’s working fine.

![Bildschirmfoto 2023-04-13 um 19.34.31](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/6/7/671fef6306ec4d91437d425c8e7bcc4ba6b30c5d.png)

Now I add a demo code for getting a notification on mobile, too.  
But this part is not working. (athomID I have replaced by XXXX)

Do I miss something ? Can I not send a notification out of a script ?  
Thanks for your help

Pflanzenabfrage.js

// Get all devices  
const devices = await Homey.devices.getDevices();

for (const device of Object.values(devices)) {

// If this device isn’t available, skip it.  
if (!device.capabilitiesObj[‘measure\_generic.water’]) continue;

// If this device is a sensor (class)  
if (device.class === ‘sensor’) {

if (device.capabilitiesObj[‘measure\_generic.water’].value === ‘Low’) {  
log(`\n ${device.name} braucht Wasser`)  
}  
}

await Homey.flow.runFlowCardAction({  
uri: ‘homey:manager:mobile’,  
id: ‘push\_text’,  
args: {  
user: {  
athomId: “xxxxxx”  
},  
text: ‘Test push notification’  
},  
});

}

❌ Script Error  
⚠ Not Found: FlowCardCondition with ID push\_confirm: Not Found: FlowCardCondition with ID push\_confirm  
at /app/node\_modules/athom-api/dist/index.js:1:1247257  
at processTicksAndRejections (node:internal/process/task\_queues:96:5)

---

<div class="post-metadata">

**Author:** ![Jero](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jero/32/17556_2.png) [@Jero](https://community.homey.app/u/Jero)\
**Post date:** [April 13, 2023, 7:54pm UTC](https://community.homey.app/t/sending-notification-will-not-work-in-homeyscript/79235/2 "2023-04-13T19:54:34Z")

</div>

Is this on the new Homey Pro 2023? If so try changing the id to homey:manager:mobile:push\_text

---

<div class="post-metadata">

**Author:** ![owuerker](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/owuerker/32/39707_2.png) [@owuerker](https://community.homey.app/u/owuerker)\
**Post date:** [April 13, 2023, 9:22pm UTC](https://community.homey.app/t/sending-notification-will-not-work-in-homeyscript/79235/3 "2023-04-13T21:22:35Z")

</div>

Thanks a lot.  
Yes it’s on the new Pro 2023  
Now it works

---

<div class="post-metadata">

**Author:** ![owuerker](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/owuerker/32/39707_2.png) [@owuerker](https://community.homey.app/u/owuerker)\
**Post date:** [May 1, 2023, 12:38pm UTC](https://community.homey.app/t/sending-notification-will-not-work-in-homeyscript/79235/4 "2023-05-01T12:38:46Z")

</div>

It worked with the tip from Jero.  
But now with firmware rc.90 it is not working anymore.

await Homey.flow.runFlowCardAction({  
uri: ‘homey:manager:mobile’,  
id: ‘homey:manager:mobile:push\_text’,  
args: {  
user: {  
athomId: “xxxxxxx”  
},  
text: `\n ${device.name} braucht Wasser`  
},  
});

I am getting the error:

❌ Script Error  
⚠ Missing Scopes: Missing Scopes

Anybody with a tip ?  
Thanks

---

<div class="post-metadata">

**Author:** ![Jero](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jero/32/17556_2.png) [@Jero](https://community.homey.app/u/Jero)\
**Post date:** [May 2, 2023, 10:55am UTC](https://community.homey.app/t/sending-notification-will-not-work-in-homeyscript/79235/5 "2023-05-02T10:55:14Z")

</div>

Ah yes this is the result of some other fix. Will discuss internally and get back to you.

---

<div class="post-metadata">

**Author:** ![Jero](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jero/32/17556_2.png) [@Jero](https://community.homey.app/u/Jero)\
**Post date:** [May 2, 2023, 12:18pm UTC](https://community.homey.app/t/sending-notification-will-not-work-in-homeyscript/79235/6 "2023-05-02T12:18:53Z")

</div>

This will be fixed in v10.0.0-rc.94 when it is available.

---

<div class="post-metadata">

**Author:** ![owuerker](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/owuerker/32/39707_2.png) [@owuerker](https://community.homey.app/u/owuerker)\
**Post date:** [June 28, 2023, 5:11pm UTC](https://community.homey.app/t/sending-notification-will-not-work-in-homeyscript/79235/7 "2023-06-28T17:11:44Z")

</div>

Hi Jero,

Is it again broken in v10.0.0-rc118 ?  
I just get notification in the timeline but no push to my mobile

---

<div class="post-metadata">

**Author:** ![Colin\_Osborne](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/colin_osborne/32/79809_2.png) [@Colin\_Osborne](https://community.homey.app/u/Colin_Osborne)\
**Post date:** [July 15, 2023, 2:42pm UTC](https://community.homey.app/t/sending-notification-will-not-work-in-homeyscript/79235/8 "2023-07-15T14:42:18Z")

</div>

On HomeyPro early 2023 version 10.0.0-rc.122, I found it necessary to give both “athomID” and “id” parameters for a successful push\_text.

Example code:

```auto
// Tested using versions:
// - Homey Pro (Early 2023), version 10.0.0-rc.122
// - Homey Web App version 1.9.58

// Status as of 15-July-2023: working
// send message to specified user, or if none specified, then first user in getUsers list

var user_name = (typeof args[0] === 'string')
  ? args[0]
  : '';

var user_athom_id = null;
var user_id = null;

if (user_name.length) {
  log('Looking-up user:', user_name);
} else {
  log('No user name specified, so will take first user from getUsers list');
}

log('Get user details');
users = await Homey.users.getUsers();
var found_user = false;
for (const user of Object.values(users)) {
  log(user.name, '; id=', user.id, '; athomId=', user.athomId);
  if ( (!user_name.length || (user.name == user_name)) && ! found_user) {
    if (!user_name.length) {
      user_name = user.name;
      log('Using first user from getUsers list:', user_name)
    }
    user_athom_id = user.athomId;
    user_id = user.id;
    found_user = true;
  }
}

var notification_text = `'Saying hello to ${user_name}'`

if (!user_id) {
  log('Failed to find user: ', user_name);
} else { // user found
    log('Sending push message to:', user_name, '; id=', user_id, '; athomId=', user_athom_id);
    await Homey.flow.runFlowCardAction(
      {
        uri: 'homey:manager:mobile',
        id: 'homey:manager:mobile:push_text',
        args: {
          user: {
            athomId: user_athom_id,
            id: user_id
          },
          text: notification_text
        },
      }
    )
    .then(() => log('runFlowCardAction OK'))
    .catch(error => log(`runFlowCardAction Error:`, error));
}

```
