# Question about timeline, energy and tiles

**URL:** <https://community.homey.app/t/question-about-timeline-energy-and-tiles/87213>\
**Category:** Developers\
**Created:** [August 16, 2023, 10:55am UTC](https://community.homey.app/t/question-about-timeline-energy-and-tiles/87213 "2023-08-16T10:55:52Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Martin072](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/martin072/32/70637_2.png) [@Martin072](https://community.homey.app/u/Martin072)\
**Post date:** [August 16, 2023, 10:55am UTC](https://community.homey.app/t/question-about-timeline-energy-and-tiles/87213/1 "2023-08-16T10:55:52Z")

</div>

Working on an App as a beginner with Homey and Javascript and have some questions.

My device is classified as ‘other’ in the driver.compose.json file, and I noticed that when defining the following:

```auto
"energy": {
    "approximation": {
      "usageOn": 15, 
      "usageOff": 1   
    }
  },

```

it doesn’t show up in the Settings of the device, it only shows ‘Constant Energy usage’ (see pic).

 ![Screenshot 2023-08-16 at 12.50.09](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/2/c/2cab613c4786d2961cb1b94a5e81fbfe4e9cfebd.png)

Does this have anything todo with the device class? As it’s not accepting the settings in the .json file?

2nd question. I noticed some devices from other brands include a timeline when jou click the device (see pic below)

 ![Screenshot 2023-08-16 at 12.50.27](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/3/8/38eff2d73fcdb60ad7e2493affcf508c6ebb8180.png)

How would this be implemented in the app? does it again have to do with the Class or capabilities (I am using defined .json capabilities and not the standard ‘onoff’)

and 3rd,

Some tiles have the option to show a status, either a message, power, or dim value, is there anyway to add a custom value on the tile as status value?

Thanks! 🙂

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [August 16, 2023, 11:34am UTC](https://community.homey.app/t/question-about-timeline-energy-and-tiles/87213/2 "2023-08-16T11:34:13Z")

</div>

Q1)  
Have you added an onoff or dim capability? Based on the docs it is the requirement for Approximated power usage.

> **[Energy](https://apps.developer.homey.app/the-basics/devices/energy#approximated-power-usage)**
>
> By defining the energy usage (or generation) of the devices your app supports users can generate detailed reports of their energy consumption.

Q2)  
The device shows a timeline for boolean capabilities (like onoff).  
You can add descriptions for on or off state in capabilityOptions (insightsTitleTrue/insightsTitleFalse) if you don’t want to get standard “switched on/off” text.

> **[Capabilities](https://apps.developer.homey.app/the-basics/devices/capabilities#boolean-capability-options)**
>
> A capability is a programmatic representation of a device's state.

Q3)  
Every numeric or alarm capability can be selected (only!) in mobile app in device settings. That’s nothing you can predefine. The user has to select a value. It’s not possible to select/show string capabilities on a tile.

---

<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:** [August 16, 2023, 11:45am UTC](https://community.homey.app/t/question-about-timeline-energy-and-tiles/87213/3 "2023-08-16T11:45:17Z")

</div>

> [@RonnyW](#):
>
> It’s not possible to select/show string capabilities on a tile.

Maybe _soon™_ it will be 🪄

> [@\[APP\]\[Pro\] Advanced Virtual Device (Device Capabilities App) with Unique Text Status Indicator](https://community.homey.app/t/app-pro-advanced-virtual-device-device-capabilities-app-with-unique-text-status-indicator/68198/232):
>
> What about we just make it possible to select any custom string-type capability to show on the device’s tile? Seems like the most elegant solution to me!

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [August 16, 2023, 11:47am UTC](https://community.homey.app/t/question-about-timeline-energy-and-tiles/87213/4 "2023-08-16T11:47:01Z")

</div>

Yes, would be really nice.  
But currently it’s only used for numbers and alarms ( ⚠ symbol)

---

<div class="post-metadata">

**Author:** ![Martin072](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/martin072/32/70637_2.png) [@Martin072](https://community.homey.app/u/Martin072)\
**Post date:** [August 16, 2023, 11:50am UTC](https://community.homey.app/t/question-about-timeline-energy-and-tiles/87213/5 "2023-08-16T11:50:55Z")

</div>

Thanks for the quick reply. As mentioned, I am using capabilities defined in .json file, like this;

```auto
{
    "type": "boolean",
    "title": { 
      "en": "turned on",          
      "nl" : "aangezet" },
    "insightsTitleTrue" : {
      "en": "turned On",
      "nl":"aangezet"
    },
    "insightsTitleFalse": {
      "en": "Turned off",
      "nl":"Uitgezet"
    },  
    "getable": true,
    "setable": true,
    "uiComponent": "toggle",
    "uiQuickAction": true,
    "icon": "/assets/power.svg"
  }

```

That doesn’t do the job unfortunately. Not sure where to define the ‘onoff’ capability, as device.compose.json contains this:

```auto
...
"class": "other",
  "capabilities": [
       "button_power",
       "button_down",
       "button_up",
       "button_light"
	],
...

```

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [August 16, 2023, 12:04pm UTC](https://community.homey.app/t/question-about-timeline-energy-and-tiles/87213/6 "2023-08-16T12:04:09Z")

</div>

You have defined custom capabilities. Only benefit would be to use a custom icon.  
I suggest to use onoff capability for the main switch.  
Then define own title/insightTitle as capabilityOptions.

Benefit is: you get flow trigger/actions/conditions for free fot this switch. But you can’t change the icon in capabilityOptions.

> **[Capabilities](https://apps.developer.homey.app/the-basics/devices/capabilities#capability-options)**
>
> A capability is a programmatic representation of a device's state.

Example:

```auto
"class": "other",
  "capabilities": [
       "onoff",
       "button_down",
       "button_up",
       "button_light"
	],

"capabilitiesOptions":{
  "onoff":{
    "title": { 
      "en": "turned on",          
      "nl" : "aangezet" },
    "insightsTitleTrue" : {
      "en": "turned On",
      "nl":"aangezet"
    },
    "insightsTitleFalse": {
      "en": "Turned off",
      "nl":"Uitgezet"
    }
  }

```

But you only need capabilitiesOptions when you define different titles. If you are happy with default titles, just use:

```auto
"class": "other",
  "capabilities": [
       "onoff",
       "button_down",
       "button_up",
       "button_light"
	]

```

Here you can find standard capabilities:

> **[Tutorial: Device Capabilities - Homey Apps SDK v3](https://apps-sdk-v3.developer.homey.app/tutorial-device-capabilities.html)**

Btw. you can also use subcapabilities like:

```auto
"class": "other",
  "capabilities": [
       "onoff",
       "onoff.sub1",
       "button_down",
       "button_up",
       "button_light"
	],

"capabilitiesOptions":{
  "onoff":{
    "title": { 
      "en": "turned on",          
      "nl" : "aangezet" },
    "insightsTitleTrue" : {
      "en": "turned On",
      "nl":"aangezet"
    },
    "insightsTitleFalse": {
      "en": "Turned off",
      "nl":"Uitgezet"
    },
  "onoff.sub1":{
    "title": { 
      "en": "Sub1 turned on",          
      "nl" : "Sub1 aangezet" },
    "insightsTitleTrue" : {
      "en": "Sub1 turned On",
      "nl":"Sub1 aangezet"
    },
    "insightsTitleFalse": {
      "en": "Sub 1Turned off",
      "nl":"Sub 1 Uitgezet"
    }
  }

```

PS: please use direkt repsonse on a post or addd someone using @name that we get an information about your response.

---

<div class="post-metadata">

**Author:** ![Martin072](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/martin072/32/70637_2.png) [@Martin072](https://community.homey.app/u/Martin072)\
**Post date:** [August 16, 2023, 12:31pm UTC](https://community.homey.app/t/question-about-timeline-energy-and-tiles/87213/7 "2023-08-16T12:31:22Z")

</div>

Thanks, will do. And will have a look at it.

As for the sub capabilities, let’s say the main onoff would be for a fan, second onoff for a light, would that need any other definitions as well? I did notice some tiles show a light when it’s on and I guess that only works when it’s classed as a light? since this device is both I use the ‘other’ class.

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [August 16, 2023, 12:53pm UTC](https://community.homey.app/t/question-about-timeline-energy-and-tiles/87213/8 "2023-08-16T12:53:01Z")

</div>

Yes, the light icon (right upper corner of device tile) is only shown for a light class.  
In your case you have to choose what’s the main usage, fan or light. Based on this I would select the class.

Then I would only use one onoff capability (to switch the light if class=light or switch fan if class=others).  
The onoff capability addes a quick action (you can press the tile), so the user should know if it’s acting on the light or fan.

The other switch I would not define as onoff because this way you will get several “big” switches on device view you have to select via dropdown.  
So additional switches I would add to the button view (smaller buttons, but acting as switch).  
I defined a custom capability for:

> <https://github.com/RonnyWinkler/io.home-assistant.community/blob/main/.homeycompose/capabilities/onoff_button.json>

Then it looks like:

 ![grafik](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/2/0/20bfbf9fc9574a8cb952ee8989625956703900ef.png)  
For this button-like switch you could use a custom icon (e.g. fan).

> **[Capabilities](https://apps.developer.homey.app/the-basics/devices/capabilities#custom-capabilities)**
>
> A capability is a programmatic representation of a device's state.

---

<div class="post-metadata">

**Author:** ![Martin072](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/martin072/32/70637_2.png) [@Martin072](https://community.homey.app/u/Martin072)\
**Post date:** [August 16, 2023, 1:51pm UTC](https://community.homey.app/t/question-about-timeline-energy-and-tiles/87213/9 "2023-08-16T13:51:37Z")

</div>

Thanks, will have a play with it.

Wouldn’t it be nice to have the insights and power usage also working for custom capabilities? Not sure if that topic is already addressed?

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [August 16, 2023, 2:21pm UTC](https://community.homey.app/t/question-about-timeline-energy-and-tiles/87213/10 "2023-08-16T14:21:26Z")

</div>

In most cases Athom is reading the standard capabilities for such things (power settings). Subcapabilities won’t work, too.

But device insights will work also for custom capabilitites - if they are boolean. Numeric capabilities will be stored in insights.

---

<div class="post-metadata">

**Author:** ![Martin072](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/martin072/32/70637_2.png) [@Martin072](https://community.homey.app/u/Martin072)\
**Post date:** [August 20, 2023, 3:21pm UTC](https://community.homey.app/t/question-about-timeline-energy-and-tiles/87213/11 "2023-08-20T15:21:25Z")

</div>

Ok thanks,

Must be doing something wrong, wanted to try the onoff capability, but when defining it in the .json and then trying to execute the following;

`this.setCapabilityValue('onoff', false).catch(MyDevice.error);`

the following error appears

```auto
node:internal/process/promises:279
            triggerUncaughtException(err, true /* fromPromise */);
            ^

Error: Invalid Capability: onoff
    at Remote Process
    at HomeyClient.emit (/node_modules/@athombv/homey-apps-sdk-v3/lib/HomeyClient.js:44:23)
    at Object.emit (/node_modules/@athombv/homey-apps-sdk-v3/manager/drivers.js:78:54)
    at Object.emit (/node_modules/@athombv/homey-apps-sdk-v3/lib/Driver.js:126:50)
    at /node_modules/@athombv/homey-apps-sdk-v3/lib/Device.js:570:27
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at MyDevice.setCapabilityValue (/node_modules/@athombv/homey-apps-sdk-v3/lib/Device.js:562:23)
    at MyDevice.onInit (/app/drivers/test/device.js:27:10)
    at MyDevice._onInit (/node_modules/@athombv/homey-apps-sdk-v3/lib/Device.js:148:18)
    at /node_modules/@athombv/homey-apps-sdk-v3/lib/Driver.js:180:34
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  statusCode: 404
}

```

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [August 20, 2023, 4:36pm UTC](https://community.homey.app/t/question-about-timeline-energy-and-tiles/87213/12 "2023-08-20T16:36:21Z")

</div>

If you use an existing device and just add the capability in driver json, the device won’t get it added. You have to create a new device or check/add the capability in device.onInit() with if (!this.hasCapability(‘onoff’){this.addCapability(‘onoff’)}.

And catch the error in right way to avoid unhandled exceptions that would crash the app.  
.catch(error){this.log(“Error blabla”, error.message)}

---

<div class="post-metadata">

**Author:** ![Martin072](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/martin072/32/70637_2.png) [@Martin072](https://community.homey.app/u/Martin072)\
**Post date:** [August 21, 2023, 1:05pm UTC](https://community.homey.app/t/question-about-timeline-energy-and-tiles/87213/13 "2023-08-21T13:05:49Z")

</div>

Great! many thanks and once again much appreciated for the patience and help.

I noticed the on/off capability delivers flowcards automatically as you mentioned before.

Is there anyway to tap into these standard cards (action, trigger, condition) programatically? I do need some additional code when turning the device on/off. If not possible, can the default flowcard perhaps be disabled or removed?

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [August 21, 2023, 7:31pm UTC](https://community.homey.app/t/question-about-timeline-energy-and-tiles/87213/14 "2023-08-21T19:31:40Z")

</div>

The flow is triggered on capability change.  
You can register a capabilityListener for the capability. Then you can react on changes (via device tile or flow) and do your stuff.

---

<div class="post-metadata">

**Author:** ![Emile](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/emile/32/115314_2.png) [@Emile](https://community.homey.app/u/Emile)\
**Post date:** [August 22, 2023, 10:18am UTC](https://community.homey.app/t/question-about-timeline-energy-and-tiles/87213/15 "2023-08-22T10:18:11Z")

</div>

> [@\[APP\]\[Pro\] Advanced Virtual Device (Device Capabilities App) with Unique Text Status Indicator](https://community.homey.app/t/app-pro-advanced-virtual-device-device-capabilities-app-with-unique-text-status-indicator/68198/456):
>
> FYI This has been available since the mobile app v7.2.0.

---

<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:** [August 22, 2023, 1:26pm UTC](https://community.homey.app/t/question-about-timeline-energy-and-tiles/87213/16 "2023-08-22T13:26:46Z")

</div>

Wow that’s cool and great news, Emile. Thanks!  
Did I miss a publication 🙃 ?  
**EDIT:**  
Yes I missed it, while I never connected this message with the status indicator 🫣 :

> ![Screenshot from 2023-08-22 17-14-31](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/0/a/0ab64dfe050cb7810f3d64a81469b9b0c3a679e7.png)

It leaves me one thought / request though:  
With a device class ‘thermostat’ one can´t select the status indicator, it’s just fixed to the target temperature capability;  
Is it somehow possible to make the status indicator for thermostats selectable, while setting the target temperature as default status indicator?  
In that case one can choose between room temp, target temp, and string values mode (i.e. Auto/Weekend/Scheduled) and status (i.e. Heating/Off/Cooling)

F.i. when I create a sensor class device with all my thermostat sensors, I can select ‘Status’ for instance. Would be nice to have in a thermostat class device:  
 ![Screenshot from 2023-08-22 15-22-55](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/2/7/272497154fc1259f571353789fe9371d9584aa64.png)

![Screenshot from 2023-08-22 15-23-41](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/6/3/6372217638e59b0d9ac7da6c07028384a090244e.png)

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [August 22, 2023, 1:43pm UTC](https://community.homey.app/t/question-about-timeline-energy-and-tiles/87213/17 "2023-08-22T13:43:17Z")

</div>

Your sensor has a string capability (only text)?  
The thermostat mode is a enum list with strings as ID and language dependent descriptions. I guess the tile only presents text/numeric/bool capabilities but no enum capabilities.

---

<div class="post-metadata">

**Author:** ![Martin072](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/martin072/32/70637_2.png) [@Martin072](https://community.homey.app/u/Martin072)\
**Post date:** [August 22, 2023, 2:45pm UTC](https://community.homey.app/t/question-about-timeline-energy-and-tiles/87213/18 "2023-08-22T14:45:59Z")

</div>

Yes, think I got that for the custom capabilities, but for the standard ‘onoff’ I meant. since it creates the flows automatically and there is no specific code needed for it right? so this; `this.homey.flow.getActionCard('onoff');` will not work?

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [August 22, 2023, 3:00pm UTC](https://community.homey.app/t/question-about-timeline-energy-and-tiles/87213/19 "2023-08-22T15:00:54Z")

</div>

This is only needed to react on the flow. I think inside the capability gets changed and you can react on this with creating a capability listener. So you can react on every change (flow and device).

> **[Device - Homey Apps SDK v3](https://apps-sdk-v3.developer.homey.app/Device.html#registerCapabilityListener)**

---

<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:** [August 22, 2023, 3:05pm UTC](https://community.homey.app/t/question-about-timeline-energy-and-tiles/87213/20 "2023-08-22T15:05:23Z")

</div>

> [@RonnyW](#):
>
> Your sensor has a string capability (only text)?  
> The thermostat mode is a enum list with strings as ID and language dependent descriptions. I guess the tile only presents text/numeric/bool capabilities but no enum capabilities.

It is a sensor device with custom added entities, Ronny:

 ![Screenshot from 2023-08-22 16-58-23](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/a/7/a79aab720017d98d95eb4df736d730b2793ff866.png)

When one adds a climate device, the Status Indicator can´t be selected, while it has the thermostat class

> ![signal-2023-08-22-170047_002](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/7/d/7dc63d9326af8b4ad4904e3be00fd8f8bd141fd7.jpeg)

The capabilities of the climate device are present, but if only Athom made the status indicator for Thermostat class freely selectable…

 ![Screenshot from 2023-08-22 17-02-01](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/f/9/f9dd6f74cb5cfa6ac66378388cc0561e8ee4643c.png)

How can I test with Enum type capabilities you think?

[Next page](https://community.homey.app/t/question-about-timeline-energy-and-tiles/87213.md?page=2)
