Custom tile creationg

I want to replicate the battery tile but as percentage and Gallons, What am I doing wrong here, how come my variables don’t display in those tiles?

I want attribute value to display gallons


image

smartthings capabilities:presentation:update sugarcarbon15890.oilsensor 1 -y -i=oilsensor.json

oilsensor.json

      > {
>     "dashboard": {
>         "states": [
>             {
>                 "label": "{{Gallons.value}} {{Gallons.unit}}"
>             }
>         ],
>         "actions": [],
>         "basicPlus": []
>     },
>     "detailView": [
>         {
>             "label": "Gallons",
>             "displayType": "slider",
>             "slider": {
>                 "range": [
>                     0,
>                     1000
>                 ],
>                 "step": 1,
>                 "command": "setGallons",
>                 "unit": "Gallons.unit",
>                 "value": "Gallons.value"
>             }
>         
> }
>     ],
>     "automation": {
>         "conditions": [
>             {
>                 "label": "Gallons",
>                 "displayType": "slider",
>                 "slider": {
>                     "range": [
>                         0,
>                         1000
>                     ],
>                     "step": 1,
>                     "value": "Gallons.value",
>                     "unit": "Gallons.unit"
>                 }
>             }
>         ],
>         "actions": [
>             {
>                 "label": "Gallons",
>                 "displayType": "slider",
>                 "slider": {
>                     "range": [
>                         0,
>                         1000
>                     ],
>                     "step": 1,
>                     "command": "setGallons",
>                     "unit": "Gallons.unit"
>                 }
>             }
>         ]
>     },
>     "id": " sugarcarbon15890.oilsensor",
>     "version": 1
> }

It may help if you formatted the content and posted it using the code brackets so we can read it to see what’s going on. You should post the capability, the presentation and the configuration to get a complete picture of what’s going on.

Custom capabilities don’t support multiple attributes yet, so you need to separate “gallons” and “percentage” into two capabilities. If you are using units in your presentation, you need to add them in the definition as well, see my example.
Also, minimum and maximum values are different in the capability definition and presentation:

//definition
"Gallons": {
    "schema": {
        "type": "object",
        "properties": {
            "value": {
                "type": "integer",
                "minimum": 0,
                "maximum": 1000
            }
        },
        "additionalProperties": false,
        "required": [
            "value"
        ]
    },
    "setter": "setGallons",
    "enumCommands": []
}

//presentation
{
    "label": "Gallons",
    "displayType": "slider",
    "slider": {
        "range": [
            2200,
            7000
        ],
        "step": 1,
        "unit": "Gallons.unit",
        "command": "setGallons",
        "argumentType": "integer",
        "value": "Gallons.value",
        "valueType": "integer"
    }
}
1 Like

I re-formatted my presentation

1 Like

I don’t need the slider but for example purposes shouldn’t my gallons display in my tile from the Gallons.value in my presentation.json file?

I used your capability in my device, the gallons value is displayed and the slider command works fine.

Verify the attribute value in the device status and if the presentation (VID) used by your device was updated.