[SOLVED] MiFlora Error -

Hi all, gotta be close on this but keep getting this error. I found a couple of links to Github but the solution seemed to be a 2.4 mqtt issue. I am on 2.4 but using the old mqtt binding. In any case, this is what I get:

[2019-06-01 13:44:45] 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 256, in <module>
    mqtt_client.publish('{}/$announce'.format(base_topic), json.dumps(flores_info), retain=True)
  File "/usr/local/lib/python3.5/dist-packages/paho/mqtt/client.py", line 1134, in publish
    raise ValueError('Publish topic cannot contain wildcards.')
ValueError: Publish topic cannot contain wildcards.

Everything looks like it connects:

Adding sensor to device list and testing connection ...
Name:          "GreenhouseThree"
Internal name: "GreenhouseThree"
Device name:   "Flower care"
MAC address:   C4:7C:8D:67:5A:2B
Firmware:      2.7.0
[2019-06-01 13:44:45] Initial connection to Mi Flora sensor "GreenhouseThree" (C4:7C:8D:67:5A:2B) successful

My items:

// Mi Flora "GreenhouseThree" (C4:7C:8D:67:5A:2B)
Group gGreenhouseGreenhouseThree "Mi Flora Sensor GreenhouseThree" (gMiFlora, gGreenhouse)
Number Greenhouse_GreenhouseThree_LightIntensity "Sunlight Intensity [%d lux]" <sun> (gGreenhouseGreenhouseThree, gLightIntensity) {mqtt="<[broker:miflora/GreenhouseThree:state:JSONPATH($.light)]"}
Number Greenhouse_GreenhouseThree_AirTemperatureCelcius "Air Temperature C" <temperature> (gGreenhouseGreenhouseThree, gAirTemperature) {mqtt="<[broker:miflora/GreenhouseThree:state:JSONPATH($.temperature)]"}
Number Greenhouse_GreenhouseThree_AirTemperatureFahrenheit "Air Temperature F" <temperature> (gGreenhouseGreenhouseThree, gAirTemperature)
Number Greenhouse_GreenhouseThree_SoilMoisture "Soil Moisture [%d %%]" <water> (gGreenhouseGreenhouseThree, gSoilMoisture) {mqtt="<[broker:miflora/GreenhouseThree:state:JSONPATH($.moisture)]"}
Number Greenhouse_GreenhouseThree_SoilConductivity "Soil Conductivity/Fertility [%d µS/cm]" <lawnmower> (gGreenhouseGreenhouseThree, gSoilConductivity) {mqtt="<[broker:miflora/GreenhouseThree:state:JSONPATH($.conductivity)]"}
Number Greenhouse_GreenhouseThree_Battery "Battery Level [%d %%]" <batterylevel> (gGreenhouseGreenhouseThree, gBattery) {mqtt="<[broker:miflora/GreenhouseThree:state:JSONPATH($.battery)]"}

Thoughts?

Thanks!

Could you post your miflora config file. Maybei the is an error in the parameters

Hi Thomas, sorry this took me awhile. Here you go…

# Configuration file for Xiaomi Mi Flora Plant Sensor MQTT Client/Daemon
# Source: https://github.com/ThomDietrich/miflora-mqtt-daemon
#
# Uncomment and adapt all settings as needed.

[General]

# The operation mode of the program. Determines wether retrieved sensor data is published via MQTT or stdout/file.
# Currently supported:
#
#           mqtt-json - Publish to an MQTT broker in a proprietary json format (Default)
#          mqtt-homie - Publish to an MQTT broker following the Homie MQTT convention
#                       (https://github.com/marvinroger/homie)
#      mqtt-smarthome - Publish to an MQTT broker following the mqtt-smarthome proposal
#                       (https://github.com/mqtt-smarthome/mqtt-smarthome)
#  homeassistant-mqtt - Publish to an MQTT broker following the HomeAssistant discovery format
#                       (https://www.home-assistant.io/docs/mqtt/discovery/)
#    thingsboard-json - Publish to the ThingsBoard MQTT broker
#                       (https://thingsboard.io)
#    wirenboard-mqtt -  Publish to the Wiren Board MQTT broker
#                       (https://wirenboard.com)
#                json - Print to stdout as json encoded strings
#
reporting_method = mqtt-json

# The bluetooth adapter that should be used to connect to Mi Flora devices (Default: hci0)
adapter = hci0

[Daemon]

# Enable or Disable an endless execution loop (Default: true)
#enabled = true

# The period between two measurements in seconds (Default: 300)
#period = 300

[MQTT]

# The hostname or IP address of the MQTT broker to connect to (Default: localhost)
hostname = 10.1.10.109

# The TCP port the MQTT broker is listening on (Default: 1883)
port = 1883

# Maximum period in seconds between ping messages to the broker. (Default: 60)
keepalive = 60

# The MQTT base topic to publish all Mi Flora sensor data topics under.
# Default depends on the configured reporting_method
base_topic = miflora                   # Default for: mqtt-json, mqtt-smarthome
#base_topic = homie                     # Default for: mqtt-homie
#base_topic = homeassistant             # Default for: homeassistant-mqtt
#base_topic = v1/devices/me/telemetry   # Default for: thingsboard-json
#base_topic =                           # Default for: wirenboard-mqtt

# Homie specific: The device ID for this daemon instance (Default: miflora-mqtt-daemon)
#homie_device_id = miflora-mqtt-daemon

# The MQTT broker authentification credentials (Default: no authentication)
#username = user
#password = pwd123

# Enable TLS/SSL on the connection
#tls = false

# Path to CA Certificate file to verify host
#tls_ca_cert =

# Path to TLS client auth key file
#tls_keyfile =

# Path to TLS client auth certificate file
#tls_certfile =

[Sensors]

# Add your Mi Flora sensors here. Each sensor consists of a name and a Ethernet MAC address.
# Additional location information can be added to the name, delimited by an '@'.
# Scan for sensors from the command line with:
#    $ sudo hcitool lescan
#
# Examples:
#
#Schefflera@Living = C4:7C:8D:11:22:33
#JapaneseBonsai    = C4:7C:8D:44:55:66
#Petunia@Balcony   = C4:7C:8D:77:88:99
GreenhouseOne      = C4:7C:8D:67:59:ED
GreenhouseTwo      = C4:7C:8D:67:40:4B
GreenhouseThree    = C4:7C:8D:67:5A:2B

Bumping this up. Any thoughts on this?

I do get this in my log:

2019-06-08 14:54:49.548 [vent.ItemStateChangedEvent] - bluetooth_beacon_hci0_c47c8d675a2b_rssi changed from -89 to -78

2019-06-08 14:55:01.676 [vent.ItemStateChangedEvent] - bluetooth_beacon_hci0_c47c8d675a2b_rssi changed from -78 to -89

That is one of my miflora sensors. What is rssi?

Sorry, this might be something else… the miflora devices shows up as a thing like this:

Flower care

Bluetooth Device

A generic Bluetooth device in beacon-mode

And only the RSSI Channel which i just figured out was signal strength. I dont get other channels…

RSSI

bluetooth:beacon:hci0:c47c8d675a2b:rssi

Number

Still getting this error:

Traceback (most recent call last):
  File "/opt/miflora-mqtt-daemon/miflora-mqtt-daemon.py", line 256, in <module>
    mqtt_client.publish('{}/$announce'.format(base_topic), json.dumps(flores_info), retain=True)
  File "/usr/local/lib/python3.5/dist-packages/paho/mqtt/client.py", line 1134, in publish
    raise ValueError('Publish topic cannot contain wildcards.')
ValueError: Publish topic cannot contain wildcards.

Oh my goodness, got this figured out. What I think it is, is to change this line in the config:

base_topic = miflora                   # Default for: mqtt-json, mqtt-smarthome

To:

base_topic = miflora

Taking all the spaces out as well.

Hope that helps someone!

3 Likes

Thank you so much that really helped me out :slight_smile:

Same here!