Closed rin closed 3 years ago
Hi @rin, thanks for the PR.
I am ok with the fix in your PR but not with the implementation you did of topic exclusion feature (also it should be in a different PR).
IGNORED_TOPIC should be a list (using a comma separator) and the default value should be empty, not map_data. You would just have to cast the varenv and then you would just have to check like this:
IGNORED_TOPICS = os.getenv("MQTT_IGNORED_TOPICS", "").split(",")
if msg.topic not in IGNORED_TOPICS:
LOG.debug('Topic "%s" was ignored', msg.topic)
return
The defined varenv would look like this: IGNORED_TOPICS = "topic1,topic2,topic3"
Disclaimer: These are the first three lines of Python I've ever written.
I encountered a
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte
when trying to use this exporter with data from my Xiaomi Roborock vacuum. It's probably themap_data
which I don't care about anyway, so this was my fix.