Having trouble adding a custom slider to my edge device

I’ve created a custom slider device, but it’s not showing up on the ST app.

pH-capability.json
{
“name”: “pH”,
“attributes”: {
“acidity”: {
“schema”: {
“type”: “object”,
“properties”: {
“value”: {
“type”: “number”,
“range”: [
0,
14
]
}
},
“additionalProperties”: false,
“required”: [
“value”
]
},
“enumCommands”:
}
},
}

pH-presentation.json
{
“dashboard”: {
“states”: [
{
“label”: “{{acidity.value}}”,
“alternatives”:
}
],
“actions”: ,
“basicPlus”:
},
“detailView”: [
{
“label”: “pH”,
“displayType”: “slider”,
“slider”: {
“range”: [
0,
14
],
“step”: 1,
“value”: “acidity.value”
}
}
],
“automation”: {
“conditions”: [
{
“label”: “pH”,
“displayType”: “slider”,
“slider”: {
“range”: [
0,
14
],
“step”: 1,
“value”: “acidity.value”
}
}
],
“actions”:
},
“id”: “heartcircle52521.ph”,
“version”: 1
}

and then my device capabilities includes heartcircle52521.ph.

I don’t see the pH capability in the Pool Controller device in the app.

Any suggestions?

I’m not sure whether range works in a capability definition. The example in the API documentation shows the capability definition using minimum and maximum like this:

"value": {
    "type": "number",
    "minimum": 0,
    "maximum": 14
},

Some ideas:

  1. Do you initialize the capability? You should be able to use "default": "7" under value in pH-capability.json or device:emit_event(capabilities['heartcircle52521.ph'].acidity(7)) in the init lifecycle handler.

  2. If you expect feedback from the slider, you’ll want to add a setter callback function.

I think range is kosher. You can dump his capability from the CLI and range is there. Easier to read this way too.

capability

id: heartcircle52521.ph
version: 1
status: proposed
name: pH
ephemeral: false
attributes:
  acidity:
    schema:
      type: object
      properties:
        value:
          type: number
          range:
            - 0
            - 14
      additionalProperties: false
      required:
        - value
    enumCommands: []
commands: {}

presentation

dashboard:
  states:
    - label: '{{acidity.value}}'
  actions: []
detailView:
  - label: pH
    displayType: slider
    slider:
      range:
        - 0
        - 14
      step: 1
      unit: null
      value: acidity.value
      valueType: number
    state: null
automation:
  conditions:
    - label: pH
      displayType: slider
      slider:
        range:
          - 0
          - 14
        step: 1
        unit: null
        value: acidity.value
        valueType: number
  actions: []
id: heartcircle52521.ph

Thanks everyone. It just started working on it’s own after some time. I know there was another topic about these things caching. Maybe that was it.