miflora-mqtt-daemon
miflora-mqtt-daemon copied to clipboard
Integration with HomeAssistant on different RaspberryPi raises wildcard issue
Hi everyone,
I receive the following issue after running the initial execution:
Announcing Mi Flora devices to MQTT broker for auto-discovery ...
Traceback (most recent call last):
File "/opt/miflora-mqtt-daemon/miflora-mqtt-daemon.py", line 305, in <module>
mqtt_client.publish('{}/{}_{}/config'.format(topic_path, flora_name, sensor).lower(), json.dumps(payload), 1, True)
File "/usr/local/lib/python3.5/dist-packages/paho/mqtt/client.py", line 1057, in publish
raise ValueError('Publish topic cannot contain wildcards.')
ValueError: Publish topic cannot contain wildcards.
The MQTT connection is successfully established. I used mainly the standard configuration with the exception of the hostname which I set to the correct IP of my MQTT broker instance which is using the hass.io add-on for the MQTT broker. My hope was to use the auto-discovery to integrate seamlessly.
I haven't found anything by googling, so I am not sure if this is a very unique issue or just my incompetence.
I didn't remove the spaces at the end, apologies. That's what caused the error.
We could handle this issue in code. The relevant variables need to be rstrip()'ed.
To give more feedback/background on this:
I had the line for homeassistant uncommented and then it looked like this:
base_topic = homeassistant # Default for: homeassistant-mqtt
Which then caused the wildcard error. I don't know if this is due to the fact that I had the # at the end or if it was due to the extra spaces. My initial assumption was due to the extra spaces, as # should be interpreted as comments.