I’ve recently bought Shelly plus 1, since it’s not yet supported by Shelly Binding I decided to integrate it using mqtt binding.
The way it works is that shelly creates one topic <shelly name>/events/rpc
and publishes all events into it, So for example when temperature changes, shelly publishes following message:
{
"src": "shellyplus1",
"dst": "shellyplus1/events",
"method": "NotifyStatus",
"params": {
"ts": 1643827043.79,
"switch:0": {
"id": 0,
"temperature": {
"tC": 52.79,
"tF": 127.02
}
}
}
}
When button is pressed, it sends message like this:
{
"src": "shellyplus1",
"dst": "shellyplus1/events",
"method": "NotifyEvent",
"params": {
"ts": 1643826690.03,
"events": [
{
"component": "input:0",
"id": 0,
"event": "single_push",
"ts": 1643826690.03
}
]
}
}
So for temperature I created new Number channel on generic mqtt thing, set channel to shellyplus1/events/rpc
and incoming transform to JSONPATH:$.params.switch:0.temperature.tC
.
That seems to work fine (channel has proper value when shelly sends temperature message). The problem is that my log is absolutly spammed with warnings for each channel whenever shelly sends message that is not matched by the JSONPATH transformation:
2022-02-02 19:37:34.135 [WARN ] [t.generic.ChannelStateTransformation] - Executing the JSONPATH-transformation failed: Invalid path '$.params.switch:0.temperature.tC' in '{"src":"shellyplus1","dst":"shellyplus1/events","method":"NotifyStatus","params":{"ts":1643827053.82,"sys":{"available_updates":null}}}'
I can set log level for ChannelStateTransformation to ERROR to get rid of it but I was wondering if there’s a better way of doing that, like tell the channel to ignore the message if jsonpath does not match?