# \[APP\]\[Pro\] Device Capabilities - Enhance the capabilities of devices

**URL:** <https://community.homey.app/t/app-pro-device-capabilities-enhance-the-capabilities-of-devices/43287>\
**Category:** Apps\
**Tags:** flow, virtual-device, homey-pro, device-capabilities, avd\
**Created:** [February 19, 2021, 8:20am UTC](https://community.homey.app/t/app-pro-device-capabilities-enhance-the-capabilities-of-devices/43287 "2021-02-19T08:20:51Z")\
**Posts on this page:** 20\
**Page:** 52

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [January 9, 2023, 1:37pm UTC](https://community.homey.app/t/app-pro-device-capabilities-enhance-the-capabilities-of-devices/43287/1035 "2023-01-09T13:37:24Z")

</div>

Sorry for the inconvenience.  
I just checked, and the updated version is different.  
Now I don’t understand how the 3 homeyscript cards and that script ended up with your flows after the import. When did you imported the TEF? Not recently?

I just [imported the TEF](https://community.homey.app/t/the-flow-exchange-r-exchange-your-flows-with-others/68981/13) twice, to make sure, and it is the one I expect; there’s one Homeyscript card in it, and this is te code in it:

```auto
// Sensor.Check, to check on sensor last update time. Argument: inactive time (in seconds):

const INVALIDATE_AFTER = (args[0]); // Example 86400sec./3600 = 24hrs

const invalidatedDevices = [];
for (const device of Object.values(await Homey.devices.getDevices())) {
  if (! device.capabilitiesObj) continue;
  let count = 0;
  for (const capabilityObj of Object.values(device.capabilitiesObj)) {
    
    if (device.capabilitiesObj.measure_temperature || device.capabilitiesObj.alarm_contact || device.capabilitiesObj.alarm_motion ) { 

      if (! capabilityObj?.lastUpdated || (Date.now() - new Date(capabilityObj?.lastUpdated) > INVALIDATE_AFTER * 1000)) {
        count++;
        }
    }
  }
  if (count && count === Object.keys(device.capabilitiesObj).length) {
    invalidatedDevices.push("- " + device.name + "\n (zone: " + device.zoneName + ")" );
  }
}

// When there are matching sensors
if ( invalidatedDevices.length != 0 ) {
  // create / update HomeyScript variable
  await tag('InvalidatedDevices', invalidatedDevices.join('\n'));
  
  // Send Timeline notification
  Homey.flow.runFlowCardAction({
          uri: 'homey:manager:notifications',
          id: 'create_notification',
          args: {
            text: "\nDevices without updates for " + INVALIDATE_AFTER / 3600 + "hrs: \n" + invalidatedDevices.join('\n') + "\n\nflow Sensors Check"
          },
        });

  console.log("Devices without updates for " + INVALIDATE_AFTER / 3600 + "hrs: \n" + invalidatedDevices.join('\n'));
  return("Devices without updates for " + INVALIDATE_AFTER / 3600 + "hrs: \n" + invalidatedDevices.join('\n'));
}
  
// When there's no matching sensor
if ( invalidatedDevices.length == 0 ) {
  // Just report "None"
  // create / update HomeyScript variable
  await tag('InvalidatedDevices', 'None');
// Send Timeline notification
  Homey.flow.runFlowCardAction({
          uri: 'homey:manager:notifications',
          id: 'create_notification',
          args: {
            text: "\nDevices without updates for " + INVALIDATE_AFTER / 3600 + "hrs: None\n\nflow Sensors Check"
          },
        });

  console.log("Devices without updates for " + INVALIDATE_AFTER / 3600 + "hrs: None" );
  return invalidatedDevices.length != 0;
}

// Original script by Robert Klep  
// https://community.homey.app/t/a-script-to-check-sensor-last-update/63142/9

```

---

<div class="post-metadata">

**Author:** ![Sharkys](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/sharkys/32/54029_2.png) [@Sharkys](https://community.homey.app/u/Sharkys)\
**Post date:** [January 9, 2023, 2:39pm UTC](https://community.homey.app/t/app-pro-device-capabilities-enhance-the-capabilities-of-devices/43287/1036 "2023-01-09T14:39:23Z")

</div>

I used build in template…yesterday. 😉 Let me check if anything change when using the TEF code directly.

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [January 9, 2023, 2:47pm UTC](https://community.homey.app/t/app-pro-device-capabilities-enhance-the-capabilities-of-devices/43287/1037 "2023-01-09T14:47:34Z")

</div>

That’s odd 🙃 The template extracts the TEF code from that topic post, it’s the same TEF.  
But anyways, now you should be able to run the right code 😉

---

<div class="post-metadata">

**Author:** ![Sharkys](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/sharkys/32/54029_2.png) [@Sharkys](https://community.homey.app/u/Sharkys)\
**Post date:** [January 9, 2023, 4:12pm UTC](https://community.homey.app/t/app-pro-device-capabilities-enhance-the-capabilities-of-devices/43287/1038 "2023-01-09T16:12:32Z")

</div>

It works now, thank you - I like tough the time stamp included in the previous version / notifications, will check if I’m able to add this myself.

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [January 9, 2023, 6:24pm UTC](https://community.homey.app/t/app-pro-device-capabilities-enhance-the-capabilities-of-devices/43287/1039 "2023-01-09T18:24:27Z")

</div>

YW! Yes, the previous version returned all of your sensors with a timestamp for you to check, the current version only returns the ‘faulty’ sensors.  
But, I’ve tried some things, and this works, but at this time only for one sensor capability. I can’t get my head around how to use a wildcard for that.

In this case, I would like to wildcard the capabilities ` measure_temperature` , `alarm_sensor` and `alarm_contact`

```auto
  //// invalidatedDevices.push("- " + device.name + "\n (zone: " + device.zoneName + ")" ); Original line

  // test with timestamps
  invalidatedDevices.push("- " + device.name + " - " + device.capabilitiesObj?.measure_temperature?.lastUpdated?.substring(0,16) + "\n (zone: " + device.zoneName + ")" ); // WORKS, but only for one SENSORTYPE

```

![Screenshot from 2023-01-09 19-22-52](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/5/7/57e555ac15f9cc831d79c87537f1504a00f1ef6c.png)  
`

---

<div class="post-metadata">

**Author:** ![Sharkys](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/sharkys/32/54029_2.png) [@Sharkys](https://community.homey.app/u/Sharkys)\
**Post date:** [January 9, 2023, 6:50pm UTC](https://community.homey.app/t/app-pro-device-capabilities-enhance-the-capabilities-of-devices/43287/1040 "2023-01-09T18:50:03Z")

</div>

Hm, thank you, honestly I would be not able to figure that condition myself … it’s a pity it doesn’t work for others sensors. Peter, would you mind to share a condition, how to exclude specific devices names from check ? That’s possibly the only / last thing missing 😉

---

<div class="post-metadata">

**Author:** ![TKroon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/tkroon/32/9504_2.png) [@TKroon](https://community.homey.app/u/TKroon)\
**Post date:** [January 11, 2023, 9:56am UTC](https://community.homey.app/t/app-pro-device-capabilities-enhance-the-capabilities-of-devices/43287/1041 "2023-01-11T09:56:17Z")

</div>

The IF-card “variable has changed” doesn’t trigger the flow. I’m not sure why, because I can see the variable changing in the virtual device.

---

<div class="post-metadata">

**Author:** ![Arie\_J\_Godschalk](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/arie_j_godschalk/32/63027_2.png) [@Arie\_J\_Godschalk](https://community.homey.app/u/Arie_J_Godschalk)\
**Post date:** [January 11, 2023, 10:00am UTC](https://community.homey.app/t/app-pro-device-capabilities-enhance-the-capabilities-of-devices/43287/1042 "2023-01-11T10:00:02Z")

</div>

Which card do you mean?

Can you share a screenshot?

---

<div class="post-metadata">

**Author:** ![TKroon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/tkroon/32/9504_2.png) [@TKroon](https://community.homey.app/u/TKroon)\
**Post date:** [January 11, 2023, 10:01am UTC](https://community.homey.app/t/app-pro-device-capabilities-enhance-the-capabilities-of-devices/43287/1043 "2023-01-11T10:01:50Z")

</div>

![Scherm­afbeelding 2023-01-11 om 10.55.38](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/5/d/5de147c0c83fb8326f4811b0096ee9511b407dfa.png)

---

<div class="post-metadata">

**Author:** ![Arie\_J\_Godschalk](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/arie_j_godschalk/32/63027_2.png) [@Arie\_J\_Godschalk](https://community.homey.app/u/Arie_J_Godschalk)\
**Post date:** [January 11, 2023, 10:23am UTC](https://community.homey.app/t/app-pro-device-capabilities-enhance-the-capabilities-of-devices/43287/1044 "2023-01-11T10:23:48Z")

</div>

How do you change/set the value?

---

<div class="post-metadata">

**Author:** ![TKroon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/tkroon/32/9504_2.png) [@TKroon](https://community.homey.app/u/TKroon)\
**Post date:** [January 11, 2023, 10:32am UTC](https://community.homey.app/t/app-pro-device-capabilities-enhance-the-capabilities-of-devices/43287/1045 "2023-01-11T10:32:39Z")

</div>

![Scherm­afbeelding 2023-01-11 om 11.31.49](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/b/1/b14efce25e4e79bb1a390d5b6e18498faa4ee071.png)

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/f/d/fd291b7c2ea2df7072ea827d59722749aea1671a.jpeg)

---

<div class="post-metadata">

**Author:** ![Arie\_J\_Godschalk](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/arie_j_godschalk/32/63027_2.png) [@Arie\_J\_Godschalk](https://community.homey.app/u/Arie_J_Godschalk)\
**Post date:** [January 11, 2023, 10:47am UTC](https://community.homey.app/t/app-pro-device-capabilities-enhance-the-capabilities-of-devices/43287/1046 "2023-01-11T10:47:51Z")

</div>

The last card: do nothing, change that to: trigger flowcards.

---

<div class="post-metadata">

**Author:** ![TKroon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/tkroon/32/9504_2.png) [@TKroon](https://community.homey.app/u/TKroon)\
**Post date:** [January 11, 2023, 10:53am UTC](https://community.homey.app/t/app-pro-device-capabilities-enhance-the-capabilities-of-devices/43287/1047 "2023-01-11T10:53:56Z")

</div>

Ahhhh… thank you 😇 just a question: why does it differ from Homey’s logic?

---

<div class="post-metadata">

**Author:** ![Arie\_J\_Godschalk](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/arie_j_godschalk/32/63027_2.png) [@Arie\_J\_Godschalk](https://community.homey.app/u/Arie_J_Godschalk)\
**Post date:** [January 11, 2023, 11:35am UTC](https://community.homey.app/t/app-pro-device-capabilities-enhance-the-capabilities-of-devices/43287/1048 "2023-01-11T11:35:37Z")

</div>

What do you mean?

---

<div class="post-metadata">

**Author:** ![TKroon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/tkroon/32/9504_2.png) [@TKroon](https://community.homey.app/u/TKroon)\
**Post date:** [January 11, 2023, 12:04pm UTC](https://community.homey.app/t/app-pro-device-capabilities-enhance-the-capabilities-of-devices/43287/1049 "2023-01-11T12:04:23Z")

</div>

Why would you change the value without triggering an IF-card that should trigger when the value has changed?

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [January 11, 2023, 12:11pm UTC](https://community.homey.app/t/app-pro-device-capabilities-enhance-the-capabilities-of-devices/43287/1050 "2023-01-11T12:11:18Z")

</div>

If I explain it well:  
That way you can be in control over which THEN cards, to which a value is set, can trigger the common WHEN card or not.

Personally I would like to be “and trigger flowcards” the default Then card option, instead of “and do nothing”. Or, make the default option set-able in the app settings.

---

<div class="post-metadata">

**Author:** ![Arie\_J\_Godschalk](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/arie_j_godschalk/32/63027_2.png) [@Arie\_J\_Godschalk](https://community.homey.app/u/Arie_J_Godschalk)\
**Post date:** [January 11, 2023, 12:36pm UTC](https://community.homey.app/t/app-pro-device-capabilities-enhance-the-capabilities-of-devices/43287/1051 "2023-01-11T12:36:10Z")

</div>

> [@TKroon](#):
>
> Why would you change the value without triggering an IF-card that should trigger when the value has changed?

Because you might only want to have it triggered when changing through the API, Homey App or Web App.

Perhaps i can buildin a option to change the default, but because the option was buildin later, i build it like this to not break existing flows at that time.

---

<div class="post-metadata">

**Author:** ![TKroon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/tkroon/32/9504_2.png) [@TKroon](https://community.homey.app/u/TKroon)\
**Post date:** [January 11, 2023, 1:57pm UTC](https://community.homey.app/t/app-pro-device-capabilities-enhance-the-capabilities-of-devices/43287/1052 "2023-01-11T13:57:09Z")

</div>

Thanks for the explanation. Something like the old virtual devices to “turn them on without trigger”. Default trigger would indeed be better in my opinion. Thanks Arie!

---

<div class="post-metadata">

**Author:** ![DirkG](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/dirkg/32/118897_2.png) [@DirkG](https://community.homey.app/u/DirkG)\
**Post date:** [January 20, 2023, 12:20pm UTC](https://community.homey.app/t/app-pro-device-capabilities-enhance-the-capabilities-of-devices/43287/1053 "2023-01-20T12:20:01Z")

</div>

Hi @Arie_J_Godschalk,  
with the actually Homey TestFlight app for iOS devices v6.11.12 (1039) it’s not possible to create a new AVD. It’s not possible to change the name of the AVD and then save it. The problem is that the keyboard isn’t available.  
I guess it’s Homey app related, but I just wanted to inform you about this issue.

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/e/b/eb42e248128052c5ee417214513bfa1d4bebac2f.jpeg)

I will inform Athom.

---

<div class="post-metadata">

**Author:** ![Arie\_J\_Godschalk](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/arie_j_godschalk/32/63027_2.png) [@Arie\_J\_Godschalk](https://community.homey.app/u/Arie_J_Godschalk)\
**Post date:** [February 6, 2023, 10:44am UTC](https://community.homey.app/t/app-pro-device-capabilities-enhance-the-capabilities-of-devices/43287/1054 "2023-02-06T10:44:54Z")

</div>

## Just release to Live:

- Resolved: Settings/Repairscreen didn’t show correctly since new homey update.
- Resolved: Templates didn’t load anymore because of a change in the Forum.

[Previous page](https://community.homey.app/t/app-pro-device-capabilities-enhance-the-capabilities-of-devices/43287.md?page=51)

[Next page](https://community.homey.app/t/app-pro-device-capabilities-enhance-the-capabilities-of-devices/43287.md?page=53)
