miflora-mqtt-daemon icon indicating copy to clipboard operation
miflora-mqtt-daemon copied to clipboard

Integration with HomeAssistant on different RaspberryPi raises wildcard issue

Open SpuriousGer opened this issue 5 years ago β€’ 3 comments

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.

SpuriousGer avatar Dec 30 '18 16:12 SpuriousGer

I didn't remove the spaces at the end, apologies. That's what caused the error.

SpuriousGer avatar Dec 30 '18 17:12 SpuriousGer

We could handle this issue in code. The relevant variables need to be rstrip()'ed.

ThomDietrich avatar Jan 01 '19 16:01 ThomDietrich

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.

SpuriousGer avatar Jan 01 '19 18:01 SpuriousGer