StyraHem / ShellyForHASS

Shelly smart home platform for Home Assistant
MIT License
615 stars 110 forks source link

[BUG] Error parsing MQTT message #642

Closed yorickri closed 2 years ago

yorickri commented 2 years ago

Environment

Describe the bug

A lot of Error parsing MQTT message errors are being logged, regardless of which type of Shelly. With having ~15 shellies connected, almost 175.000 errors have been logged within 12 hours. See the screenshot below for the details.

Steps to Reproduce

Expected behavior

Screenshots

image

Traceback/Error logs

Additional context

fishbone-git commented 2 years ago

Seems to be an issue in pyShelly. Looks like it's parsing topics too far down, and seems to also assume all shelly devices use shellies/shelly* as the topic, which is not at all correct if the settings in the shelly device are to use a custom prefix. Sadly, not sure if this is maintained any more

fishbone-git commented 2 years ago

So, I've managed to trace this down to something from above. The custom MQTT topic is the cause (at least for me) of these errors as it assumes the standard topic. If you do customise, then use -{id} as the suffix (not _ )so that the parser will work, or stay away from any custom topic that starts with shelly. At least it's a workaround.

hakana commented 2 years ago

The topic is used to identify the unit and should not be changed, see the documentation.

fishbone-git commented 2 years ago

Apologies, but I do not see where this is mentioned in the documentation. There is only a mention of using the same prefix in the config.yaml (and shelly is default). Default does not make it clear that it is, in fact, required by the pyShelly parser. However, I take your point that this is not a bug so I will keep the reversion to default as all is well. Thanks for responding

hakana commented 2 years ago

It is in the release note, I thought I have moved that to master doc but I see nothing about mqtt is moved to master doc. If you have time to help update master doc it is very welcome.

fishbone-git commented 2 years ago

I'll see if I can whip up a PR for it. I assume that you mean the readme.md? Since it's a reasonable chunk of material, I'm thinking a link on readme.md to the MQTT Setup details. Probably easy enough to link to the relevant release notes (I missed them as I was only looking at the 0.3+ notes

hakana commented 2 years ago

That would be great if you can help. I think it is better to copy and paste into the readme instead of create a link.

fishbone-git commented 2 years ago

done, pull request #649