I’m working with a simple 4-buttons device on Schema Connector, but I have a problem about making automation.
StateRefreshCallback
is working very well. When I push or held button, App shows matching states.
However, I can not make automation with that device.
More accurately, I can, but not customers.
Only battery condition appears on their app, like below.
Honestly, I struggled with this problem more than pair of weeks. Other all devices are working properly, except this simple buttons.
At the first, I made below device profile:
┌───────────────────┬──────────────────────────────────────┐
│ main component │ healthCheck │
│ │ battery │
│ button1 component │ button │
│ button2 component │ button │
│ button3 component │ button │
│ button4 component │ button │
└───────────────────┴──────────────────────────────────────┘
After I found problem, I had a advice, that was adding HealthCheck
and refresh
cap into all components. So I did:
┌───────────────────┬──────────────────────────────────────┐
│ main component │ healthCheck │
│ │ battery │
│ │ refresh │
│ button1 component │ button │
│ │ healthCheck │
│ │ refresh │
│ button2 component │ button │
│ │ healthCheck │
│ │ refresh │
│ button3 component │ button │
│ │ healthCheck │
│ │ refresh │
│ button4 component │ button │
│ │ healthCheck │
│ │ refresh │
└───────────────────┴──────────────────────────────────────┘
But nothing changed. So I just moved button1
to main
:
┌───────────────────┬──────────────────────────────────────┐
│ main component │ healthCheck │
│ │ battery │
│ │ refresh │
│ │ button │ <- I moved this one
│ button2 component │ button │
│ │ healthCheck │
│ │ refresh │
│ button3 component │ button │
│ │ healthCheck │
│ │ refresh │
│ button4 component │ button │
│ │ healthCheck │
│ │ refresh │
└───────────────────┴──────────────────────────────────────┘
Then main button
was shown on the automation page. I was confused.
I asked to the support team, and they told me:
- Add
button
intomain
component. And It will represent device itself. - And each
button{number}
component would represent each button on my device. -
main
-button
-numberOfButtons
should be4
-
button{number}
-button
-numberOfButtons
should be1
So the result is:
┌───────────────────┬──────────────────────────────────────┐
│ main component │ healthCheck │
│ │ battery │
│ │ refresh │
│ │ button │ <- represent device itself?
│ button1 component │ button │
│ │ healthCheck │
│ │ refresh │
│ button2 component │ button │
│ │ healthCheck │
│ │ refresh │
│ button3 component │ button │
│ │ healthCheck │
│ │ refresh │
│ button4 component │ button │
│ │ healthCheck │
│ │ refresh │
└───────────────────┴──────────────────────────────────────┘
And situation is same as above case, only main
-button
is on the app.
Here is my interaction examples.
State Refresh
{
"externalDeviceId": "blabla",
"states": [
{
"component": "main",
"capability": "st.battery",
"attribute": "battery",
"value": 100,
"unit": "%"
},
{
"component": "main",
"capability": "st.healthCheck",
"attribute": "healthStatus",
"value": "online"
},
{
"component": "main",
"capability": "st.button",
"attribute": "button",
"value": "pushed"
},
{
"component": "main",
"capability": "st.button",
"attribute": "numberOfButtons",
"value": 4
},
{
"component": "main",
"capability": "st.button",
"attribute": "supportedButtonValues",
"value": ["pushed", "double", "pushed_3x", "held"]
},
{
"component": "button1",
"capability": "st.button",
"attribute": "button",
"value": "pushed"
},
{
"component": "button1",
"capability": "st.button",
"attribute": "numberOfButtons",
"value": 1
},
{
"component": "button1",
"capability": "st.button",
"attribute": "supportedButtonValues",
"value": ["pushed", "double", "pushed_3x", "held"]
},
{
"component": "button1",
"capability": "st.healthCheck",
"attribute": "healthStatus",
"value": "online"
},
{
"component": "button2",
"capability": "st.button",
"attribute": "button",
"value": "pushed"
},
{
"component": "button2",
"capability": "st.button",
"attribute": "numberOfButtons",
"value": 1
},
{
"component": "button2",
"capability": "st.button",
"attribute": "supportedButtonValues",
"value": ["pushed", "double", "pushed_3x", "held"]
},
{
"component": "button2",
"capability": "st.healthCheck",
"attribute": "healthStatus",
"value": "online"
},
{
"component": "button3",
"capability": "st.button",
"attribute": "button",
"value": "pushed"
},
{
"component": "button3",
"capability": "st.button",
"attribute": "numberOfButtons",
"value": 1
},
{
"component": "button3",
"capability": "st.button",
"attribute": "supportedButtonValues",
"value": ["pushed", "double", "pushed_3x", "held"]
},
{
"component": "button3",
"capability": "st.healthCheck",
"attribute": "healthStatus",
"value": "online"
},
{
"component": "button4",
"capability": "st.button",
"attribute": "button",
"value": "pushed"
},
{
"component": "button4",
"capability": "st.button",
"attribute": "numberOfButtons",
"value": 1
},
{
"component": "button4",
"capability": "st.button",
"attribute": "supportedButtonValues",
"value": ["pushed", "double", "pushed_3x", "held"]
},
{
"component": "button4",
"capability": "st.healthCheck",
"attribute": "healthStatus",
"value": "online"
}
]
}
State Refresh Callback
{
"externalDeviceId": "blabla",
"states": [
{
"component": "main",
"capability": "st.battery",
"attribute": "battery",
"value": 100,
"unit": "%"
},
{
"component": "main",
"capability": "st.healthCheck",
"attribute": "healthStatus",
"value": "online"
},
{
"component": "button4",
"capability": "st.button",
"attribute": "button",
"value": "pushed"
},
{
"component": "button4",
"capability": "st.button",
"attribute": "numberOfButtons",
"value": 1
},
{
"component": "button4",
"capability": "st.button",
"attribute": "supportedButtonValues",
"value": ["pushed", "double", "pushed_3x", "held"]
},
{
"component": "button4",
"capability": "st.healthCheck",
"attribute": "healthStatus",
"value": "online"
}
]
}