Assistance Needed with Querying Device Consumption for Custom Tile

"Hello everyone,

I would like to query the actual consumption from the devices ‘SP Uwe’ and ‘SP Fanny’ and sum them up in a tile for display. I have already tried using Custom Tiles, but I’m struggling with querying the devices. Can someone give me a tip?

Best regards, Uwe.

Is there a particular reason you’re doing this within a Custom Tile? If it is within a Custom Tile, you can programmatically access Things and Variables.

Alternatively, you might be able to use a SharpTools Rule to get the device data you are interested in and sum it into a variable (eg. with expressions). Then you could use that variable in any of the supported tile types including a Super Tile.

1 Like

Hi Josh, Thanks for the tip about the variables. I managed that. I don’t have a problem now. I can’t get a dropdown field filled. They are always empty. What am I doing wrong?

   <script type="application/json" id="tile-settings">
   {
     "schema": "0.2.0",
     "settings": [
       {
         "type": "ENUM",
         "name": "DEVICE_COUNT",
         "label": "Anzahl der Geräte",
         "options": [
           {"value": 1, "label": "1 Gerät"},
           {"value": 2, "label": "2 Geräte"},
           {"value": 3, "label": "3 Geräte"},
           {"value": 4, "label": "4 Geräte"}
         ],
         "default": 4
       }
     ]
   }
   </script>

Hi Uwe - thanks for the update. Keep in mind that ENUM is not an officially supported data type for settings in a Custom Tile. That being said, we have implemented ENUM support internally, but it could change in the future.

The main change you would need to make is the options key should be called values.

Manual Editing Tip

Also note that since we don’t officially support ENUM data types, there of course isn’t an interface for modifying the setting configuration. One trick I sometimes use is to:

  1. Cut all the content in my settings key from the editor
  2. Click outside the editor so it will perform the automatic diff behind the scenes and prompt you to remove all the settings
  3. Paste the settings back in and make the change before clicking outside the editor so it performs the diff again and pulls in my new settings.

Also note that you can tap the column header in the settings diff to select all items in that column (eg. if you are removing several settings at once).