Shelly Plus & MQTT too much warnings in log files

as Shelly Plus is not yet supported by the binding I went via MQTT. the Plus API publishes events on the same statetopic so one has to filter the required properties. unfortunately the statetopic does not include all properties when sent but just the one property that changed. this results that an openhab warning is logged on receipt of a statetopic that does not include the filter criteria.

MQTT message when switch changed to OFF:

{
"src":"shellyplus1pm-441793d4e558",
"dst":"shellyplus1pm-441793d4e558/events",
"method":"NotifyStatus",
"params":
{
"ts":1643612407.10,
"switch:0":
{
"id":0,
"apower":0,
"current":0,
"output":false,
"source":"WS_in"}}}

MQTT message when Wh changed:

{
"src":"shellyplus1pm-441793d4e558",
"dst":"shellyplus1pm-441793d4e558/events",
"method":"NotifyStatus",
"params":
{
"ts":1643612220.25,
"switch:0":
{
"id":0,
"aenergy":
{
"by_minute":[0.000,0.000,0.000],
"minute_ts":1643612218,
"total":257.553}}}}

I tried Jsonpath and Regex but both still post warning messages which fill my log file.

JSONPATH:$.params.switch:0.current
REGEX:(.*shellyplus1pm-441793d4e558.*)∩JSONPATH:$.params.switch:0.apower

If the Wh Item receives an update a warning is sent for Current, Switch and W Items because their jsonpath filter failed:

Executing the JSONPATH-transformation failed: Invalid path '$.params.switch:0.current'

I’m sure there are some shelly Plus owner here, how did you solve this issue?

Extend your REGEX to check also for the presence of power etc. JSON

Do you have to check for device ID, is the topic not unique?

the topic is unique for every shelly and same for every message:

shellyplus1pm-441793d4e558/events/rpc

I extended the Regex filter

REGEX:(.* shellyplus1pm-441793d4e558.* current.*)∩JSONPATH:$.params.switch:0.current

thats the solution, many thanks!!!

so you do not need

and can just REGEX on the “current” etc.

1 Like

Hello,
I tried to insert your regex filter (changing the topic) inside the “Incoming Value Transformations” field of the Shelly 1PM Plus MQTT channel but it doesn’t read any value. The logs do not show any errors or warnings.

The regex filter inserted is the following:

REGEX:(.* shellyplus1pm-44173344e1a8.* apower.*)∩JSONPATH:$.params.switch:0.apower

Is it correct to use the character between the REGEX and JSONPATH expression ?

Thanks
Massimo

Do it less specifically:

REGEX:(.*apower.*)∩JSONPATH:$.params.switch:0.apower
1 Like

for me it’s working as Udo and rossko explained. take care, the state topic is case sensitive.

Thank you very much, it works perfectly.
I had no idea that you can concatenate functions with the symbol ∩

In fact, you can’t, unless it’s specified. :slight_smile: